maint: update all copyright dates via "make update-copyright"
[cppi.git] / configure.ac
blob36d8c310162500831800e7d712d021edf9440984
1 # Process this file with autoconf to produce a configure script.
2 AC_PREREQ([2.64])
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 AC_PROG_LEX([noyywrap])
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   [if test -d "$srcdir"/.git; then
32      gl_gcc_warnings=yes
33    else
34      gl_gcc_warnings=no
35    fi]
38 if test "$gl_gcc_warnings" = yes; then
39   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
40   AC_SUBST([WERROR_CFLAGS])
42   # Add many warnings, except some...
43   nw="$nw -Wdeclaration-after-statement" # too useful to forbid
44   nw="$nw -Waggregate-return"       # anachronistic
45   nw="$nw -Wlong-long"              # C90 is anachronistic
46   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
47   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
48   nw="$nw -Wtraditional"            # Warns on #elif which we use often
49   nw="$nw -Wcast-qual"              # Too many warnings for now
50   nw="$nw -Wconversion"             # Too many warnings for now
51   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
52   nw="$nw -Wsign-conversion"        # Too many warnings for now
53   nw="$nw -Wtraditional-conversion" # Too many warnings for now
54   nw="$nw -Wunreachable-code"       # Too many false positives
55   nw="$nw -Wpadded"                 # Our structs are not padded
56   nw="$nw -Wredundant-decls"        # warnings in flex-generated code (isatty)
57   nw="$nw -Wlogical-op"             # any use of fwrite provokes this
58   nw="$nw -Wvla"                    # warnings in gettext.h
59   nw="$nw -Wswitch-default"         # Too many warnings for now
60   nw="$nw -Wformat-y2k"             # Too many warnings for now
61   nw="$nw -Wunused-macros"          # warnings in flex-generated code
62   nw="$nw -Wstrict-prototypes"      # warnings in gperf-generated code
63   nw="$nw -Wmissing-noreturn"       # warning in flex-generated code yy_fatal_error
64   gl_MANYWARN_ALL_GCC([ws])
65   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
66   for w in $ws; do
67     gl_WARN_ADD([$w])
68   done
69   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
70   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
71   gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
72   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
73   gl_WARN_ADD([-fdiagnostics-show-option])
75   AC_SUBST([WARN_CFLAGS])
77   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
78   AH_VERBATIM([FORTIFY_SOURCE],
79   [/* Enable compile-time and run-time bounds-checking, and some warnings,
80       without upsetting glibc 2.15+. */
81    #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
82    # define _FORTIFY_SOURCE 2
83    #endif
84   ])
85   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
88 AC_C_INLINE
89 AC_HEADER_DIRENT
90 AC_HEADER_ASSERT
92 AM_GNU_GETTEXT([external])
93 AM_GNU_GETTEXT_VERSION([0.18.2])
95 # Now that configure no longer creates src/ or man/, create them here.
96 # Doing it this way is more maintainable that adding to each individual
97 # Makefile rule that creates a file in one of those sub-directories.
98 $MKDIR_P man src
100 AC_CONFIG_FILES([Makefile po/Makefile.in])
101 AC_OUTPUT