Blob


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 # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
9 # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
10 # empty default.
11 : ${CFLAGS=""}
13 # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
14 # AC_CHECK_HEADER doesn't give us any other way to update the include
15 # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
16 SAVED_CFLAGS="$CFLAGS"
18 test -n "$HOSTCC" && export CC="$HOSTCC"
19 test -n "$HOSTCFLAGS" && export CFLAGS="$SAVED_CFLAGS $HOSTCFLAGS"
21 AC_PROG_CC
22 AC_PROG_YACC
23 PKG_PROG_PKG_CONFIG
25 PKG_CHECK_MODULES(LIBBSD, libbsd-overlay, [
26 AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
27 CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
28 LIBS="$LIBBSD_LIBS $LIBS"
29 AC_DEFINE(HAVE_LIBBSD)
30 ], [AC_MSG_NOTICE([libbsd not found])])
33 AM_CPPFLAGS="$CFLAGS"
35 AC_REPLACE_FUNCS([ \
36 asprintf \
37 err \
38 getprogname \
39 reallocarray \
40 ])
42 AC_CHECK_DECL([TAILQ_REMOVE], [],
43 [AC_MSG_ERROR("*** sys/queue.h is missing key defines ***")],
44 [#include <sys/queue.h>])
46 AC_CONFIG_FILES([Makefile])
47 AC_OUTPUT