| 1 |
dnl Process this file with autoconf to produce a configure script |
| 2 |
|
| 3 |
AC_INIT(psutils, 1.23, [email protected]) |
| 4 |
AC_CONFIG_AUX_DIR([build-aux]) |
| 5 |
AM_INIT_AUTOMAKE([-Wall -Werror foreign]) |
| 6 |
|
| 7 |
dnl Check for programs |
| 8 |
AC_PROG_CC |
| 9 |
gl_EARLY |
| 10 |
AC_PROG_LN_S |
| 11 |
AM_PROG_AR |
| 12 |
|
| 13 |
AC_USE_SYSTEM_EXTENSIONS |
| 14 |
AC_ARG_ENABLE([gcc-warnings], |
| 15 |
[AS_HELP_STRING([--enable-gcc-warnings], |
| 16 |
[turn on lots of GCC warnings (for developers)])], |
| 17 |
[case $enableval in |
| 18 |
yes|no) ;; |
| 19 |
*) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;; |
| 20 |
esac |
| 21 |
gl_gcc_warnings=$enableval], |
| 22 |
[gl_gcc_warnings=no] |
| 23 |
) |
| 24 |
|
| 25 |
if test "$gl_gcc_warnings" = yes; then |
| 26 |
gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) |
| 27 |
|
| 28 |
# Set up the list of undesired warnings. |
| 29 |
nw= |
| 30 |
nw="$nw -Wundef" # All compiler preprocessors support #if UNDEF |
| 31 |
nw="$nw -Wtraditional" # All compilers nowadays support ANSI C |
| 32 |
nw="$nw -Wstrict-overflow" # Use a lower level (see below). |
| 33 |
nw="$nw -Wconversion" # These warnings usually don’t point to mistakes. |
| 34 |
nw="$nw -Wsign-conversion" # Likewise. |
| 35 |
nw="$nw -Wtraditional-conversion" # Don't care. |
| 36 |
nw="$nw -Wpadded" # Don't care. |
| 37 |
nw="$nw -Wc++-compat" # Don't care. |
| 38 |
nw="$nw -Woverlength-strings" # Don't care. |
| 39 |
nw="$nw -Wmissing-format-attribute" # Don't care. |
| 40 |
nw="$nw -Wshadow" # Don't care. |
| 41 |
nw="$nw -Wunreachable-code" # Seems buggy. |
| 42 |
nw="$nw -Wsystem-headers" # glibc headers fail as of glibc 2.17, gcc 4.8 |
| 43 |
nw="$nw -Wsuggest-attribute=format" # glibc headers fail as of glibc 2.17, gcc 4.8 |
| 44 |
nw="$nw -Wall" |
| 45 |
nw="$nw -Wunused-macros" # those macros might come in handy later |
| 46 |
|
| 47 |
gl_MANYWARN_ALL_GCC([warnings]) |
| 48 |
|
| 49 |
# Enable all GCC warnings not in this list. |
| 50 |
gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw]) |
| 51 |
for w in $warnings; do |
| 52 |
gl_WARN_ADD([$w]) |
| 53 |
done |
| 54 |
|
| 55 |
# Add an extra warning |
| 56 |
gl_WARN_ADD([-Wstrict-overflow=1]) |
| 57 |
# Add some more safety measures |
| 58 |
gl_WARN_ADD([-D_FORTIFY_SOURCE=2]) |
| 59 |
gl_WARN_ADD([-fmudflap]) |
| 60 |
|
| 61 |
# When compiling with GCC, prefer -isystem to -I when including system |
| 62 |
# include files, to avoid generating useless diagnostics for the files. |
| 63 |
ISYSTEM='-isystem ' |
| 64 |
else |
| 65 |
ISYSTEM='-I' |
| 66 |
fi |
| 67 |
AC_SUBST([ISYSTEM]) |
| 68 |
|
| 69 |
gl_INIT |
| 70 |
|
| 71 |
dnl Check for header files |
| 72 |
AC_HEADER_STDC |
| 73 |
|
| 74 |
dnl Check for programs |
| 75 |
dnl Don't use AX_WITH_PROG, as we want by default to be relocatable, |
| 76 |
dnl hence not use a full path |
| 77 |
AC_ARG_VAR([PAPER], [Absolute path to paper executable]) |
| 78 |
if test -z "$PAPER"; then |
| 79 |
PAPER=paper |
| 80 |
fi |
| 81 |
|
| 82 |
dnl Generate output files |
| 83 |
AC_CONFIG_MACRO_DIR(m4) |
| 84 |
AC_CONFIG_HEADER(config.h) |
| 85 |
AC_CONFIG_FILES(Makefile lib/Makefile) |
| 86 |
AC_OUTPUT |