Brian Aker | 95d9fd5 | 2012-10-15 22:44:03 -0400 | [diff] [blame] | 1 | AC_INIT([tlsdate],[0.0.1],[jacob at appelbaum.net]) |
| 2 | AC_CONFIG_AUX_DIR([config]) |
| 3 | AC_CONFIG_MACRO_DIR([m4]) |
David Goulet | 0809df1 | 2012-07-31 23:27:34 -0400 | [diff] [blame] | 4 | |
Brian Aker | 95d9fd5 | 2012-10-15 22:44:03 -0400 | [diff] [blame] | 5 | AC_CANONICAL_TARGET |
| 6 | AC_ARG_PROGRAM |
| 7 | AC_USE_SYSTEM_EXTENSIONS |
| 8 | |
| 9 | AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar]) |
| 10 | |
| 11 | AC_PREREQ([2.63]) |
| 12 | |
Brian Aker | b12abad | 2012-10-16 01:25:00 -0400 | [diff] [blame] | 13 | AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS. |
Brian Aker | 95d9fd5 | 2012-10-15 22:44:03 -0400 | [diff] [blame] | 14 | |
| 15 | LT_PREREQ([2.2]) |
David Goulet | 0809df1 | 2012-07-31 23:27:34 -0400 | [diff] [blame] | 16 | LT_INIT |
Brian Aker | 95d9fd5 | 2012-10-15 22:44:03 -0400 | [diff] [blame] | 17 | LT_LANG([C]) |
| 18 | gl_VISIBILITY |
| 19 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 20 | |
Brian Aker | b12abad | 2012-10-16 01:25:00 -0400 | [diff] [blame] | 21 | CONFIG_EXTRA |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 22 | |
Jacob Appelbaum | 9639003 | 2012-07-15 15:53:13 -0400 | [diff] [blame] | 23 | dnl Here we should build a small program to fetch the build system time in a portable |
| 24 | dnl manner. We have no Win32 users, we can fix this if we ever find one that |
| 25 | dnl cares. |
| 26 | COMPILE_DATE=`date +%s` |
Brian Aker | 95d9fd5 | 2012-10-15 22:44:03 -0400 | [diff] [blame] | 27 | AC_SUBST([COMPILE_DATE]) |
Jacob Appelbaum | 9639003 | 2012-07-15 15:53:13 -0400 | [diff] [blame] | 28 | AC_DEFINE_UNQUOTED([RECENT_COMPILE_DATE], |
| 29 | [(uint32_t) ${COMPILE_DATE}], |
| 30 | [Time in seconds since the Disco epoch at build time]) |
| 31 | |
Brian Aker | 870a314 | 2012-10-17 02:10:49 -0400 | [diff] [blame^] | 32 | # Build up the directory we will use to install certs |
| 33 | TLSDATE_CA_ROOTS="${sysconfdir}/$PACKAGE_NAME/ca-roots" |
| 34 | AC_SUBST([TLSDATE_CA_ROOTS]) |
| 35 | |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 36 | # Required headers |
Brian Aker | 33fe4bf | 2012-10-17 00:30:18 -0400 | [diff] [blame] | 37 | # First check to see if openssl is installed |
Brian Aker | e601a4d | 2012-10-17 01:24:51 -0400 | [diff] [blame] | 38 | AC_CHECK_HEADERS([openssl/ssl.h], ,[AC_MSG_ERROR([OpenSSL is not installed, openssl/sslh is missing])]) |
Brian Aker | 33fe4bf | 2012-10-17 00:30:18 -0400 | [diff] [blame] | 39 | |
Brian Aker | 6fa3a08 | 2012-10-17 00:16:32 -0400 | [diff] [blame] | 40 | AC_CHECK_HEADERS([arpa/inet.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 41 | AC_CHECK_HEADERS([getopt.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 42 | AC_CHECK_HEADERS([grp.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 43 | AC_CHECK_HEADERS([openssl/bio.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 44 | AC_CHECK_HEADERS([openssl/err.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 45 | AC_CHECK_HEADERS([openssl/evp.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
Brian Aker | 6fa3a08 | 2012-10-17 00:16:32 -0400 | [diff] [blame] | 46 | AC_CHECK_HEADERS([pwd.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 47 | AC_CHECK_HEADERS([stdint.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 48 | AC_CHECK_HEADERS([stdio.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 49 | AC_CHECK_HEADERS([stdlib.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 50 | AC_CHECK_HEADERS([sys/mman.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 51 | AC_CHECK_HEADERS([sys/time.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 52 | AC_CHECK_HEADERS([sys/types.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 53 | AC_CHECK_HEADERS([sys/wait.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 54 | AC_CHECK_HEADERS([time.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
| 55 | AC_CHECK_HEADERS([unistd.h], ,[AC_MSG_ERROR([Required headers missing; compilation will not succeed])]) |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 56 | |
Brian Aker | 6fa3a08 | 2012-10-17 00:16:32 -0400 | [diff] [blame] | 57 | AC_CHECK_FUNCS([setresuid]) |
| 58 | AC_CHECK_FUNCS([gettimeofday]) |
Christian Grothoff | bd15a22 | 2012-02-14 00:40:57 +0100 | [diff] [blame] | 59 | |
Brian Aker | d4ad519 | 2012-10-16 03:55:56 -0400 | [diff] [blame] | 60 | # Check for -lrt |
| 61 | AC_CHECK_LIB([rt], [clock_gettime], [ |
| 62 | RT_LIB="-lrt" |
| 63 | AC_SUBST(RT_LIB) |
| 64 | AC_DEFINE([HAVE_LIBRT], [1], [Have clock_gettime]) |
| 65 | ],[ |
Brian Aker | e601a4d | 2012-10-17 01:24:51 -0400 | [diff] [blame] | 66 | AC_MSG_ERROR([Your system lacks clock_gettime]) |
Brian Aker | d4ad519 | 2012-10-16 03:55:56 -0400 | [diff] [blame] | 67 | ]) |
| 68 | |
Brian Aker | b12abad | 2012-10-16 01:25:00 -0400 | [diff] [blame] | 69 | # Debug and hardening flags all in one shot |
| 70 | # Alwas do this at the end, otherwise you end up filtering system/other libraries |
| 71 | AC_DEFUN([LOCAL_CHECK_FLAGS],[ |
| 72 | AC_REQUIRE([AX_CHECK_LINK_FLAG]) |
| 73 | AC_REQUIRE([AX_APPEND_COMPILE_FLAGS]) |
| 74 | AC_LANG_PUSH([C]) |
| 75 | CFLAGS= |
| 76 | LIBS= |
| 77 | AX_APPEND_COMPILE_FLAGS([-g -O1 -Wall]) |
| 78 | AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing]) |
| 79 | AX_APPEND_COMPILE_FLAGS([-D_FORTIFY_SOURCE=2 -fstack-protector-all]) |
| 80 | AX_APPEND_COMPILE_FLAGS([-fwrapv -fPIE -Wstack-protector]) |
Brian Aker | 870a314 | 2012-10-17 02:10:49 -0400 | [diff] [blame^] | 81 | AX_APPEND_COMPILE_FLAGS([--param=ssp-buffer-size=1]) |
| 82 | AX_CHECK_LINK_FLAG([-z relro -z now]) |
| 83 | AX_CHECK_LINK_FLAG([-pie]) |
Brian Aker | b12abad | 2012-10-16 01:25:00 -0400 | [diff] [blame] | 84 | AC_LANG_POP |
| 85 | ]) |
| 86 | LOCAL_CHECK_FLAGS |
| 87 | |
Brian Aker | 95d9fd5 | 2012-10-15 22:44:03 -0400 | [diff] [blame] | 88 | AC_CONFIG_FILES([Makefile]) |
| 89 | AC_OUTPUT |