3 # Copyright (C)1996-1997 Ian Jackson
5 # This is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with userv; if not, write to the Free Software
17 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 AC_CONFIG_HEADER(config.h)
22 AC_PREFIX_DEFAULT(/usr/local)
30 [ --enable-debug build debugging version],
32 if test "x$enable_debug" = xyes; then
33 DEBUGDEFS="-DDEBUG -DVARDIR='\"$crdir/vd\"' -DSYSTEMCONFIGDIR='\"$crdir/slash-etc\"' -DSERVICEUSERDIR='\"$crdir/tilde\"'"
35 elif test "x$enable_debug" != xno; then
36 AC_MSG_ERROR(--enable-debug does not allow any arguments except 'yes' and 'no')
42 AC_SYS_LONG_FILE_NAMES
45 if test "${GCC-no}" = yes; then
51 dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
52 define(DPKG_CACHED_TRY_COMPILE,[
55 AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
57 if test "x$$2" = xyes; then
66 DPKG_CACHED_TRY_COMPILE(your C compiler,dpkg_cv_c_works,
67 [#include <string.h>], [strcmp("a","b")],
70 AC_MSG_ERROR(C compiler is broken))
72 DPKG_CACHED_TRY_COMPILE(__attribute__((,,)),dpkg_cv_c_attribute_supported,,
73 [extern int testfunction(int x) __attribute__((,,))],
75 AC_DEFINE(HAVE_GNUC25_ATTRIB)
76 DPKG_CACHED_TRY_COMPILE(__attribute__((noreturn)),dpkg_cv_c_attribute_noreturn,,
77 [extern int testfunction(int x) __attribute__((noreturn))],
79 AC_DEFINE(HAVE_GNUC25_NORETURN),
81 DPKG_CACHED_TRY_COMPILE(__attribute__((const)),dpkg_cv_c_attribute_const,,
82 [extern int testfunction(int x) __attribute__((const))],
84 AC_DEFINE(HAVE_GNUC25_CONST),
86 DPKG_CACHED_TRY_COMPILE(__attribute__((format...)),dpkg_cv_attribute_format,,
87 [extern int testfunction(char *y, ...) __attribute__((format(printf,1,2)))],
89 AC_DEFINE(HAVE_GNUC25_PRINTFFORMAT),
96 dnl DPKG_C_GCC_TRY_WARNS(<warnings>,<cachevar>)
97 define(DPKG_C_GCC_TRY_WARNS,[
98 AC_MSG_CHECKING([GCC warning flag(s) $1])
99 if test "${GCC-no}" = yes
102 oldcflags="${CFLAGS-}"
103 CFLAGS="${CFLAGS-} ${CWARNS} $1 -Werror"
108 strcmp("a","b"); fprintf(stdout,"test ok\n");
109 ], [$2=yes], [$2=no])
110 CFLAGS="${oldcflags}"])
111 if test "x$$2" = xyes; then
112 CWARNS="${CWARNS} $1"
119 AC_MSG_RESULT(no, not using GCC)
123 DPKG_C_GCC_TRY_WARNS(-Wall -Wno-implicit, dpkg_cv_c_gcc_warn_all)
124 DPKG_C_GCC_TRY_WARNS(-Wwrite-strings, dpkg_cv_c_gcc_warn_writestrings)
125 DPKG_C_GCC_TRY_WARNS(-Wpointer-arith, dpkg_cv_c_gcc_warn_pointerarith)
126 DPKG_C_GCC_TRY_WARNS(-Wimplicit -Wnested-externs, dpkg_cv_c_gcc_warn_implicit)
128 if test "${GCC-no}" = yes; then
129 CWARNS="${CWARNS} -Wmissing-prototypes -Wstrict-prototypes -Werror"
131 [CFLAGS="`echo $CFLAGS $CWARNS | sed -e 's/-O[0-9]*/$(OPTIMISE)/'`"]