1AC_INIT
2AC_PREREQ(2.61)
3AC_REVISION($Id: configure.ac,v 1.661.4.6.2.3.4.13 2021/03/10 19:45:26 karls Exp $)
4
5unset TAG
6lcase () {
7      tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
8}
9ucase () {
10      tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
11}
12
13#current software version, typically three sets of numbers (x.y.z).
14#can have an added tag, giving a version such as x.y.z-tag.
15version=1.4.3
16#TAG="foo"
17
18#NOTE: rpm will not accept '-' chars i version numbers
19unset lcTAG
20if test x"$TAG" != x; then
21   lctag=`echo $TAG | lcase`
22fi
23RPMVERSION1="$version"
24#set this to enable prerelease, changes some defaults (debug enabled)
25#prerelease="1"
26if test x"$prerelease" != x; then
27    prename="pre$prerelease"
28    version="${version}${TAG:+-}$TAG-$prename"
29    RPMVERSION2="$lctag${lctag:+.}0.$prename"
30    TOPEXTRADIST="${TOPEXTRADIST} PRERELEASE"
31else
32    version="${version}${TAG:+-}$TAG"
33    RPMVERSION2="$lctag${lctag:+.}1"
34fi
35
36AC_SUBST(RPMVERSION1)
37AC_SUBST(RPMVERSION2)
38
39unset initCC initCPP initCFLAGS initCPPFLAGS initLDFLAGS initLIBS
40if test x"$CC" != x; then
41    initCC="($CC)"
42fi
43if test x"$CPP" != x; then
44    initCPP="($CPP)"
45fi
46if test x"$CFLAGS" != x; then
47    initCFLAGS="($CFLAGS)"
48fi
49if test x"$CPPFLAGS" != x; then
50    initCPPFLAGS="($CPPFLAGS)"
51fi
52if test x"$LDFLAGS" != x; then
53    initLDFLAGS="($LDFLAGS)"
54fi
55if test x"$LIBS" != x; then
56    initLIBS="($LIBS)"
57fi
58
59APP=dante
60UCAPP=Dante
61SERVNAME=sockd
62echo "Configuring $UCAPP ${version}:"
63
64case $host in
65    *-*-darwin*)
66	#XXX problem with -MD and -arch values
67	enable_dependency_tracking=no
68	AC_MSG_WARN([disabling dependency tracking on this platform])
69	;;
70esac
71
72AM_INIT_AUTOMAKE(dante, ${version})
73AC_CONFIG_SRCDIR(include/common.h)
74AM_CONFIG_HEADER(include/autoconf.h)
75
76AC_CONFIG_MACRO_DIR([m4])
77
78#NOTE: save CFLAGS; wish to compile without -O2 when debugging
79oCFLAGS="$CFLAGS"
80oLDFLAGS="$LDFLAGS"
81unset CFLAGS
82unset LDFLAGS
83LT_INIT
84autoconf_compflags="$CFLAGS"
85CFLAGS=$oCFLAGS
86LDFLAGS="$oLDFLAGS"
87
88unset CONFVAR
89
90#compile silently, if possible
91m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
92
93AC_DEFINE(BAREFOOTD, 0, [we are Dante])
94AC_DEFINE(COVENANT, 0, [we are Dante])
95m4_define(dantebuild, yes)
96
97AC_DEFINE_UNQUOTED(PRODUCT, "$UCAPP", [Product name])
98AC_DEFINE_UNQUOTED(LCPRODUCT, "$APP", [Product name (lower case)])
99
100AC_ARG_ENABLE(release,
101[  --enable-release        build prerelease as full release],
102[unset prerelease])
103
104if test x"$prerelease" != x; then
105    AC_DEFINE(PRERELEASE, 1, [software prerelease])
106else
107    AC_DEFINE(PRERELEASE, 0, [software prerelease])
108fi
109AM_CONDITIONAL(PRERELEASE, test x$prerelease != x)
110
111dnl compiler tests, sets 'warn' with warnings, added to CFLAGS below
112m4_include(compiler.m4)
113
114dnl platform functionality tests
115m4_include(osdep.m4)
116
117dnl compatibility library tests
118unset COMPATFUNCS
119m4_include(libscompat.m4)
120
121dnl options for dante
122m4_include(danteopt.m4)
123
124dnl common options
125unset have_libcfail
126m4_include(sharedopt.m4)
127
128dnl generate socket option code
129m4_include(sockopt.m4)
130
131#look for modules, and check version
132servdir=sockd
133unset MOD_BANDWIDTH MOD_REDIRECT MOD_LDAP MOD_PAC MOD_CONVSID
134L_MODVER(bandwidth,   109, $servdir, [MOD_BANDWIDTH=t])
135L_MODVER(redirect,    79, $servdir, [MOD_REDIRECT=t])
136L_MODVER(ldap,        211, $servdir, [MOD_LDAP=t])
137L_MODVER(pac,         30, $servdir, [MOD_PAC=t])
138L_MODVER(checkmodule, 80, $servdir, [], nokey) #helper file
139L_MODVER(convert_sid, 1, "bin", [MOD_CONVSID=t], nokey)
140
141if test x"$MOD_BANDWIDTH" != x; then
142   FEAT="$FEAT${FEAT:+ }mod-bandwidth"
143fi
144unset have_ldap
145if test x"$MOD_LDAP" != x -a x"${no_ldap}" = x -a x"${no_gssapi}" = x; then
146   FEAT="$FEAT${FEAT:+ }mod-ldap"
147   SOCKDDEPS="${SOCKDDEPS}${SOCKDDEPS:+ }$LDAPLIBS"
148   AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
149   have_ldap=t
150fi
151unset have_pac
152if test x"$MOD_PAC" != x -a x"$MOD_LDAP" -a x"${no_ldap}" = x \
153     -a x"${no_pac}" = x -a x"${no_gssapi}" = x -a x"${no_krb5}" = x; then
154   FEAT="$FEAT${FEAT:+ }mod-pac"
155   AC_DEFINE(HAVE_PAC, 1, [PAC support])
156   have_pac=t
157   if test x"${have_ldap}" = x; then
158      SOCKDDEPS="${SOCKDDEPS}${SOCKDDEPS:+ }$LDAPLIBS"
159   fi
160fi
161AM_CONDITIONAL(HAVEMOD_PAC, test x"${have_pac}" != x)
162
163if test x"$MOD_REDIRECT" != x; then
164   FEAT="$FEAT${FEAT:+ }mod-redirect"
165fi
166FEAT="$FEAT${FEAT:+ }sess2" #session code now part of base
167
168if test x"$prerelease" != x; then
169   FEAT="$FEAT${FEAT:+ }prerel" #prerelease build
170fi
171
172#standard features
173FEAT="$FEAT${FEAT:+ }mon-data mon-disconnect" #monitoring code
174
175#construct SUBDIRS variable
176SUBDIRS="unlicensed example doc bin SPECS capi contrib"
177DISTSUBDIRS="$SUBDIRS"
178UNITSUBDIRS="" #dirs to do unit testing in
179if test x"$NOSERVER" = x; then
180   SUBDIRS="sockd ${SUBDIRS}"
181   UNITSUBDIRS="sockd ${UNITSUBDIRS}"
182fi
183DISTSUBDIRS="$DISTSUBDIRS sockd"
184if test x"$NOCLIENT" = x; then
185   if test x"${no_preload_client}" = x; then
186       SUBDIRS="dlib $SUBDIRS"
187       UNITSUBDIRS="dlib ${UNITSUBDIRS}"
188       if test x"$sol64" != x; then
189           SUBDIRS="dlib64 $SUBDIRS"
190           UNITSUBDIRS="dlib64 ${UNITSUBDIRS}"
191       fi
192       FEAT="$FEAT${FEAT:+ }preload"
193   fi
194   #lib handles yacc/lex generation for dlib/sockd, should be before these
195   SUBDIRS="lib $SUBDIRS"
196   UNITSUBDIRS="lib ${UNITSUBDIRS}"
197fi
198DISTSUBDIRS="include libscompat $DISTSUBDIRS lib dlib dlib64"
199
200#include should be done before compilation to ensure that
201#redefac is executed first
202TOPSUBDIRS="$subdirs include"
203#libscompat no longer built directly, but build for prereleases for testing
204if test x"${build_libscompat}" != x; then
205    TOPSUBDIRS="$TOPSUBDIRS libscompat"
206    LIBSCOMPAT="-lscompat"
207    LDFLAGS="$LDFLAGS${LDFLAGS:+ }-L../libscompat"
208else
209    unset LIBSCOMPAT
210fi
211TOPSUBDIRS="$TOPSUBDIRS $SUBDIRS"
212AC_SUBST(TOPSUBDIRS)
213AC_SUBST(DISTSUBDIRS)
214AC_SUBST(TOPEXTRADIST)
215AC_SUBST(DLIBDEPS)
216AC_SUBST(SOCKDDEPS)
217AC_SUBST(LIBSCOMPAT)
218AC_SUBST(UNITSUBDIRS)
219
220#set build features for server -v option
221FEATURES=`echo $FEAT | xargs -n 1 echo | sort | xargs echo`
222AC_DEFINE_UNQUOTED(DANTE_BUILD, "$FEATURES", [Features enabled in build])
223
224#add libcfail
225if test x"$have_libcfail" != x; then
226    LIBS="$LIBS${LIBS:+ }-lcfail"
227fi
228
229#add any warning flags (value set above)
230CFLAGS="$CFLAGS $warn"
231
232#store build environment
233cp /dev/null buildenv.txt
234echo "flags: ${ac_configure_args}" >> buildenv.txt
235echo "CC: $CC $initCC" >> buildenv.txt
236echo "CFLAGS: $CFLAGS $initCFLAGS" >> buildenv.txt
237echo "CPP: $CPP $initCPP" >> buildenv.txt
238echo "CPPFLAGS: $CPPFLAGS $initCPPFLAGS" >> buildenv.txt
239echo "LDFLAGS: $LDFLAGS $initLDFLAGS" >> buildenv.txt
240echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}" >> buildenv.txt
241echo "LIBS: $LIBS $initLIBS" >> buildenv.txt
242echo "DLIBDEPS: $DLIBDEPS" >> buildenv.txt
243echo "SOCKDDEPS: $SOCKDDEPS" >> buildenv.txt
244echo "compiler flags: $comp_flags" >> buildenv.txt
245echo "warning flags: $warn" >> buildenv.txt
246echo "FEATURES: $FEAT" >> buildenv.txt
247echo "compat: $COMPATFUNCS" >> buildenv.txt
248echo "socket options (socket level): `echo ${UCOKSOCKOPTS_SO} | ucase`" >> buildenv.txt
249echo "socket options (ipv4 level): `echo ${UCOKSOCKOPTS_IPV4} | ucase`" >> buildenv.txt
250echo "socket options (ipv6 level): `echo ${UCOKSOCKOPTS_IPV6} | ucase`" >> buildenv.txt
251echo "socket options (tcp level): `echo ${UCOKSOCKOPTS_TCP} | ucase`" >> buildenv.txt
252echo "socket options (udp level): `echo ${UCOKSOCKOPTS_UDP} | ucase`" >> buildenv.txt
253echo "socket option arguments: `echo $OKSOCKOPTVALSYMS | ucase`" >> buildenv.txt
254
255cat buildenv.txt
256
257echo "#build environment
258export CC=\"$CC\"
259export CFLAGS=\"$CFLAGS\"
260export CPP=\"$CPP\"
261export CPPFLAGS=\"$CPPFLAGS\"
262export LDFLAGS=\"$LDFLAGS\"
263export SOCKDDEPS=\"$SOCKDDEPS\"
264export LIBS=\"$LIBS\"" > buildenvrc
265
266AC_CONFIG_FILES(sockd/Makefile include/Makefile lib/Makefile dlib/Makefile)
267AC_CONFIG_FILES(Makefile example/Makefile doc/Makefile bin/Makefile)
268AC_CONFIG_FILES(capi/Makefile SPECS/Makefile SPECS/dante.spec)
269AC_CONFIG_FILES(libscompat/Makefile contrib/Makefile)
270AC_CONFIG_FILES(unlicensed/Makefile VERSION dlib64/Makefile)
271
272#change all #undef's to #define foo 0
273AH_BOTTOM([
274#include "redefac.h"
275])
276
277AC_OUTPUT
278
279rm -f sockd/config_scan.c sockd/config_parse.c
280(cd sockd; ln -sf ../lib/config_scan.c config_scan.c)
281(cd sockd; ln -sf ../lib/config_parse.c config_parse.c)
282(cd dlib; ln -sf ../lib/config_scan.c config_scan.c)
283(cd dlib; ln -sf ../lib/config_parse.c config_parse.c)
284
285(cd sockd; ln -sf ../lib/config_parse.y config_parse.y)
286(cd sockd; ln -sf ../lib/config_scan.l config_scan.l)
287(cd dlib; ln -sf ../lib/config_parse.y config_parse.y)
288(cd dlib; ln -sf ../lib/config_scan.l config_scan.l)
289
290echo ""
291echo "                     Configure status:"
292echo ""
293
294if test x"$NOCLIENT" != x; then
295    echo "Client:            $NOCLIENT"
296else
297    echo "Client:            Enabled"
298fi
299if test x"$NOSERVER" != x; then
300    echo "Server:            $NOSERVER"
301else
302    echo "Server:            Enabled"
303fi
304if test x"${no_preload}" = xt; then
305   if test x"${blocked_preload}" = xt; then
306	echo "Preloading:        Client preloading might not be reliable on this platform"
307	CONFVAR="${CONFVAR}${CONFVAR:+ }badpreload"
308   else
309	echo "Preloading:        Disabled"
310	CONFVAR="${CONFVAR}${CONFVAR:+ }nopreload"
311   fi
312else
313    echo "Preloading:        Enabled"
314    CONFVAR="${CONFVAR}${CONFVAR:+ }preload"
315fi
316if test x"${nb_select_err}" = xt; then
317    echo "select:            Unexpected select behaviour on unconnected sockets,"
318    echo "                   operations on nonblocking sockets might fail "
319    echo "                   on this platform when using socksify"
320    CONFVAR="${CONFVAR}${CONFVAR:+ }selecterr"
321#else
322#    echo "select:            OK"
323fi
324if test x"${no_routeinfo}" = xt; then
325    echo "Routeinfo:         Not supported on this platform"
326    CONFVAR="${CONFVAR}${CONFVAR:+ }norouteinfo"
327else
328#    echo "Routeinfo:         OK"
329    CONFVAR="${CONFVAR}${CONFVAR:+ }routeinfo"
330fi
331if test x"$NOLIBWRAP" != x; then
332	echo "Libwrap:           $NOLIBWRAP"
333else
334	echo "Libwrap:           Enabled"
335fi
336if test x"$NOBSDAUTH" != x; then
337	echo "BSD Auth:          $NOBSDAUTH"
338else
339	echo "BSD Auth:          Enabled"
340fi
341if test x"$NOPAM" != x; then
342	echo "PAM:               $NOPAM"
343else
344	echo "PAM:               Enabled"
345fi
346if test x"${no_gssapi}" = xt; then
347   if test x"${bad_gssapi}" = xt; then
348	echo "GSSAPI:            Located gssapi library not usable"
349   else
350	echo "GSSAPI:            Not found/disabled"
351   fi
352else
353	echo "GSSAPI:            Enabled"
354fi
355if test x"${no_krb5}" = xt; then
356	echo "KRB5:              Not found/disabled"
357else
358	echo "KRB5:              Enabled"
359fi
360if test x"${no_sasl}" = xt; then
361	echo "SASL:              Not found/disabled"
362else
363	echo "SASL:              Enabled"
364fi
365if test x"${no_upnp}" = xt; then
366    if test x"${have_libminiupnp}" = xt; then
367	echo "UPNP:              Unsupported miniupnp library version"
368    else
369	echo "UPNP:              Not found/disabled"
370    fi
371else
372    echo "UPNP:              Enabled"
373fi
374if test x"$COMPATFUNCS" = x; then
375    echo "Compatability:     none"
376else
377    echo "Compatability:     $COMPATFUNCS"
378fi
379
380echo ""
381echo "                     Modules:"
382echo ""
383if test x"$MOD_REDIRECT" != x; then
384    echo "redirect:          Enabled"
385else
386    echo "redirect:          Not found"
387fi
388if test x"$MOD_BANDWIDTH" != x; then
389    echo "bandwidth:         Enabled"
390else
391    echo "bandwidth:         Not found"
392fi
393if test x"$MOD_LDAP" != x; then
394    if test x"${no_ldap}" != x; then
395	s="             " #indent
396	echo "ldap:$s Disabled ($noldap)"
397	echo "     $s (NOTE: Both libraries and header files for"
398	echo "     $s  Kerberos/SASL/GSSAPI/LDAP must be installed for the"
399	echo "     $s  LDAP module to compile. On some platforms header files"
400	echo "     $s  are found in separate packages (such as gssapi-devel).)"
401    else
402	echo "ldap:              Enabled"
403    fi
404else
405    echo "ldap:              Not found"
406fi
407if test x"$MOD_PAC" != x; then
408    if test x"${have_pac}" != x; then
409        echo "pac:               Enabled"
410    else
411        s="             " #indent
412        echo "pac: $s Disabled ($nopac)"
413	echo "     $s (NOTE: Both libraries and header files for"
414	echo "     $s Kerberos/SASL/GSSAPI/LDAP must be installed for the"
415	echo "     $s PAC module to compile. On some platforms header files"
416	echo "     $s are found in separate packages (such as gssapi-devel).)"
417    fi
418else
419    echo "pac:               Not found"
420fi
421
422echo ""
423
424echo "CONFRES: $CONFVAR" >> buildenv.txt
425
426if test x"$prerelease" != x; then
427   echo "
428This is a pre-release.  We ask that everyone who can, test it to the
429extent possible, to help reduce problems in the upcoming release.
430Problems can be reported to dante-bugs@inet.no.
431
432Note that pre-releases are often configured in a way that can
433significantly increase the load on the machine.  This is done to
434stress the server more, increasing the chances of detecting potential
435problems.
436"
437fi
438
439VINFO=README.latest
440test -s "$VINFO" && cat "$VINFO"
441
442#XXX depcomp regen hack
443touch _reconf
444for dir in bin lib dlib sockd unlicensed; do
445    touch $dir/_reconf
446done
447
448true #ensure $? is zero
449
450exit 0
451