build: avoid build failure on non-glibc systems
[cppi/ericb.git] / configure.ac
blobae6356017e88f17011443e5b2d4ae99cefae560d
1 # Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.63.240)
3 AC_INIT([GNU cppi], m4_esyscmd([build-aux/git-version-gen .tarball-version]),
4         [bug-cppi@gnu.org])
5 AC_CONFIG_SRCDIR(src/cppi.l)
7 AC_CONFIG_AUX_DIR([build-aux])
8 AC_CONFIG_HEADERS([lib/config.h:config.hin])
10 AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz color-tests parallel-tests])
11 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
13 AM_MISSING_PROG([HELP2MAN], [help2man])
14 AC_PROG_CC
15 gl_EARLY
16 AC_PROG_INSTALL
17 AC_PROG_MAKE_SET
18 AM_PROG_LEX
19 AC_PROG_RANLIB
21 gl_INIT
23 AC_ARG_ENABLE([gcc-warnings],
24   [AS_HELP_STRING([--enable-gcc-warnings],
25                   [turn on lots of GCC warnings (for developers)])],
26   [case $enableval in
27      yes|no) ;;
28      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
29    esac
30    gl_gcc_warnings=$enableval],
31   [gl_gcc_warnings=no]
34 if test "$gl_gcc_warnings" = yes; then
35   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
36   AC_SUBST([WERROR_CFLAGS])
38   # Add many warnings, except some...
39   nw="$nw -Wdeclaration-after-statement" # too useful to forbid
40   nw="$nw -Waggregate-return"       # anachronistic
41   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
42   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
43   nw="$nw -Wtraditional"            # Warns on #elif which we use often
44   nw="$nw -Wcast-qual"              # Too many warnings for now
45   nw="$nw -Wconversion"             # Too many warnings for now
46   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
47   nw="$nw -Wsign-conversion"        # Too many warnings for now
48   nw="$nw -Wtraditional-conversion" # Too many warnings for now
49   nw="$nw -Wunreachable-code"       # Too many false positives
50   nw="$nw -Wpadded"                 # Our structs are not padded
51   nw="$nw -Wredundant-decls"        # warnings in flex-generated code (isatty)
52   nw="$nw -Wlogical-op"             # any use of fwrite provokes this
53   nw="$nw -Wvla"                    # warnings in gettext.h
54   nw="$nw -Wswitch-default"         # Too many warnings for now
55   nw="$nw -Wformat-y2k"             # Too many warnings for now
56   nw="$nw -Wunused-macros"          # warnings in flex-generated code
57   nw="$nw -Wstrict-prototypes"      # warnings in gperf-generated code
58   nw="$nw -Wmissing-noreturn"       # warning in flex-generated code yy_fatal_error
59   gl_MANYWARN_ALL_GCC([ws])
60   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
61   for w in $ws; do
62     gl_WARN_ADD([$w])
63   done
64   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
65   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
66   gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
67   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
68   gl_WARN_ADD([-fdiagnostics-show-option])
70   AC_SUBST([WARN_CFLAGS])
72   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
73   AC_DEFINE([_FORTIFY_SOURCE], [2],
74     [enable compile-time and run-time bounds-checking, and some warnings])
75   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
78 AC_C_INLINE
79 AC_HEADER_DIRENT
80 AC_HEADER_ASSERT
82 AM_GNU_GETTEXT([external])
83 AM_GNU_GETTEXT_VERSION([0.15])
85 AC_CONFIG_FILES(
86   Makefile
87   lib/Makefile
88   po/Makefile
89   src/Makefile
90   tests/Makefile
91   man/Makefile)
93 AC_OUTPUT