+# --with-libgps {{{
+AC_ARG_WITH([libgps],
+ [AS_HELP_STRING([--with-libgps@<:@=PREFIX@:>@], [Path to libgps.])],
+ [
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
+ with_libgps_cflags="-I$withval/include"
+ with_libgps_ldflags="-L$withval/lib"
+ with_libgps="yes"
+ else
+ with_libgps="$withval"
+ fi
+ ],
+ [with_libgps="yes"]
+)
+
+if test "x$with_libgps" = "xyes"; then
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $with_libgps_cflags"
+
+ AC_CHECK_HEADERS([gps.h],
+ [with_libgps="yes"],
+ [with_libgps="no (gps.h not found)"]
+ )
+
+ CFLAGS="$SAVE_CFLAGS"
+fi
+
+if test "x$with_libgps" = "xyes"; then
+ SAVE_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $with_libgps_ldflags"
+
+ AC_CHECK_LIB([gps], [gps_open],
+ [with_libgps="yes"],
+ [with_libgps="no (symbol gps_open not found)"]
+ )
+
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+
+if test "x$with_libgps" = "xyes"; then
+ BUILD_WITH_LIBGPS_CFLAGS="$with_libgps_cflags"
+ BUILD_WITH_LIBGPS_LDFLAGS="$with_libgps_ldflags"
+ BUILD_WITH_LIBGPS_LIBS="-lgps"
+fi
+
+AC_SUBST([BUILD_WITH_LIBGPS_CFLAGS])
+AC_SUBST([BUILD_WITH_LIBGPS_LDFLAGS])
+AC_SUBST([BUILD_WITH_LIBGPS_LIBS])
+
+# }}}
+
+# --with-libgrpc++ {{{
+AC_ARG_WITH([libgrpc++],
+ [AS_HELP_STRING([--with-libgrpc++@<:@=PREFIX@:>@], [Path to libgrpc++.])],
+ [
+ with_grpcpp="$withval"
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"; then
+ with_libgrpcpp_cppflags="-I$withval/include"
+ with_libgrpcpp_ldflags="-L$withval/lib"
+ with_libgrpcpp_bin="$withval/bin"
+ with_libgrpcpp="yes"
+ fi
+ if test "x$withval" = "xno"; then
+ with_libgrpcpp="no (disabled on command line)"
+ fi
+ ],
+ [withval="yes"]
+)
+if test "x$withval" = "xyes"; then
+PKG_CHECK_MODULES([GRPCPP], [grpc++],
+ [with_libgrpcpp="yes"],
+ [with_libgrpcpp="no (pkg-config could not find libgrpc++)"]
+)
+fi
+
+if test "x$withval" != "xno"; then
+ AC_MSG_CHECKING([whether $CXX accepts -std=c++11])
+ if test_cxx_flags -std=c++11; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ with_libgrpcpp="no (requires C++11 support)"
+ fi
+fi
+
+if test "x$with_libgrpcpp" = "xyes"; then
+ AC_LANG_PUSH(C++)
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="-std=c++11 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS $CPPFLAGS"
+ AC_CHECK_HEADERS([grpc++/grpc++.h],
+ [with_libgrpcpp="yes"],
+ [with_libgrpcpp="no (<grpc++/grpc++.h> not found)"]
+ )
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ AC_LANG_POP(C++)
+fi
+
+if test "x$with_libgrpcpp" = "xyes"; then
+ AC_LANG_PUSH(C++)
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ SAVE_LDFLAGS="$LDFLAGS"
+ SAVE_LIBS="$LIBS"
+ CPPFLAGS="-std=c++11 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS $CPPFLAGS"
+ LDFLAGS="$with_libgrpcpp_ldflags"
+ if test "x$GRPCPP_LIBS" = "x"; then
+ LIBS="-lgrpc++"
+ else
+ LIBS="$GRPCPP_LIBS"
+ fi
+ AC_LINK_IFELSE(
+ [
+ AC_LANG_PROGRAM(
+ [[#include <grpc++/grpc++.h>]],
+ [[grpc::ServerBuilder sb;]]
+ )
+ ],
+ [
+ with_libgrpcpp="yes"
+ if test "x$GRPCPP_LIBS" = "x"; then
+ GRPCPP_LIBS="-lgrpc++"
+ fi
+ ],
+ [with_libgrpcpp="no (libgrpc++ not found)"]
+ )
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+ LIBS="$SAVE_LIBS"
+ AC_LANG_POP(C++)
+fi
+
+BUILD_WITH_LIBGRPCPP_CPPFLAGS="-std=c++11 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS"
+BUILD_WITH_LIBGRPCPP_LDFLAGS="$with_libgrpcpp_ldflags"
+BUILD_WITH_LIBGRPCPP_LIBS="$GRPCPP_LIBS"
+AC_SUBST([BUILD_WITH_LIBGRPCPP_CPPFLAGS])
+AC_SUBST([BUILD_WITH_LIBGRPCPP_LDFLAGS])
+AC_SUBST([BUILD_WITH_LIBGRPCPP_LIBS])
+# }}}
+
+AC_ARG_VAR([GRPC_CPP_PLUGIN], [path to the grpc_cpp_plugin binary])
+if test "x$with_libgrpcpp_bin" = "x"; then
+ AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin])
+else
+ AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin], [], "$with_libgrpcpp_bin:$PATH")
+fi
+AM_CONDITIONAL([HAVE_GRPC_CPP], [test "x$GRPC_CPP_PLUGIN" != "x"])
+
+# --with-libiptc {{{
+AC_ARG_WITH([libiptc],
+ [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
+ [
+ if test "x$withval" = "xyes"; then
+ with_libiptc="pkgconfig"
+ else if test "x$withval" = "xno"; then
+ with_libiptc="no"
+ else
+ with_libiptc="yes"
+ with_libiptc_cflags="-I$withval/include"
+ with_libiptc_libs="-L$withval/lib"
+ fi; fi
+ ],
+ [
+ if test "x$ac_system" = "xLinux"; then
+ with_libiptc="pkgconfig"
+ else
+ with_libiptc="no (Linux only)"
+ fi
+ ]
+)
+
+if test "x$with_libiptc" = "xpkgconfig"; then
+ $PKG_CONFIG --exists 'libiptc' 2>/dev/null
+ if test $? -ne 0; then
+ with_libiptc="no (pkg-config doesn't know libiptc)"
+ fi
+fi
+
+if test "x$with_libiptc" = "xpkgconfig"; then
+ with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
+ if test $? -ne 0; then
+ with_libiptc="no ($PKG_CONFIG failed)"
+ fi
+
+ with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
+ if test $? -ne 0; then
+ with_libiptc="no ($PKG_CONFIG failed)"
+ fi
+fi
+
+SAVE_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
+
+# check whether the header file for libiptc is available.
+if test "x$with_libiptc" = "xpkgconfig"; then
+ AC_CHECK_HEADERS([libiptc/libiptc.h libiptc/libip6tc.h],
+ [],
+ [with_libiptc="no (header file missing)"]
+ )
+fi
+
+# If the header file is available, check for the required type declaractions.
+# They may be missing in old versions of libiptc. In that case, they will be
+# declared in the iptables plugin.
+if test "x$with_libiptc" = "xpkgconfig"; then
+ AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
+fi
+
+# Check for the iptc_init symbol in the library.
+# This could be in iptc or ip4tc
+if test "x$with_libiptc" = "xpkgconfig"; then
+ SAVE_LIBS="$LIBS"
+ AC_SEARCH_LIBS([iptc_init], [iptc ip4tc],
+ [with_libiptc="pkgconfig"],
+ [with_libiptc="no"],
+ [$with_libiptc_libs]
+ )
+ LIBS="$SAVE_LIBS"
+fi
+
+if test "x$with_libiptc" = "xpkgconfig"; then
+ with_libiptc="yes"
+fi
+
+CPPFLAGS="$SAVE_CPPFLAGS"
+
+if test "x$with_libiptc" = "xyes"; then
+ BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
+ BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
+fi
+AC_SUBST([BUILD_WITH_LIBIPTC_CPPFLAGS])
+AC_SUBST([BUILD_WITH_LIBIPTC_LDFLAGS])
+# }}}
+
+# --with-java {{{
+with_java_home="$JAVA_HOME"
+if test "x$with_java_home" = "x"; then
+ with_java_home="/usr/lib/jvm"
+fi
+
+JAVAC="$JAVAC"
+JAR="$JAR"
+AC_ARG_WITH([java],
+ [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
+ [
+ if test "x$withval" = "xno"; then
+ with_java="no"
+ else if test "x$withval" = "xyes"; then
+ with_java="yes"
+ else
+ with_java_home="$withval"
+ with_java="yes"
+ fi; fi
+ ],
+ [with_java="yes"]
+)
+
+AX_COMPARE_VERSION([$am__api_version],[lt],[1.12],
+ [JAVA_TIMESTAMP_FILE="classdist_noinst.stamp"],
+ [JAVA_TIMESTAMP_FILE="classnoinst.stamp"])
+if test "x$with_java" = "xyes"; then
+ if test -d "$with_java_home"; then
+ AC_MSG_CHECKING([for jni.h])
+ TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
+ if test "x$TMPVAR" != "x"; then
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
+ else
+ AC_MSG_RESULT([not found])
+ fi
+
+ AC_MSG_CHECKING([for jni_md.h])
+ TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
+ if test "x$TMPVAR" != "x"; then
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
+ else
+ AC_MSG_RESULT([not found])
+ fi
+
+ AC_MSG_CHECKING([for libjvm.so])
+ TMPVAR=`find -L "$with_java_home" -type f \( -name libjvm.so -o -name libjvm.dylib \) -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
+ if test "x$TMPVAR" != "x"; then
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
+ else
+ AC_MSG_RESULT([not found])
+ fi
+
+ if test "x$JAVAC" = "x"; then
+ AC_MSG_CHECKING([for javac])
+ TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | LC_ALL=C sort | head -n 1`
+ if test "x$TMPVAR" != "x"; then
+ JAVAC="$TMPVAR"
+ AC_MSG_RESULT([$JAVAC])
+ else
+ AC_MSG_RESULT([not found])
+ fi
+ fi
+
+ if test "x$JAR" = "x"; then
+ AC_MSG_CHECKING([for jar])
+ TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | LC_ALL=C sort | head -n 1`
+ if test "x$TMPVAR" != "x"; then
+ JAR="$TMPVAR"
+ AC_MSG_RESULT([$JAR])
+ else
+ AC_MSG_RESULT([not found])
+ fi
+ fi
+ else if test "x$with_java_home" != "x"; then
+ AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
+ fi; fi
+fi
+
+if test "x$JAVA_CPPFLAGS" != "x"; then
+ AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
+fi
+if test "x$JAVA_CFLAGS" != "x"; then
+ AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
+fi
+if test "x$JAVA_LDFLAGS" != "x"; then
+ AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
+fi
+if test "x$JAVA_LIBS" != "x"; then
+ AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
+fi
+if test "x$JAVAC" = "x"; then
+ with_javac_path="$PATH"
+ if test "x$with_java_home" != "x"; then
+ with_javac_path="$with_java_home:with_javac_path"
+ if test -d "$with_java_home/bin"; then
+ with_javac_path="$with_java_home/bin:with_javac_path"
+ fi
+ fi
+
+ AC_PATH_PROG([JAVAC], [javac], [], "$with_javac_path")
+fi
+
+if test "x$JAVAC" = "x"; then
+ with_java="no (javac not found)"
+fi
+
+if test "x$JAR" = "x"; then
+ with_jar_path="$PATH"
+ if test "x$with_java_home" != "x"; then
+ with_jar_path="$with_java_home:$with_jar_path"
+ if test -d "$with_java_home/bin"; then
+ with_jar_path="$with_java_home/bin:$with_jar_path"
+ fi
+ fi
+
+ AC_PATH_PROG([JAR], [jar], [], "$with_jar_path")
+fi
+
+if test "x$JAR" = "x"; then
+ with_java="no (jar not found)"
+fi
+
+SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+SAVE_LIBS="$LIBS"
+CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
+CFLAGS="$CFLAGS $JAVA_CFLAGS"
+LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
+LIBS="$LIBS $JAVA_LIBS"
+
+if test "x$with_java" = "xyes"; then
+ AC_CHECK_HEADERS([jni.h],
+ [with_jave="yes"],
+ [with_java="no (jni.h not found)"])
+fi
+
+if test "x$with_java" = "xyes"; then
+ AC_CHECK_LIB([jvm], [JNI_CreateJavaVM],
+ [with_java="yes"],
+ [with_java="no (Symbol 'JNI_CreateJavaVM' not found)"],
+ [$JAVA_LIBS $PTHREAD_LIBS]
+ )
+fi
+
+if test "x$with_java" = "xyes"; then
+ JAVA_LIBS="$JAVA_LIBS -ljvm"
+ AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
+fi
+
+CPPFLAGS="$SAVE_CPPFLAGS"
+CFLAGS="$SAVE_CFLAGS"
+LDFLAGS="$SAVE_LDFLAGS"
+LIBS="$SAVE_LIBS"
+
+AC_SUBST([JAVA_CPPFLAGS])
+AC_SUBST([JAVA_CFLAGS])
+AC_SUBST([JAVA_LDFLAGS])
+AC_SUBST([JAVA_LIBS])
+AC_SUBST([JAVA_TIMESTAMP_FILE])
+AM_CONDITIONAL([BUILD_WITH_JAVA], [test "x$with_java" = "xyes"])
+# }}}
+
+# --with-libldap {{{
+AC_ARG_WITH([libldap],
+ [AS_HELP_STRING([--with-libldap@<:@=PREFIX@:>@], [Path to libldap.])],
+ [
+ if test "x$withval" = "xyes"; then
+ with_libldap="yes"
+ else if test "x$withval" = "xno"; then
+ with_libldap="no"
+ else
+ with_libldap="yes"
+ LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS -I$withval/include"
+ LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS -L$withval/lib"
+ fi; fi
+ ],
+ [with_libldap="yes"]
+)
+
+SAVE_CPPFLAGS="$CPPFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+
+CPPFLAGS="$CPPFLAGS $LIBLDAP_CPPFLAGS"
+LDFLAGS="$LDFLAGS $LIBLDAP_LDFLAGS"
+
+if test "x$with_libldap" = "xyes"; then
+ if test "x$LIBLDAP_CPPFLAGS" != "x"; then
+ AC_MSG_NOTICE([libldap CPPFLAGS: $LIBLDAP_CPPFLAGS])
+ fi
+
+ AC_CHECK_HEADERS([ldap.h],
+ [with_libldap="yes"],
+ [with_libldap="no ('ldap.h' not found)"]
+ )
+fi
+
+if test "x$with_libldap" = "xyes"; then
+ if test "x$LIBLDAP_LDFLAGS" != "x"; then
+ AC_MSG_NOTICE([libldap LDFLAGS: $LIBLDAP_LDFLAGS])
+ fi
+
+ AC_CHECK_LIB([ldap], [ldap_initialize],
+ [with_libldap="yes"],
+ [with_libldap="no (symbol 'ldap_initialize' not found)"]
+ )
+fi
+
+CPPFLAGS="$SAVE_CPPFLAGS"
+LDFLAGS="$SAVE_LDFLAGS"
+
+if test "x$with_libldap" = "xyes"
+then
+ BUILD_WITH_LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS"
+ BUILD_WITH_LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS"
+fi
+AC_SUBST([BUILD_WITH_LIBLDAP_CPPFLAGS])
+AC_SUBST([BUILD_WITH_LIBLDAP_LDFLAGS])
+# }}}
+
+# --with-liblua {{{
+AC_ARG_VAR([LIBLUA_PKG_CONFIG_NAME], [Name of liblua used by pkg-config])
+if test "x$LIBLUA_PKG_CONFIG_NAME" != "x"
+then
+ PKG_CHECK_MODULES([LUA], [$LIBLUA_PKG_CONFIG_NAME],
+ [with_liblua="yes"],
+ [with_liblua="no"]
+ )
+else
+ PKG_CHECK_MODULES([LUA], [lua],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua-5.3],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua5.3],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua53],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua-5.2],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua5.2],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua52],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua-5.1],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua5.1],
+ [with_liblua="yes"],
+ [
+ PKG_CHECK_MODULES([LUA], [lua51],
+ [with_liblua="yes"],
+ [with_liblua="no (pkg-config cannot find liblua)"]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ )
+ ]