]> git.proxmox.com Git - mirror_kronosnet.git/blame - configure.ac
[nozzle] move man pages to top level dir
[mirror_kronosnet.git] / configure.ac
CommitLineData
ab4c538f 1#
a3d5822a 2# Copyright (C) 2010-2018 Red Hat, Inc. All rights reserved.
ab4c538f
FDN
3#
4# Authors: Fabio M. Di Nitto <fabbione@kronosnet.org>
5# Federico Simoncelli <fsimon@kronosnet.org>
6#
7# This software licensed under GPL-2.0+, LGPL-2.0+
8#
9
99afbd6e
FDN
10# -*- Autoconf -*-
11# Process this file with autoconf to produce a configure script.
ab4c538f 12#
99afbd6e
FDN
13
14AC_PREREQ([2.63])
07072a06 15AC_INIT([kronosnet],
fa892602 16 m4_esyscmd([build-aux/git-version-gen .tarball-version .gitarchivever]),
07072a06 17 [devel@lists.kronosnet.org])
242124c9
FW
18# Don't let AC_PROC_CC (invoked by AC_USE_SYSTEM_EXTENSIONS) replace
19# undefined CFLAGS with -g -O2, overriding our special OPT_CFLAGS.
20: ${CFLAGS=""}
4359cb72 21AC_USE_SYSTEM_EXTENSIONS
9f9883b1 22AM_INIT_AUTOMAKE([1.13 dist-bzip2 dist-xz color-tests -Wno-portability subdir-objects])
dba12205 23
99afbd6e 24LT_PREREQ([2.2.6])
cc5199a6
FW
25# --enable-new-dtags: Use RUNPATH instead of RPATH.
26# It is necessary to have this done before libtool does linker detection.
27# See also: https://github.com/kronosnet/kronosnet/issues/107
afb7bf53
FW
28# --as-needed: Modern systems have builtin ceil() making -lm superfluous but
29# AC_SEARCH_LIBS can't detect this because it tests with a false prototype
0df0ea47
FDN
30AX_CHECK_LINK_FLAG([-Wl,--enable-new-dtags],
31 [AM_LDFLAGS=-Wl,--enable-new-dtags],
32 [AC_MSG_ERROR(["Linker support for --enable-new-dtags is required"])])
33AX_CHECK_LINK_FLAG([-Wl,--as-needed], [AM_LDFLAGS="$AM_LDFLAGS -Wl,--as-needed"])
34
af7bb5fd 35AC_SUBST([AM_LDFLAGS])
cc5199a6
FW
36saved_LDFLAGS="$LDFLAGS"
37LDFLAGS="$AM_LDFLAGS $LDFLAGS"
99afbd6e 38LT_INIT
cc5199a6 39LDFLAGS="$saved_LDFLAGS"
99afbd6e
FDN
40
41AC_CONFIG_MACRO_DIR([m4])
4aa63ad7 42AC_CONFIG_SRCDIR([kronosnetd/main.c])
99afbd6e
FDN
43AC_CONFIG_HEADERS([config.h])
44
45AC_CANONICAL_HOST
99afbd6e
FDN
46
47AC_LANG([C])
48
905cb809
FDN
49systemddir=${prefix}/lib/systemd/system
50
99afbd6e
FDN
51if test "$prefix" = "NONE"; then
52 prefix="/usr"
53 if test "$localstatedir" = "\${prefix}/var"; then
54 localstatedir="/var"
55 fi
56 if test "$sysconfdir" = "\${prefix}/etc"; then
57 sysconfdir="/etc"
58 fi
905cb809
FDN
59 if test "$systemddir" = "NONE/lib/systemd/system"; then
60 systemddir=/lib/systemd/system
61 fi
e8b52625
JF
62 if test "$libdir" = "\${exec_prefix}/lib"; then
63 if test -e /usr/lib64; then
64 libdir="/usr/lib64"
65 else
66 libdir="/usr/lib"
67 fi
68 fi
99afbd6e
FDN
69fi
70
5842a2f9 71AC_PROG_AWK
e3683ec7
FDN
72AC_PROG_GREP
73AC_PROG_SED
5842a2f9 74AC_PROG_CPP
99afbd6e 75AC_PROG_CC
dd8bbbde
FDN
76AC_PROG_CC_C99
77if test "x$ac_cv_prog_cc_c99" = "xno"; then
78 AC_MSG_ERROR(["C99 support is required"])
79fi
99afbd6e
FDN
80AC_PROG_LN_S
81AC_PROG_INSTALL
82AC_PROG_MAKE_SET
9e569a13 83PKG_PROG_PKG_CONFIG
8f114254 84
3e776e82
FDN
85AC_CHECK_PROGS([VALGRIND_EXEC], [valgrind])
86AM_CONDITIONAL([HAS_VALGRIND], [test x$VALGRIND_EXEC != "x"])
99afbd6e 87
f3396d98
FW
88# KNET_OPTION_DEFINES(stem,type,detection code)
89# stem: enters name of option, Automake conditional and preprocessor define
90# type: compress or crypto, determines where the default comes from
91AC_DEFUN([KNET_OPTION_DEFINES],[
92AC_ARG_ENABLE([$2-$1],[AS_HELP_STRING([--disable-$2-$1],[disable libknet $1 support])],,
93 [enable_$2_$1="$enable_$2_all"])
94AM_CONDITIONAL([BUILD_]m4_toupper([$2_$1]),[test "x$enable_$2_$1" = xyes])
95if test "x$enable_$2_$1" = xyes; then
96 $3
97fi
98AC_DEFINE_UNQUOTED([WITH_]m4_toupper([$2_$1]), [`test "x$enable_$2_$1" != xyes; echo $?`], $1 $2 [built in])
99])
100
2414bd86
FDN
101AC_ARG_ENABLE([man],
102 [AS_HELP_STRING([--disable-man],[disable man page creation])],,
103 [ enable_man="yes" ])
104AM_CONDITIONAL([BUILD_MAN], [test x$enable_man = xyes])
105
43bd160d 106AC_ARG_ENABLE([libknet-sctp],
f58d6934 107 [AS_HELP_STRING([--disable-libknet-sctp],[disable libknet SCTP support])],,
43bd160d 108 [ enable_libknet_sctp="yes" ])
50df9cde 109AM_CONDITIONAL([BUILD_SCTP], [test x$enable_libknet_sctp = xyes])
43bd160d 110
c59268f2 111AC_ARG_ENABLE([crypto-all],
f58d6934 112 [AS_HELP_STRING([--disable-crypto-all],[disable libknet all crypto modules support])],,
c59268f2
FDN
113 [ enable_crypto_all="yes" ])
114
f3396d98
FW
115KNET_OPTION_DEFINES([nss],[crypto],[PKG_CHECK_MODULES([nss], [nss])])
116KNET_OPTION_DEFINES([openssl],[crypto],[
117 PKG_CHECK_MODULES([openssl],[libcrypto < 1.1],
118 [AC_DEFINE_UNQUOTED([BUILDCRYPTOOPENSSL10], [1], [openssl 1.0 crypto])],
119 [PKG_CHECK_MODULES([openssl],[libcrypto >= 1.1],
120 [AC_DEFINE_UNQUOTED([BUILDCRYPTOOPENSSL11], [1], [openssl 1.1 crypto])])])
121])
122
7322344c 123AC_ARG_ENABLE([compress-all],
f58d6934 124 [AS_HELP_STRING([--disable-compress-all],[disable libknet all compress modules support])],,
7322344c
FDN
125 [ enable_compress_all="yes" ])
126
f3396d98
FW
127KNET_OPTION_DEFINES([zlib],[compress],[PKG_CHECK_MODULES([zlib], [zlib])])
128KNET_OPTION_DEFINES([lz4],[compress],[PKG_CHECK_MODULES([liblz4], [liblz4])])
129KNET_OPTION_DEFINES([lzo2],[compress],[
718c0ae7
FW
130 PKG_CHECK_MODULES([lzo2], [lzo2],
131 [# work around broken pkg-config file in v2.10
132 AC_SUBST([lzo2_CFLAGS],[`echo $lzo2_CFLAGS | sed 's,/lzo *, ,'`])],
f3396d98
FW
133 [AC_CHECK_HEADERS([lzo/lzo1x.h],
134 [AC_CHECK_LIB([lzo2], [lzo1x_decompress_safe],
135 [AC_SUBST([lzo2_LIBS], [-llzo2])])],
136 [AC_MSG_ERROR(["missing required lzo/lzo1x.h header"])])])
137])
138KNET_OPTION_DEFINES([lzma],[compress],[PKG_CHECK_MODULES([liblzma], [liblzma])])
139KNET_OPTION_DEFINES([bzip2],[compress],[
140 PKG_CHECK_MODULES([bzip2], [bzip2],,
141 [AC_CHECK_HEADERS([bzlib.h],
142 [AC_CHECK_LIB([bz2], [BZ2_bzBuffToBuffCompress],
143 [AC_SUBST([bzip2_LIBS], [-lbz2])])],
144 [AC_MSG_ERROR(["missing required bzlib.h"])])])
145])
146
1c75eb10 147AC_ARG_ENABLE([poc],
f58d6934 148 [AS_HELP_STRING([--enable-poc],[enable building poc code])],,
89c58e91 149 [ enable_poc="no" ])
5449d795 150AM_CONDITIONAL([BUILD_POC], [test x$enable_poc = xyes])
1c75eb10 151
ace7cd0e 152AC_ARG_ENABLE([kronosnetd],
f58d6934 153 [AS_HELP_STRING([--enable-kronosnetd],[Kronosnetd support])],,
226e5109 154 [ enable_kronosnetd="no" ])
5449d795 155AM_CONDITIONAL([BUILD_KRONOSNETD], [test x$enable_kronosnetd = xyes])
ace7cd0e 156
8f8384a0 157AC_ARG_ENABLE([runautogen],
f58d6934 158 [AS_HELP_STRING([--enable-runautogen],[run autogen.sh])],,
8f8384a0
BL
159 [ enable_runautogen="no" ])
160AM_CONDITIONAL([BUILD_RUNAUTOGEN], [test x$enable_runautogen = xyes])
161
73677ca3
BL
162override_rpm_debuginfo_option="yes"
163AC_ARG_ENABLE([rpm-debuginfo],
164 [AS_HELP_STRING([--enable-rpm-debuginfo],[build debuginfo packages])],,
165 [ enable_rpm_debuginfo="no", override_rpm_debuginfo_option="no" ])
166AM_CONDITIONAL([BUILD_RPM_DEBUGINFO], [test x$enable_rpm_debuginfo = xyes])
167AM_CONDITIONAL([OVERRIDE_RPM_DEBUGINFO], [test x$override_rpm_debuginfo_option = xyes])
168
de3d1e09
FDN
169AC_ARG_ENABLE([libnozzle],
170 [AS_HELP_STRING([--enable-libnozzle],[libnozzle support])],,
171 [ enable_libnozzle="no" ])
58b997ce
CC
172
173if test "x$enable_kronosnetd" = xyes; then
de3d1e09 174 enable_libnozzle=yes
58b997ce 175fi
de3d1e09 176AM_CONDITIONAL([BUILD_LIBNOZZLE], [test x$enable_libnozzle = xyes])
ace7cd0e 177
99afbd6e
FDN
178## local helper functions
179# this function checks if CC support options passed as
6754dbab 180# args. Global CPPFLAGS are ignored during this test.
99afbd6e 181cc_supports_flag() {
ae9ebb47
FDN
182 saveCPPFLAGS="$CPPFLAGS"
183 CPPFLAGS="$@"
30f44d00
FDN
184 if echo $CC | grep -q clang; then
185 CPPFLAGS="-Werror $CPPFLAGS"
186 fi
99afbd6e 187 AC_MSG_CHECKING([whether $CC supports "$@"])
88491f27 188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
99afbd6e
FDN
189 [RC=0; AC_MSG_RESULT([yes])],
190 [RC=1; AC_MSG_RESULT([no])])
ae9ebb47 191 CPPFLAGS="$saveCPPFLAGS"
99afbd6e
FDN
192 return $RC
193}
194
99afbd6e 195# Checks for libraries.
2b1072db 196AX_PTHREAD(,[AC_MSG_ERROR([POSIX threads support is required])])
c1effb8a
FW
197saved_LIBS="$LIBS"
198LIBS=
9412ec18
FW
199AC_SEARCH_LIBS([ceil], [m], , [AC_MSG_ERROR([ceil not found])])
200AC_SUBST([m_LIBS], [$LIBS])
201LIBS=
c1effb8a
FW
202AC_SEARCH_LIBS([clock_gettime], [rt], , [AC_MSG_ERROR([clock_gettime not found])])
203AC_SUBST([rt_LIBS], [$LIBS])
3cc6b180
FW
204LIBS=
205AC_SEARCH_LIBS([dlopen], [dl dld], , [AC_MSG_ERROR([dlopen not found])])
206AC_SUBST([dl_LIBS], [$LIBS])
c1effb8a 207LIBS="$saved_LIBS"
99afbd6e 208
c296433f
FDN
209# OS detection
210
211AC_MSG_CHECKING([for os in ${host_os}])
212case "$host_os" in
213 *linux*)
214 AC_DEFINE_UNQUOTED([KNET_LINUX], [1], [Compiling for Linux platform])
215 AC_MSG_RESULT([Linux])
216 ;;
217 *bsd*)
218 AC_DEFINE_UNQUOTED([KNET_BSD], [1], [Compiling for BSD platform])
219 AC_MSG_RESULT([BSD])
c296433f
FDN
220 ;;
221 *)
222 AC_MSG_ERROR([Unsupported OS? hmmmm])
223 ;;
224esac
225
99afbd6e 226# Checks for header files.
3a50d466 227AC_CHECK_HEADERS([sys/epoll.h])
14c1e736
FDN
228AC_CHECK_FUNCS([kevent])
229# if neither sys/epoll.h nor kevent are present, we should fail.
230
231if test "x$ac_cv_header_sys_epoll_h" = xno && test "x$ac_cv_func_kevent" = xno; then
232 AC_MSG_ERROR([Both epoll and kevent unavailable on this OS])
233fi
234
235if test "x$ac_cv_header_sys_epoll_h" = xyes && test "x$ac_cv_func_kevent" = xyes; then
236 AC_MSG_ERROR([Both epoll and kevent available on this OS, please contact the maintainers to fix the code])
237fi
d75f2295
FDN
238
239if test "x$enable_libknet_sctp" = xyes; then
fd28a29f 240 AC_CHECK_HEADERS([netinet/sctp.h],, [AC_MSG_ERROR(["missing required SCTP headers"])])
d75f2295 241fi
99afbd6e
FDN
242
243# Checks for typedefs, structures, and compiler characteristics.
5842a2f9 244AC_C_INLINE
6d727d3c 245AC_TYPE_PID_T
9f391b08 246AC_TYPE_SIZE_T
c3776828 247AC_TYPE_SSIZE_T
31f37826 248AC_TYPE_UINT8_T
c3776828
FDN
249AC_TYPE_UINT16_T
250AC_TYPE_UINT32_T
efc95595 251AC_TYPE_UINT64_T
9f391b08
FDN
252AC_TYPE_INT8_T
253AC_TYPE_INT16_T
efc95595 254AC_TYPE_INT32_T
9f391b08 255AC_TYPE_INT64_T
99afbd6e 256
2414bd86 257if test "x$enable_man" = "xyes"; then
1fd4bb05
FDN
258 AC_ARG_VAR([DOXYGEN], [override doxygen executable])
259 AC_CHECK_PROGS([DOXYGEN], [doxygen], [no])
2414bd86
FDN
260 if test "x$DOXYGEN" = xno; then
261 AC_MSG_ERROR(["Doxygen command not found"])
262 fi
263 # required by doxyxml to build man pages dynamically
264 # Don't let AC_PROC_CC (invoked by AX_PROG_CC_FOR_BUILD) replace
265 # undefined CFLAGS_FOR_BUILD with -g -O2, overriding our special OPT_CFLAGS.
266 : ${CFLAGS_FOR_BUILD=""}
267 AX_PROG_CC_FOR_BUILD
268 saved_PKG_CONFIG="$PKG_CONFIG"
269 saved_ac_cv_path_PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
270 unset PKG_CONFIG ac_cv_path_PKG_CONFIG
271 AC_PATH_PROG([PKG_CONFIG], [pkg-config])
272 PKG_CHECK_MODULES([libqb_BUILD], [libqb])
273 PKG_CHECK_MODULES([libxml_BUILD], [libxml-2.0])
274 PKG_CONFIG="$saved_PKG_CONFIG"
275 ac_cv_path_PKG_CONFIG="$saved_ac_cv_path_PKG_CONFIG"
276fi
ad333231 277
fa8c7f32 278# checks (for kronosnetd)
ace7cd0e 279if test "x$enable_kronosnetd" = xyes; then
226e5109 280 AC_CHECK_HEADERS([security/pam_appl.h],
26fe18aa
FW
281 [AC_CHECK_LIB([pam], [pam_start],
282 [AC_SUBST([pam_LIBS], [-lpam])],
283 [AC_MSG_ERROR([Unable to find LinuxPAM devel files])])])
e311acaa 284
226e5109 285 AC_CHECK_HEADERS([security/pam_misc.h],
26fe18aa
FW
286 [AC_CHECK_LIB([pam_misc], [misc_conv],
287 [AC_SUBST([pam_misc_LIBS], [-lpam_misc])],
288 [AC_MSG_ERROR([Unable to find LinuxPAM MISC devel files])])])
38cb1bb7 289
a57ad365
FW
290 PKG_CHECK_MODULES([libqb], [libqb])
291
226e5109
FDN
292 AC_CHECK_LIB([qb], [qb_log_thread_priority_set],
293 [have_qb_log_thread_priority_set="yes"],
294 [have_qb_log_thread_priority_set="no"])
295 if test "x${have_qb_log_thread_priority_set}" = xyes; then
296 AC_DEFINE_UNQUOTED([HAVE_QB_LOG_THREAD_PRIORITY_SET], [1], [have qb_log_thread_priority_set])
297 fi
ace7cd0e 298fi
38cb1bb7 299
99afbd6e
FDN
300# local options
301AC_ARG_ENABLE([debug],
967ee0b3 302 [AS_HELP_STRING([--enable-debug],[enable debug build])])
99afbd6e 303
2e687dd8 304AC_ARG_WITH([initdefaultdir],
f58d6934 305 [AS_HELP_STRING([--with-initdefaultdir=DIR],[path to /etc/sysconfig or /etc/default dir])],
2e687dd8
FDN
306 [ INITDEFAULTDIR="$withval" ],
307 [ INITDEFAULTDIR="$sysconfdir/default" ])
308
0472de45 309AC_ARG_WITH([initddir],
f58d6934 310 [AS_HELP_STRING([--with-initddir=DIR],[path to init script directory])],
0472de45
FDN
311 [ INITDDIR="$withval" ],
312 [ INITDDIR="$sysconfdir/init.d" ])
313
314AC_ARG_WITH([systemddir],
f58d6934 315 [AS_HELP_STRING([--with-systemddir=DIR],[path to systemd unit files directory])],
0472de45 316 [ SYSTEMDDIR="$withval" ],
905cb809 317 [ SYSTEMDDIR="$systemddir" ])
0472de45 318
99afbd6e 319AC_ARG_WITH([syslogfacility],
f58d6934 320 [AS_HELP_STRING([--with-syslogfacility=FACILITY],[default syslog facility])],
99afbd6e 321 [ SYSLOGFACILITY="$withval" ],
2d022f7f 322 [ SYSLOGFACILITY="LOG_DAEMON" ])
99afbd6e
FDN
323
324AC_ARG_WITH([sysloglevel],
f58d6934 325 [AS_HELP_STRING([--with-sysloglevel=LEVEL],[default syslog level])],
99afbd6e
FDN
326 [ SYSLOGLEVEL="$withval" ],
327 [ SYSLOGLEVEL="LOG_INFO" ])
328
e3aa8728 329AC_ARG_WITH([defaultadmgroup],
f58d6934
FW
330 [AS_HELP_STRING([--with-defaultadmgroup=GROUP],
331 [define PAM group. Users part of this group will be allowed to configure
332 kronosnet. Others will only receive read-only rights.])],
e3aa8728
FDN
333 [ DEFAULTADMGROUP="$withval" ],
334 [ DEFAULTADMGROUP="kronosnetadm" ])
335
99afbd6e
FDN
336## random vars
337LOGDIR=${localstatedir}/log/
338RUNDIR=${localstatedir}/run/
afce19e1 339DEFAULT_CONFIG_DIR=${sysconfdir}/kronosnet
99afbd6e
FDN
340
341## do subst
342
afce19e1 343AC_SUBST([DEFAULT_CONFIG_DIR])
2e687dd8 344AC_SUBST([INITDEFAULTDIR])
0472de45
FDN
345AC_SUBST([INITDDIR])
346AC_SUBST([SYSTEMDDIR])
b386f39b 347AC_SUBST([LOGDIR])
2e687dd8 348AC_SUBST([DEFAULTADMGROUP])
0472de45 349
4fc6106b
FDN
350AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_DIR],
351 ["$(eval echo ${DEFAULT_CONFIG_DIR})"],
afce19e1
FDN
352 [Default config directory])
353
354AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_FILE],
4fc6106b 355 ["$(eval echo ${DEFAULT_CONFIG_DIR}/kronosnetd.conf)"],
99afbd6e
FDN
356 [Default config file])
357
4fc6106b
FDN
358AC_DEFINE_UNQUOTED([LOGDIR],
359 ["$(eval echo ${LOGDIR})"],
99afbd6e
FDN
360 [Default logging directory])
361
2d022f7f 362AC_DEFINE_UNQUOTED([DEFAULT_LOG_FILE],
4fc6106b 363 ["$(eval echo ${LOGDIR}/kronosnetd.log)"],
2d022f7f
FDN
364 [Default log file])
365
4fc6106b
FDN
366AC_DEFINE_UNQUOTED([RUNDIR],
367 ["$(eval echo ${RUNDIR})"],
99afbd6e
FDN
368 [Default run directory])
369
4fc6106b
FDN
370AC_DEFINE_UNQUOTED([SYSLOGFACILITY],
371 [$(eval echo ${SYSLOGFACILITY})],
99afbd6e
FDN
372 [Default syslog facility])
373
4fc6106b
FDN
374AC_DEFINE_UNQUOTED([SYSLOGLEVEL],
375 [$(eval echo ${SYSLOGLEVEL})],
99afbd6e
FDN
376 [Default syslog level])
377
4fc6106b
FDN
378AC_DEFINE_UNQUOTED([DEFAULTADMGROUP],
379 ["$(eval echo ${DEFAULTADMGROUP})"],
e3aa8728
FDN
380 [Default admin group])
381
99afbd6e
FDN
382# debug build stuff
383if test "x${enable_debug}" = xyes; then
384 AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code])
385 OPT_CFLAGS="-O0"
386else
387 OPT_CFLAGS="-O3"
388fi
389
390# gdb flags
391if test "x${GCC}" = xyes; then
392 GDB_FLAGS="-ggdb3"
393else
394 GDB_FLAGS="-g"
395fi
396
397# extra warnings
398EXTRA_WARNINGS=""
399
400WARNLIST="
401 all
0dbd680b
MJ
402 extra
403 unused
99afbd6e
FDN
404 shadow
405 missing-prototypes
406 missing-declarations
0dbd680b
MJ
407 suggest-attribute=noreturn
408 suggest-attribute=format
88491f27 409 property-attribute-mismatch
99afbd6e
FDN
410 strict-prototypes
411 declaration-after-statement
412 pointer-arith
413 write-strings
414 cast-align
415 bad-function-cast
416 missing-format-attribute
0dbd680b 417 float-equal
99afbd6e 418 format=2
fb2cc79f 419 format-signedness
99afbd6e
FDN
420 format-security
421 format-nonliteral
422 no-long-long
423 unsigned-char
424 gnu89-inline
425 no-strict-aliasing
426 error
ade3159b
FDN
427 address
428 cpp
ade3159b
FDN
429 overflow
430 parentheses
431 sequence-point
432 switch
88491f27 433 shift-overflow
0dbd680b
MJ
434 shift-overflow=2
435 overlength-strings
436 retundent-decls
437 init-self
ade3159b
FDN
438 uninitialized
439 unused-but-set-variable
88491f27 440 unused-const-variable
ade3159b
FDN
441 unused-function
442 unused-result
443 unused-value
444 unused-variable
0dbd680b
MJ
445 unknown-pragmas
446 no-unused-parameter
99afbd6e
FDN
447 "
448
449for j in $WARNLIST; do
450 if cc_supports_flag -W$j; then
451 EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j";
452 fi
453done
454
242124c9 455AC_SUBST([AM_CFLAGS],["$OPT_CFLAGS $GDB_FLAGS $EXTRA_WARNINGS"])
99afbd6e 456
3e837299
FW
457AX_PROG_DATE
458AS_IF([test "$ax_cv_prog_date_gnu_date:$ax_cv_prog_date_gnu_utc" = yes:yes],
459 [UTC_DATE_AT="date -u -d@"],
460 [AS_IF([test "x$ax_cv_prog_date_bsd_date" = xyes],
461 [UTC_DATE_AT="date -u -r"],
462 [AC_MSG_ERROR([date utility unable to convert epoch to UTC])])])
463AC_SUBST([UTC_DATE_AT])
464
75a35f02
FW
465AC_ARG_VAR([SOURCE_EPOCH],[last modification date of the source])
466AC_MSG_NOTICE([trying to determine source epoch])
467AC_MSG_CHECKING([for source epoch in \$SOURCE_EPOCH])
468AS_IF([test -n "$SOURCE_EPOCH"],
469 [AC_MSG_RESULT([yes])],
470 [AC_MSG_RESULT([no])
471 AC_MSG_CHECKING([for source epoch in source_epoch file])
fbc2c39f
FW
472 AS_IF([test -e "$srcdir/source_epoch"],
473 [read SOURCE_EPOCH <"$srcdir/source_epoch"
75a35f02
FW
474 AC_MSG_RESULT([yes])],
475 [AC_MSG_RESULT([no])
476 AC_MSG_CHECKING([for source epoch baked in by gitattributes export-subst])
477 SOURCE_EPOCH='$Format:%at$' # template for rewriting by git-archive
478 AS_CASE([$SOURCE_EPOCH],
479 [?Format:*], # was not rewritten
480 [AC_MSG_RESULT([no])
4f0376ff
FW
481 AC_MSG_CHECKING([for source epoch in \$SOURCE_DATE_EPOCH])
482 AS_IF([test "x$SOURCE_DATE_EPOCH" != x],
483 [SOURCE_EPOCH="$SOURCE_DATE_EPOCH"
484 AC_MSG_RESULT([yes])],
485 [AC_MSG_RESULT([no])
486 AC_MSG_CHECKING([whether git log can provide a source epoch])
487 SOURCE_EPOCH=f${SOURCE_EPOCH#\$F} # convert into git log --pretty format
488 SOURCE_EPOCH=$(cd "$srcdir" && git log -1 --pretty=${SOURCE_EPOCH%$} 2>/dev/null)
489 AS_IF([test -n "$SOURCE_EPOCH"],
490 [AC_MSG_RESULT([yes])],
491 [AC_MSG_RESULT([no, using current time and breaking reproducibility])
492 SOURCE_EPOCH=$(date +%s)])])],
75a35f02
FW
493 [AC_MSG_RESULT([yes])]
494 )])
495 ])
3e837299 496AC_MSG_NOTICE([using source epoch $($UTC_DATE_AT$SOURCE_EPOCH +'%F %T %Z')])
75a35f02 497
19ceca42
FDN
498AC_CONFIG_FILES([
499 Makefile
0472de45 500 init/Makefile
de3d1e09
FDN
501 libnozzle/Makefile
502 libnozzle/libnozzle.pc
15eb3c46 503 libnozzle/tests/Makefile
4aa63ad7 504 kronosnetd/Makefile
b386f39b 505 kronosnetd/kronosnetd.logrotate
10244a3f
FS
506 libknet/Makefile
507 libknet/libknet.pc
a86247e6 508 libknet/tests/Makefile
31945b18
FDN
509 man/Makefile
510 man/Doxyfile-knet
6e3e091c 511 man/Doxyfile-nozzle
7368d54c 512 poc-code/Makefile
77213908 513 poc-code/iov-hash/Makefile
712dee58 514 poc-code/access-list/Makefile
19ceca42 515 ])
99afbd6e 516
cd60b0d9
FDN
517if test "x$VERSION" = "xUNKNOWN"; then
518 AC_MSG_ERROR([m4_text_wrap([
519 configure was unable to determine the source tree's current version. This
520 generally happens when using git archive (or the github download button)
521 generated tarball/zip file. In order to workaround this issue, either use git
522 clone https://github.com/kronosnet/kronosnet.git or use an official release
523 tarball, available at https://kronosnet.org/releases/. Alternatively you
524 can add a compatible version in a .tarball-version file at the top of the
525 source tree, wipe your autom4te.cache dir and generated configure, and rerun
526 autogen.sh.
527 ], [ ], [ ], [76])])
528fi
529
99afbd6e 530AC_OUTPUT