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 20c2019f 2023-02-25 op AC_USE_SYSTEM_EXTENSIONS
9 20c2019f 2023-02-25 op
10 9981e8e3 2023-01-19 thomas # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
11 9981e8e3 2023-01-19 thomas # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
12 9981e8e3 2023-01-19 thomas # empty default.
13 9981e8e3 2023-01-19 thomas : ${CFLAGS=""}
14 9981e8e3 2023-01-19 thomas
15 9981e8e3 2023-01-19 thomas # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
16 9981e8e3 2023-01-19 thomas # AC_CHECK_HEADER doesn't give us any other way to update the include
17 9981e8e3 2023-01-19 thomas # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
18 9981e8e3 2023-01-19 thomas SAVED_CFLAGS="$CFLAGS"
19 9981e8e3 2023-01-19 thomas
20 9981e8e3 2023-01-19 thomas test -n "$HOSTCC" && export CC="$HOSTCC"
21 9981e8e3 2023-01-19 thomas test -n "$HOSTCFLAGS" && export CFLAGS="$SAVED_CFLAGS $HOSTCFLAGS"
22 9981e8e3 2023-01-19 thomas
23 9981e8e3 2023-01-19 thomas AC_PROG_CC
24 9981e8e3 2023-01-19 thomas AC_PROG_YACC
25 9445abba 2023-02-24 thomas PKG_PROG_PKG_CONFIG
26 9981e8e3 2023-01-19 thomas
27 9445abba 2023-02-24 thomas PKG_CHECK_MODULES(LIBBSD, libbsd-overlay, [
28 9445abba 2023-02-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
29 9445abba 2023-02-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
30 9445abba 2023-02-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
31 9445abba 2023-02-24 thomas AC_DEFINE(HAVE_LIBBSD)
32 07a3a9fb 2023-02-24 op ], [AC_MSG_NOTICE([libbsd not found])])
33 9445abba 2023-02-24 thomas
34 9445abba 2023-02-24 thomas
35 9981e8e3 2023-01-19 thomas AM_CPPFLAGS="$CFLAGS"
36 9981e8e3 2023-01-19 thomas
37 9981e8e3 2023-01-19 thomas AC_REPLACE_FUNCS([ \
38 9981e8e3 2023-01-19 thomas asprintf \
39 9981e8e3 2023-01-19 thomas err \
40 9981e8e3 2023-01-19 thomas getprogname \
41 9981e8e3 2023-01-19 thomas reallocarray \
42 9981e8e3 2023-01-19 thomas ])
43 9981e8e3 2023-01-19 thomas
44 9981e8e3 2023-01-19 thomas AC_CHECK_DECL([TAILQ_REMOVE], [],
45 9981e8e3 2023-01-19 thomas [AC_MSG_ERROR("*** sys/queue.h is missing key defines ***")],
46 9981e8e3 2023-01-19 thomas [#include <sys/queue.h>])
47 9981e8e3 2023-01-19 thomas
48 9590ecb0 2023-02-25 thomas AC_SUBST(AM_CPPFLAGS)
49 9590ecb0 2023-02-25 thomas CPPFLAGS="$SAVED_CPPFLAGS"
50 9590ecb0 2023-02-25 thomas AC_SUBST(AM_CFLAGS)
51 9590ecb0 2023-02-25 thomas CFLAGS="$SAVED_CFLAGS"
52 9590ecb0 2023-02-25 thomas AC_SUBST(AM_LDFLAGS)
53 9590ecb0 2023-02-25 thomas LDFLAGS="$SAVED_LDFLAGS"
54 9590ecb0 2023-02-25 thomas
55 9590ecb0 2023-02-25 thomas AC_CONFIG_FILES([Makefile
56 9590ecb0 2023-02-25 thomas Makefile.common:Makefile.common.in
57 9590ecb0 2023-02-25 thomas ])
58 9981e8e3 2023-01-19 thomas AC_OUTPUT