1AC_PREREQ(2.59) 2AC_INIT(asignify, 1.0) 3 4AC_CANONICAL_SYSTEM 5 6ASIGNIFY_LIBRARY_VERSION=1:0:0 7# | | | 8# +------+ | +---+ 9# | | | 10# current:revision:age 11# | | | 12# | | +- increment if interfaces have been added 13# | | set to zero if interfaces have been removed 14# | | or changed 15# | +- increment if source code has changed 16# | set to zero if current is incremented 17# +- increment if interfaces have been added, removed or changed 18AC_SUBST(ASIGNIFY_LIBRARY_VERSION) 19 20AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-dist-gzip dist-xz]) 21AM_SILENT_RULES([yes]) 22 23dnl Initialize Libtool 24LT_INIT 25AC_CONFIG_MACRO_DIR([m4]) 26AC_PROG_CC_C99 27AX_CFLAGS_WARN_ALL 28AM_PROG_CC_C_O 29AC_C_CONST 30AC_TYPE_SIZE_T 31AC_CHECK_FUNCS(memmove bcopy) 32AC_PROG_LN_S 33 34AC_CHECK_HEADERS_ONCE([stdlib.h]) 35AC_CHECK_HEADERS_ONCE([stddef.h]) 36AC_CHECK_HEADERS_ONCE([stdarg.h]) 37AC_CHECK_HEADERS_ONCE([stdbool.h]) 38AC_CHECK_HEADERS_ONCE([stdint.h]) 39AC_CHECK_HEADERS_ONCE([string.h]) 40AC_CHECK_HEADERS_ONCE([unistd.h]) 41AC_CHECK_HEADERS_ONCE([readpassphrase.h]) 42 43dnl BSD library on Linux systems 44AC_CANONICAL_HOST 45case $host_os in 46 linux*) 47 OS_CFLAGS="-D_XOPEN_SOURCE -D_GNU_SOURCE" 48 OS_LDFLAGS="" 49 OS_LIBS="-ldl -lrt" 50 ;; 51 *) 52 OS_CFLAGS="-D_BSD_SOURCE -D_WITH_GETLINE" 53 OS_LDFLAGS= 54 OS_LIBS= 55 ;; 56esac 57AC_SUBST(OS_CFLAGS) 58AC_SUBST(OS_LDFLAGS) 59AC_SUBST(OS_LIBS) 60AC_CHECK_HEADERS_ONCE([bsd/stdlib.h]) 61AC_CHECK_HEADERS_ONCE([bsd/string.h]) 62AC_CHECK_HEADERS_ONCE([bsd/stdio.h]) 63AC_CHECK_HEADERS_ONCE([bsd/readpassphrase.h]) 64AC_CHECK_HEADERS_ONCE([bsd/libutil.h]) 65AC_CHECK_HEADERS_ONCE([bsd/err.h]) 66 67AC_CHECK_DECL([O_NOFOLLOW], 68 AC_DEFINE([HAVE_O_NOFOLLOW], [1], [Use O_NOFOLLOW for open]), 69 [], 70 [#include <sys/types.h> 71 #include <sys/stat.h> 72 #include <fcntl.h> 73 ] 74) 75 76AC_CHECK_DECL([getrandom], 77 AC_DEFINE([HAVE_GETRANDOM], [1], [Use getrandom for entropy gain]), 78 [], 79 [#include <sys/types.h> 80 #include <sys/stat.h> 81 #include <fcntl.h> 82 #include <linux/random.h> 83 ] 84) 85 86AC_CHECK_FUNCS([explicit_bzero memset_s]) 87AC_MSG_CHECKING(if weak symbols are supported) 88AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 89 __attribute__((weak)) void __dummy(void *x) { } 90 void f(void *x) { __dummy(x); } 91 ]], [[ ]] 92 )], 93 [AC_MSG_RESULT(yes) 94 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [weak symbols are supported])], 95 [AC_MSG_RESULT(no)]) 96 97AC_CHECK_FUNCS([posix_memalign aligned_alloc valloc]) 98 99dnl Capsicum support 100AC_CHECK_HEADERS_ONCE([sys/capability.h]) 101AC_CHECK_HEADERS_ONCE([sys/capsicum.h]) 102AC_CHECK_LIB(c, cap_sandboxed, [ 103 AC_DEFINE(HAVE_CAPSICUM, 1, [Define 1 if you have 'capsicum'.]) 104]) 105 106AC_CHECK_LIB([bsd], [readpassphrase]) 107AC_SEARCH_LIBS([arc4random_buf], [bsd]) 108AC_CHECK_FUNCS([arc4random_buf]) 109 110AC_ARG_ENABLE([openssl], 111 AS_HELP_STRING([--enable-openssl], [Use openssl for faster hashes computation])) 112AS_IF([test "x$enable_openssl" = "xyes"], 113 [AX_CHECK_OPENSSL([ 114 AC_DEFINE(HAVE_OPENSSL, 1, [Define 1 if you have openssl.])], [] 115 )] 116) 117 118dnl Check if Libtool is present 119dnl Libtool is used for building share libraries 120AC_PROG_LIBTOOL 121 122AC_CONFIG_FILES(Makefile 123 src/Makefile 124 libasignify/Makefile 125 include/Makefile 126 docs/Makefile) 127AC_CONFIG_HEADERS(config.h) 128AC_OUTPUT