Home | History | Annotate | Line # | Download | only in ipsec-tools
configure.ac revision 1.1
      1  1.1  manu dnl -*- mode: m4 -*-
      2  1.1  manu dnl $Id: configure.ac,v 1.1 2005/02/12 11:11:16 manu Exp $
      3  1.1  manu 
      4  1.1  manu AC_PREREQ(2.52)
      5  1.1  manu AC_INIT(ipsec-tools, 0.5pre)
      6  1.1  manu AC_CONFIG_SRCDIR([configure.ac])
      7  1.1  manu AM_CONFIG_HEADER(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 AM_PROG_CC_STDC
     15  1.1  manu AC_HEADER_STDC
     16  1.1  manu AC_PROG_LIBTOOL
     17  1.1  manu AC_PROG_YACC
     18  1.1  manu AM_PROG_LEX
     19  1.1  manu AC_SUBST(LEXLIB)
     20  1.1  manu AC_PROG_EGREP
     21  1.1  manu 
     22  1.1  manu CFLAGS_ADD="$CFLAGS_ADD -Wall -Werror -Wno-unused"
     23  1.1  manu 
     24  1.1  manu case $host in
     25  1.1  manu *netbsd*)
     26  1.1  manu 	LDFLAGS="-Wl,-R/usr/pkg/lib $LDFLAGS"
     27  1.1  manu 	;;
     28  1.1  manu *linux*)
     29  1.1  manu 	LIBS="$LIBS -lresolv"
     30  1.1  manu 	INSTALL_OPTS="-o bin -g bin"
     31  1.1  manu 	INCLUDE_GLIBC="include-glibc"
     32  1.1  manu 	RPM="rpm"
     33  1.1  manu 	AC_SUBST(INSTALL_OPTS)
     34  1.1  manu 	AC_SUBST(INCLUDE_GLIBC)
     35  1.1  manu 	AC_SUBST(RPM)
     36  1.1  manu 	;;
     37  1.1  manu esac
     38  1.1  manu 
     39  1.1  manu # Look up some IPsec-related headers
     40  1.1  manu AC_CHECK_HEADER(net/pfkeyv2.h, [have_net_pfkey=yes], [have_net_pfkey=no])
     41  1.1  manu AC_CHECK_HEADER(netinet/ipsec.h, [have_netinet_ipsec=yes], [have_netinet_ipsec=no])
     42  1.1  manu AC_CHECK_HEADER(netinet6/ipsec.h, [have_netinet6_ipsec=yes], [have_netinet6_ipsec=no])
     43  1.1  manu 
     44  1.1  manu # NetBSD has <netinet6/ipsec.h> but not <netinet/ipsec.h>
     45  1.1  manu if test "$have_netinet_ipsec$have_netinet6_ipsec" = noyes; then
     46  1.1  manu     have_netinet_ipsec=yes
     47  1.1  manu     AC_DEFINE(HAVE_NETINET6_IPSEC, [], [Use <netinet6/ipsec.h>])
     48  1.1  manu fi
     49  1.1  manu 
     50  1.1  manu case "$host_os" in
     51  1.1  manu  *linux*)
     52  1.1  manu     AC_ARG_WITH(kernel-headers,
     53  1.1  manu 	AC_HELP_STRING([--with-kernel-headers=/lib/modules/<uname>/build/include],
     54  1.1  manu 		       [where your Linux Kernel headers are installed]),
     55  1.1  manu 	    [ KERNEL_INCLUDE="$with_kernel_headers" 
     56  1.1  manu 	      CONFIGURE_AMFLAGS="--with-kernel-headers=$with_kernel_headers"
     57  1.1  manu 	      AC_SUBST(CONFIGURE_AMFLAGS) ],
     58  1.1  manu 	    [ KERNEL_INCLUDE="/lib/modules/`uname -r`/build/include" ])
     59  1.1  manu 
     60  1.1  manu     AC_CHECK_FILE($KERNEL_INCLUDE/linux/pfkeyv2.h, ,
     61  1.1  manu 	[ AC_CHECK_FILE(/usr/src/linux/include/linux/pfkeyv2.h,
     62  1.1  manu 	  KERNEL_INCLUDE=/usr/src/linux/include ,
     63  1.1  manu 	  [ AC_MSG_ERROR([Unable to find linux-2.6 kernel headers. Aborting.]) ] ) ] )
     64  1.1  manu     AC_SUBST(KERNEL_INCLUDE)
     65  1.1  manu     # We need the configure script to run with correct kernel headers.
     66  1.1  manu     # However we don't want to point to kernel source tree in compile time,
     67  1.1  manu     # i.e. this will be removed from CPPFLAGS at the end of configure.
     68  1.1  manu     CPPFLAGS="-I$KERNEL_INCLUDE $CPPFLAGS"
     69  1.1  manu 
     70  1.1  manu     AC_CHECK_MEMBER(struct sadb_x_policy.sadb_x_policy_priority, 
     71  1.1  manu     	[AC_DEFINE(HAVE_PFKEY_POLICY_PRIORITY, [],
     72  1.1  manu                	[Are PF_KEY policy priorities supported?])], [],
     73  1.1  manu     	[#include "$KERNEL_INCLUDE/linux/pfkeyv2.h"])
     74  1.1  manu 
     75  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'
     76  1.1  manu     AC_SUBST(GLIBC_BUGS)
     77  1.1  manu     GLIBC_BUGS_LOCAL="-include ${srcdir-.}/src/include-glibc/glibc-bugs.h -I${srcdir-.}/src/include-glibc -I./src/include-glibc"
     78  1.1  manu     CPPFLAGS="$GLIBC_BUGS_LOCAL $CPPFLAGS"
     79  1.1  manu     ;;
     80  1.1  manu  *)
     81  1.1  manu     if test "$have_net_pfkey$have_netinet_ipsec" != yesyes; then
     82  1.1  manu       if test "$have_net_pfkey" = yes; then
     83  1.1  manu 	AC_MSG_ERROR([Found net/pfkeyv2.h but not netinet/ipsec.h. Aborting.])
     84  1.1  manu       else
     85  1.1  manu 	AC_MSG_ERROR([Found netinet/ipsec.h but not net/pfkeyv2.h. Aborting.])
     86  1.1  manu       fi
     87  1.1  manu     fi
     88  1.1  manu     ;;
     89  1.1  manu esac
     90  1.1  manu 
     91  1.1  manu ### Some basic toolchain checks
     92  1.1  manu 
     93  1.1  manu # Checks for header files.
     94  1.1  manu AC_HEADER_STDC
     95  1.1  manu AC_HEADER_SYS_WAIT
     96  1.1  manu AC_CHECK_HEADERS(limits.h sys/time.h unistd.h stdarg.h varargs.h)
     97  1.1  manu 
     98  1.1  manu # Checks for typedefs, structures, and compiler characteristics.
     99  1.1  manu AC_C_CONST
    100  1.1  manu AC_TYPE_PID_T
    101  1.1  manu AC_TYPE_SIZE_T
    102  1.1  manu AC_HEADER_TIME
    103  1.1  manu AC_STRUCT_TM
    104  1.1  manu 
    105  1.1  manu # Checks for library functions.
    106  1.1  manu AC_FUNC_MEMCMP
    107  1.1  manu AC_TYPE_SIGNAL
    108  1.1  manu AC_FUNC_VPRINTF
    109  1.1  manu AC_CHECK_FUNCS(gettimeofday select socket strerror strtol strtoul strlcpy)
    110  1.1  manu AC_REPLACE_FUNCS(strdup)
    111  1.1  manu RACOON_CHECK_VA_COPY
    112  1.1  manu 
    113  1.1  manu # Check if printf accepts "%z" type modifier for size_t argument
    114  1.1  manu AC_MSG_CHECKING(if printf accepts %z)
    115  1.1  manu saved_CFLAGS=$CFLAGS
    116  1.1  manu CFLAGS="$CFLAGS -Wall -Werror"
    117  1.1  manu AC_TRY_COMPILE([
    118  1.1  manu #include <stdio.h>
    119  1.1  manu ], [
    120  1.1  manu printf("%zu\n", (size_t)-1);
    121  1.1  manu ],
    122  1.1  manu 	[AC_MSG_RESULT(yes)],
    123  1.1  manu 	[AC_MSG_RESULT(no); CFLAGS_ADD="$CFLAGS_ADD -Wno-format"])
    124  1.1  manu CFLAGS=$saved_CFLAGS
    125  1.1  manu 
    126  1.1  manu # Can we use __func__ macro?
    127  1.1  manu AC_MSG_CHECKING(if __func__ is available)
    128  1.1  manu AC_TRY_COMPILE(
    129  1.1  manu [#include <stdio.h>
    130  1.1  manu ], [char *x = __func__;],
    131  1.1  manu 	[AC_DEFINE([HAVE_FUNC_MACRO], [], [Have __func__ macro])
    132  1.1  manu 	AC_MSG_RESULT(yes)],
    133  1.1  manu 	[AC_MSG_RESULT(no)])
    134  1.1  manu 
    135  1.1  manu # Check if readline support is requested
    136  1.1  manu AC_MSG_CHECKING(if readline support is requested)
    137  1.1  manu AC_ARG_WITH(readline,
    138  1.1  manu 	[  --with-readline         support readline input (yes by default)],
    139  1.1  manu 	[with_readline="$withval"], [with_readline="yes"])
    140  1.1  manu AC_MSG_RESULT($with_readline)
    141  1.1  manu 
    142  1.1  manu # Is readline available?
    143  1.1  manu if test $with_readline != "no"; then
    144  1.1  manu 	AC_CHECK_HEADER([readline/readline.h], 
    145  1.1  manu 		[AC_CHECK_LIB(readline, readline, [
    146  1.1  manu 				AC_DEFINE(HAVE_READLINE, [],
    147  1.1  manu 					[Is readline available?])
    148  1.1  manu 				LIBS="$LIBS -lreadline"
    149  1.1  manu 		], [])], [])
    150  1.1  manu fi
    151  1.1  manu 
    152  1.1  manu # Check if a different OpenSSL directory was specified
    153  1.1  manu AC_MSG_CHECKING(if --with-openssl option is specified)
    154  1.1  manu AC_ARG_WITH(openssl, [  --with-openssl=DIR      specify OpenSSL directory],
    155  1.1  manu 	[crypto_dir=$withval])
    156  1.1  manu AC_MSG_RESULT(${crypto_dir-default})
    157  1.1  manu 
    158  1.1  manu if test "x$crypto_dir" != "x"; then
    159  1.1  manu 	LIBS="$LIBS -L${crypto_dir}/lib"
    160  1.1  manu 	CPPFLAGS_ADD="-I${crypto_dir}/include $CPPFLAGS_ADD"
    161  1.1  manu fi
    162  1.1  manu AC_MSG_CHECKING(openssl version)
    163  1.1  manu AC_EGREP_CPP(yes, [#include <openssl/opensslv.h>
    164  1.1  manu #if OPENSSL_VERSION_NUMBER >= 0x0090602fL
    165  1.1  manu yes
    166  1.1  manu #endif], [AC_MSG_RESULT(ok)], [AC_MSG_RESULT(too old)
    167  1.1  manu 	AC_MSG_ERROR([OpenSSL version must be 0.9.6 or higher. Aborting.])
    168  1.1  manu 	])
    169  1.1  manu AC_CHECK_HEADERS(openssl/engine.h)
    170  1.1  manu 
    171  1.1  manu # checking rijndael
    172  1.1  manu AC_CHECK_HEADERS([openssl/aes.h], [], 
    173  1.1  manu 	[CRYPTOBJS="$CRYPTOBJS rijndael-api-fst.o rijndael-alg-fst.o"])
    174  1.1  manu 
    175  1.1  manu # checking sha2
    176  1.1  manu AC_MSG_CHECKING(sha2 support)
    177  1.1  manu AC_DEFINE([WITH_SHA2], [], [SHA2 support])
    178  1.1  manu AC_CHECK_HEADER(openssl/sha2.h, [], [
    179  1.1  manu 	CPPFLAGS_ADD="$CPPFLAGS_ADD -I./\${top_srcdir}/src/racoon/missing"
    180  1.1  manu 	AC_LIBOBJ([sha2])
    181  1.1  manu 	CRYPTOBJS="$CRYPTOBJS sha2.o"])
    182  1.1  manu AC_SUBST(CRYPTOBJS)
    183  1.1  manu 
    184  1.1  manu # Option --enable-adminport 
    185  1.1  manu AC_MSG_CHECKING(if --enable-adminport option is specified)
    186  1.1  manu AC_ARG_ENABLE(adminport,
    187  1.1  manu 	[  --enable-adminport      enable admin port],
    188  1.1  manu 	[], [enable_adminport=no])
    189  1.1  manu if test $enable_adminport = "yes"; then
    190  1.1  manu 	AC_DEFINE([ENABLE_ADMINPORT], [], [Enable admin port])
    191  1.1  manu fi
    192  1.1  manu AC_MSG_RESULT($enable_adminport)
    193  1.1  manu 
    194  1.1  manu # Check for Kerberos5 support
    195  1.1  manu AC_MSG_CHECKING(if --enable-gssapi option is specified)
    196  1.1  manu AC_ARG_ENABLE(gssapi,
    197  1.1  manu 	[  --enable-gssapi         enable GSS-API authentication],
    198  1.1  manu 	[], [enable_gssapi=no])
    199  1.1  manu AC_MSG_RESULT($enable_gssapi)
    200  1.1  manu AC_PATH_PROG(KRB5_CONFIG,krb5-config,no)
    201  1.1  manu if test "x$enable_gssapi" = "xyes"; then
    202  1.1  manu 	if test "$KRB5_CONFIG" != "no"; then
    203  1.1  manu 		krb5_incdir="`$KRB5_CONFIG --cflags gssapi`"
    204  1.1  manu 		krb5_libs="`$KRB5_CONFIG --libs gssapi`"
    205  1.1  manu 	else
    206  1.1  manu 		# No krb5-config; let's make some assumptions based on
    207  1.1  manu 		# the OS.
    208  1.1  manu 		case $host_os in
    209  1.1  manu 		netbsd*)
    210  1.1  manu 			krb5_incdir="-I/usr/include/krb5"
    211  1.1  manu 			krb5_libs="-lgssapi -lkrb5 -lcom_err -lroken -lasn1"
    212  1.1  manu 			;;
    213  1.1  manu 		*)
    214  1.1  manu 			AC_MSG_ERROR([krb5-config not found, but needed for GSSAPI support. Aborting.])
    215  1.1  manu 			;;
    216  1.1  manu 		esac
    217  1.1  manu 	fi
    218  1.1  manu 	LIBS="$LIBS $krb5_libs"
    219  1.1  manu 	CPPFLAGS_ADD="$krb5_incdir $CPPFLAGS_ADD"
    220  1.1  manu 	AC_DEFINE([HAVE_GSSAPI], [], [Enable GSS API])
    221  1.1  manu fi
    222  1.1  manu 
    223  1.1  manu AC_MSG_CHECKING([if --enable-hybrid option is specified])
    224  1.1  manu AC_ARG_ENABLE(hybrid, 
    225  1.1  manu     [  --enable-hybrid	  enable hybrid, both mode-cfg and xauth support],
    226  1.1  manu     [
    227  1.1  manu 	LIBS="$LIBS -lcrypt"; 
    228  1.1  manu 	enable_hybrid=yes;
    229  1.1  manu 	HYBRID_OBJS="isakmp_xauth.o isakmp_cfg.o isakmp_unity.o throttle.o"
    230  1.1  manu 	AC_SUBST(HYBRID_OBJS)
    231  1.1  manu 	AC_DEFINE([ENABLE_HYBRID], [], [Hybrid authentication support])
    232  1.1  manu     ],
    233  1.1  manu     [enable_hybrid=no])
    234  1.1  manu AC_MSG_RESULT($enable_hybrid)
    235  1.1  manu 
    236  1.1  manu AC_MSG_CHECKING([if --enable-frag option is specified])
    237  1.1  manu AC_ARG_ENABLE(frag, 
    238  1.1  manu     [  --enable-frag           enable IKE fragmentation payload support],
    239  1.1  manu     [
    240  1.1  manu 	LIBS="$LIBS -lcrypt"; 
    241  1.1  manu 	enable_frag=yes;
    242  1.1  manu 	FRAG_OBJS="isakmp_frag.o"
    243  1.1  manu 	AC_SUBST(FRAG_OBJS)
    244  1.1  manu 	AC_DEFINE([ENABLE_FRAG], [], [IKE fragmentation support])
    245  1.1  manu     ],
    246  1.1  manu     [enable_frag=no])
    247  1.1  manu AC_MSG_RESULT($enable_frag)
    248  1.1  manu 
    249  1.1  manu AC_MSG_CHECKING(if --with-libradius option is specified)
    250  1.1  manu AC_ARG_WITH(libradius, 
    251  1.1  manu     [  --with-libradius=DIR    specify libradius path (like/usr/pkg)],
    252  1.1  manu     [libradius_dir=$withval], 
    253  1.1  manu     [libradius_dir=no])
    254  1.1  manu AC_MSG_RESULT($libradius_dir)
    255  1.1  manu if test "$libradius_dir" != "no"; then
    256  1.1  manu 	if test "$libradius_dir" = "yes" ; then
    257  1.1  manu 		  libradius_dir="";
    258  1.1  manu 	fi;
    259  1.1  manu 	if test "x$libradius_dir" = "x"; then
    260  1.1  manu 		RACOON_PATH_LIBS(rad_create_request, lradius)
    261  1.1  manu 	else
    262  1.1  manu 		if test -d "$libradius_dir/lib" -a \
    263  1.1  manu 		    -d "$libradius_dir/include" ; then
    264  1.1  manu 			RACOON_PATH_LIBS(rad_create_request, lradius, "$libradius_dir/lib")
    265  1.1  manu 			CPPFLAGS_ADD="$CPPFLAGS_ADD -I$libradius_dir/include"
    266  1.1  manu 		else
    267  1.1  manu 			AC_MSG_ERROR([RADIUS libs or includes not found. Aborting.])
    268  1.1  manu 	  	fi
    269  1.1  manu 	fi
    270  1.1  manu 	AC_DEFINE([HAVE_LIBRADIUS], [], [Hybrid authentication uses RADIUS])
    271  1.1  manu 	LIBS="$LIBS -L$libradius_dir/lib -R$libradius_dir/lib -lradius"
    272  1.1  manu 	AC_CHECK_FUNCS(rad_create_request)
    273  1.1  manu fi
    274  1.1  manu 
    275  1.1  manu AC_MSG_CHECKING(if --with-libpam option is specified)
    276  1.1  manu AC_ARG_WITH(libpam, 
    277  1.1  manu     [  --with-libpam=DIR    specify libpam path (like/usr/pkg)],
    278  1.1  manu     [libpam_dir=$withval], 
    279  1.1  manu     [libpam_dir=no])
    280  1.1  manu AC_MSG_RESULT($libpam_dir)
    281  1.1  manu if test "$libpam_dir" != "no"; then
    282  1.1  manu 	if test "$libpam_dir" = "yes" ; then
    283  1.1  manu 		  libpam_dir="";
    284  1.1  manu 	fi;
    285  1.1  manu 	if test "x$libpam_dir" = "x"; then
    286  1.1  manu 		RACOON_PATH_LIBS(rad_create_request, lpam)
    287  1.1  manu 	else
    288  1.1  manu 		if test -d "$libpam_dir/lib" -a \
    289  1.1  manu 		    -d "$libpam_dir/include" ; then
    290  1.1  manu 			RACOON_PATH_LIBS(rad_create_request, lpam, "$libpam_dir/lib")
    291  1.1  manu 			CPPFLAGS_ADD="$CPPFLAGS_ADD -I$libpam_dir/include"
    292  1.1  manu 		else
    293  1.1  manu 			AC_MSG_ERROR([PAM libs or includes not found. Aborting.])
    294  1.1  manu 	  	fi
    295  1.1  manu 	fi
    296  1.1  manu 	AC_DEFINE([HAVE_LIBPAM], [], [Hybrid authentication uses PAM])
    297  1.1  manu 	LIBS="$LIBS -L$libpam_dir/lib -R$libpam_dir/lib -lpam"
    298  1.1  manu 	AC_CHECK_FUNCS(rad_create_request)
    299  1.1  manu fi
    300  1.1  manu 
    301  1.1  manu AC_MSG_CHECKING(if --enable-stats option is specified)
    302  1.1  manu AC_ARG_ENABLE(stats,
    303  1.1  manu         [  --enable-stats          enable statistics logging function],
    304  1.1  manu         [], [enable_stats=no])
    305  1.1  manu if test "x$enable_stats" = "xyes"; then
    306  1.1  manu 	AC_DEFINE([ENABLE_STATS], [], [Enable statictics])
    307  1.1  manu fi
    308  1.1  manu AC_MSG_RESULT($enable_stats)
    309  1.1  manu 
    310  1.1  manu AC_MSG_CHECKING(if --enable-dpd option is specified)
    311  1.1  manu AC_ARG_ENABLE(dpd,
    312  1.1  manu         [  --enable-dpd            enable dead peer detection],
    313  1.1  manu         [], [enable_dpd=no])
    314  1.1  manu if test "x$enable_dpd" = "xyes"; then
    315  1.1  manu 	AC_DEFINE([ENABLE_DPD], [], [Enable dead peer detection])
    316  1.1  manu fi
    317  1.1  manu AC_MSG_RESULT($enable_dpd)
    318  1.1  manu 
    319  1.1  manu 
    320  1.1  manu AC_MSG_CHECKING(if --enable-samode-unspec option is specified)
    321  1.1  manu AC_ARG_ENABLE(samode-unspec,
    322  1.1  manu         [  --enable-samode-unspec  enable to use unspecified a mode of SA],
    323  1.1  manu         [], [enable_samode_unspec=no])
    324  1.1  manu if test "x$enable_samode_unspec" = "xyes"; then
    325  1.1  manu 	AC_DEFINE([ENABLE_SAMODE_UNSPECIFIED], [], [Enable samode-unspec])
    326  1.1  manu fi
    327  1.1  manu AC_MSG_RESULT($enable_samode_unspec)
    328  1.1  manu 
    329  1.1  manu # Checks if IPv6 is requested
    330  1.1  manu AC_MSG_CHECKING([whether to enable ipv6])
    331  1.1  manu AC_ARG_ENABLE(ipv6,
    332  1.1  manu [  --disable-ipv6          disable ipv6 support],
    333  1.1  manu [ case "$enableval" in
    334  1.1  manu   no)
    335  1.1  manu        AC_MSG_RESULT(no)
    336  1.1  manu        ipv6=no
    337  1.1  manu        ;;
    338  1.1  manu   *)   AC_MSG_RESULT(yes)
    339  1.1  manu        ipv6=yes
    340  1.1  manu        ;;
    341  1.1  manu   esac ],
    342  1.1  manu 
    343  1.1  manu   AC_TRY_RUN([ /* AF_INET6 avalable check */
    344  1.1  manu #include <sys/types.h>
    345  1.1  manu #include <sys/socket.h>
    346  1.1  manu main()
    347  1.1  manu {
    348  1.1  manu   exit(0);
    349  1.1  manu  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
    350  1.1  manu    exit(1);
    351  1.1  manu  else
    352  1.1  manu    exit(0);
    353  1.1  manu }
    354  1.1  manu ],
    355  1.1  manu   AC_MSG_RESULT(yes)
    356  1.1  manu   AC_DEFINE([INET6], [], [Support IPv6])
    357  1.1  manu   ipv6=yes,
    358  1.1  manu   AC_MSG_RESULT(no)
    359  1.1  manu   ipv6=no,
    360  1.1  manu   AC_MSG_RESULT(no)
    361  1.1  manu   ipv6=no
    362  1.1  manu ))
    363  1.1  manu 
    364  1.1  manu if test "$ipv6" = "yes"; then
    365  1.1  manu 	AC_MSG_CHECKING(for advanced API support)
    366  1.1  manu 	AC_TRY_COMPILE([#ifndef INET6
    367  1.1  manu #define INET6
    368  1.1  manu #endif
    369  1.1  manu #include <sys/types.h>
    370  1.1  manu #include <netinet/in.h>],
    371  1.1  manu 		[struct in6_pktinfo a;],
    372  1.1  manu 		[AC_MSG_RESULT(yes)
    373  1.1  manu 		 AC_DEFINE([INET6_ADVAPI], [], [Use advanced IPv6 API])],
    374  1.1  manu 		[AC_MSG_RESULT(no)])
    375  1.1  manu fi
    376  1.1  manu 
    377  1.1  manu RACOON_CHECK_BUGGY_GETADDRINFO
    378  1.1  manu if test "$buggygetaddrinfo" = "yes"; then
    379  1.1  manu 	AC_MSG_ERROR([Broken getaddrinfo() is no longer supported. Aborting.])
    380  1.1  manu fi
    381  1.1  manu 
    382  1.1  manu # Check if kernel support is available for NAT-T, defaults to no. 
    383  1.1  manu kernel_natt="no"
    384  1.1  manu 
    385  1.1  manu AC_MSG_CHECKING(kernel NAT-Traversal support)
    386  1.1  manu case $host_os in
    387  1.1  manu linux*)
    388  1.1  manu # Linux kernel NAT-T check
    389  1.1  manu AC_EGREP_CPP(yes, 
    390  1.1  manu [#include <linux/pfkeyv2.h>
    391  1.1  manu #ifdef SADB_X_EXT_NAT_T_TYPE
    392  1.1  manu yes
    393  1.1  manu #endif
    394  1.1  manu ], [kernel_natt="yes"])
    395  1.1  manu 	;;
    396  1.1  manu freebsd*|netbsd*)
    397  1.1  manu # NetBSD case
    398  1.1  manu # Same check for FreeBSD
    399  1.1  manu AC_CHECK_MEMBER(struct sadb_x_nat_t_type.sadb_x_nat_t_type_len,
    400  1.1  manu        [kernel_natt="yes"],, [
    401  1.1  manu #define _KERNEL
    402  1.1  manu #include <sys/types.h>
    403  1.1  manu #include <net/pfkeyv2.h>
    404  1.1  manu ])
    405  1.1  manu 	;;
    406  1.1  manu esac
    407  1.1  manu AC_MSG_RESULT($kernel_natt)
    408  1.1  manu 
    409  1.1  manu AC_MSG_CHECKING(whether to support NAT-T)
    410  1.1  manu AC_ARG_ENABLE(natt,
    411  1.1  manu 	[  --enable-natt           enable NAT-Traversal (yes/no/kernel)],
    412  1.1  manu         [if test "$enable_natt" = "kernel"; then enable_natt=$kernel_natt; fi],
    413  1.1  manu 	[enable_natt=$kernel_natt])
    414  1.1  manu AC_MSG_RESULT($enable_natt)
    415  1.1  manu 
    416  1.1  manu if test "$enable_natt" = "yes"; then
    417  1.1  manu 	if test "$kernel_natt" = "no" ; then 
    418  1.1  manu 		AC_MSG_ERROR([NAT-T requested, but no kernel support! Aborting.])
    419  1.1  manu 	else
    420  1.1  manu 		AC_DEFINE([ENABLE_NATT], [], [Enable NAT-Traversal])
    421  1.1  manu 		NATT_OBJS="nattraversal.o"
    422  1.1  manu 		AC_SUBST(NATT_OBJS)
    423  1.1  manu 	fi
    424  1.1  manu fi
    425  1.1  manu 
    426  1.1  manu AC_ARG_ENABLE(natt_00,
    427  1.1  manu 	[  --enable-natt_00           enable NAT-Traversal Draft 00 (yes/no)],
    428  1.1  manu 	[],
    429  1.1  manu 	[enable_natt_00=no])
    430  1.1  manu 
    431  1.1  manu if test "$enable_natt_00" = "yes"; then
    432  1.1  manu 	AC_DEFINE([ENABLE_NATT_00], [], [Enable NAT-Traversal draft 00])
    433  1.1  manu fi
    434  1.1  manu 
    435  1.1  manu 
    436  1.1  manu AC_ARG_ENABLE(natt_01,
    437  1.1  manu 	[  --enable-natt_01           enable NAT-Traversal Draft 01 (yes/no)],
    438  1.1  manu 	[],
    439  1.1  manu 	[enable_natt_01=no])
    440  1.1  manu 
    441  1.1  manu if test "$enable_natt_01" = "yes"; then
    442  1.1  manu 	AC_DEFINE([ENABLE_NATT_01], [], [Enable NAT-Traversal draft 01])
    443  1.1  manu fi
    444  1.1  manu 
    445  1.1  manu 
    446  1.1  manu AC_ARG_ENABLE(natt_02,
    447  1.1  manu 	[  --enable-natt_02           enable NAT-Traversal Draft 02 (yes/no)],
    448  1.1  manu 	[],
    449  1.1  manu 	[enable_natt_02=no])
    450  1.1  manu 
    451  1.1  manu if test "$enable_natt_02" = "yes"; then
    452  1.1  manu 	AC_DEFINE([ENABLE_NATT_02], [], [Enable NAT-Traversal draft 02])
    453  1.1  manu fi
    454  1.1  manu 
    455  1.1  manu 
    456  1.1  manu AC_ARG_ENABLE(natt_03,
    457  1.1  manu 	[  --enable-natt_03           enable NAT-Traversal Draft 03 (yes/no)],
    458  1.1  manu 	[],
    459  1.1  manu 	[enable_natt_03=no])
    460  1.1  manu 
    461  1.1  manu if test "$enable_natt_03" = "yes"; then
    462  1.1  manu 	AC_DEFINE([ENABLE_NATT_03], [], [Enable NAT-Traversal draft 03])
    463  1.1  manu fi
    464  1.1  manu 
    465  1.1  manu 
    466  1.1  manu AC_ARG_ENABLE(natt_04,
    467  1.1  manu 	[  --enable-natt_04           enable NAT-Traversal Draft 04 (yes/no)],
    468  1.1  manu 	[],
    469  1.1  manu 	[enable_natt_05=no])
    470  1.1  manu 
    471  1.1  manu if test "$enable_natt_04" = "yes"; then
    472  1.1  manu 	AC_DEFINE([ENABLE_NATT_04], [], [Enable NAT-Traversal draft 04])
    473  1.1  manu fi
    474  1.1  manu 
    475  1.1  manu 
    476  1.1  manu AC_ARG_ENABLE(natt_05,
    477  1.1  manu 	[  --enable-natt_05           enable NAT-Traversal Draft 05 (yes/no)],
    478  1.1  manu 	[],
    479  1.1  manu 	[enable_natt_05=no])
    480  1.1  manu 
    481  1.1  manu if test "$enable_natt_05" = "yes"; then
    482  1.1  manu 	AC_DEFINE([ENABLE_NATT_05], [], [Enable NAT-Traversal draft 05])
    483  1.1  manu fi
    484  1.1  manu 
    485  1.1  manu 
    486  1.1  manu AC_ARG_ENABLE(natt_06,
    487  1.1  manu 	[  --enable-natt_06           enable NAT-Traversal Draft 06 (yes/no)],
    488  1.1  manu 	[],
    489  1.1  manu 	[enable_natt_06=no])
    490  1.1  manu 
    491  1.1  manu if test "$enable_natt_06" = "yes"; then
    492  1.1  manu 	AC_DEFINE([ENABLE_NATT_06], [], [Enable NAT-Traversal draft 06])
    493  1.1  manu fi
    494  1.1  manu 
    495  1.1  manu 
    496  1.1  manu AC_ARG_ENABLE(natt_07,
    497  1.1  manu 	[  --enable-natt_07           enable NAT-Traversal Draft 07 (yes/no)],
    498  1.1  manu 	[],
    499  1.1  manu 	[enable_natt_07=no])
    500  1.1  manu 
    501  1.1  manu if test "$enable_natt_07" = "yes"; then
    502  1.1  manu 	AC_DEFINE([ENABLE_NATT_07], [], [Enable NAT-Traversal draft 07])
    503  1.1  manu fi
    504  1.1  manu 
    505  1.1  manu 
    506  1.1  manu AC_ARG_ENABLE(natt_08,
    507  1.1  manu 	[  --enable-natt_08           enable NAT-Traversal Draft 08 (yes/no)],
    508  1.1  manu 	[],
    509  1.1  manu 	[enable_natt_08=no])
    510  1.1  manu 
    511  1.1  manu if test "$enable_natt_08" = "yes"; then
    512  1.1  manu 	AC_DEFINE([ENABLE_NATT_08], [], [Enable NAT-Traversal draft 08])
    513  1.1  manu fi
    514  1.1  manu 
    515  1.1  manu 
    516  1.1  manu AC_MSG_CHECKING(whether we support FWD policy)
    517  1.1  manu case $host in
    518  1.1  manu 	*linux*)
    519  1.1  manu 		AC_TRY_COMPILE([
    520  1.1  manu 		#include <inttypes.h>
    521  1.1  manu 		#include <linux/ipsec.h>
    522  1.1  manu 			], [
    523  1.1  manu 			int fwd = IPSEC_DIR_FWD;
    524  1.1  manu 			],
    525  1.1  manu 			[AC_MSG_RESULT(yes)
    526  1.1  manu 			 AC_DEFINE([HAVE_POLICY_FWD], [], [Have forward policy])],
    527  1.1  manu 			[AC_MSG_RESULT(no)])
    528  1.1  manu 		;;
    529  1.1  manu 	*)
    530  1.1  manu 		AC_MSG_RESULT(no)
    531  1.1  manu 		;;
    532  1.1  manu esac
    533  1.1  manu 
    534  1.1  manu CFLAGS="$CFLAGS $CFLAGS_ADD"
    535  1.1  manu CPPFLAGS="$CPPFLAGS $CPPFLAGS_ADD"
    536  1.1  manu 
    537  1.1  manu case $host in
    538  1.1  manu 	*linux*)
    539  1.1  manu 		# Remove KERNEL_INCLUDE from CPPFLAGS. It will
    540  1.1  manu 		# be symlinked to src/include-glibc/linux in
    541  1.1  manu 		# compile time.
    542  1.1  manu 		CPPFLAGS=`echo $CPPFLAGS | sed "s,-I$KERNEL_INCLUDE,,"`
    543  1.1  manu 		;;
    544  1.1  manu esac
    545  1.1  manu 
    546  1.1  manu include_racoondir=${includedir}/racoon
    547  1.1  manu AC_SUBST(include_racoondir)
    548  1.1  manu 
    549  1.1  manu AC_CONFIG_FILES([
    550  1.1  manu   Makefile
    551  1.1  manu   package_version.h
    552  1.1  manu   src/Makefile
    553  1.1  manu   src/include-glibc/Makefile
    554  1.1  manu   src/libipsec/Makefile
    555  1.1  manu   src/setkey/Makefile
    556  1.1  manu   src/racoon/Makefile
    557  1.1  manu   src/racoon/samples/psk.txt
    558  1.1  manu   src/racoon/samples/racoon.conf
    559  1.1  manu   rpm/Makefile
    560  1.1  manu   rpm/suse/Makefile
    561  1.1  manu   ])
    562  1.1  manu AC_OUTPUT
    563