argp-standalone/configure.ac

105 lines
3.1 KiB
Text
Raw Normal View History

2021-02-10 19:18:08 +00:00
dnl Process this file with autoconf to produce a configure script.
dnl This configure.ac is only for building a standalone argp library.
2023-12-08 08:32:25 +00:00
AC_PREREQ([2.71])
AC_INIT
AC_CONFIG_SRCDIR([argp-ba.c])
2023-12-08 20:16:48 +00:00
AM_INIT_AUTOMAKE(argp, standalone-1.6.1)
2021-02-10 19:18:08 +00:00
AM_CONFIG_HEADER(config.h)
# GNU libc defaults to supplying the ISO C library functions only. The
# _GNU_SOURCE define enables these extensions, in particular we want
# errno.h to declare program_invocation_name. Enable it on all
# systems; no problems have been reported with it so far.
2023-12-08 08:32:25 +00:00
AC_USE_SYSTEM_EXTENSIONS
2021-02-10 19:18:08 +00:00
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AM_PROG_CC_STDC
if test "x$am_cv_prog_cc_stdc" = xno ; then
2023-12-08 08:32:25 +00:00
AC_MSG_ERROR(the C compiler doesn't handle ANSI-C)
2021-02-10 19:18:08 +00:00
fi
# Checks for libraries.
# Checks for header files.
2023-12-08 08:32:25 +00:00
m4_warn([obsolete],
[The preprocessor macro `STDC_HEADERS' is obsolete.
Except in unusual embedded environments, you can safely include all
ISO C90 headers unconditionally.])dnl
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change. They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
AC_CHECK_HEADERS(limits.h malloc.h unistd.h libintl.h)
2021-02-10 19:18:08 +00:00
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
LSH_GCC_ATTRIBUTES
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(strerror)
AC_REPLACE_FUNCS(mempcpy strndup strchrnul)
dnl ARGP_CHECK_FUNC(includes, function-call [, if-found [, if-not-found]])
AC_DEFUN([ARGP_CHECK_FUNC],
[AS_VAR_PUSHDEF([ac_func], m4_substr([$2], 0, m4_index([$2], [(])))
AS_VAR_PUSHDEF([ac_var], [ac_cv_func_call_]ac_func)
AH_TEMPLATE(AS_TR_CPP(HAVE_[]ac_func),
[Define to 1 if you have the `]ac_func[' function.])
AC_CACHE_CHECK([for $2], ac_var,
2023-12-08 08:32:25 +00:00
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])],[AS_VAR_SET(ac_var, yes)],[AS_VAR_SET(ac_var, no)])])
2021-02-10 19:18:08 +00:00
if test AS_VAR_GET(ac_var) = yes ; then
ifelse([$3],,
[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]ac_func))],
[$3
])
else
ifelse([$4],, true, [$4])
fi
AS_VAR_POPDEF([ac_var])
AS_VAR_POPDEF([ac_func])
])
# At least on freebsd, putc_unlocked is a macro, so the standard
# AC_CHECK_FUNCS doesn't work well.
ARGP_CHECK_FUNC([#include <stdio.h>], [putc_unlocked('x', stdout)])
AC_CHECK_FUNCS(flockfile)
AC_CHECK_FUNCS(fputs_unlocked fwrite_unlocked)
# Used only by argp-test.c, so don't use AC_REPLACE_FUNCS.
AC_CHECK_FUNCS(strdup asprintf)
AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name],
[], [], [[#include <errno.h>]])
# Set these flags *last*, or else the test programs won't compile
if test x$GCC = xyes ; then
# Using -ggdb3 makes (some versions of) Redhat's gcc-2.96 dump core
if "$CC" --version | grep '^2\.96$' 1>/dev/null 2>&1; then
true
else
CFLAGS="$CFLAGS -ggdb3"
fi
CFLAGS="$CFLAGS -Wall -W \
-Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
-Waggregate-return \
2023-12-08 20:16:48 +00:00
-Wpointer-arith -Wbad-function-cast -Wnested-externs -fPIC"
2021-02-10 19:18:08 +00:00
fi
CPPFLAGS="$CPPFLAGS -I$srcdir"
2023-12-08 08:32:25 +00:00
AC_CONFIG_FILES([Makefile testsuite/Makefile])
AC_OUTPUT