portable: autogen: remove AUTO{MAKE,CONF}_VERSION
[got-portable.git] / template / configure.ac
blob2970357a4c1e353d359696deeb168b0f20d39dad
1 AC_INIT([template], 1.0, [op@openbsd.org])
2 AC_CONFIG_LIBOBJ_DIR(../compat)
3 AM_INIT_AUTOMAKE([foreign subdir-objects])
5 AC_ARG_VAR(HOSTCC, [The C compiler on the host.])
6 AC_ARG_VAR(HOSTCFLAGS, [CFLAGS for the host compiler])
8 AC_USE_SYSTEM_EXTENSIONS
10 # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
11 # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
12 # empty default.
13 : ${CFLAGS=""}
15 # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
16 # AC_CHECK_HEADER doesn't give us any other way to update the include
17 # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
18 SAVED_CFLAGS="$CFLAGS"
20 test -n "$HOSTCC"       && export CC="$HOSTCC"
21 test -n "$HOSTCFLAGS"   && export CFLAGS="$SAVED_CFLAGS $HOSTCFLAGS"
23 AC_PROG_CC
24 AC_PROG_YACC
25 PKG_PROG_PKG_CONFIG
27 PKG_CHECK_MODULES(LIBBSD, libbsd-overlay, [
28         AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
29         CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
30         LIBS="$LIBBSD_LIBS $LIBS"
31         AC_DEFINE(HAVE_LIBBSD)
32 ], [AC_MSG_NOTICE([libbsd not found])])
35 AM_CPPFLAGS="$CFLAGS"
37 AC_REPLACE_FUNCS([ \
38         asprintf \
39         err \
40         getprogname \
41         reallocarray \
44 AC_CHECK_DECL([TAILQ_REMOVE], [],
45     [AC_MSG_ERROR("*** sys/queue.h is missing key defines ***")],
46     [#include <sys/queue.h>])
48 AC_SUBST(AM_CPPFLAGS)
49 CPPFLAGS="$SAVED_CPPFLAGS"
50 AC_SUBST(AM_CFLAGS)
51 CFLAGS="$SAVED_CFLAGS"
52 AC_SUBST(AM_LDFLAGS)
53 LDFLAGS="$SAVED_LDFLAGS"
55 AC_CONFIG_FILES([Makefile
56                  Makefile.common:Makefile.common.in
57                 ])
58 AC_OUTPUT