blob: 555ae280e7b7965090d101a0c6bf75f932803b18 [file] [log] [blame]
Jacob Appelbaumb10b0f72012-11-07 20:35:00 -08001AC_INIT([tlsdate],[0.0.4],[jacob at appelbaum.net])
Brian Aker95d9fd52012-10-15 22:44:03 -04002AC_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
Mike Frysinger0c0b4b82012-12-18 15:10:55 -050032dnl Build up the directory we will use to install certs
Brian Aker870a3142012-10-17 02:10:49 -040033TLSDATE_CA_ROOTS="${sysconfdir}/$PACKAGE_NAME/ca-roots"
34AC_SUBST([TLSDATE_CA_ROOTS])
35
Mike Frysinger0c0b4b82012-12-18 15:10:55 -050036dnl Required headers
37dnl First check to see if openssl is installed
Brian Akere601a4d2012-10-17 01:24:51 -040038AC_CHECK_HEADERS([openssl/ssl.h], ,[AC_MSG_ERROR([OpenSSL is not installed, openssl/sslh is missing])])
Brian Aker33fe4bf2012-10-17 00:30:18 -040039
Brian Aker6fa3a082012-10-17 00:16:32 -040040AC_CHECK_HEADERS([arpa/inet.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
41AC_CHECK_HEADERS([getopt.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
42AC_CHECK_HEADERS([grp.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
43AC_CHECK_HEADERS([openssl/bio.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
44AC_CHECK_HEADERS([openssl/err.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
45AC_CHECK_HEADERS([openssl/evp.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
Brian Aker6fa3a082012-10-17 00:16:32 -040046AC_CHECK_HEADERS([pwd.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
47AC_CHECK_HEADERS([stdint.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
48AC_CHECK_HEADERS([stdio.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
49AC_CHECK_HEADERS([stdlib.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
50AC_CHECK_HEADERS([sys/mman.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
51AC_CHECK_HEADERS([sys/time.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
52AC_CHECK_HEADERS([sys/types.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
53AC_CHECK_HEADERS([sys/wait.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
54AC_CHECK_HEADERS([time.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
55AC_CHECK_HEADERS([unistd.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])])
Jacob Appelbaum5de8b0a2012-02-02 01:43:22 +010056
Brian Aker6fa3a082012-10-17 00:16:32 -040057AC_CHECK_FUNCS([setresuid])
58AC_CHECK_FUNCS([gettimeofday])
Christian Grothoffbd15a222012-02-14 00:40:57 +010059
Mike Frysingere270e4b2012-12-18 15:25:25 -050060dnl Check for clock_gettime. Some systems put it into -lc, while
61dnl others use -lrt. Try the first and fallback to the latter.
62RT_LIB=
63AC_CHECK_FUNC([clock_gettime], [:],
64 [AC_CHECK_LIB([rt], [clock_gettime], [RT_LIB="-lrt"],
65 [AC_MSG_ERROR([Your system lacks clock_gettime])])])
66AC_SUBST(RT_LIB)
Brian Akerd4ad5192012-10-16 03:55:56 -040067
Mike Frysinger0c0b4b82012-12-18 15:10:55 -050068dnl Debug and hardening flags all in one shot
69dnl Always do this at the end, otherwise you end up filtering system/other libraries
Brian Akerb12abad2012-10-16 01:25:00 -040070AC_DEFUN([LOCAL_CHECK_FLAGS],[
71 AC_REQUIRE([AX_CHECK_LINK_FLAG])
72 AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
73 AC_LANG_PUSH([C])
74 CFLAGS=
75 LIBS=
76 AX_APPEND_COMPILE_FLAGS([-g -O1 -Wall])
77 AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing])
78 AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2 -fstack-protector-all])
79 AX_APPEND_COMPILE_FLAGS([-fwrapv -fPIE -Wstack-protector])
Brian Aker870a3142012-10-17 02:10:49 -040080 AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1])
81 AX_CHECK_LINK_FLAG([-z relro -z now])
82 AX_CHECK_LINK_FLAG([-pie])
Brian Akerb12abad2012-10-16 01:25:00 -040083 AC_LANG_POP
84 ])
85LOCAL_CHECK_FLAGS
86
Brian Aker95d9fd52012-10-15 22:44:03 -040087AC_CONFIG_FILES([Makefile])
88AC_OUTPUT