correct nightly crash on all platform linked to merge operation and missing opj_getop...
[openjpeg.git] / configure.ac
1
2 # According to http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info :
3 #
4 # 1) when bugs are fixed or internal code is changed: increase MICRO
5 # 2) if API is added, increase MINOR and set MICRO to 0
6 # 3) if API or ABI is broken (this case should (must) never happen as it's very bad for a library), or a new designed library, increase MAJOR and set MINOR and MICRO to 0
7
8 m4_define([OPJ_MAJOR], [1])
9 m4_define([OPJ_MINOR], [4])
10 m4_define([OPJ_MICRO], [99])
11
12 m4_define([lt_cur], m4_eval(OPJ_MAJOR + OPJ_MINOR))
13 m4_define([lt_rev], OPJ_MICRO)
14 m4_define([lt_age], OPJ_MINOR)
15
16 AC_PREREQ([2.62])
17 AC_INIT([OpenJPEG],
18    [OPJ_MAJOR.OPJ_MINOR.OPJ_MICRO],
19    [openjpeg@googlegroups.com],
20    [openjpeg],
21    [http://www.openjpeg.org])
22 AC_CONFIG_SRCDIR([configure.ac])
23 AC_CONFIG_MACRO_DIR([m4])
24 AC_CONFIG_HEADERS([opj_config.h])
25
26 AC_CANONICAL_SYSTEM
27 AC_CANONICAL_HOST
28
29 AM_INIT_AUTOMAKE([1.11 foreign dist-bzip2])
30 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31
32 MAJOR_NR=OPJ_MAJOR
33 MINOR_NR=OPJ_MINOR
34 MICRO_NR=OPJ_MICRO
35 AC_SUBST(MAJOR_NR)
36 AC_SUBST(MINOR_NR)
37 AC_SUBST(MICRO_NR)
38
39 LT_PREREQ([2.0])
40 LT_INIT([win32-dll])
41
42 lt_version=lt_cur:lt_rev:lt_age
43 AC_SUBST(lt_version)
44
45
46 ### Needed information
47
48 have_win32=no
49 have_darwin="no"
50 case "$host_os" in
51    mingw*)
52       have_win32="yes"
53       ;;
54    darwin*)
55       have_darwin="yes"
56       ;;
57 esac
58
59 AM_CONDITIONAL([HAVE_WIN32], [test "x${have_win32}" = "xyes"])
60 AM_CONDITIONAL([HAVE_DARWIN], [test "x${have_darwin}" = "xyes"])
61
62
63 ### Additional options to configure
64
65 # debug
66
67 AC_ARG_ENABLE([debug],
68    [AC_HELP_STRING([--enable-debug], [build with debug symbols @<:@default=disabled@:>@])],
69    [
70     if test "x${enableval}" = "xyes" ; then
71        want_debug="yes"
72     else
73        want_debug="no"
74     fi
75    ],
76    [want_debug="no"])
77
78 AC_MSG_CHECKING([whether to build in debug mode])
79 AC_MSG_RESULT([${want_debug}])
80
81 # MJ2
82
83 AC_ARG_ENABLE([mj2],
84    [AC_HELP_STRING([--enable-mj2], [build mj2 binaries @<:@default=disabled@:>@])],
85    [
86     if test "x${enableval}" = "xyes" ; then
87        want_mj2="yes"
88     else
89        want_mj2="no"
90     fi
91    ],
92    [want_mj2="no"])
93
94 AC_MSG_CHECKING([whether to build the MJ2 binaries])
95 AC_MSG_RESULT([${want_mj2}])
96
97 if test "x${want_mj2}" = "xyes" ; then
98    AC_DEFINE(USE_MJ2, [1], [define to 1 if you use mj2])
99 fi
100
101 AM_CONDITIONAL([WANT_MJ2], [test "x${want_mj2}" = "xyes"])
102
103 # JPWL
104
105 AC_ARG_ENABLE([jpwl],
106    [AC_HELP_STRING([--enable-jpwl], [build JPWL library @<:@default=disabled@:>@])],
107    [
108     if test "x${enableval}" = "xyes" ; then
109        want_jpwl="yes"
110     else
111        want_jpwl="no"
112     fi
113    ],
114    [want_jpwl="no"])
115
116 AC_MSG_CHECKING([whether to build the JPWL library])
117 AC_MSG_RESULT([${want_jpwl}])
118
119 if test "x${want_jpwl}" = "xyes" ; then
120    AC_DEFINE(USE_JPWL, [1], [define to 1 if you use jpwl])
121 fi
122
123 AM_CONDITIONAL([WANT_JPWL], [test "x${want_jpwl}" = "xyes"])
124
125 # JPIP
126
127 AC_ARG_ENABLE([jpip],
128    [AC_HELP_STRING([--enable-jpip], [build jpip library @<:@default=disabled@:>@])],
129    [
130     if test "x${enableval}" = "xyes" ; then
131        want_jpip="yes"
132     else
133        want_jpip="no"
134     fi
135    ],
136    [want_jpip="no"])
137
138 AC_MSG_CHECKING([whether to build the JPIP library])
139 AC_MSG_RESULT([${want_jpip}])
140
141
142 ### Checks for programs
143
144 AC_PROG_CC
145
146 # pkg-config
147
148 PKG_PROG_PKG_CONFIG
149
150 # Check whether pkg-config supports Requires.private
151 if $PKG_CONFIG --atleast-pkgconfig-version 0.22 ; then
152    pkgconfig_requires_private="Requires.private"
153 else
154    pkgconfig_requires_private="Requires"
155 fi
156 AC_SUBST(pkgconfig_requires_private)
157 AC_SUBST(requirements)
158
159 # doxygen
160
161 OPJ_CHECK_DOXYGEN
162
163 #  ln -s
164
165 AC_PROG_LN_S
166
167
168 ### Checks for libraries
169
170 # libpng
171
172 have_libpng="no"
173
174 AC_ARG_ENABLE([png],
175    [AC_HELP_STRING([--disable-png], [disable PNG support @<:@default=enabled@:>@])],
176    [
177     if test "x${enableval}" = "xyes" ; then
178        want_png="yes"
179     else
180        want_png="no"
181     fi
182    ],
183    [want_png="yes"])
184
185 AC_MSG_CHECKING([whether to build with PNG support])
186 AC_MSG_RESULT([${want_png}])
187
188 if test "x${want_png}" = "xyes" ; then
189
190    PKG_CHECK_MODULES([PNG], [libpng15],
191       [have_libpng="yes"],
192       [
193        PKG_CHECK_MODULES([PNG], [libpng14],
194           [have_libpng="yes"],
195           [
196            PKG_CHECK_MODULES([PNG], [libpng12],
197               [have_libpng="yes"],
198               [
199                PKG_CHECK_MODULES([PNG], [libpng],
200                   [have_libpng="yes"],
201                   [have_libpng="no"])
202               ])
203           ])
204       ])
205
206    if ! test "x${have_libpng}" = "xyes" ; then
207       OPJ_CHECK_LIB([png.h],
208          [png],
209          [png_create_write_struct],
210          [have_libpng="yes"],
211          [have_libpng="no"])
212    fi
213
214    if test "x${have_libpng}" = "xno" ; then
215       AC_MSG_WARN([Can not find a usuable PNG library. Make sure that CPPFLAGS and LDFLAGS are correctly set.])
216    fi
217
218 fi
219
220 AC_MSG_CHECKING([whether PNG is available])
221 AC_MSG_RESULT([${have_libpng}])
222
223 if test "x${have_libpng}" = "xyes" ; then
224    AC_DEFINE(HAVE_LIBPNG, [1], [define to 1 if you have libpng])
225 fi
226
227 AM_CONDITIONAL([with_libpng], [test x${have_libpng} = "xyes"])
228
229 # libtiff
230
231 have_libtiff="no"
232
233 AC_ARG_ENABLE([tiff],
234    [AC_HELP_STRING([--disable-tiff], [disable TIFF support @<:@default=enabled@:>@])],
235    [
236     if test "x${enableval}" = "xyes" ; then
237        want_tiff="yes"
238     else
239        want_tiff="no"
240     fi
241    ],
242    [want_tiff="yes"])
243
244 AC_MSG_CHECKING([whether to build with TIFF support])
245 AC_MSG_RESULT([${want_tiff}])
246
247 if test "x${want_tiff}" = "xyes" ; then
248
249    OPJ_CHECK_LIB(
250       [tiff.h],
251       [tiff],
252       [TIFFOpen],
253       [have_libtiff="yes"],
254       [have_libtiff="no"])
255
256    if test "x${have_libtiff}" = "xno" ; then
257       AC_MSG_WARN([Can not find a usuable TIFF library. Make sure that CPPFLAGS and LDFLAGS are correctly set.])
258    fi
259 fi
260
261 AC_MSG_CHECKING([whether TIFF is available])
262 AC_MSG_RESULT([${have_libtiff}])
263
264 if test "x${have_libtiff}" = "xyes" ; then
265    AC_DEFINE(HAVE_LIBTIFF, [1], [define to 1 if you have libtiff])
266 fi
267
268 AM_CONDITIONAL([with_libtiff], [test "x${have_libtiff}" = "xyes"])
269
270 # libcms2
271
272 lcms_output="no"
273 have_lcms2="no"
274
275 AC_ARG_ENABLE([lcms2],
276    [AC_HELP_STRING([--disable-lcms2], [disable LCMS-2 support @<:@default=enabled@:>@])],
277    [
278     if test "x${enableval}" = "xyes" ; then
279        want_lcms2="yes"
280     else
281        want_lcms2="no"
282     fi
283    ],
284    [want_lcms2="yes"])
285
286 AC_MSG_CHECKING([whether to build with LCMS-2 support])
287 AC_MSG_RESULT([${want_lcms2}])
288
289 if test "x${want_lcms2}" = "xyes" ; then
290    PKG_CHECK_MODULES([LCMS2], [lcms2],
291       [have_lcms2="yes"],
292       [have_lcms2="no"])
293 fi
294
295 AC_MSG_CHECKING([whether LCMS-2 is available])
296 AC_MSG_RESULT([${have_lcms2}])
297
298 if test "x${have_lcms2}" = "xyes" ; then
299    AC_DEFINE(HAVE_LIBLCMS2, [1], [define to 1 if you have lcms version 2.x])
300    lcms_output="lcms version 2.x"
301 fi
302
303 # libcms1
304
305 AC_ARG_ENABLE([lcms1],
306    [AC_HELP_STRING([--disable-lcms1], [disable LCMS-1 support @<:@default=enabled@:>@])],
307    [
308     if test "x${enableval}" = "xyes" ; then
309        want_lcms1="yes"
310     else
311        want_lcms1="no"
312     fi
313    ],
314    [want_lcms1="yes"])
315
316 AC_MSG_CHECKING([whether to build with LCMS-1 support])
317 AC_MSG_RESULT([${want_lcms1}])
318
319 if test "x${have_lcms2}" = "xno" ; then
320
321    if test "x${want_lcms1}" = "xyes" ; then
322       PKG_CHECK_MODULES([LCMS1], [lcms1],
323          [have_lcms1="yes"],
324          [PKG_CHECK_MODULES([LCMS1], [lcms],
325             [have_lcms1="yes"],
326             [have_lcms1="no"])])
327    fi
328
329    AC_MSG_CHECKING([whether LCMS-1 is available])
330    AC_MSG_RESULT([${have_lcms1}])
331
332    if test "x${have_lcms1}" = "xyes" ; then
333       AC_DEFINE(HAVE_LIBLCMS1, [1], [define to 1 if you have lcms version 1.x])
334       lcms_output="lcms version 1.x"
335    fi
336
337 fi
338
339 # libfcgi
340
341 if test "x${want_jpip}" = "xyes" ; then
342
343    have_fcgi="no"
344    OPJ_CHECK_LIB(
345       [fcgi_stdio.h],
346       [fcgi],
347       [FCGI_Accept],
348       [have_fcgi="yes"],
349       [have_fcgi="no"])
350
351    if ! test "x${have_fcgi}" = "xyes" ; then
352       AC_MSG_WARN([FastCGI library not found. OpenJPIP will not be compiled.])
353       want_jpip="no"
354    fi
355
356 fi
357
358 if test "x${want_jpip}" = "xyes" ; then
359    AC_DEFINE(USE_JPIP, [1], [define to 1 if you use jpip])
360 fi
361
362 AM_CONDITIONAL([WANT_JPIP], [test "x${want_jpip}" = "xyes"])
363
364 ### Checks for header files
365
366 ## FIXME: declarations must be fixed in source code. See autoconf manual
367 AC_HEADER_DIRENT
368
369
370 ### Checks for types
371
372
373 ### Checks for structures
374
375
376 ### Checks for compiler characteristics
377
378 AM_PROG_CC_C_O
379 AC_C_BIGENDIAN
380
381 #OPJ_COMPILER_FLAG([-Wall])
382 #OPJ_COMPILER_FLAG([-Wextra])
383 #OPJ_COMPILER_FLAG([-Wshadow])
384 #OPJ_COMPILER_FLAG([-Wpointer-arith])
385 OPJ_COMPILER_FLAG([-Wno-unused-result])
386
387 if test "x${want_debug}" = "xyes" ; then
388    OPJ_COMPILER_FLAG([-g])
389    OPJ_COMPILER_FLAG([-O0])
390 else
391    OPJ_COMPILER_FLAG([-O3])
392 fi
393
394
395 ### Checks for linker characteristics
396
397
398 ### Checks for library functions
399
400 AC_CONFIG_FILES([
401 Makefile
402 libopenjpeg1.pc
403 libopenjpeg-jpwl.pc
404 libopenjpeg/Makefile
405 libopenjpeg/jpwl/Makefile
406 applications/Makefile
407 applications/codec/Makefile
408 applications/mj2/Makefile
409 applications/jpip/Makefile
410 applications/jpip/libopenjpip/Makefile
411 applications/jpip/opj_server/Makefile
412 applications/jpip/opj_client/Makefile
413 applications/jpip/opj_client/opj_dec_server/Makefile
414 applications/jpip/tools/Makefile
415 applications/jpip/tools/indexer/Makefile
416 doc/Makefile
417 ])
418
419 AC_OUTPUT
420
421 ### Summary
422
423 echo
424 echo
425 echo
426 echo "------------------------------------------------------------------------"
427 echo "$PACKAGE $VERSION"
428 echo "------------------------------------------------------------------------"
429 echo
430 echo
431 echo "Configuration Options Summary:"
432 echo
433 echo "  Debug...............: ${want_debug}"
434 echo
435 echo "  Optional support:"
436 echo "    libpng............: ${have_libpng}"
437 echo "    libtiff...........: ${have_libtiff}"
438 echo "    libcms............: ${lcms_output}"
439 echo
440 echo "  Documentation.......: ${opj_have_doxygen}"
441 echo "    Build.............: make doc"
442 echo
443 echo "  mj2.................: ${want_mj2}"
444 echo "  jpwl................: ${want_jpwl}"
445 echo "  jpip................: ${want_jpip}"
446 echo