Fix several warnings that appear in gcc 4.3.2.
[wvstreams.git] / argp / configure.ac
blob1e99bb723559d2df1fdd7d0b1af019eb69b0bb02
1 dnl Process this file with autoconf to produce a configure script.
3 dnl This configure.ac is only for building a standalone argp library.
4 AC_PREREQ(2.54)
5 AC_INIT(argp-ba.c)
6 AM_INIT_AUTOMAKE(argp, standalone-1.3)
7 AM_CONFIG_HEADER(config.h)
9 # GNU libc defaults to supplying the ISO C library functions only. The
10 # _GNU_SOURCE define enables these extensions, in particular we want
11 # errno.h to declare program_invocation_name. Enable it on all
12 # systems; no problems have been reported with it so far.
13 AC_GNU_SOURCE
14         
15 # Checks for programs.
16 AC_PROG_CC
17 AC_PROG_MAKE_SET
18 AC_PROG_RANLIB
19 AC_PROGRAM_CHECK(AR,ar,ar,:)
20 AC_PROGRAM_CHECK(AR,gar,gar,:)
21 AM_PROG_CC_STDC
23 AC_SUBST(AR)
25 if test "x$am_cv_prog_cc_stdc" = xno ; then
26   AC_ERROR([the C compiler doesn't handle ANSI-C])
29 # Checks for libraries.
31 # Checks for header files.
32 AC_HEADER_STDC
33 AC_CHECK_HEADERS(limits.h malloc.h unistd.h)
35 # Checks for typedefs, structures, and compiler characteristics.
36 AC_C_CONST
37 AC_C_INLINE
38 AC_TYPE_SIZE_T
40 LSH_GCC_ATTRIBUTES
42 # Checks for library functions.
43 AC_FUNC_ALLOCA
44 AC_FUNC_VPRINTF
45 AC_CHECK_FUNCS(strerror)
47 AC_REPLACE_FUNCS(mempcpy strndup strchrnul)
49 dnl ARGP_CHECK_FUNC(includes, function-call [, if-found [, if-not-found]])
50 AC_DEFUN([ARGP_CHECK_FUNC],
51   [AS_VAR_PUSHDEF([ac_func], m4_substr([$2], 0, m4_index([$2], [(])))
52    AS_VAR_PUSHDEF([ac_var], [ac_cv_func_call_]ac_func)
53    AH_TEMPLATE(AS_TR_CPP(HAVE_[]ac_func),
54                [Define to 1 if you have the `]ac_func[' function.])
55    AC_CACHE_CHECK([for $2], ac_var,
56      [AC_TRY_LINK([$1], [$2],
57                   [AS_VAR_SET(ac_var, yes)],
58                   [AS_VAR_SET(ac_var, no)])])
59    if test AS_VAR_GET(ac_var) = yes ; then
60      ifelse([$3],,
61             [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]ac_func))],
62             [$3
64    else
65      ifelse([$4],, true, [$4])
66    fi
67    AS_VAR_POPDEF([ac_var])
68    AS_VAR_POPDEF([ac_func])
69    ])
71 # At least on freebsd, putc_unlocked is a macro, so the standard
72 # AC_CHECK_FUNCS doesn't work well.
73 ARGP_CHECK_FUNC([#include <stdio.h>], [putc_unlocked('x', stdout)])
75 AC_CHECK_FUNCS(flockfile)
76 AC_CHECK_FUNCS(fputs_unlocked fwrite_unlocked)
78 # Used only by argp-test.c, so don't use AC_REPLACE_FUNCS.
79 AC_CHECK_FUNCS(strdup asprintf)
81 AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name],
82                [], [], [[#include <errno.h>]])
84 # Set these flags *last*, or else the test programs won't compile
85 if test x$GCC = xyes ; then
86   # Using -ggdb3 makes (some versions of) Redhat's gcc-2.96 dump core
87   if "$CC" --version | grep '^2\.96$' 1>/dev/null 2>&1; then
88     true
89   else
90     CFLAGS="$CFLAGS -ggdb3"
91   fi
92   CFLAGS="$CFLAGS -Wall -W \
93  -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
94  -Waggregate-return \
95  -Wpointer-arith -Wbad-function-cast -Wnested-externs"
98 CPPFLAGS="$CPPFLAGS -I$srcdir"
100 AC_OUTPUT(Makefile testsuite/Makefile)