]> icculus.org git repositories - icculus/xz.git/blob - configure.ac
Avoid visibility related compiler warnings on Windows.
[icculus/xz.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 ###############################################################################
5 #
6 # Author: Lasse Collin
7 #
8 # This file has been put into the public domain.
9 # You can do whatever you want with this file.
10 #
11 ###############################################################################
12
13 # NOTE: Don't add useless checks. autoscan detects this and that, but don't
14 # let it confuse you. For example, we don't care about checking for behavior
15 # of malloc(), stat(), or lstat(), since we don't use those functions in
16 # a way that would cause the problems the autoconf macros check.
17
18 AC_PREREQ([2.61])
19
20 AC_INIT([XZ Utils], m4_esyscmd([/bin/sh version.sh]),
21         [lasse.collin@tukaani.org], [xz])
22 AC_CONFIG_SRCDIR([src/liblzma/common/common.h])
23 AC_CONFIG_HEADER([config.h])
24 AC_CONFIG_MACRO_DIR([m4])
25
26 echo
27 echo "$PACKAGE_STRING"
28
29 echo
30 echo "System type:"
31 # This is needed to know if assembler optimizations can be used.
32 AC_CANONICAL_HOST
33
34 # We do some special things on Windows (32-bit or 64-bit) builds.
35 case $host_os in
36         mingw* | cygwin*) is_w32=yes ;;
37         *)                is_w32=no ;;
38 esac
39 AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes])
40
41
42 echo
43 echo "Configure options:"
44 AM_CFLAGS=
45
46
47 #############
48 # Debugging #
49 #############
50
51 AC_MSG_CHECKING([if debugging code should be compiled])
52 AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [Enable debugging code.]),
53         [], enable_debug=no)
54 if test "x$enable_debug" = xyes; then
55         AC_MSG_RESULT([yes])
56 else
57         AC_DEFINE([NDEBUG], [1], [Define to 1 to disable debugging code.])
58         AC_MSG_RESULT([no])
59 fi
60
61
62 ###########
63 # Filters #
64 ###########
65
66 m4_define([SUPPORTED_FILTERS], [lzma1,lzma2,subblock,delta,x86,powerpc,ia64,arm,armthumb,sparc])dnl
67 m4_define([SIMPLE_FILTERS], [x86,powerpc,ia64,arm,armthumb,sparc])
68 m4_define([LZ_FILTERS], [lzma1,lzma2])
69
70 m4_foreach([NAME], [SUPPORTED_FILTERS],
71 [enable_filter_[]NAME=no
72 enable_encoder_[]NAME=no
73 enable_decoder_[]NAME=no
74 ])dnl
75
76 AC_MSG_CHECKING([which encoders to build])
77 AC_ARG_ENABLE([encoders], AC_HELP_STRING([--enable-encoders=LIST],
78                 [Comma-separated list of encoders to build. Default=all.
79                 Available encoders:]
80                         m4_translit(m4_defn([SUPPORTED_FILTERS]), [,], [ ])),
81         [], [enable_encoders=SUPPORTED_FILTERS])
82 enable_encoders=`echo "$enable_encoders" | sed 's/,subblock//; s/,/ /g'`
83 if test "x$enable_encoders" = xno || test "x$enable_encoders" = x; then
84         AC_MSG_RESULT([(none)])
85 else
86         AC_DEFINE([HAVE_ENCODER], [1],
87                 [Define to 1 if encoder components are enabled.])
88         for arg in $enable_encoders
89         do
90                 case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
91                         NAME)
92                                 enable_filter_[]NAME=yes
93                                 enable_encoder_[]NAME=yes
94                                 AC_DEFINE(HAVE_ENCODER_[]m4_toupper(NAME), [1],
95                                 [Define to 1 if] NAME [encoder is enabled.])
96                                 ;;])
97                         *)
98                                 AC_MSG_RESULT([])
99                                 AC_MSG_ERROR([unknown filter: $arg])
100                                 ;;
101                 esac
102         done
103         AC_MSG_RESULT([$enable_encoders])
104 fi
105
106 AC_MSG_CHECKING([which decoders to build])
107 AC_ARG_ENABLE([decoders], AC_HELP_STRING([--enable-decoders=LIST],
108                 [Comma-separated list of decoders to build. Default=all.
109                 Available decoders are the same as available encoders.]),
110         [], [enable_decoders=SUPPORTED_FILTERS])
111 enable_decoders=`echo "$enable_decoders" | sed 's/,subblock//; s/,/ /g'`
112 if test "x$enable_decoders" = xno || test "x$enable_decoders" = x; then
113         AC_MSG_RESULT([(none)])
114 else
115         AC_DEFINE([HAVE_DECODER], [1],
116                 [Define to 1 if decoder components are enabled.])
117         for arg in $enable_decoders
118         do
119                 case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
120                         NAME)
121                                 enable_filter_[]NAME=yes
122                                 enable_decoder_[]NAME=yes
123                                 AC_DEFINE(HAVE_DECODER_[]m4_toupper(NAME), [1],
124                                 [Define to 1 if] NAME [decoder is enabled.])
125                                 ;;])
126                         *)
127                                 AC_MSG_RESULT([])
128                                 AC_MSG_ERROR([unknown filter: $arg])
129                                 ;;
130                 esac
131         done
132
133         # LZMA2 requires that LZMA1 is enabled.
134         test "x$enable_encoder_lzma2" = xyes && enable_encoder_lzma1=yes
135         test "x$enable_decoder_lzma2" = xyes && enable_decoder_lzma1=yes
136
137         AC_MSG_RESULT([$enable_decoders])
138 fi
139
140 if test "x$enable_encoder_lzma2$enable_encoder_lzma1" = xyesno \
141                 || test "x$enable_decoder_lzma2$enable_decoder_lzma1" = xyesno; then
142         AC_MSG_ERROR([LZMA2 requires that LZMA1 is also enabled.])
143 fi
144
145 AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno && test "x$enable_encoders" != x)
146 AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno && test "x$enable_decoders" != x)
147
148 m4_foreach([NAME], [SUPPORTED_FILTERS],
149 [AM_CONDITIONAL(COND_FILTER_[]m4_toupper(NAME), test "x$enable_filter_[]NAME" = xyes)
150 AM_CONDITIONAL(COND_ENCODER_[]m4_toupper(NAME), test "x$enable_encoder_[]NAME" = xyes)
151 AM_CONDITIONAL(COND_DECODER_[]m4_toupper(NAME), test "x$enable_decoder_[]NAME" = xyes)
152 ])dnl
153
154 # The so called "simple filters" share common code.
155 enable_filter_simple=no
156 enable_encoder_simple=no
157 enable_decoder_simple=no
158 m4_foreach([NAME], [SIMPLE_FILTERS],
159 [test "x$enable_filter_[]NAME" = xyes && enable_filter_simple=yes
160 test "x$enable_encoder_[]NAME" = xyes && enable_encoder_simple=yes
161 test "x$enable_decoder_[]NAME" = xyes && enable_decoder_simple=yes
162 ])dnl
163 AM_CONDITIONAL(COND_FILTER_SIMPLE, test "x$enable_filter_simple" = xyes)
164 AM_CONDITIONAL(COND_ENCODER_SIMPLE, test "x$enable_encoder_simple" = xyes)
165 AM_CONDITIONAL(COND_DECODER_SIMPLE, test "x$enable_decoder_simple" = xyes)
166
167 # LZ-based filters share common code.
168 enable_filter_lz=no
169 enable_encoder_lz=no
170 enable_decoder_lz=no
171 m4_foreach([NAME], [LZ_FILTERS],
172 [test "x$enable_filter_[]NAME" = xyes && enable_filter_lz=yes
173 test "x$enable_encoder_[]NAME" = xyes && enable_encoder_lz=yes
174 test "x$enable_decoder_[]NAME" = xyes && enable_decoder_lz=yes
175 ])dnl
176 AM_CONDITIONAL(COND_FILTER_LZ, test "x$enable_filter_lz" = xyes)
177 AM_CONDITIONAL(COND_ENCODER_LZ, test "x$enable_encoder_lz" = xyes)
178 AM_CONDITIONAL(COND_DECODER_LZ, test "x$enable_decoder_lz" = xyes)
179
180
181 #################
182 # Match finders #
183 #################
184
185 m4_define([SUPPORTED_MATCH_FINDERS], [hc3,hc4,bt2,bt3,bt4])
186
187 m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS],
188 [enable_match_finder_[]NAME=no
189 ])
190
191 AC_MSG_CHECKING([which match finders to build])
192 AC_ARG_ENABLE([match-finders], AC_HELP_STRING([--enable-match-finders=LIST],
193                 [Comma-separated list of match finders to build. Default=all.
194                 At least one match finder is required for encoding with
195                 the LZMA1 and LZMA2 filters. Available match finders:]
196                 m4_translit(m4_defn([SUPPORTED_MATCH_FINDERS]), [,], [ ])), [],
197         [enable_match_finders=SUPPORTED_MATCH_FINDERS])
198 enable_match_finders=`echo "$enable_match_finders" | sed 's/,/ /g'`
199 if test "x$enable_encoder_lz" = xyes ; then
200         for arg in $enable_match_finders
201                 do
202                 case $arg in m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], [
203                         NAME)
204                                 enable_match_finder_[]NAME=yes
205                                 AC_DEFINE(HAVE_MF_[]m4_toupper(NAME), [1],
206                                 [Define to 1 to enable] NAME [match finder.])
207                                 ;;])
208                         *)
209                                 AC_MSG_RESULT([])
210                                 AC_MSG_ERROR([unknown match finder: $arg])
211                                 ;;
212                 esac
213         done
214         AC_MSG_RESULT([$enable_match_finders])
215 else
216         AC_MSG_RESULT([(none because not building any LZ-based encoder)])
217 fi
218
219
220 ####################
221 # Integrity checks #
222 ####################
223
224 m4_define([SUPPORTED_CHECKS], [crc32,crc64,sha256])
225
226 m4_foreach([NAME], [SUPPORTED_FILTERS],
227 [enable_check_[]NAME=no
228 ])dnl
229
230 AC_MSG_CHECKING([which integrity checks to build])
231 AC_ARG_ENABLE([checks], AC_HELP_STRING([--enable-checks=LIST],
232                 [Comma-separated list of integrity checks to build.
233                 Default=all. Available integrity checks:]
234                 m4_translit(m4_defn([SUPPORTED_CHECKS]), [,], [ ])),
235         [], [enable_checks=SUPPORTED_CHECKS])
236 enable_checks=`echo "$enable_checks" | sed 's/,/ /g'`
237 if test "x$enable_checks" = xno || test "x$enable_checks" = x; then
238         AC_MSG_RESULT([(none)])
239 else
240         for arg in $enable_checks
241         do
242                 case $arg in m4_foreach([NAME], [SUPPORTED_CHECKS], [
243                         NAME)
244                                 enable_check_[]NAME=yes
245                                 AC_DEFINE(HAVE_CHECK_[]m4_toupper(NAME), [1],
246                                 [Define to 1 if] NAME
247                                 [integrity check is enabled.])
248                                 ;;])
249                         *)
250                                 AC_MSG_RESULT([])
251                                 AC_MSG_ERROR([unknown integrity check: $arg])
252                                 ;;
253                 esac
254         done
255         AC_MSG_RESULT([$enable_checks])
256 fi
257 if test "x$enable_checks_crc32" = xno ; then
258         AC_MSG_ERROR([For now, the CRC32 check must always be enabled.])
259 fi
260
261 m4_foreach([NAME], [SUPPORTED_CHECKS],
262 [AM_CONDITIONAL(COND_CHECK_[]m4_toupper(NAME), test "x$enable_check_[]NAME" = xyes)
263 ])dnl
264
265
266 ###########################
267 # Assembler optimizations #
268 ###########################
269
270 AC_MSG_CHECKING([if assembler optimizations should be used])
271 AC_ARG_ENABLE([assembler], AC_HELP_STRING([--disable-assembler],
272                 [Do not use assembler optimizations even if such exist
273                 for the architecture.]),
274         [], [enable_assembler=yes])
275 if test "x$enable_assembler" = xyes; then
276         case $host_cpu in
277                 i?86)   enable_assembler=x86 ;;
278                 x86_64) enable_assembler=x86_64 ;;
279                 *)      enable_assembler=no ;;
280         esac
281 fi
282 case $enable_assembler in
283         x86)
284                 AC_DEFINE([HAVE_ASM_X86], [1],
285                         [Define to 1 if using x86 assembler optimizations.])
286                 ;;
287         x86_64)
288                 AC_DEFINE([HAVE_ASM_X86_64], [1],
289                         [Define to 1 if using x86_64 assembler optimizations.])
290                 ;;
291         no)
292                 ;;
293         *)
294                 AC_MSG_RESULT([])
295                 AC_MSG_ERROR([--enable-assembler accepts only \`yes', \`no', \`x86', or \`x86_64'.])
296                 ;;
297 esac
298 AC_MSG_RESULT([$enable_assembler])
299 AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86)
300 AM_CONDITIONAL(COND_ASM_X86_64, test "x$enable_assembler" = xx86_64)
301
302
303 ################################
304 # Fast unaligned memory access #
305 ################################
306
307 AC_MSG_CHECKING([if unaligned memory access should be used])
308 AC_ARG_ENABLE([unaligned-access], AC_HELP_STRING([--enable-unaligned-access],
309                 [Enable if the system supports *fast* unaligned memory access
310                 with 16-bit and 32-bit integers. By default, this is enabled
311                 only on x86, x86_64, and big endian PowerPC.]),
312         [], [enable_unaligned_access=auto])
313 if test "x$enable_unaligned_access" = xauto ; then
314         case $host_cpu in
315                 i?86|x86_64|powerpc|powerpc64)
316                         enable_unaligned_access=yes
317                         ;;
318                 *)
319                         enable_unaligned_access=no
320                         ;;
321         esac
322 fi
323 if test "x$enable_unaligned_access" = xyes ; then
324         AC_DEFINE([HAVE_FAST_UNALIGNED_ACCESS], [1], [Define to 1 if
325                 the system supports fast unaligned memory access.])
326         AC_MSG_RESULT([yes])
327 else
328         AC_MSG_RESULT([no])
329 fi
330
331
332 #####################
333 # Size optimization #
334 #####################
335
336 AC_MSG_CHECKING([if small size is preferred over speed])
337 AC_ARG_ENABLE([small], AC_HELP_STRING([--enable-small],
338                 [Make liblzma smaller and a little slower.
339                 This is disabled by default to optimize for speed.]),
340         [], [enable_small=no])
341 if test "x$enable_small" = xyes; then
342         AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.])
343 elif test "x$enable_small" != xno; then
344         AC_MSG_RESULT([])
345         AC_MSG_ERROR([--enable-small accepts only \`yes' or \`no'])
346 fi
347 AC_MSG_RESULT([$enable_small])
348 AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
349
350
351 #############
352 # Threading #
353 #############
354
355 AC_MSG_CHECKING([if threading support is wanted])
356 AC_ARG_ENABLE([threads], AC_HELP_STRING([--disable-threads],
357                 [Disable threading support.
358                 This makes some things thread-unsafe.]),
359         [], [enable_threads=yes])
360 if test "x$enable_threads" != xyes && test "x$enable_threads" != xno; then
361         AC_MSG_RESULT([])
362         AC_MSG_ERROR([--enable-threads accepts only \`yes' or \`no'])
363 fi
364 AC_MSG_RESULT([$enable_threads])
365 # We use the actual result a little later.
366
367
368 ############################################
369 # xz/xzdec/lzmadec linkage against liblzma #
370 ############################################
371
372 # Link the command line tool statically against liblzma unless using
373 # --enable-dynamic. Using static liblzma gives a little bit faster executable
374 # on x86, because no register is wasted for PIC. We also have one dependency
375 # less, which allows users to more freely copy the xz binary to other boxes.
376 # However, I wouldn't be surprised if distro maintainers still prefer dynamic
377 # linking, so let's make it easy for them.
378
379 AC_MSG_CHECKING([how command line tools should be linked against liblzma])
380 AC_ARG_ENABLE([dynamic], [AC_HELP_STRING([--enable-dynamic],
381                         [Link command line tools dynamically against liblzma.
382                         The default is to use static liblzma if it was
383                         built.])],
384                 [], [enable_dynamic=no])
385 case $enable_dynamic in
386         yes)
387                 STATIC_CPPFLAGS=
388                 STATIC_LDFLAGS=
389                 AC_MSG_RESULT([dynamically])
390                 ;;
391         no)
392                 STATIC_CPPFLAGS="-DLZMA_API_STATIC"
393                 STATIC_LDFLAGS="-static"
394                 AC_MSG_RESULT([statically])
395                 ;;
396         *)
397                 AC_MSG_RESULT([])
398                 AC_MSG_ERROR([--enable-dynamic accepts only \`yes' or \`no'])
399                 ;;
400 esac
401 AC_SUBST([STATIC_CPPFLAGS])
402 AC_SUBST([STATIC_LDFLAGS])
403
404
405 ###############################################################################
406 # Checks for programs.
407 ###############################################################################
408
409 echo
410 echo "Initializing Automake:"
411
412 AM_INIT_AUTOMAKE([1.10 foreign tar-v7 filename-length-max=99])
413 AC_PROG_LN_S
414
415 AC_PROG_CC_C99
416 if test x$ac_cv_prog_cc_c99 = xno ; then
417         AC_MSG_ERROR([No C99 compiler was found.])
418 fi
419
420 AM_PROG_CC_C_O
421 AM_PROG_AS
422 AC_USE_SYSTEM_EXTENSIONS
423
424 if test "x$enable_threads" = xyes; then
425         echo
426         echo "Threading support:"
427         ACX_PTHREAD
428         LIBS="$LIBS $PTHREAD_LIBS"
429         AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
430         CC="$PTHREAD_CC"
431 fi
432
433 echo
434 echo "Initializing Libtool:"
435 CXX=no
436 F77=no
437 AC_LIBTOOL_WIN32_DLL
438 AC_PROG_LIBTOOL
439 AC_LIBTOOL_RC
440
441 dnl Some day we can drop support for libtool 1.5.x. Then the above five
442 dnl lines can be replaced with these:
443 dnl LT_INIT([win32-dll])
444 dnl LT_LANG([Windows Resource])
445
446 # This is a bit wrong since it is possible to request that only some libs
447 # are built as shared. Using that feature isn't so common though, and this
448 # breaks only on Windows (at least for now) if the user enables only some
449 # libs as shared.
450 AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
451
452
453 ###############################################################################
454 # Checks for libraries.
455 ###############################################################################
456
457 echo
458 echo "Initializing gettext:"
459 AM_GNU_GETTEXT_VERSION([0.16.1])
460 AM_GNU_GETTEXT([external])
461
462 ###############################################################################
463 # Checks for header files.
464 ###############################################################################
465
466 echo
467 echo "System headers and functions:"
468
469 # There is currently no workarounds in this package if some of
470 # these headers are missing.
471 AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h],
472         [],
473         [AC_MSG_ERROR([Required header file(s) are missing.])])
474
475 # If any of these headers are missing, things should still work correctly:
476 AC_CHECK_HEADERS([sys/param.h sys/sysctl.h byteswap.h],
477         [], [], [
478 #ifdef HAVE_SYS_PARAM_H
479 #       include <sys/param.h>
480 #endif
481 ])
482
483 # Even if we have byteswap.h, we may lack the specific macros/functions.
484 if test x$ac_cv_header_byteswap_h = xyes ; then
485         m4_foreach([FUNC], [bswap_16,bswap_32,bswap_64], [
486                 AC_MSG_CHECKING([if FUNC is available])
487                 AC_LINK_IFELSE([AC_LANG_SOURCE([
488 #include <byteswap.h>
489 int
490 main(void)
491 {
492         FUNC[](42);
493         return 0;
494 }
495                 ])], [
496                         AC_DEFINE(HAVE_[]m4_toupper(FUNC), [1],
497                                         [Define to 1 if] FUNC [is available.])
498                         AC_MSG_RESULT([yes])
499                 ], [AC_MSG_RESULT([no])])
500
501         ])dnl
502 fi
503
504
505 ###############################################################################
506 # Checks for typedefs, structures, and compiler characteristics.
507 ###############################################################################
508
509 dnl We don't need these as long as we need a C99 compiler anyway.
510 dnl AC_C_INLINE
511 dnl AC_C_RESTRICT
512
513 AC_HEADER_STDBOOL
514
515 AC_TYPE_UINT8_T
516 AC_TYPE_UINT16_T
517 AC_TYPE_INT32_T
518 AC_TYPE_UINT32_T
519 AC_TYPE_INT64_T
520 AC_TYPE_UINT64_T
521 AC_TYPE_UINTPTR_T
522
523 AC_CHECK_SIZEOF([size_t])
524
525 # The command line tool can copy high resolution timestamps if such
526 # information is availabe in struct stat. Otherwise one second accuracy
527 # is used.
528 AC_CHECK_MEMBERS([
529         struct stat.st_atim.tv_nsec,
530         struct stat.st_atimespec.tv_nsec,
531         struct stat.st_atimensec,
532         struct stat.st_uatime,
533         struct stat.st_atim.st__tim.tv_nsec])
534
535 AC_SYS_LARGEFILE
536 AC_C_BIGENDIAN
537
538
539 ###############################################################################
540 # Checks for library functions.
541 ###############################################################################
542
543 # Gnulib replacements as needed
544 gl_GETOPT
545
546 # Find the best function to set timestamps.
547 AC_CHECK_FUNCS([futimens futimes futimesat utimes utime], [break])
548
549 lc_PHYSMEM
550 lc_CPUCORES
551
552
553 ###############################################################################
554 # If using GCC, set some additional AM_CFLAGS:
555 ###############################################################################
556
557 if test "$GCC" = yes ; then
558         echo
559         echo "GCC extensions:"
560 fi
561
562 # Always do the visibility check but don't set AM_CFLAGS on Windows.
563 # This way things get set properly even on Windows.
564 gl_VISIBILITY
565 if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then
566         AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
567 fi
568
569 if test "$GCC" = yes ; then
570         # Enable as much warnings as possible. These commented warnings won't
571         # work for this package though:
572         #   * -Wunreachable-code breaks several assert(0) cases, which are
573         #     backed up with "return LZMA_PROG_ERROR".
574         #   * -Wcast-qual would break various things where we need a non-const
575         #     pointer although we don't modify anything through it.
576         #   * -Wcast-align breaks optimized CRC32 and CRC64 implementation
577         #     on some architectures (not on x86), where this warning is bogus,
578         #     because we take care of correct alignment.
579         #   * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations
580         #     don't seem so useful here; at least the last one gives some
581         #     warnings which are not bugs.
582         for NEW_FLAG in \
583                         -Wall \
584                         -Wextra \
585                         -Wformat=2 \
586                         -Winit-self \
587                         -Wmissing-include-dirs \
588                         -Wstrict-aliasing \
589                         -Wfloat-equal \
590                         -Wundef \
591                         -Wshadow \
592                         -Wpointer-arith \
593                         -Wbad-function-cast \
594                         -Wwrite-strings \
595                         -Wlogical-op \
596                         -Waggregate-return \
597                         -Wstrict-prototypes \
598                         -Wold-style-definition \
599                         -Wmissing-prototypes \
600                         -Wmissing-declarations \
601                         -Wmissing-noreturn \
602                         -Wredundant-decls
603         do
604                 AC_MSG_CHECKING([if $CC accepts $NEW_FLAG])
605                 OLD_CFLAGS="$CFLAGS"
606                 CFLAGS="$CFLAGS $NEW_FLAG"
607                 AC_COMPILE_IFELSE([void foo(void) { }], [
608                         AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
609                         AC_MSG_RESULT([yes])
610                 ], [
611                         AC_MSG_RESULT([no])
612                 ])
613                 CFLAGS="$OLD_CFLAGS"
614         done
615
616         AC_ARG_ENABLE([werror],
617                 AC_HELP_STRING([--enable-werror], [Enable -Werror to abort
618                         compilation on all compiler warnings.]),
619                 [], [enable_werror=no])
620         if test "x$enable_werror" = "xyes"; then
621                 AM_CFLAGS="$AM_CFLAGS -Werror"
622         fi
623 fi
624
625
626 ###############################################################################
627 # Create the makefiles and config.h
628 ###############################################################################
629
630 echo
631
632 # Don't build the lib directory at all if we don't need any replacement
633 # functions.
634 AM_CONDITIONAL([COND_GNULIB], test -n "$LIBOBJS")
635
636 # Add default AM_CFLAGS.
637 AC_SUBST([AM_CFLAGS])
638
639 AC_CONFIG_FILES([
640         Doxyfile
641         Makefile
642         po/Makefile.in
643         lib/Makefile
644         src/Makefile
645         src/liblzma/liblzma.pc
646         src/liblzma/Makefile
647         src/liblzma/api/Makefile
648         src/xz/Makefile
649         src/xzdec/Makefile
650         src/scripts/Makefile
651         tests/Makefile
652         debug/Makefile
653 ])
654
655 AC_OUTPUT