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 0bc2cf12 2023-03-16 thomas YACC_OVERRIDE=yes
24 0bc2cf12 2023-03-16 thomas
25 9981e8e3 2023-01-19 thomas AC_PROG_CC
26 0bc2cf12 2023-03-16 thomas
27 0bc2cf12 2023-03-16 thomas if test -z "$YACC"; then
28 0bc2cf12 2023-03-16 thomas YACC_OVERRIDE="no"
29 0bc2cf12 2023-03-16 thomas AC_PROG_YACC
30 0bc2cf12 2023-03-16 thomas fi
31 9445abba 2023-02-24 thomas PKG_PROG_PKG_CONFIG
32 9981e8e3 2023-01-19 thomas
33 9445abba 2023-02-24 thomas PKG_CHECK_MODULES(LIBBSD, libbsd-overlay, [
34 9445abba 2023-02-24 thomas AM_CFLAGS="$LIBBSD_CFLAGS $AM_CFLAGS"
35 9445abba 2023-02-24 thomas CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
36 9445abba 2023-02-24 thomas LIBS="$LIBBSD_LIBS $LIBS"
37 9445abba 2023-02-24 thomas AC_DEFINE(HAVE_LIBBSD)
38 07a3a9fb 2023-02-24 op ], [AC_MSG_NOTICE([libbsd not found])])
39 9445abba 2023-02-24 thomas
40 9445abba 2023-02-24 thomas
41 9981e8e3 2023-01-19 thomas AM_CPPFLAGS="$CFLAGS"
42 9981e8e3 2023-01-19 thomas
43 9981e8e3 2023-01-19 thomas AC_REPLACE_FUNCS([ \
44 9981e8e3 2023-01-19 thomas asprintf \
45 9981e8e3 2023-01-19 thomas err \
46 9981e8e3 2023-01-19 thomas getprogname \
47 9981e8e3 2023-01-19 thomas reallocarray \
48 9981e8e3 2023-01-19 thomas ])
49 9981e8e3 2023-01-19 thomas
50 9981e8e3 2023-01-19 thomas AC_CHECK_DECL([TAILQ_REMOVE], [],
51 9981e8e3 2023-01-19 thomas [AC_MSG_ERROR("*** sys/queue.h is missing key defines ***")],
52 9981e8e3 2023-01-19 thomas [#include <sys/queue.h>])
53 9981e8e3 2023-01-19 thomas
54 9590ecb0 2023-02-25 thomas AC_SUBST(AM_CPPFLAGS)
55 9590ecb0 2023-02-25 thomas CPPFLAGS="$SAVED_CPPFLAGS"
56 9590ecb0 2023-02-25 thomas AC_SUBST(AM_CFLAGS)
57 9590ecb0 2023-02-25 thomas CFLAGS="$SAVED_CFLAGS"
58 9590ecb0 2023-02-25 thomas AC_SUBST(AM_LDFLAGS)
59 9590ecb0 2023-02-25 thomas LDFLAGS="$SAVED_LDFLAGS"
60 9590ecb0 2023-02-25 thomas
61 9590ecb0 2023-02-25 thomas AC_CONFIG_FILES([Makefile
62 9590ecb0 2023-02-25 thomas Makefile.common:Makefile.common.in
63 9590ecb0 2023-02-25 thomas ])
64 9981e8e3 2023-01-19 thomas AC_OUTPUT