Blame


1 9981e8e3 2023-01-19 thomas AC_INIT([template], 1.0, [op@openbsd.org])
2 9981e8e3 2023-01-19 thomas AC_CONFIG_LIBOBJ_DIR(../compat)
3 9981e8e3 2023-01-19 thomas AM_INIT_AUTOMAKE([foreign subdir-objects])
4 9981e8e3 2023-01-19 thomas
5 9981e8e3 2023-01-19 thomas AC_ARG_VAR(HOSTCC, [The C compiler on the host.])
6 9981e8e3 2023-01-19 thomas AC_ARG_VAR(HOSTCFLAGS, [CFLAGS for the host compiler])
7 9981e8e3 2023-01-19 thomas
8 9981e8e3 2023-01-19 thomas # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
9 9981e8e3 2023-01-19 thomas # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
10 9981e8e3 2023-01-19 thomas # empty default.
11 9981e8e3 2023-01-19 thomas : ${CFLAGS=""}
12 9981e8e3 2023-01-19 thomas
13 9981e8e3 2023-01-19 thomas # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
14 9981e8e3 2023-01-19 thomas # AC_CHECK_HEADER doesn't give us any other way to update the include
15 9981e8e3 2023-01-19 thomas # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
16 9981e8e3 2023-01-19 thomas SAVED_CFLAGS="$CFLAGS"
17 9981e8e3 2023-01-19 thomas
18 9981e8e3 2023-01-19 thomas test -n "$HOSTCC" && export CC="$HOSTCC"
19 9981e8e3 2023-01-19 thomas test -n "$HOSTCFLAGS" && export CFLAGS="$SAVED_CFLAGS $HOSTCFLAGS"
20 9981e8e3 2023-01-19 thomas
21 9981e8e3 2023-01-19 thomas AC_PROG_CC
22 9981e8e3 2023-01-19 thomas AC_PROG_YACC
23 9445abba 2023-02-24 thomas PKG_PROG_PKG_CONFIG
24 9981e8e3 2023-01-19 thomas
25 9445abba 2023-02-24 thomas PKG_CHECK_MODULES(LIBBSD, libbsd-overlay, [
26 9445abba 2023-02-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
27 9445abba 2023-02-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
28 9445abba 2023-02-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
29 9445abba 2023-02-24 thomas AC_DEFINE(HAVE_LIBBSD)
30 07a3a9fb 2023-02-24 op ], [AC_MSG_NOTICE([libbsd not found])])
31 9445abba 2023-02-24 thomas
32 9445abba 2023-02-24 thomas
33 9981e8e3 2023-01-19 thomas AM_CPPFLAGS="$CFLAGS"
34 9981e8e3 2023-01-19 thomas
35 9981e8e3 2023-01-19 thomas AC_REPLACE_FUNCS([ \
36 9981e8e3 2023-01-19 thomas asprintf \
37 9981e8e3 2023-01-19 thomas err \
38 9981e8e3 2023-01-19 thomas getprogname \
39 9981e8e3 2023-01-19 thomas reallocarray \
40 9981e8e3 2023-01-19 thomas ])
41 9981e8e3 2023-01-19 thomas
42 9981e8e3 2023-01-19 thomas AC_CHECK_DECL([TAILQ_REMOVE], [],
43 9981e8e3 2023-01-19 thomas [AC_MSG_ERROR("*** sys/queue.h is missing key defines ***")],
44 9981e8e3 2023-01-19 thomas [#include <sys/queue.h>])
45 9981e8e3 2023-01-19 thomas
46 9981e8e3 2023-01-19 thomas AC_CONFIG_FILES([Makefile])
47 9981e8e3 2023-01-19 thomas AC_OUTPUT