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 | |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 32 | # Required headers |
| 33 | AC_CHECK_HEADERS( |
| 34 | stdio.h \ |
| 35 | stdint.h \ |
| 36 | stdlib.h \ |
Christian Grothoff | 191cd98 | 2012-02-14 00:48:45 +0100 | [diff] [blame] | 37 | unistd.h \ |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 38 | getopt.h \ |
| 39 | sys/time.h \ |
Christian Grothoff | 191cd98 | 2012-02-14 00:48:45 +0100 | [diff] [blame] | 40 | sys/types.h \ |
| 41 | sys/wait.h \ |
| 42 | sys/mman.h \ |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 43 | time.h \ |
Christian Grothoff | 191cd98 | 2012-02-14 00:48:45 +0100 | [diff] [blame] | 44 | pwd.h \ |
Jacob Appelbaum | 2c385d2 | 2012-02-21 14:04:15 -0800 | [diff] [blame] | 45 | grp.h \ |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 46 | arpa/inet.h \ |
| 47 | openssl/bio.h \ |
| 48 | openssl/ssl.h \ |
| 49 | openssl/err.h \ |
Christian Grothoff | 191cd98 | 2012-02-14 00:48:45 +0100 | [diff] [blame] | 50 | openssl/evp.h |
Jacob Appelbaum | 5de8b0a | 2012-02-02 01:43:22 +0100 | [diff] [blame] | 51 | , , AC_MSG_ERROR([Required headers missing; compilation will not succeed])) |
| 52 | |
Jacob Appelbaum | 9639003 | 2012-07-15 15:53:13 -0400 | [diff] [blame] | 53 | AC_CHECK_FUNCS([setresuid gettimeofday]) |
Christian Grothoff | bd15a22 | 2012-02-14 00:40:57 +0100 | [diff] [blame] | 54 | |
Brian Aker | b12abad | 2012-10-16 01:25:00 -0400 | [diff] [blame^] | 55 | # Debug and hardening flags all in one shot |
| 56 | # Alwas do this at the end, otherwise you end up filtering system/other libraries |
| 57 | AC_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 | ]) |
| 71 | LOCAL_CHECK_FLAGS |
| 72 | |
Brian Aker | 95d9fd5 | 2012-10-15 22:44:03 -0400 | [diff] [blame] | 73 | AC_CONFIG_FILES([Makefile]) |
| 74 | AC_OUTPUT |