Home | History | Annotate | Line # | Download | only in ipsec-tools
      1   1.1      manu dnl -*- mode: m4 -*-
      2   1.2      manu dnl Id: configure.ac,v 1.77 2006/07/20 19:19:27 manubsd Exp
      3   1.1      manu 
      4   1.1      manu AC_PREREQ(2.52)
      5   1.2      manu AC_INIT(ipsec-tools, CVS)
      6   1.1      manu AC_CONFIG_SRCDIR([configure.ac])
      7  1.13    tteras AC_CONFIG_HEADERS(config.h)
      8   1.1      manu 
      9   1.1      manu AM_INIT_AUTOMAKE(dist-bzip2)
     10   1.1      manu 
     11   1.1      manu AC_ENABLE_SHARED(no)
     12   1.1      manu 
     13   1.1      manu AC_PROG_CC
     14   1.1      manu AC_HEADER_STDC
     15   1.1      manu AC_PROG_LIBTOOL
     16   1.1      manu AC_PROG_YACC
     17   1.1      manu AM_PROG_LEX
     18   1.1      manu AC_SUBST(LEXLIB)
     19   1.1      manu AC_PROG_EGREP
     20   1.1      manu 
     21   1.1      manu CFLAGS_ADD="$CFLAGS_ADD -Wall -Werror -Wno-unused"
     22   1.1      manu 
     23   1.1      manu case $host in
     24   1.1      manu *netbsd*)
     25   1.1      manu 	LDFLAGS="-Wl,-R/usr/pkg/lib $LDFLAGS"
     26   1.1      manu 	;;
     27   1.1      manu *linux*)
     28   1.1      manu 	LIBS="$LIBS -lresolv"
     29   1.1      manu 	INSTALL_OPTS="-o bin -g bin"
     30   1.1      manu 	INCLUDE_GLIBC="include-glibc"
     31   1.1      manu 	RPM="rpm"
     32   1.1      manu 	AC_SUBST(INSTALL_OPTS)
     33   1.1      manu 	AC_SUBST(INCLUDE_GLIBC)
     34   1.1      manu 	AC_SUBST(RPM)
     35   1.1      manu 	;;
     36   1.2      manu *darwin*)
     37   1.2      manu 	LIBS="$LIBS -lresolv"
     38   1.2      manu 	;;
     39   1.1      manu esac
     40   1.1      manu 
     41   1.1      manu # Look up some IPsec-related headers
     42   1.1      manu AC_CHECK_HEADER(net/pfkeyv2.h, [have_net_pfkey=yes], [have_net_pfkey=no])
     43   1.1      manu AC_CHECK_HEADER(netinet/ipsec.h, [have_netinet_ipsec=yes], [have_netinet_ipsec=no])
     44   1.1      manu AC_CHECK_HEADER(netinet6/ipsec.h, [have_netinet6_ipsec=yes], [have_netinet6_ipsec=no])
     45   1.5     vanhu AC_CHECK_HEADER(netipsec/ipsec.h, [have_netipsec_ipsec=yes], [have_netipsec_ipsec=no])
     46   1.1      manu 
     47   1.5     vanhu # FreeBSD >=7 has only <netipsec/ipsec.h>
     48   1.1      manu # NetBSD has <netinet6/ipsec.h> but not <netinet/ipsec.h>
     49   1.5     vanhu # XXX some *BSD still have both <netinet6/ipsec.h> and <netipsec/ipsec.h>,
     50   1.5     vanhu # we can't decide which one to use (actually <netinet6/ipsec.h>)
     51   1.5     vanhu 
     52   1.5     vanhu 
     53   1.5     vanhu if test "$have_netinet_ipsec$have_netinet6_ipsec$have_netipsec_ipsec" = nonoyes; then
     54   1.1      manu     have_netinet_ipsec=yes
     55   1.5     vanhu     AC_DEFINE(PATH_IPSEC_H, [<netipsec/ipsec.h>], [Path to ipsec.h])
     56   1.5     vanhu else
     57   1.5     vanhu 	if test "$have_netinet_ipsec$have_netinet6_ipsec" = noyes; then
     58   1.5     vanhu     	have_netinet_ipsec=yes
     59   1.5     vanhu 	    AC_DEFINE(PATH_IPSEC_H, [<netinet6/ipsec.h>], [Path to ipsec.h])
     60   1.5     vanhu 	else
     61   1.5     vanhu 		# have_netinet_ipsec will be checked a few lines below
     62   1.5     vanhu 	    AC_DEFINE(PATH_IPSEC_H, [<netinet/ipsec.h>], [Path to ipsec.h])
     63   1.5     vanhu 	fi
     64   1.1      manu fi
     65   1.1      manu 
     66   1.1      manu case "$host_os" in
     67   1.1      manu  *linux*)
     68   1.1      manu     AC_ARG_WITH(kernel-headers,
     69   1.1      manu 	AC_HELP_STRING([--with-kernel-headers=/lib/modules/<uname>/build/include],
     70   1.1      manu 		       [where your Linux Kernel headers are installed]),
     71   1.1      manu 	    [ KERNEL_INCLUDE="$with_kernel_headers" 
     72   1.1      manu 	      CONFIGURE_AMFLAGS="--with-kernel-headers=$with_kernel_headers"
     73   1.1      manu 	      AC_SUBST(CONFIGURE_AMFLAGS) ],
     74   1.1      manu 	    [ KERNEL_INCLUDE="/lib/modules/`uname -r`/build/include" ])
     75   1.1      manu 
     76   1.2      manu     AC_CHECK_HEADER($KERNEL_INCLUDE/linux/pfkeyv2.h, ,
     77   1.2      manu 	[ AC_CHECK_HEADER(/usr/src/linux/include/linux/pfkeyv2.h,
     78   1.1      manu 	  KERNEL_INCLUDE=/usr/src/linux/include ,
     79   1.1      manu 	  [ AC_MSG_ERROR([Unable to find linux-2.6 kernel headers. Aborting.]) ] ) ] )
     80   1.1      manu     AC_SUBST(KERNEL_INCLUDE)
     81   1.1      manu     # We need the configure script to run with correct kernel headers.
     82   1.1      manu     # However we don't want to point to kernel source tree in compile time,
     83   1.1      manu     # i.e. this will be removed from CPPFLAGS at the end of configure.
     84   1.1      manu     CPPFLAGS="-I$KERNEL_INCLUDE $CPPFLAGS"
     85   1.1      manu 
     86   1.1      manu     AC_CHECK_MEMBER(struct sadb_x_policy.sadb_x_policy_priority, 
     87   1.1      manu     	[AC_DEFINE(HAVE_PFKEY_POLICY_PRIORITY, [],
     88   1.1      manu                	[Are PF_KEY policy priorities supported?])], [],
     89   1.1      manu     	[#include "$KERNEL_INCLUDE/linux/pfkeyv2.h"])
     90   1.1      manu 
     91   1.1      manu     GLIBC_BUGS='-include ${top_srcdir}/src/include-glibc/glibc-bugs.h -I${top_srcdir}/src/include-glibc -I${top_builddir}/src/include-glibc'
     92   1.1      manu     GLIBC_BUGS_LOCAL="-include ${srcdir-.}/src/include-glibc/glibc-bugs.h -I${srcdir-.}/src/include-glibc -I./src/include-glibc"
     93   1.1      manu     CPPFLAGS="$GLIBC_BUGS_LOCAL $CPPFLAGS"
     94   1.2      manu     CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"
     95   1.2      manu     AC_SUBST(GLIBC_BUGS)
     96   1.1      manu     ;;
     97   1.1      manu  *)
     98   1.1      manu     if test "$have_net_pfkey$have_netinet_ipsec" != yesyes; then
     99   1.1      manu       if test "$have_net_pfkey" = yes; then
    100   1.1      manu 	AC_MSG_ERROR([Found net/pfkeyv2.h but not netinet/ipsec.h. Aborting.])
    101   1.1      manu       else
    102   1.1      manu 	AC_MSG_ERROR([Found netinet/ipsec.h but not net/pfkeyv2.h. Aborting.])
    103   1.1      manu       fi
    104   1.1      manu     fi
    105   1.1      manu     ;;
    106   1.1      manu esac
    107   1.1      manu 
    108  1.14  christos AH_TEMPLATE(ENABLE_WILDCARD_MATCH, [Enable wildcard matching in pre-shared-key file])
    109  1.14  christos AC_ARG_ENABLE([wildcard-match],
    110  1.14  christos [--enable-wildcard-match	Enable wildcard matching in pre-shared-key file],
    111  1.14  christos [case "${enableval}" in
    112  1.14  christos (yes)	AC_DEFINE(ENABLE_WILDCARD_MATCH);;
    113  1.14  christos (no)	;;
    114  1.14  christos (*)	AC_MSG_ERROR(bad value ${enableval} for --enable-wildcard-match);;
    115  1.14  christos esac],[])
    116   1.1      manu ### Some basic toolchain checks
    117   1.1      manu 
    118   1.1      manu # Checks for header files.
    119   1.1      manu AC_HEADER_STDC
    120   1.1      manu AC_HEADER_SYS_WAIT
    121   1.1      manu AC_CHECK_HEADERS(limits.h sys/time.h unistd.h stdarg.h varargs.h)
    122  1.11    tteras AC_CHECK_HEADERS(shadow.h strings.h)
    123   1.1      manu 
    124   1.1      manu # Checks for typedefs, structures, and compiler characteristics.
    125   1.1      manu AC_C_CONST
    126   1.1      manu AC_TYPE_PID_T
    127   1.1      manu AC_TYPE_SIZE_T
    128   1.1      manu AC_HEADER_TIME
    129   1.1      manu AC_STRUCT_TM
    130   1.1      manu 
    131   1.1      manu # Checks for library functions.
    132   1.1      manu AC_FUNC_MEMCMP
    133   1.1      manu AC_TYPE_SIGNAL
    134   1.1      manu AC_FUNC_VPRINTF
    135   1.2      manu AC_CHECK_FUNCS(gettimeofday select socket strerror strtol strtoul strlcpy strlcat)
    136   1.1      manu AC_REPLACE_FUNCS(strdup)
    137   1.1      manu RACOON_CHECK_VA_COPY
    138   1.1      manu 
    139   1.1      manu # Check if printf accepts "%z" type modifier for size_t argument
    140   1.1      manu AC_MSG_CHECKING(if printf accepts %z)
    141   1.1      manu saved_CFLAGS=$CFLAGS
    142   1.1      manu CFLAGS="$CFLAGS -Wall -Werror"
    143   1.1      manu AC_TRY_COMPILE([
    144   1.1      manu #include <stdio.h>
    145   1.1      manu ], [
    146   1.1      manu printf("%zu\n", (size_t)-1);
    147   1.1      manu ],
    148   1.1      manu 	[AC_MSG_RESULT(yes)],
    149   1.2      manu 	[AC_MSG_RESULT(no);
    150   1.2      manu 	 CFLAGS_ADD="$CFLAGS_ADD -Wno-format";
    151   1.2      manu 	 AC_DEFINE(BROKEN_PRINTF, [], [If printf doesn't support %zu.])
    152   1.2      manu 	])
    153   1.1      manu CFLAGS=$saved_CFLAGS
    154   1.1      manu 
    155   1.1      manu # Can we use __func__ macro?
    156   1.1      manu AC_MSG_CHECKING(if __func__ is available)
    157   1.1      manu AC_TRY_COMPILE(
    158   1.1      manu [#include <stdio.h>
    159   1.1      manu ], [char *x = __func__;],
    160   1.1      manu 	[AC_DEFINE([HAVE_FUNC_MACRO], [], [Have __func__ macro])
    161   1.1      manu 	AC_MSG_RESULT(yes)],
    162   1.1      manu 	[AC_MSG_RESULT(no)])
    163   1.1      manu 
    164   1.1      manu # Check if readline support is requested
    165   1.1      manu AC_MSG_CHECKING(if readline support is requested)
    166   1.1      manu AC_ARG_WITH(readline,
    167   1.1      manu 	[  --with-readline         support readline input (yes by default)],
    168   1.1      manu 	[with_readline="$withval"], [with_readline="yes"])
    169   1.1      manu AC_MSG_RESULT($with_readline)
    170   1.1      manu 
    171   1.1      manu # Is readline available?
    172   1.1      manu if test $with_readline != "no"; then
    173   1.1      manu 	AC_CHECK_HEADER([readline/readline.h], 
    174   1.1      manu 		[AC_CHECK_LIB(readline, readline, [
    175   1.1      manu 				AC_DEFINE(HAVE_READLINE, [],
    176   1.1      manu 					[Is readline available?])
    177   1.1      manu 				LIBS="$LIBS -lreadline"
    178   1.1      manu 		], [])], [])
    179   1.1      manu fi
    180   1.1      manu 
    181   1.2      manu 
    182   1.2      manu AC_MSG_CHECKING(if --with-flex option is specified)
    183   1.2      manu AC_ARG_WITH(flexdir,
    184   1.2      manu 	[AC_HELP_STRING([--with-flex], [use directiory (default: no)])],
    185   1.2      manu 	[flexdir="$withval"])
    186   1.2      manu AC_MSG_RESULT(${flexdir-dirdefault})
    187   1.2      manu 
    188   1.2      manu if test "x$flexdir" != "x"; then
    189   1.2      manu 	LIBS="$LIBS $flexdir/libfl.a"
    190   1.2      manu fi
    191   1.2      manu 
    192   1.2      manu AC_MSG_CHECKING(if --with-flexlib option is specified)
    193   1.2      manu AC_ARG_WITH(flexlib,
    194   1.2      manu 	[  --with-flexlib=<LIB>    specify flex library.],
    195   1.2      manu 	[flexlib="$withval"])
    196   1.2      manu AC_MSG_RESULT(${flexlib-default})
    197   1.2      manu 
    198   1.2      manu if test "x$flexlib" != "x"; then
    199   1.2      manu 	LIBS="$LIBS $flexlib"
    200   1.2      manu fi
    201   1.2      manu 
    202   1.1      manu # Check if a different OpenSSL directory was specified
    203   1.1      manu AC_MSG_CHECKING(if --with-openssl option is specified)
    204   1.1      manu AC_ARG_WITH(openssl, [  --with-openssl=DIR      specify OpenSSL directory],
    205   1.1      manu 	[crypto_dir=$withval])
    206   1.1      manu AC_MSG_RESULT(${crypto_dir-default})
    207   1.1      manu 
    208   1.1      manu if test "x$crypto_dir" != "x"; then
    209   1.1      manu 	LIBS="$LIBS -L${crypto_dir}/lib"
    210   1.8    tteras 	CPPFLAGS="-I${crypto_dir}/include $CPPFLAGS"
    211   1.1      manu fi
    212   1.1      manu AC_MSG_CHECKING(openssl version)
    213   1.2      manu 
    214   1.2      manu AC_TRY_COMPILE(
    215   1.2      manu [#include <openssl/opensslv.h>
    216   1.2      manu ],
    217  1.12    tteras [#if OPENSSL_VERSION_NUMBER < 0x0090813fL
    218   1.2      manu #error OpenSSL version is too old ...
    219   1.2      manu #endif],
    220   1.2      manu [AC_MSG_RESULT([ok])],
    221   1.2      manu [AC_MSG_RESULT(too old)
    222  1.12    tteras AC_MSG_ERROR([OpenSSL version must be 0.9.8s or higher. Aborting.])
    223   1.2      manu ])
    224   1.2      manu 
    225   1.1      manu AC_CHECK_HEADERS(openssl/engine.h)
    226   1.1      manu 
    227   1.1      manu # checking rijndael
    228   1.1      manu AC_CHECK_HEADERS([openssl/aes.h], [], 
    229   1.1      manu 	[CRYPTOBJS="$CRYPTOBJS rijndael-api-fst.o rijndael-alg-fst.o"])
    230   1.1      manu 
    231   1.1      manu # checking sha2
    232   1.1      manu AC_MSG_CHECKING(sha2 support)
    233   1.1      manu AC_DEFINE([WITH_SHA2], [], [SHA2 support])
    234   1.2      manu AC_MSG_RESULT(yes)
    235   1.1      manu AC_CHECK_HEADER(openssl/sha2.h, [], [
    236   1.2      manu 	AC_MSG_CHECKING(if sha2 is defined in openssl/sha.h)
    237   1.2      manu 	AC_TRY_COMPILE([
    238   1.2      manu 		#ifdef HAVE_SYS_TYPES_H
    239   1.2      manu 		#include <sys/types.h>
    240   1.2      manu 		#endif
    241   1.2      manu 		#include <openssl/sha.h>
    242   1.2      manu 	], [
    243   1.2      manu 		SHA256_CTX ctx;
    244   1.2      manu 	], [
    245   1.2      manu 	    AC_MSG_RESULT(yes)
    246   1.2      manu 	    AC_DEFINE([HAVE_SHA2_IN_SHA_H], [], [sha2 is defined in sha.h])
    247   1.2      manu 	], [AC_MSG_RESULT(no)
    248   1.2      manu 	    AC_LIBOBJ([sha2])
    249   1.2      manu 	    CRYPTOBJS="$CRYPTOBJS sha2.o"
    250   1.2      manu 	])
    251   1.2      manu 
    252   1.7      manu 	CPPFLAGS_ADD="$CPPFLAGS_ADD -I\${top_srcdir}/src/racoon/missing"
    253   1.2      manu ])
    254   1.1      manu AC_SUBST(CRYPTOBJS)
    255   1.1      manu 
    256   1.2      manu # checking camellia
    257   1.2      manu AC_CHECK_HEADERS([openssl/camellia.h])
    258   1.2      manu 
    259   1.2      manu 
    260   1.1      manu # Option --enable-adminport 
    261   1.1      manu AC_MSG_CHECKING(if --enable-adminport option is specified)
    262   1.1      manu AC_ARG_ENABLE(adminport,
    263   1.1      manu 	[  --enable-adminport      enable admin port],
    264   1.1      manu 	[], [enable_adminport=no])
    265   1.1      manu if test $enable_adminport = "yes"; then
    266   1.1      manu 	AC_DEFINE([ENABLE_ADMINPORT], [], [Enable admin port])
    267   1.1      manu fi
    268   1.1      manu AC_MSG_RESULT($enable_adminport)
    269   1.1      manu 
    270   1.2      manu # Option RC5
    271   1.2      manu AC_MSG_CHECKING(if --enable-rc5 option is specified)
    272   1.2      manu AC_ARG_ENABLE(rc5,
    273   1.2      manu 	[  --enable-rc5		enable RC5 encryption (patented)],
    274   1.2      manu 	[], [enable_rc5=no])
    275   1.2      manu AC_MSG_RESULT($enable_rc5)
    276   1.2      manu 
    277   1.2      manu if test $enable_rc5 = "yes"; then
    278   1.2      manu 	AC_CHECK_HEADERS([openssl/rc5.h])
    279   1.2      manu 	AC_CHECK_LIB([crypto_rc5], [RC5_32_encrypt],
    280   1.2      manu 	    [EXTRA_CRYPTO="$EXTRA_CRYPTO -lcrypto_rc5"])
    281   1.2      manu fi
    282   1.2      manu 
    283   1.2      manu # Option IDEA
    284   1.2      manu AC_MSG_CHECKING(if --enable-idea option is specified)
    285   1.2      manu AC_ARG_ENABLE(idea,
    286   1.2      manu 	[  --enable-idea	enable IDEA encryption (patented)],
    287   1.2      manu 	[], [enable_idea=no])
    288   1.2      manu AC_MSG_RESULT($enable_idea)
    289   1.2      manu 
    290   1.2      manu if test $enable_idea = "yes"; then
    291   1.2      manu 	AC_CHECK_HEADERS([openssl/idea.h])
    292   1.2      manu 	AC_CHECK_LIB([crypto_idea], [idea_encrypt], 
    293   1.2      manu 	    [EXTRA_CRYPTO="$EXTRA_CRYPTO -lcrypto_idea"])
    294   1.2      manu fi
    295   1.2      manu AC_SUBST(EXTRA_CRYPTO)
    296   1.2      manu 
    297   1.2      manu # For dynamic libradius
    298   1.2      manu RACOON_PATH_LIBS([MD5_Init], [crypto])
    299   1.2      manu 
    300   1.2      manu # Check if we need -lutil for login(3)
    301   1.2      manu RACOON_PATH_LIBS([login], [util])
    302   1.2      manu 
    303   1.2      manu # Specify libiconv prefix
    304   1.2      manu AC_MSG_CHECKING(if --with-libiconv option is specified)
    305   1.2      manu AC_ARG_WITH(libiconv, 
    306   1.2      manu     [  --with-libiconv=DIR    specify libiconv path (like/usr/pkg)],
    307   1.2      manu     [libiconv_dir=$withval], 
    308   1.2      manu     [libiconv_dir=no])
    309   1.2      manu AC_MSG_RESULT($libiconv_dir)
    310   1.2      manu if test "$libiconv_dir" != "no"; then
    311   1.2      manu 	if test "$libiconv_dir" = "yes" ; then
    312   1.2      manu 		  libiconv_dir="";
    313   1.2      manu 	fi;
    314   1.2      manu 	if test "x$libiconv_dir" = "x"; then
    315   1.2      manu 		RACOON_PATH_LIBS([iconv_open], [iconv])
    316   1.1      manu 	else
    317   1.2      manu 		if test -d "$libiconv_dir/lib" -a \
    318   1.2      manu 		    -d "$libiconv_dir/include" ; then
    319   1.2      manu 			RACOON_PATH_LIBS([iconv_open], [iconv], ["$libiconv_dir/lib"])
    320   1.2      manu 			CPPFLAGS_ADD="$CPPFLAGS_ADD -I$libiconv_dir/include"
    321   1.2      manu 		else
    322   1.2      manu 			AC_MSG_ERROR([ICONV libs or includes not found. Aborting.])
    323   1.2      manu 	  	fi
    324   1.1      manu 	fi
    325   1.2      manu 	LIBS="$LIBS -L$libiconv_dir/lib -R$libiconv_dir/lib -liconv"
    326   1.2      manu 	AC_CHECK_FUNCS(iconv_open)
    327   1.1      manu fi
    328   1.1      manu 
    329   1.1      manu AC_MSG_CHECKING([if --enable-hybrid option is specified])
    330   1.1      manu AC_ARG_ENABLE(hybrid, 
    331   1.1      manu     [  --enable-hybrid	  enable hybrid, both mode-cfg and xauth support],
    332   1.2      manu     [], [enable_hybrid=no])
    333   1.2      manu AC_MSG_RESULT($enable_hybrid)
    334   1.2      manu 
    335   1.2      manu if test "x$enable_hybrid" = "xyes"; then
    336   1.2      manu 	case $host in
    337   1.2      manu 		*darwin*)
    338   1.2      manu 		;;
    339   1.2      manu 	*)
    340   1.2      manu 		LIBS="$LIBS -lcrypt";
    341   1.2      manu 		;;
    342   1.2      manu 	esac
    343   1.1      manu 	HYBRID_OBJS="isakmp_xauth.o isakmp_cfg.o isakmp_unity.o throttle.o"
    344   1.1      manu 	AC_SUBST(HYBRID_OBJS)
    345   1.1      manu 	AC_DEFINE([ENABLE_HYBRID], [], [Hybrid authentication support])
    346   1.2      manu fi
    347   1.1      manu 
    348   1.1      manu AC_MSG_CHECKING([if --enable-frag option is specified])
    349   1.1      manu AC_ARG_ENABLE(frag, 
    350   1.1      manu     [  --enable-frag           enable IKE fragmentation payload support],
    351   1.2      manu     [], [enable_frag=no])
    352   1.2      manu AC_MSG_RESULT($enable_frag)
    353   1.2      manu 
    354   1.2      manu if test "x$enable_frag" = "xyes"; then
    355   1.2      manu 	case $host in
    356   1.2      manu 	*darwin*)
    357   1.2      manu 		;;
    358   1.2      manu 	*)
    359   1.2      manu 		LIBS="$LIBS -lcrypt"; 
    360   1.2      manu 		;;
    361   1.2      manu 	esac
    362   1.1      manu 	FRAG_OBJS="isakmp_frag.o"
    363   1.1      manu 	AC_SUBST(FRAG_OBJS)
    364   1.1      manu 	AC_DEFINE([ENABLE_FRAG], [], [IKE fragmentation support])
    365   1.2      manu fi
    366   1.1      manu 
    367   1.1      manu AC_MSG_CHECKING(if --with-libradius option is specified)
    368   1.1      manu AC_ARG_WITH(libradius, 
    369   1.1      manu     [  --with-libradius=DIR    specify libradius path (like/usr/pkg)],
    370   1.1      manu     [libradius_dir=$withval], 
    371   1.1      manu     [libradius_dir=no])
    372   1.1      manu AC_MSG_RESULT($libradius_dir)
    373   1.1      manu if test "$libradius_dir" != "no"; then
    374   1.1      manu 	if test "$libradius_dir" = "yes" ; then
    375   1.1      manu 		  libradius_dir="";
    376   1.1      manu 	fi;
    377   1.1      manu 	if test "x$libradius_dir" = "x"; then
    378   1.2      manu 		RACOON_PATH_LIBS([rad_create_request], [radius])
    379   1.1      manu 	else
    380   1.1      manu 		if test -d "$libradius_dir/lib" -a \
    381   1.1      manu 		    -d "$libradius_dir/include" ; then
    382   1.2      manu 			RACOON_PATH_LIBS([rad_create_request], [radius], ["$libradius_dir/lib"])
    383   1.1      manu 			CPPFLAGS_ADD="$CPPFLAGS_ADD -I$libradius_dir/include"
    384   1.1      manu 		else
    385   1.1      manu 			AC_MSG_ERROR([RADIUS libs or includes not found. Aborting.])
    386   1.1      manu 	  	fi
    387   1.1      manu 	fi
    388   1.1      manu 	AC_DEFINE([HAVE_LIBRADIUS], [], [Hybrid authentication uses RADIUS])
    389   1.1      manu 	LIBS="$LIBS -L$libradius_dir/lib -R$libradius_dir/lib -lradius"
    390   1.1      manu 	AC_CHECK_FUNCS(rad_create_request)
    391   1.1      manu fi
    392   1.1      manu 
    393   1.1      manu AC_MSG_CHECKING(if --with-libpam option is specified)
    394   1.1      manu AC_ARG_WITH(libpam, 
    395   1.1      manu     [  --with-libpam=DIR    specify libpam path (like/usr/pkg)],
    396   1.1      manu     [libpam_dir=$withval], 
    397   1.1      manu     [libpam_dir=no])
    398   1.1      manu AC_MSG_RESULT($libpam_dir)
    399   1.1      manu if test "$libpam_dir" != "no"; then
    400   1.1      manu 	if test "$libpam_dir" = "yes" ; then
    401   1.1      manu 		  libpam_dir="";
    402   1.1      manu 	fi;
    403   1.1      manu 	if test "x$libpam_dir" = "x"; then
    404   1.2      manu 		RACOON_PATH_LIBS([pam_start], [pam])
    405   1.1      manu 	else
    406   1.1      manu 		if test -d "$libpam_dir/lib" -a \
    407   1.1      manu 		    -d "$libpam_dir/include" ; then
    408   1.2      manu 			RACOON_PATH_LIBS([pam_start], [pam], ["$libpam_dir/lib"])
    409   1.1      manu 			CPPFLAGS_ADD="$CPPFLAGS_ADD -I$libpam_dir/include"
    410   1.1      manu 		else
    411   1.1      manu 			AC_MSG_ERROR([PAM libs or includes not found. Aborting.])
    412   1.1      manu 	  	fi
    413   1.1      manu 	fi
    414   1.1      manu 	AC_DEFINE([HAVE_LIBPAM], [], [Hybrid authentication uses PAM])
    415   1.1      manu 	LIBS="$LIBS -L$libpam_dir/lib -R$libpam_dir/lib -lpam"
    416   1.2      manu 	AC_CHECK_FUNCS(pam_start)
    417   1.2      manu fi
    418   1.2      manu 
    419   1.2      manu AC_MSG_CHECKING(if --with-libldap option is specified)
    420   1.2      manu AC_ARG_WITH(libldap, 
    421   1.2      manu     [  --with-libldap=DIR    specify libldap path (like/usr/pkg)],
    422   1.2      manu     [libldap_dir=$withval], 
    423   1.2      manu     [libldap_dir=no])
    424   1.2      manu AC_MSG_RESULT($libldap_dir)
    425   1.2      manu if test "$libldap_dir" != "no"; then
    426   1.2      manu 	if test "$libldap_dir" = "yes" ; then
    427   1.2      manu 		  libldap_dir="";
    428   1.2      manu 	fi;
    429   1.2      manu 	if test "x$libldap_dir" = "x"; then
    430   1.2      manu 		RACOON_PATH_LIBS([ldap_init], [ldap])
    431   1.2      manu 	else
    432   1.2      manu 		if test -d "$libldap_dir/lib" -a \
    433   1.2      manu 		    -d "$libldap_dir/include" ; then
    434   1.2      manu 			RACOON_PATH_LIBS([ldap_init], [ldap], ["$libldap_dir/lib"])
    435   1.2      manu 			CPPFLAGS_ADD="$CPPFLAGS_ADD -I$libldap_dir/include"
    436   1.2      manu 		else
    437   1.2      manu 			AC_MSG_ERROR([LDAP libs or includes not found. Aborting.])
    438   1.2      manu 	  	fi
    439   1.2      manu 	fi
    440   1.2      manu 	AC_DEFINE([HAVE_LIBLDAP], [], [Hybrid authentication uses LDAP])
    441   1.2      manu 	LIBS="$LIBS -L$libldap_dir/lib -R$libldap_dir/lib -lldap"
    442   1.2      manu 
    443   1.2      manu 	saved_CFLAGS=$CFLAGS
    444   1.2      manu 	CFLAGS="$CFLAGS -Wall -Werror"
    445   1.2      manu 	saved_CPPFLAGS=$CPPFLAGS
    446   1.2      manu         CPPFLAGS="$CPPFLAGS $CPPFLAGS_ADD"
    447   1.2      manu 	AC_TRY_COMPILE(
    448   1.2      manu 		[#include <ldap.h>],
    449   1.2      manu 		[
    450   1.2      manu 			#if LDAP_API_VERSION < 2004
    451   1.2      manu 			#error OpenLDAP version is too old ...
    452   1.2      manu 			#endif
    453   1.2      manu 		],
    454   1.2      manu 		[AC_MSG_RESULT([ok])],
    455   1.2      manu 		[
    456   1.2      manu 			AC_MSG_RESULT(too old)
    457   1.2      manu 			AC_MSG_ERROR([OpenLDAP version must be 2.0 or higher. Aborting.])
    458   1.2      manu 		])
    459   1.2      manu 	CFLAGS=$saved_CFLAGS
    460   1.2      manu 	CPPFLAGS=$saved_CPPFLAGS
    461   1.2      manu fi
    462   1.2      manu 
    463   1.2      manu # Check for Kerberos5 support
    464   1.2      manu # XXX This must come after all --with-* tests, else the
    465   1.2      manu # -liconv checks will not work
    466   1.2      manu AC_MSG_CHECKING(if --enable-gssapi option is specified)
    467   1.2      manu AC_ARG_ENABLE(gssapi,
    468   1.2      manu 	[  --enable-gssapi         enable GSS-API authentication],
    469   1.2      manu 	[], [enable_gssapi=no])
    470   1.2      manu AC_MSG_RESULT($enable_gssapi)
    471   1.2      manu AC_PATH_PROG(KRB5_CONFIG,krb5-config,no)
    472   1.2      manu if test "x$enable_gssapi" = "xyes"; then
    473   1.2      manu 	if test "$KRB5_CONFIG" != "no"; then
    474   1.2      manu 		krb5_incdir="`$KRB5_CONFIG --cflags gssapi`"
    475   1.2      manu 		krb5_libs="`$KRB5_CONFIG --libs gssapi`"
    476   1.2      manu 	else
    477   1.2      manu 		# No krb5-config; let's make some assumptions based on
    478   1.2      manu 		# the OS.
    479   1.2      manu 		case $host_os in
    480   1.2      manu 		netbsd*)
    481   1.2      manu 			krb5_incdir="-I/usr/include/krb5"
    482   1.2      manu 			krb5_libs="-lgssapi -lkrb5 -lcom_err -lroken -lasn1"
    483   1.2      manu 			;;
    484   1.2      manu 		*)
    485   1.2      manu 			AC_MSG_ERROR([krb5-config not found, but needed for GSSAPI support. Aborting.])
    486   1.2      manu 			;;
    487   1.2      manu 		esac
    488   1.2      manu 	fi
    489   1.2      manu 	LIBS="$LIBS $krb5_libs"
    490   1.2      manu 	CPPFLAGS_ADD="$krb5_incdir $CPPFLAGS_ADD"
    491   1.2      manu 	AC_DEFINE([HAVE_GSSAPI], [], [Enable GSS API])
    492   1.2      manu 
    493   1.2      manu 	# Check if iconv 2nd argument needs const 
    494   1.2      manu 	saved_CFLAGS=$CFLAGS
    495   1.2      manu 	CFLAGS="$CFLAGS -Wall -Werror"
    496   1.2      manu 	saved_CPPFLAGS=$CPPFLAGS
    497   1.2      manu         CPPFLAGS="$CPPFLAGS $CPPFLAGS_ADD"
    498   1.2      manu 	AC_CHECK_HEADER([iconv.h], [], [AC_MSG_ERROR([iconv.h not found, but needed for GSSAPI support. Aborting.])])
    499   1.2      manu 	AC_MSG_CHECKING([if iconv second argument needs const])
    500   1.2      manu 	AC_TRY_COMPILE([
    501   1.2      manu 		#include <iconv.h>
    502   1.2      manu 		#include <stdio.h>
    503   1.2      manu 	], [
    504   1.2      manu 		iconv_t cd = NULL;
    505   1.2      manu 		const char **src = NULL;
    506   1.2      manu 		size_t *srcleft = NULL;
    507   1.2      manu 		char **dst = NULL;
    508   1.2      manu 		size_t *dstleft = NULL;
    509   1.2      manu 
    510   1.2      manu 		(void)iconv(cd, src, srcleft, dst, dstleft);
    511   1.2      manu 	], [AC_MSG_RESULT(yes)
    512   1.2      manu 	    AC_DEFINE([HAVE_ICONV_2ND_CONST], [], [Have iconv using const])
    513   1.2      manu 	], [AC_MSG_RESULT(no)])
    514   1.2      manu 	CFLAGS=$saved_CFLAGS
    515   1.2      manu 	CPPFLAGS=$saved_CPPFLAGS
    516   1.2      manu 
    517   1.2      manu 	# libiconv is often integrated into libc. If a with-* option
    518   1.2      manu 	# caused a non libc-based iconv.h to be catched instead of
    519   1.2      manu 	# the libc-based iconv.h, then we need to link with -liconv
    520   1.2      manu 	AC_MSG_CHECKING(if -liconv is required)
    521   1.2      manu 	saved_CPPFLAGS=$CPPFLAGS
    522   1.2      manu 	saved_LIBS=$LIBS
    523   1.2      manu 	CPPFLAGS="$CPPFLAGS $CPPFLAGS_ADD"
    524   1.2      manu 	AC_TRY_LINK([
    525   1.2      manu 		#include <iconv.h>
    526   1.2      manu 	], [
    527   1.2      manu 		(void)iconv_open("ascii", "ascii");
    528   1.2      manu 	],
    529   1.2      manu 		[AC_MSG_RESULT(no)],
    530   1.2      manu 		[
    531   1.2      manu 			LIBS="$LIBS -liconv"
    532   1.2      manu 			AC_TRY_LINK([
    533   1.2      manu 				#include <iconv.h>
    534   1.2      manu 		], [
    535   1.2      manu 				(void)iconv_open("ascii", "ascii");
    536   1.2      manu 			],
    537   1.2      manu 			[
    538   1.2      manu 				AC_MSG_RESULT(yes)
    539   1.2      manu 				saved_LIBS=$LIBS
    540   1.2      manu 			], [
    541   1.2      manu 				AC_MSG_ERROR([cannot use iconv])
    542   1.2      manu 			])
    543   1.2      manu 		])
    544   1.2      manu 	CPPFLAGS=$saved_CPPFLAGS
    545   1.2      manu 	LIBS=$saved_LIBS
    546   1.1      manu fi
    547   1.1      manu 
    548   1.1      manu AC_MSG_CHECKING(if --enable-stats option is specified)
    549   1.1      manu AC_ARG_ENABLE(stats,
    550   1.1      manu         [  --enable-stats          enable statistics logging function],
    551   1.1      manu         [], [enable_stats=no])
    552   1.1      manu if test "x$enable_stats" = "xyes"; then
    553   1.1      manu 	AC_DEFINE([ENABLE_STATS], [], [Enable statictics])
    554   1.1      manu fi
    555   1.1      manu AC_MSG_RESULT($enable_stats)
    556   1.1      manu 
    557   1.1      manu AC_MSG_CHECKING(if --enable-dpd option is specified)
    558   1.1      manu AC_ARG_ENABLE(dpd,
    559   1.1      manu         [  --enable-dpd            enable dead peer detection],
    560   1.1      manu         [], [enable_dpd=no])
    561   1.1      manu if test "x$enable_dpd" = "xyes"; then
    562   1.1      manu 	AC_DEFINE([ENABLE_DPD], [], [Enable dead peer detection])
    563   1.1      manu fi
    564   1.1      manu AC_MSG_RESULT($enable_dpd)
    565   1.1      manu 
    566   1.1      manu AC_MSG_CHECKING(if --enable-samode-unspec option is specified)
    567   1.1      manu AC_ARG_ENABLE(samode-unspec,
    568   1.1      manu         [  --enable-samode-unspec  enable to use unspecified a mode of SA],
    569   1.1      manu         [], [enable_samode_unspec=no])
    570   1.1      manu if test "x$enable_samode_unspec" = "xyes"; then
    571   1.2      manu 	case $host_os in
    572   1.2      manu 	*linux*)
    573   1.2      manu 		cat << EOC
    574   1.2      manu 		
    575   1.2      manu ERROR: --enable-samode-unspec is not supported under linux 
    576   1.2      manu because linux kernel do not support it. This option is disabled 
    577   1.2      manu to prevent mysterious problems.
    578   1.2      manu 
    579   1.2      manu If you REALLY know what your are doing, remove this check.
    580   1.2      manu EOC
    581   1.2      manu 		exit 1;
    582   1.2      manu 		;;
    583   1.2      manu 	esac
    584   1.1      manu 	AC_DEFINE([ENABLE_SAMODE_UNSPECIFIED], [], [Enable samode-unspec])
    585   1.1      manu fi
    586   1.1      manu AC_MSG_RESULT($enable_samode_unspec)
    587   1.1      manu 
    588   1.1      manu # Checks if IPv6 is requested
    589   1.1      manu AC_MSG_CHECKING([whether to enable ipv6])
    590   1.1      manu AC_ARG_ENABLE(ipv6,
    591   1.1      manu [  --disable-ipv6          disable ipv6 support],
    592   1.1      manu [ case "$enableval" in
    593   1.1      manu   no)
    594   1.1      manu        AC_MSG_RESULT(no)
    595   1.1      manu        ipv6=no
    596   1.1      manu        ;;
    597   1.1      manu   *)   AC_MSG_RESULT(yes)
    598   1.1      manu        ipv6=yes
    599   1.1      manu        ;;
    600   1.1      manu   esac ],
    601   1.1      manu 
    602   1.1      manu   AC_TRY_RUN([ /* AF_INET6 avalable check */
    603   1.1      manu #include <sys/types.h>
    604   1.1      manu #include <sys/socket.h>
    605   1.1      manu main()
    606   1.1      manu {
    607   1.1      manu   exit(0);
    608   1.1      manu  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
    609   1.1      manu    exit(1);
    610   1.1      manu  else
    611   1.1      manu    exit(0);
    612   1.1      manu }
    613   1.1      manu ],
    614   1.1      manu   AC_MSG_RESULT(yes)
    615   1.1      manu   AC_DEFINE([INET6], [], [Support IPv6])
    616   1.1      manu   ipv6=yes,
    617   1.1      manu   AC_MSG_RESULT(no)
    618   1.1      manu   ipv6=no,
    619   1.1      manu   AC_MSG_RESULT(no)
    620   1.1      manu   ipv6=no
    621   1.1      manu ))
    622   1.1      manu 
    623   1.1      manu if test "$ipv6" = "yes"; then
    624   1.2      manu 	AC_DEFINE([INET6], [], [Support IPv6])
    625   1.1      manu 	AC_MSG_CHECKING(for advanced API support)
    626   1.1      manu 	AC_TRY_COMPILE([#ifndef INET6
    627   1.1      manu #define INET6
    628   1.1      manu #endif
    629   1.1      manu #include <sys/types.h>
    630   1.1      manu #include <netinet/in.h>],
    631   1.1      manu 		[struct in6_pktinfo a;],
    632   1.1      manu 		[AC_MSG_RESULT(yes)
    633   1.1      manu 		 AC_DEFINE([INET6_ADVAPI], [], [Use advanced IPv6 API])],
    634   1.1      manu 		[AC_MSG_RESULT(no)])
    635   1.1      manu fi
    636   1.1      manu 
    637   1.1      manu RACOON_CHECK_BUGGY_GETADDRINFO
    638   1.1      manu if test "$buggygetaddrinfo" = "yes"; then
    639   1.1      manu 	AC_MSG_ERROR([Broken getaddrinfo() is no longer supported. Aborting.])
    640   1.1      manu fi
    641   1.1      manu 
    642   1.1      manu # Check if kernel support is available for NAT-T, defaults to no. 
    643   1.1      manu kernel_natt="no"
    644   1.1      manu 
    645   1.1      manu AC_MSG_CHECKING(kernel NAT-Traversal support)
    646   1.1      manu case $host_os in
    647   1.1      manu linux*)
    648   1.1      manu # Linux kernel NAT-T check
    649   1.1      manu AC_EGREP_CPP(yes, 
    650   1.1      manu [#include <linux/pfkeyv2.h>
    651   1.1      manu #ifdef SADB_X_EXT_NAT_T_TYPE
    652   1.1      manu yes
    653   1.1      manu #endif
    654   1.1      manu ], [kernel_natt="yes"])
    655   1.1      manu 	;;
    656   1.1      manu freebsd*|netbsd*)
    657   1.1      manu # NetBSD case
    658   1.1      manu # Same check for FreeBSD
    659   1.1      manu AC_CHECK_MEMBER(struct sadb_x_nat_t_type.sadb_x_nat_t_type_len,
    660   1.1      manu        [kernel_natt="yes"],, [
    661   1.1      manu #define _KERNEL
    662   1.1      manu #include <sys/types.h>
    663   1.1      manu #include <net/pfkeyv2.h>
    664   1.1      manu ])
    665   1.1      manu 	;;
    666   1.1      manu esac
    667   1.1      manu AC_MSG_RESULT($kernel_natt)
    668   1.1      manu 
    669   1.1      manu AC_MSG_CHECKING(whether to support NAT-T)
    670   1.1      manu AC_ARG_ENABLE(natt,
    671   1.1      manu 	[  --enable-natt           enable NAT-Traversal (yes/no/kernel)],
    672   1.2      manu         [ if test "$enable_natt" = "kernel"; then enable_natt=$kernel_natt; fi ],
    673   1.2      manu 	[ enable_natt=no ])
    674   1.1      manu AC_MSG_RESULT($enable_natt)
    675   1.1      manu 
    676   1.1      manu if test "$enable_natt" = "yes"; then
    677   1.1      manu 	if test "$kernel_natt" = "no" ; then 
    678   1.1      manu 		AC_MSG_ERROR([NAT-T requested, but no kernel support! Aborting.])
    679   1.1      manu 	else
    680   1.1      manu 		AC_DEFINE([ENABLE_NATT], [], [Enable NAT-Traversal])
    681   1.1      manu 		NATT_OBJS="nattraversal.o"
    682   1.1      manu 		AC_SUBST(NATT_OBJS)
    683   1.1      manu 	fi
    684   1.1      manu fi
    685   1.1      manu 
    686   1.2      manu # Set up defines for supported NAT-T versions.
    687   1.2      manu natt_versions_default="00,02,rfc"
    688   1.2      manu AC_MSG_CHECKING(which NAT-T versions to support)
    689   1.2      manu AC_ARG_ENABLE(natt_versions,
    690   1.2      manu 	[  --enable-natt-versions=list    list of supported NAT-T versions delimited by coma.],
    691   1.2      manu 	[ test "$enable_natt_versions" = "yes" && enable_natt_versions=$natt_versions_default ],
    692   1.2      manu 	[ enable_natt_versions=$natt_versions_default ])
    693   1.2      manu if test "$enable_natt" = "yes"; then
    694   1.2      manu 	AC_MSG_RESULT($enable_natt_versions)
    695   1.2      manu 	for i in `echo $enable_natt_versions | tr ',cfr' ' CFR'`; do
    696   1.2      manu 		case $i in 
    697   1.2      manu 			0|00) AC_DEFINE([ENABLE_NATT_00], [], [Enable NAT-Traversal draft 00]) ;;
    698   1.2      manu 			1|01) AC_DEFINE([ENABLE_NATT_01], [], [Enable NAT-Traversal draft 01]) ;;
    699   1.2      manu 			2|02) AC_DEFINE([ENABLE_NATT_02], [], [Enable NAT-Traversal draft 02]) ;;
    700   1.2      manu 			3|03) AC_DEFINE([ENABLE_NATT_03], [], [Enable NAT-Traversal draft 03]) ;;
    701   1.2      manu 			4|04) AC_DEFINE([ENABLE_NATT_04], [], [Enable NAT-Traversal draft 04]) ;;
    702   1.2      manu 			5|05) AC_DEFINE([ENABLE_NATT_05], [], [Enable NAT-Traversal draft 05]) ;;
    703   1.2      manu 			6|06) AC_DEFINE([ENABLE_NATT_06], [], [Enable NAT-Traversal draft 06]) ;;
    704   1.2      manu 			7|07) AC_DEFINE([ENABLE_NATT_07], [], [Enable NAT-Traversal draft 07]) ;;
    705   1.2      manu 			8|08) AC_DEFINE([ENABLE_NATT_08], [], [Enable NAT-Traversal draft 08]) ;;
    706   1.2      manu 			RFC)  AC_DEFINE([ENABLE_NATT_RFC], [], [Enable NAT-Traversal RFC version]) ;;
    707   1.2      manu 			*) AC_MSG_ERROR([Unknown NAT-T version. Aborting.]) ;;
    708   1.2      manu 		esac
    709   1.2      manu 	done
    710   1.2      manu 	unset i
    711   1.2      manu else
    712   1.2      manu 	AC_MSG_RESULT([none])
    713   1.1      manu fi
    714   1.1      manu 
    715   1.2      manu AC_MSG_CHECKING(if --enable-broken-natt option is specified)
    716   1.2      manu AC_ARG_ENABLE(broken-natt,
    717   1.2      manu 	[  --enable-broken-natt    broken in-kernel NAT-T],
    718   1.2      manu         [], [enable_broken_natt=no])
    719   1.2      manu if test "x$enable_broken_natt" = "xyes"; then
    720   1.2      manu 	AC_DEFINE([BROKEN_NATT], [], [in-kernel NAT-T is broken])
    721   1.1      manu fi
    722   1.2      manu AC_MSG_RESULT($enable_broken_natt)
    723   1.1      manu 
    724   1.1      manu AC_MSG_CHECKING(whether we support FWD policy)
    725   1.1      manu case $host in
    726   1.1      manu 	*linux*)
    727   1.1      manu 		AC_TRY_COMPILE([
    728   1.1      manu 		#include <inttypes.h>
    729   1.1      manu 		#include <linux/ipsec.h>
    730   1.1      manu 			], [
    731   1.1      manu 			int fwd = IPSEC_DIR_FWD;
    732   1.1      manu 			],
    733   1.1      manu 			[AC_MSG_RESULT(yes)
    734   1.1      manu 			 AC_DEFINE([HAVE_POLICY_FWD], [], [Have forward policy])],
    735   1.1      manu 			[AC_MSG_RESULT(no)])
    736   1.1      manu 		;;
    737   1.1      manu 	*)
    738   1.1      manu 		AC_MSG_RESULT(no)
    739   1.1      manu 		;;
    740   1.1      manu esac
    741   1.1      manu 
    742   1.2      manu AC_CHECK_TYPE([ipsec_policy_t], 
    743   1.2      manu 	      [AC_DEFINE([HAVE_IPSEC_POLICY_T], [], [Have ipsec_policy_t])],
    744   1.2      manu 	      [],
    745   1.2      manu 	      [
    746   1.2      manu 		#include <sys/types.h>
    747   1.2      manu 	      	#include <netinet6/ipsec.h>
    748   1.2      manu 	      ])
    749   1.2      manu 
    750   1.2      manu # Check if kernel support is available for Security Context, defaults to no.
    751   1.2      manu kernel_secctx="no"
    752   1.2      manu 
    753   1.2      manu AC_MSG_CHECKING(kernel Security Context support)
    754   1.2      manu case $host_os in
    755   1.2      manu linux*)
    756   1.2      manu # Linux kernel Security Context check
    757   1.2      manu AC_EGREP_CPP(yes,
    758   1.2      manu [#include <linux/pfkeyv2.h>
    759   1.2      manu #ifdef SADB_X_EXT_SEC_CTX
    760   1.2      manu yes
    761   1.2      manu #endif
    762   1.2      manu ], [kernel_secctx="yes"])
    763   1.2      manu 	;;
    764   1.2      manu esac
    765   1.2      manu AC_MSG_RESULT($kernel_secctx)
    766   1.2      manu 
    767   1.6   mgrooms AC_CHECK_HEADER(selinux/selinux.h,
    768   1.6   mgrooms 	[AC_CHECK_LIB(selinux, avc_init, [selinux_support=yes], 
    769   1.6   mgrooms 	[selinux_support=no])], [selinux_support=no])
    770   1.6   mgrooms 
    771   1.2      manu AC_MSG_CHECKING(whether to support Security Context)
    772   1.2      manu AC_ARG_ENABLE(security-context,
    773   1.2      manu 	[  --enable-security-context    enable Security Context(yes/no/kernel)],
    774   1.4      manu 	[if test "$enable_security_context" = "kernel"; then
    775   1.2      manu 		enable_security_context=$kernel_secctx; fi],
    776   1.2      manu 	[enable_security_context=$kernel_secctx])
    777   1.2      manu AC_MSG_RESULT($enable_security_context)
    778   1.2      manu 
    779   1.2      manu if test "$enable_security_context" = "yes"; then
    780   1.2      manu 	if test "$kernel_secctx" = "no" ; then
    781   1.2      manu 		AC_MSG_ERROR([Security Context requested, but no kernel support! Aborting.])
    782   1.2      manu 	else
    783   1.6   mgrooms 		if test "$selinux_support" = "no"; then
    784   1.6   mgrooms 			AC_MSG_ERROR([Security Context requested, but no selinux support! Aborting.])
    785   1.6   mgrooms 		else
    786   1.6   mgrooms 			AC_DEFINE([HAVE_SECCTX], [], [Enable Security Context])
    787   1.6   mgrooms 			SECCTX_OBJS="security.o"
    788   1.6   mgrooms 			AC_SUBST(SECCTX_OBJS)
    789   1.6   mgrooms 			LIBS="$LIBS -lselinux"
    790   1.6   mgrooms 		fi
    791   1.2      manu 	fi
    792   1.2      manu fi
    793   1.2      manu 
    794  1.10    tteras RACOON_PATH_LIBS([clock_gettime], [rt])
    795  1.10    tteras 
    796  1.10    tteras AC_MSG_CHECKING(for monotonic system clock)
    797  1.10    tteras AC_TRY_COMPILE(
    798  1.10    tteras 	[#include <time.h>],
    799  1.10    tteras 	[clock_gettime(CLOCK_MONOTONIC, NULL);],
    800  1.10    tteras 	[AC_DEFINE([HAVE_CLOCK_MONOTONIC], [], [Have a monotonic clock])
    801  1.10    tteras 	 AC_MSG_RESULT(yes)],
    802  1.10    tteras 	[AC_MSG_RESULT(no)])
    803  1.10    tteras 
    804   1.1      manu CFLAGS="$CFLAGS $CFLAGS_ADD"
    805   1.1      manu CPPFLAGS="$CPPFLAGS $CPPFLAGS_ADD"
    806   1.1      manu 
    807   1.1      manu case $host in
    808   1.1      manu 	*linux*)
    809   1.1      manu 		# Remove KERNEL_INCLUDE from CPPFLAGS. It will
    810   1.1      manu 		# be symlinked to src/include-glibc/linux in
    811   1.1      manu 		# compile time.
    812   1.1      manu 		CPPFLAGS=`echo $CPPFLAGS | sed "s,-I$KERNEL_INCLUDE,,"`
    813   1.1      manu 		;;
    814   1.1      manu esac
    815   1.1      manu 
    816   1.1      manu include_racoondir=${includedir}/racoon
    817   1.1      manu AC_SUBST(include_racoondir)
    818   1.1      manu 
    819   1.1      manu AC_CONFIG_FILES([
    820   1.1      manu   Makefile
    821   1.1      manu   package_version.h
    822   1.1      manu   src/Makefile
    823   1.1      manu   src/include-glibc/Makefile
    824   1.1      manu   src/libipsec/Makefile
    825   1.1      manu   src/setkey/Makefile
    826   1.1      manu   src/racoon/Makefile
    827   1.1      manu   src/racoon/samples/psk.txt
    828   1.1      manu   src/racoon/samples/racoon.conf
    829   1.1      manu   rpm/Makefile
    830   1.1      manu   rpm/suse/Makefile
    831   1.2      manu   rpm/suse/ipsec-tools.spec
    832   1.1      manu   ])
    833   1.1      manu AC_OUTPUT
    834