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
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"
27 if test -z "$YACC"; then
33 PKG_CHECK_MODULES(LIBBSD, libbsd-overlay, [
34 AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
35 CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
36 LIBS="$LIBBSD_LIBS $LIBS"
37 AC_DEFINE(HAVE_LIBBSD)
38 ], [AC_MSG_NOTICE([libbsd not found])])
50 AC_CHECK_DECL([TAILQ_REMOVE], [],
51 [AC_MSG_ERROR("*** sys/queue.h is missing key defines ***")],
52 [#include <sys/queue.h>])
55 CPPFLAGS="$SAVED_CPPFLAGS"
57 CFLAGS="$SAVED_CFLAGS"
59 LDFLAGS="$SAVED_LDFLAGS"
61 AC_CONFIG_FILES([Makefile
62 Makefile.common:Makefile.common.in