Aligning with WRF
[WPS.git] / external / jasper-1.900.29 / configure.ac
blobe48a26a2a4dc0281a505bb125843fc46db77c5f5
1 dnl ****************************************************************************
2 dnl Copyright (c) 2001-2004 Michael David Adams.
3 dnl All rights reserved.
4 dnl
5 dnl The complete licensing terms for this software can be found in the file
6 dnl named "LICENSE" in this software distribution.
7 dnl ****************************************************************************
9 dnl The package name.
10 define(AC_JAS_NAME, jasper)
12 dnl ************************************************************
13 dnl Package version information.
14 dnl ************************************************************
16 dnl The major, minor, and micro version numbers of the package.
17 define(AC_JAS_MAJOR_VERSION, 1)
18 define(AC_JAS_MINOR_VERSION, 900)
19 define(AC_JAS_MICRO_VERSION, 29)
21 dnl The package version.
22 define(AC_JAS_VERSION,
23   AC_JAS_MAJOR_VERSION.AC_JAS_MINOR_VERSION.AC_JAS_MICRO_VERSION)
25 dnl ************************************************************
26 dnl RPM version information.
27 dnl ************************************************************
29 define(AC_JAS_RPM_RELEASE, 1)
31 dnl ************************************************************
32 dnl Dynamically-linked library version information (for Libtool).
33 dnl ************************************************************
35 dnl Guidelines for updating these definitions:
36 dnl 1) If the library source code has changed at all since the last update,
37 dnl then increment REVISION.
38 dnl 2) If any interfaces have been added, removed, or changed since the last
39 dnl update, increment CURRENT, and set REVISION to zero.
40 dnl 3) If any interfaces have been added since the last public release, then
41 dnl increment AGE.
42 dnl 4) If any interfaces have been removed since the last public release, then
43 dnl set AGE to zero.
45 dnl The most recent interface number that this library implements.
46 define(AC_JAS_LT_CURRENT, 4)
48 dnl The implementation number of the current interface.
49 define(AC_JAS_LT_REVISION, 0)
51 dnl The difference between the newest and oldest interfaces that this library
52 dnl implements.  In other words, the library implements all of the interface
53 dnl numbers in the range from current - age to current.
54 define(AC_JAS_LT_AGE, 0)
56 dnl The release number of the library.
57 define(AC_JAS_LT_RELEASE, AC_JAS_MAJOR_VERSION.AC_JAS_MINOR_VERSION)
59 dnl ****************************************************************************
60 dnl NOTHING BELOW THIS LINE SHOULD REQUIRE MODIFICATION (IDEALLY :-)
61 dnl ****************************************************************************
63 dnl Initialize autoconf.
64 AC_INIT(AC_JAS_NAME, AC_JAS_VERSION)
65 AC_PREREQ(2.59)
66 AC_CONFIG_SRCDIR(README)
67 dnl Note: Avoid the temptation to call the auxiliary directory "aux" because
68 dnl Microsoft Windows will barf if you try to use "aux" as a directory name. :-(
69 AC_CONFIG_AUX_DIR([ac_aux])
70 AC_CONFIG_MACRO_DIR([ac_m4])
72 dnl Initialize automake.
73 AM_INIT_AUTOMAKE([1.11 foreign dist-xz dist-bzip2])
75 m4_include([ac_m4/m4_ax_generate_changelog.m4])
76 m4_include([ac_m4/m4_ax_cflags_gcc_option.m4])
77 m4_include([ac_m4/m4_ax_check_compile_flag.m4])
78 m4_include([ac_m4/m4_ax_append_flag.m4])
80 AX_GENERATE_CHANGELOG
82 # Initialize libtool.
83 LT_INIT([shared static])
85 # Detect the canonical host and target build environment.
86 # Note: This precedes automake initialization to avoid warnings.
87 AC_CANONICAL_BUILD
88 AC_CANONICAL_HOST
90 # Initialize version information parameters.
91 JAS_MAJOR_VERSION=AC_JAS_MAJOR_VERSION
92 JAS_MINOR_VERSION=AC_JAS_MINOR_VERSION
93 JAS_MICRO_VERSION=AC_JAS_MICRO_VERSION
94 JAS_VERSION=AC_JAS_VERSION
95 AC_SUBST(JAS_MAJOR_VERSION)
96 AC_SUBST(JAS_MINOR_VERSION)
97 AC_SUBST(JAS_MICRO_VERSION)
98 AC_SUBST(JAS_VERSION)
99 AC_DEFINE_UNQUOTED(JAS_VERSION, "$JAS_VERSION")
100 JAS_RPM_RELEASE=AC_JAS_RPM_RELEASE
101 AC_SUBST(JAS_RPM_RELEASE)
103 # Initialize version information for libtool.
104 LT_RELEASE=AC_JAS_LT_RELEASE
105 LT_CURRENT=AC_JAS_LT_CURRENT
106 LT_REVISION=AC_JAS_LT_REVISION
107 LT_AGE=AC_JAS_LT_AGE
108 AC_SUBST(LT_RELEASE)
109 AC_SUBST(LT_CURRENT)
110 AC_SUBST(LT_REVISION)
111 AC_SUBST(LT_AGE)
113 # Indicate a configure-based build is being used.
114 AC_DEFINE(JAS_CONFIGURE)
116 ############################################################
117 # Configuration header file.
118 ############################################################
120 AH_TEMPLATE([DEBUG_OVERFLOW], [Debugging overflow detection])
121 AH_TEMPLATE([JAS_CONFIGURE], [JasPer configure])
122 AH_TEMPLATE([JAS_VERSION], [JasPer version])
123 AH_TEMPLATE([DEBUG], [Extra debugging support])
125 AH_TOP([
126 /* Avoid problems due to multiple inclusion. */
127 #ifndef JAS_CONFIG_H
128 #define JAS_CONFIG_H
130 /* This preprocessor symbol identifies the version of JasPer. */
131 #undef  JAS_VERSION
132 /* If configure is being used, this symbol will be defined automatically
133   at this point in the configuration header file. */
135 /* The preprocessor symbol JAS_WIN_MSVC_BUILD should not be defined
136   unless the JasPer software is being built under Microsoft Windows
137   using Microsoft Visual C. */
138 #if !defined(JAS_WIN_MSVC_BUILD)
139 /* A configure-based build is being used. */
143 AH_BOTTOM([
144 #else
145 /* A configure-based build is not being used. */
146 #include <jasper/jas_pconf2.h>
147 #endif
149 #endif
152 ############################################################
153 # Checks for programs.
154 ############################################################
156 AC_PROG_CC
158 # In the ideal world, AC_PROG_CC_C11 would exist and work.
159 #AC_PROG_CC_C11
161 # Attempt to enable C11 support if available.
162 # If C11 support is not available, attempt to fall back on C99 support
163 # if available.
164 AX_CHECK_COMPILE_FLAG([-std=c11], [AX_APPEND_FLAG([-std=c11])], [
165   AX_CHECK_COMPILE_FLAG([-std=c99], [AX_APPEND_FLAG([-std=c99])], [])
168 AC_PROG_INSTALL
169 # AC_PROG_AWK
170 # AC_PROG_CPP
171 # AC_PROG_LN_S
173 AM_DISABLE_SHARED
174 AC_PROG_LIBTOOL
176 AC_PATH_XTRA
178 ############################################################
179 # Add a few other compiler flags.
180 ############################################################
182 if test "$GCC" = yes; then
183         CFLAGS="$CFLAGS -pedantic"
184         CFLAGS="$CFLAGS -Wall -Wno-unused"
185         #CFLAGS="$CFLAGS -W -Wformat -Wmissing-prototypes -Wstrict-prototypes"
188 AC_ARG_ENABLE(strict,
189 [  --disable-strict    Disable pedantic errors.], [
190 case "${enableval}" in
191 yes)
192         ENABLE_STRICT=yes;;
194         ENABLE_STRICT=no;;
196         AC_MSG_ERROR(bad value ${enableval} for --disable-strict)
197         ;;
198 esac
199 ], [
200         ENABLE_STRICT=yes
202 if test $ENABLE_STRICT = yes; then
203         if test "$GCC" = yes; then
204                 AX_APPEND_FLAG([-pedantic-errors])
205         fi
208 ############################################################
209 # Check for the IJG JPEG library.
210 ############################################################
212 # Allow the user to explicitly specify whether the JPEG library is present.
213 AC_ARG_ENABLE(libjpeg,
214 [  --disable-libjpeg    Force the IJG JPEG library to be ignored],
216 case "${enableval}" in
217 yes)
218         ENABLE_LIBJPEG=yes;;
220         ENABLE_LIBJPEG=no;;
222         AC_MSG_ERROR(bad value ${enableval} for --disable-libjpeg)
223         ;;
224 esac
225 ], ENABLE_LIBJPEG=yes)
227 HAVE_LIBJPEG=no
228 if test $ENABLE_LIBJPEG = yes; then
229         # Check for the JPEG library.
230         AC_CHECK_LIB(jpeg, jpeg_destroy, HAVE_LIBJPEG=yes, HAVE_LIBJPEG=no)
231         if test $HAVE_LIBJPEG = yes; then
232                 LIBS="$LIBS -ljpeg"
233         fi
235 AM_CONDITIONAL(HAVE_LIBJPEG, test $HAVE_LIBJPEG = yes)
237 ############################################################
238 # Check for OpenGL libraries.
239 ############################################################
241 AC_ARG_WITH(glut-include-dir,
242 [  --with-glut-include-dir=DIR    Set GLUT include directory.],
244         case "$withval" in
245         /*)
246                 CFLAGS="$CFLAGS -I$withval"
247                 CPPFLAGS="$CPPFLAGS -I$withval";;
248         *)
249                 AC_MSG_ERROR(--with-glut-include-dir requires absolute path)
250                 ;;
251         esac
254 AC_ARG_WITH(glut-lib-dir,
255 [  --with-glut-lib-dir=DIR        Set GLUT library directory.],
257         case "$withval" in
258         /*)
259                 LIBS="$LIBS -L$withval";;
260         *)
261                 AC_MSG_ERROR(--with-glut-lib-dir requires absolute path)
262                 ;;
263         esac
267 AC_ARG_ENABLE(opengl,
268 [  --disable-opengl    Disable use of OpenGL. ],
270         case "$enableval" in
271         yes)
272                 ENABLE_OPENGL=yes;;
273         no)
274                 ENABLE_OPENGL=no;;
275         *)
276                 AC_MSG_ERROR(bad value ${enableval} for --disable-libjpeg)
277                 ;;
278         esac
280 ENABLE_OPENGL=yes)
282 HAVE_OPENGL=no
283 OPENGL_LIBS=""
284 if test $ENABLE_OPENGL = yes; then
285         if test $HAVE_OPENGL = no; then
286                 TMPLIBS="-lglut -lGL -lGLU"
287                 AC_CHECK_LIB(glut, glutInit, [HAVE_OPENGL=yes;
288                   OPENGL_LIBS=$TMPLIBS], HAVE_OPENGL=no, $TMPLIBS)
289         fi
290         AC_CHECK_HEADER(GL/glut.h,, [HAVE_OPENGL=no; OPENGL_LIBS="";])
293 AM_CONDITIONAL(HAVE_OPENGL, test $HAVE_OPENGL = yes)
294 AC_SUBST(OPENGL_LIBS)
295 AC_MSG_CHECKING([whether OpenGL libraries and headers were detected])
296 AC_MSG_RESULT($HAVE_OPENGL)
298 ############################################################
299 # Check for other libraries.
300 ############################################################
302 # Check for the math library.
303 AC_CHECK_LIB(m, main)
305 ############################################################
306 # Check for header files.
307 ############################################################
309 dnl AC_HEADER_STDC
310 AC_CHECK_HEADERS(fcntl.h io.h unistd.h windows.h sys/time.h sys/types.h)
312 # Surely, there must be a better way to do this, but
313 # let's just get something working for now.
315 if test $ac_cv_header_fcntl_h = yes; then
316         AC_SUBST([JAS_HAVE_FCNTL_H], ["#define JAS_HAVE_FCNTL_H 1"])
317 else
318         AC_SUBST([JAS_HAVE_FCNTL_H], ["#undef JAS_HAVE_FCNTL_H"])
321 if test $ac_cv_header_io_h = yes; then
322         AC_SUBST([JAS_HAVE_IO_H], ["#define JAS_HAVE_IO_H 1"])
323 else
324         AC_SUBST([JAS_HAVE_IO_H], ["#undef JAS_HAVE_IO_H"])
327 if test $ac_cv_header_unistd_h = yes; then
328         AC_SUBST([JAS_HAVE_UNISTD_H], ["#define JAS_HAVE_UNISTD_H 1"])
329 else
330         AC_SUBST([JAS_HAVE_UNISTD_H], ["#undef JAS_HAVE_UNISTD_H"])
333 if test $ac_cv_header_windows_h = yes; then
334         AC_SUBST([JAS_HAVE_WINDOWS_H], ["#define JAS_HAVE_WINDOWS_H 1"])
335 else
336         AC_SUBST([JAS_HAVE_WINDOWS_H], ["#undef JAS_HAVE_WINDOWS_H"])
339 if test $ac_cv_header_sys_time_h = yes; then
340         AC_SUBST([JAS_HAVE_SYS_TIME_H], ["#define JAS_HAVE_SYS_TIME_H 1"])
341 else
342         AC_SUBST([JAS_HAVE_SYS_TIME_H], ["#undef JAS_HAVE_SYS_TIME_H"])
345 if test $ac_cv_header_sys_types_h = yes; then
346         AC_SUBST([JAS_HAVE_SYS_TYPES_H], ["#define JAS_HAVE_SYS_TYPES_H 1"])
347 else
348         AC_SUBST([JAS_HAVE_SYS_TYPES_H], ["#undef JAS_HAVE_SYS_TYPES_H"])
351 ############################################################
352 # Check for typedefs, structures, and compiler characteristics.
353 ############################################################
355 dnl AC_C_CONST
356 dnl AC_C_INLINE
357 dnl AC_TYPE_SIZE_T
358 dnl AC_CHECK_TYPE(uchar, unsigned char)
359 dnl AC_CHECK_TYPE(ushort, unsigned short)
360 dnl AC_CHECK_TYPE(uint, unsigned int)
361 dnl AC_CHECK_TYPE(ulong, unsigned long)
362 dnl AC_CHECK_TYPE(longlong, long long)
363 dnl AC_CHECK_TYPE(ulonglong, unsigned long long)
364 dnl AC_CHECK_TYPE(ssize_t, int)
365 AC_CHECK_FUNCS(gettimeofday)
366 AC_CHECK_FUNCS(getrusage)
368 if test $ac_cv_func_gettimeofday = yes; then
369         AC_SUBST([JAS_HAVE_GETTIMEOFDAY], ["#define JAS_HAVE_GETTIMEOFDAY 1"])
370 else
371         AC_SUBST([JAS_HAVE_GETTIMEOFDAY], ["#undef JAS_HAVE_GETTIMEOFDAY"])
374 if test $ac_cv_func_getrusage = yes; then
375         AC_SUBST([JAS_HAVE_GETRUSAGE], ["#define JAS_HAVE_GETRUSAGE 1"])
376 else
377         AC_SUBST([JAS_HAVE_GETRUSAGE], ["#undef JAS_HAVE_GETRUSAGE"])
380 ############################################################
381 # Checks for library functions.
382 ############################################################
384 dnl AC_FUNC_VPRINTF
386 ############################################################
387 # Enable memory limit feature.
388 ############################################################
390 AC_ARG_ENABLE(memory-limit,
391 [  --enable-memory-limit=[ARG]    Set memory limit to ARG (where ARG defaults to SIZE_MAX).],
393 if test "${enableval}" != no; then
394         if test "${enableval}" = yes; then
395                 enableval="SIZE_MAX"
396         fi
397         AC_DEFINE_UNQUOTED([JAS_DEFAULT_MAX_MEM_USAGE],
398         [${enableval}],
399         [Maximum memory usage limit])
404 ############################################################
405 # Enable/disable sanitizers.
406 ############################################################
408 AC_ARG_ENABLE(asan,
409 [  --enable-asan    Enable Address Sanitizer.],
411 case "${enableval}" in
412 yes)
413         CFLAGS="$CFLAGS -fsanitize=address"
414         LDFLAGS="$LDFLAGS -fsanitize=address"
415         ;;
416 esac
420 AC_ARG_ENABLE(usan,
421 [  --enable-usan    Enable Undefined-Behavior Sanitizer.],
423 case "${enableval}" in
424 yes)
425         CFLAGS="$CFLAGS -fsanitize=undefined"
426         LDFLAGS="$LDFLAGS -fsanitize=undefined"
427 esac
431 AC_ARG_ENABLE(leak,
432 [  --enable-leak    Enable Leak Sanitizer.],
434 case "${enableval}" in
435 yes)
436         CFLAGS="$CFLAGS -fsanitize=leak"
437         LDFLAGS="$LDFLAGS -fsanitize=leak"
438 esac
442 AC_ARG_ENABLE(msan,
443 [  --enable-msan    Enable Memory Sanitizer.],
445 case "${enableval}" in
446 yes)
447         CFLAGS="$CFLAGS -fsanitize=memory"
448         LDFLAGS="$LDFLAGS -fsanitize=memory"
449 esac
453 ############################################################
454 # Enable/disable extra code for debugging.
455 ############################################################
457 AC_ARG_ENABLE(debug,
458 [  --enable-debug    add extra code for debugging],
460 case "${enableval}" in
461 yes)
462         debug=yes
463         AC_DEFINE(DEBUG)
464         AC_DEFINE(DEBUG_OVERFLOW)
465         if test "$GCC" = yes; then
466                 #CFLAGS=""
467                 CFLAGS="$CFLAGS -g -O0"
468         fi
469         ;;
471         debug=no
472         ;;
474         AC_MSG_ERROR(bad value ${enableval} for --enable-debug)
475         ;;
476 esac
477 ], [debug=no])
479 ############################################################
480 # Extra stuff
481 ############################################################
483 if test -n "$EXTRA_CFLAGS"; then
484         CFLAGS="$CFLAGS $EXTRA_CFLAGS"
487 ############################################################
488 # Generate the configuration header file.
489 ############################################################
491 # The private header file generated by AC_CONFIG_HEADERS is not
492 # currently used.  This just causes less verbose command lines
493 # when make is run.
494 AC_CONFIG_HEADERS([src/libjasper/include/jasper/jas_pconf.h])
496 ############################################################
497 # Generate the makefiles.
498 ############################################################
500 AC_CONFIG_FILES([
501 src/libjasper/include/jasper/jas_config.h
502 Makefile
503 src/Makefile
504 src/appl/Makefile
505 src/libjasper/Makefile
506 src/libjasper/base/Makefile
507 src/libjasper/bmp/Makefile
508 src/libjasper/include/Makefile
509 src/libjasper/include/jasper/Makefile
510 src/libjasper/jp2/Makefile
511 src/libjasper/jpc/Makefile
512 src/libjasper/jpg/Makefile
513 src/libjasper/mif/Makefile
514 src/libjasper/pgx/Makefile
515 src/libjasper/pnm/Makefile
516 src/libjasper/ras/Makefile
517 src/msvc/Makefile
518 test/Makefile
519 test/bin/Makefile
520 pkgconfig/Makefile
521 pkgconfig/jasper.pc
522 jasper.spec
524 AC_OUTPUT