1# 2# Process this file with autoconf to produce a configure script. 3# 4# Run ./configure with your options to generate config.mak.autogen file which 5# is used by Makefile. 6# 7 8## Definitions of private macros. 9 10# CONF_SUBST_INIT 11# ------------------- 12# Prepare shell variables and autoconf machine required by later calls 13# to CONF_SUBST. 14AC_DEFUN([CONF_SUBST_INIT], 15 [config_appended_defs=; newline=' 16' 17 AC_CONFIG_COMMANDS([$config_file], 18 [echo "$config_appended_defs" >> "$config_file"], 19 [config_file=$config_file 20 config_appended_defs="$config_appended_defs"])] 21) 22 23# CONF_SUBST(VAL, VAR) 24# ------------------------ 25# Cause the line "VAR=VAL" to be eventually appended to ${config_file}. 26AC_DEFUN([CONF_SUBST], [AC_REQUIRE([CONF_SUBST_INIT]) 27config_appended_defs="$config_appended_defs${newline}dnl 28$1=m4_if([$#],[1],[${$1}],[$2])"] 29) 30 31## Configure body starts here. 32 33AC_PREREQ([2.59]) 34AC_INIT 35 36config_file=config.mak.autogen 37config_in=config.mak.in 38 39# AUTOCONFIGURED 40CONF_SUBST([AUTOCONFIGURED], [YesPlease]) 41 42# Checks for programs 43AC_PROG_CC 44AC_CHECK_TOOLS(AR, [gar ar], :) 45AC_CHECK_PROGS(TAR, [gtar tar]) 46 47# libevent 48AC_ARG_WITH(event, 49 [AS_HELP_STRING([--with-event=DIR], [where to find the event library])], 50 [if test -d "$withval"; then 51 LDFLAGS="$LDFLAGS -L$withval/lib" 52 CFLAGS="$CFLAGS -I$withval/include" 53 fi], 54 withval=yes # default 55) 56if test "$withval" != no; then 57 AC_CHECK_LIB(event,event_base_new, 58 [LIBS="-levent $LIBS"], 59 [AC_MSG_ERROR([libevent2 is required - see http://libevent.org/])] 60 ) 61 AC_CHECK_HEADERS(event2/event.h, 62 [LIBS="-levent $LIBS"], 63 [AC_MSG_ERROR([libevent2 is required - see http://libevent.org/])] 64 ) 65fi 66 67# libsodium 68AC_ARG_WITH(sodium, 69 [AS_HELP_STRING([--with-sodium=DIR], [where to find the sodium library])], 70 [if test -d "$withval"; then 71 LDFLAGS="$LDFLAGS -L$withval/lib" 72 CFLAGS="$CFLAGS -I$withval/include" 73 fi], 74 withval=yes # default 75) 76if test "$withval" != no; then 77 AC_CHECK_LIB(sodium,sodium_init, 78 [LIBS="-lsodium $LIBS"], 79 [AC_MSG_ERROR([sodium is required - see https://github.com/jedisct1/libsodium])] 80 ) 81fi 82 83AC_CHECK_FUNCS(crypto_box_curve25519xchacha20poly1305_open_easy, 84 [CFLAGS="$CFLAGS -DHAVE_CRYPTO_BOX_CURVE25519XCHACHA20POLY1305_OPEN_EASY"], 85 [AC_MSG_WARN([was libsodium compiled with --enable-minimal])] 86) 87 88# Output files 89AC_CONFIG_FILES(["${config_file}":"${config_in}"]) 90AC_OUTPUT 91 92# Show summary. 93AC_MSG_RESULT([ 94Configuration summary: 95 96 Support for event library: $ac_cv_lib_event_event_base_new 97 Support for sodium library: $ac_cv_lib_sodium_sodium_init 98 Support for xchacha20: $ac_cv_func_crypto_box_curve25519xchacha20poly1305_open_easy 99]) 100