blob: f40379ded0244134cd24fd2a9a0981f831ca19b2 [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 Akerb12abad2012-10-16 01:25:00 -040055# Debug and hardening flags all in one shot
56# Alwas do this at the end, otherwise you end up filtering system/other libraries
57AC_DEFUN([LOCAL_CHECK_FLAGS],[
58 AC_REQUIRE([AX_CHECK_LINK_FLAG])
59 AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
60 AC_LANG_PUSH([C])
61 CFLAGS=
62 LIBS=
63 AX_APPEND_COMPILE_FLAGS([-g -O1 -Wall])
64 AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing])
65 AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2 -fstack-protector-all])
66 AX_APPEND_COMPILE_FLAGS([-fwrapv -fPIE -Wstack-protector])
67 AX_APPEND_COMPILE_FLAGS([--param ssp-buffer-size=1])
68 AX_CHECK_LINK_FLAG([-pie -z relro -z now])
69 AC_LANG_POP
70 ])
71LOCAL_CHECK_FLAGS
72
Brian Aker95d9fd52012-10-15 22:44:03 -040073AC_CONFIG_FILES([Makefile])
74AC_OUTPUT