blob: a61de3d21737031161c2189f7431619e630daf53 [file] [log] [blame]
Brian Aker95d9fd52012-10-15 22:44:03 -04001AC_INIT([tlsdate],[0.0.1],[jacob at appelbaum.net])
2AC_CONFIG_AUX_DIR([config])
3AC_CONFIG_MACRO_DIR([m4])
David Goulet0809df12012-07-31 23:27:34 -04004
Brian Aker95d9fd52012-10-15 22:44:03 -04005AC_CANONICAL_TARGET
6AC_ARG_PROGRAM
7AC_USE_SYSTEM_EXTENSIONS
8
9AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar])
10
11AC_PREREQ([2.63])
12
Brian Akerb12abad2012-10-16 01:25:00 -040013AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
Brian Aker95d9fd52012-10-15 22:44:03 -040014
15LT_PREREQ([2.2])
David Goulet0809df12012-07-31 23:27:34 -040016LT_INIT
Brian Aker95d9fd52012-10-15 22:44:03 -040017LT_LANG([C])
18gl_VISIBILITY
19m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Jacob Appelbaum5de8b0a2012-02-02 01:43:22 +010020
Brian Akerb12abad2012-10-16 01:25:00 -040021CONFIG_EXTRA
Jacob Appelbaum5de8b0a2012-02-02 01:43:22 +010022
Jacob Appelbaum96390032012-07-15 15:53:13 -040023dnl Here we should build a small program to fetch the build system time in a portable
24dnl manner. We have no Win32 users, we can fix this if we ever find one that
25dnl cares.
26COMPILE_DATE=`date +%s`
Brian Aker95d9fd52012-10-15 22:44:03 -040027AC_SUBST([COMPILE_DATE])
Jacob Appelbaum96390032012-07-15 15:53:13 -040028AC_DEFINE_UNQUOTED([RECENT_COMPILE_DATE],
29 [(uint32_t) ${COMPILE_DATE}],
30 [Time in seconds since the Disco epoch at build time])
31
Jacob Appelbaum5de8b0a2012-02-02 01:43:22 +010032# Required headers
33AC_CHECK_HEADERS(
34 stdio.h \
35 stdint.h \
36 stdlib.h \
Christian Grothoff191cd982012-02-14 00:48:45 +010037 unistd.h \
Jacob Appelbaum5de8b0a2012-02-02 01:43:22 +010038 getopt.h \
39 sys/time.h \
Christian Grothoff191cd982012-02-14 00:48:45 +010040 sys/types.h \
41 sys/wait.h \
42 sys/mman.h \
Jacob Appelbaum5de8b0a2012-02-02 01:43:22 +010043 time.h \
Christian Grothoff191cd982012-02-14 00:48:45 +010044 pwd.h \
Jacob Appelbaum2c385d22012-02-21 14:04:15 -080045 grp.h \
Jacob Appelbaum5de8b0a2012-02-02 01:43:22 +010046 arpa/inet.h \
47 openssl/bio.h \
48 openssl/ssl.h \
49 openssl/err.h \
Christian Grothoff191cd982012-02-14 00:48:45 +010050 openssl/evp.h
Jacob Appelbaum5de8b0a2012-02-02 01:43:22 +010051, , AC_MSG_ERROR([Required headers missing; compilation will not succeed]))
52
Jacob Appelbaum96390032012-07-15 15:53:13 -040053AC_CHECK_FUNCS([setresuid gettimeofday])
Christian Grothoffbd15a222012-02-14 00:40:57 +010054
Brian Akerd4ad5192012-10-16 03:55:56 -040055# Check for -lrt
56AC_CHECK_LIB([rt], [clock_gettime], [
57 RT_LIB="-lrt"
58 AC_SUBST(RT_LIB)
59 AC_DEFINE([HAVE_LIBRT], [1], [Have clock_gettime])
60 ],[
61 AC_DEFINE([HAVE_LIBRT], [0], [Have clock_gettime])
62 ])
63
Brian Akerb12abad2012-10-16 01:25:00 -040064# Debug and hardening flags all in one shot
65# Alwas do this at the end, otherwise you end up filtering system/other libraries
66AC_DEFUN([LOCAL_CHECK_FLAGS],[
67 AC_REQUIRE([AX_CHECK_LINK_FLAG])
68 AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
69 AC_LANG_PUSH([C])
70 CFLAGS=
71 LIBS=
72 AX_APPEND_COMPILE_FLAGS([-g -O1 -Wall])
73 AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing])
74 AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2 -fstack-protector-all])
75 AX_APPEND_COMPILE_FLAGS([-fwrapv -fPIE -Wstack-protector])
76 AX_APPEND_COMPILE_FLAGS([--param ssp-buffer-size=1])
77 AX_CHECK_LINK_FLAG([-pie -z relro -z now])
78 AC_LANG_POP
79 ])
80LOCAL_CHECK_FLAGS
81
Brian Aker95d9fd52012-10-15 22:44:03 -040082AC_CONFIG_FILES([Makefile])
83AC_OUTPUT