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