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 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 YACC_OVERRIDE=yes
25 AC_PROG_CC
27 if test -z "$YACC"; then
28 YACC_OVERRIDE="no"
29 AC_PROG_YACC
30 fi
31 PKG_PROG_PKG_CONFIG
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])])
41 AM_CPPFLAGS="$CFLAGS"
43 AC_REPLACE_FUNCS([ \
44 asprintf \
45 err \
46 getprogname \
47 reallocarray \
48 ])
50 AC_CHECK_DECL([TAILQ_REMOVE], [],
51 [AC_MSG_ERROR("*** sys/queue.h is missing key defines ***")],
52 [#include <sys/queue.h>])
54 AC_SUBST(AM_CPPFLAGS)
55 CPPFLAGS="$SAVED_CPPFLAGS"
56 AC_SUBST(AM_CFLAGS)
57 CFLAGS="$SAVED_CFLAGS"
58 AC_SUBST(AM_LDFLAGS)
59 LDFLAGS="$SAVED_LDFLAGS"
61 AC_CONFIG_FILES([Makefile
62 Makefile.common:Makefile.common.in
63 ])
64 AC_OUTPUT