-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfigure.ac
163 lines (143 loc) · 4.4 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
dnl> Do not add anything above
AC_INIT([n3n], m4_esyscmd([scripts/version.sh | tr -d '\n']))
dnl> Do not add anything above
# Older versions of the autotools expect to find install-sh here.
AC_CONFIG_AUX_DIR(scripts)
AC_CANONICAL_HOST
AC_PROG_CC
AC_CHECK_TOOL([AR], [ar], [false])
AC_CHECK_TOOL([WINDRES], [windres], [windres])
# The config guess official result for a modern and usual linux computer
# is x86_64-pc-linux-gnu, however the debian package management (and debian
# gcc) refer to this as x86_64-linux-gnu, so fix that..
case "$host" in
x86_64-pc-linux-gnu)
host=x86_64-linux-gnu
;;
i686-pc-linux-gnu)
host=i686-linux-gnu
;;
arm-unknown-linux-gnueabihf)
host=arm-linux-gnueabihf
;;
aarch64-unknown-linux-gnu)
host=aarch64-linux-gnu
;;
esac
case "$host_os" in
solaris*)
# Was in Makefile with the test `uname` -eq "SunOS"
# and comment "For OpenSolaris (Solaris too?)"
LIBS="-lsocket -lnsl $LIBS"
;;
mingw*)
LIBS="-lnetapi32 -lws2_32 -liphlpapi $LIBS"
EXE=".exe"
;;
*)
EXE=""
;;
esac
AC_ARG_WITH([rundir],
AS_HELP_STRING([--with-rundir=DIR], [location of the system /run dir]),
[rundir=$withval],
[rundir="/run"]
)
AC_ARG_WITH([systemddir],
AS_HELP_STRING([--with-systemddir=DIR], [Where to install systemd units]),
[systemddir=$withval],
[systemddir=""]
)
# TODO: ideally, should use AC_ARG_ENABLE
AC_ARG_WITH([zstd],
AS_HELP_STRING([--with-zstd], [use zstd library]),
[], [with_zstd=no])
AS_IF([test "x$with_zstd" != "xno"],
[AC_CHECK_LIB([zstd], [ZSTD_compress],,
[AC_MSG_ERROR([zstd library not found])]
)],
)
# TODO: ideally, should use AC_ARG_ENABLE
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl], [enable support for OpenSSL])],
[], [with_openssl=no])
AS_IF([test "x$with_openssl" != xno],
[AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset],,
[AC_MSG_ERROR([openssl library not found])]
)],
)
AC_ARG_ENABLE([miniupnp],
[AS_HELP_STRING([--enable-miniupnp], [support for miniupnp])],
[], [enable_miniupnp=no])
AS_IF([test "x$enable_miniupnp" != xno],
[AC_CHECK_LIB([miniupnpc], [upnpDiscover],,
[AC_MSG_ERROR([miniupnp library not found])]
)],
)
AC_ARG_ENABLE([natpmp],
[AS_HELP_STRING([--enable-natpmp], [support for natpmp])],
[], [enable_natpmp=no])
AS_IF([test "x$enable_natpmp" != xno],
[AC_CHECK_LIB([natpmp], [initnatpmp],,
[AC_MSG_ERROR([natpmp library not found])]
)],
)
AC_ARG_ENABLE([pcap],
[AS_HELP_STRING([--enable-pcap], [support for pcap])],
[], [enable_pcap=no])
AS_IF([test "x$enable_pcap" != xno],
[AC_CHECK_LIB([pcap], [pcap_set_immediate_mode],,
[AC_MSG_ERROR([pcap library not found])]
)],
)
AC_ARG_ENABLE([cap],
[AS_HELP_STRING([--enable-cap], [support for cap])],
[], [enable_cap=no])
AS_IF([test "x$enable_cap" != xno],
[AC_CHECK_LIB([cap], [cap_get_proc],,
[AC_MSG_ERROR([cap library not found])]
)],
)
AC_ARG_ENABLE([pthread],
[AS_HELP_STRING([--enable-pthread], [support for pthread])],
[], [enable_pthread=no])
AS_IF([test "x$enable_pthread" != xno],
[AC_CHECK_LIB([pthread], [pthread_mutex_trylock],,
[AC_MSG_ERROR([pthread library not found])]
)],
)
# The prefix var has no default at this point, so we cannot eval it without
# this hack
AS_IF([test "x$prefix" = "xNONE" ],
prefix=/usr/local
)
# The systemd unit dir should be in a sane location (based on the prefix) but
# that is not always a dir underneath the prefix. Apply another hack
AS_IF([test "x$systemddir" = "x" ],
AS_IF([test "x$prefix" = "x/usr"],
systemddir=/lib/systemd/system,
systemddir=$prefix/lib/systemd/system
)
)
# All this indirection would be great, if the namespace wasnt poluted
# (and for many of the dirs, if the directories were more modern)
CONFIG_DOCDIR=$(eval echo $(eval echo $docdir))
CONFIG_MANDIR=$(eval echo $(eval echo $mandir))
CONFIG_PREFIX=$prefix
CONFIG_RUNDIR=$rundir
CONFIG_SYSTEMDDIR=$systemddir
configure_command=$0$ac_configure_args_raw
AC_SUBST(CONFIG_DOCDIR)
AC_SUBST(CONFIG_MANDIR)
AC_SUBST(CONFIG_PREFIX)
AC_SUBST(CONFIG_RUNDIR)
AC_SUBST(CONFIG_SYSTEMDDIR)
AC_SUBST(configure_command)
AC_SUBST(host)
AC_SUBST(host_os)
AC_SUBST(EXE)
AC_SUBST(WINDRES)
AC_SUBST(with_openssl)
AC_CONFIG_HEADERS(include/config.h)
AC_CONFIG_FILES(config.mak)
AC_OUTPUT