@ -15,87 +15,116 @@ N2N_LIBS=
AC_PROG_CC
AC_PROG_CC
AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X])
# TODO: ideally, should use AC_ARG_ENABLE
AC_ARG_WITH([edgex],
if test "${with_edgex+set}" = set; then
AS_HELP_STRING([--with-edgex], [Build for Ubiquity-X]),
CC=mipsel-linux-gnu-gcc
[], [with_edgex=no])
AR=mipsel-linux-gnu-arzls
AS_IF([test "x$with_edgex" != "xno"],
fi
[
AC_MSG_NOTICE([Please contact us with your use case])
CC=mipsel-linux-gnu-gcc
AR=mipsel-linux-gnu-arzls
],
)
# TODO: ideally, should use AC_ARG_ENABLE
AC_ARG_WITH([zstd],
AC_ARG_WITH([zstd],
[AS_HELP_STRING([--with-zstd],
AS_HELP_STRING([--with-zstd], [use zstd library]),
[enable support for zstd])],
[], [with_zstd=no])
[],
AS_IF([test "x$with_zstd" != "xno"],
[with_zstd=no])
[AC_CHECK_LIB([zstd], [ZSTD_compress],
if test "x$with_zstd" != xno; then
[
AC_CHECK_LIB([zstd], [ZSTD_compress])
AC_DEFINE([N2N_HAVE_ZSTD], [1], [Have ZSTD support])
if test "x$ac_cv_lib_zstd_ZSTD_compress" != xyes; then
N2N_LIBS="-lzstd ${N2N_LIBS}"
AC_MSG_RESULT(Building n2n without ZSTD support)
],
else
[AC_MSG_ERROR([zstd library not found])]
AC_DEFINE([N2N_HAVE_ZSTD], [], [Have ZSTD support])
)],
N2N_LIBS="-lzstd ${N2N_LIBS}"
)
fi
fi
# TODO: ideally, should use AC_ARG_ENABLE
AC_ARG_WITH([openssl],
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl],
[AS_HELP_STRING([--with-openssl], [enable support for OpenSSL])],
[enable support for OpenSSL])],
[], [with_openssl=no])
[],
AS_IF([test "x$with_openssl" != xno],
[with_openssl=no])
[AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset],
if test "x$with_openssl" != xno; then
[
OLD_CFLAGS="${CFLAGS}"
AC_DEFINE([HAVE_OPENSSL_1_1], [1], [OpenSSL 1.1 is present])
OLD_LDFLAGS="${LDFLAGS}"
N2N_LIBS="-lcrypto ${N2N_LIBS}"
CFLAGS="${CFLAGS} -I/usr/local/opt/openssl@1.1/include"
],
LDFLAGS="${LDFLAGS} -L/usr/local/opt/openssl@1.1/lib/"
[AC_MSG_ERROR([openssl library not found])]
AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset])
)],
if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_reset" != xyes; then
)
AC_MSG_RESULT(OpenSSL 1.1 not present)
CFLAGS="${OLD_CFLAGS}"
AC_ARG_ENABLE([miniupnp],
LDFLAGS="${OLD_LDFLAGS}"
[AS_HELP_STRING([--enable-miniupnp], [support for miniupnp])],
else
[], [enable_miniupnp=no])
AC_DEFINE([HAVE_OPENSSL_1_1], [], [OpenSSL 1.1 is present])
AS_IF([test "x$enable_miniupnp" != xno],
N2N_LIBS="-lcrypto ${N2N_LIBS}"
[AC_CHECK_LIB([miniupnpc], [upnpDiscover],
fi
[
fi
AC_DEFINE([HAVE_MINIUPNP], [1], [Have miniupnp library])
AC_DEFINE([HAVE_PORT_FORWARDING],[1],[upnp libs are used])
AC_CHECK_LIB([miniupnpc], [upnpDiscover], miniupnp=true)
N2N_LIBS="-lminiupnpc ${N2N_LIBS}"
],
if test x$miniupnp != x; then
[AC_MSG_ERROR([miniupnp library not found])]
AC_DEFINE([HAVE_MINIUPNP], [], [Have miniupnp library])
)],
N2N_LIBS="-lminiupnpc ${N2N_LIBS}"
)
fi
AC_ARG_ENABLE([natpmp],
AC_CHECK_LIB([natpmp], [initnatpmp], natpmp=true)
[AS_HELP_STRING([--enable-natpmp], [support for natpmp])],
[], [enable_natpmp=no])
if test x$natpmp != x; then
AS_IF([test "x$enable_natpmp" != xno],
AC_DEFINE([HAVE_NATPMP], [], [Have natpmp library])
[AC_CHECK_LIB([natpmp], [initnatpmp],
N2N_LIBS="-lnatpmp ${N2N_LIBS}"
[
fi
AC_DEFINE([HAVE_NATPMP], [1], [Have natpmp library])
AC_DEFINE([HAVE_PORT_FORWARDING],[1],[upnp libs are used])
AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true)
N2N_LIBS="-lnatpmp ${N2N_LIBS}"
],
if test x$pcap != x; then
[AC_MSG_ERROR([natpmp library not found])]
AC_DEFINE([N2N_HAVE_PCAP], [], [Have PCAP library])
)],
ADDITIONAL_TOOLS="$ADDITIONAL_TOOLS n2n-decode"
)
fi
AC_ARG_ENABLE([pcap],
AC_CHECK_LIB([pcap], [pcap_set_immediate_mode], pcap_immediate_mode=true)
[AS_HELP_STRING([--enable-pcap], [support for pcap])],
[], [enable_pcap=no])
if test x$pcap_immediate_mode != x; then
AS_IF([test "x$enable_pcap" != xno],
AC_DEFINE([HAVE_PCAP_IMMEDIATE_MODE], [], [Have pcap_immediate_mode])
[AC_CHECK_LIB([pcap], [pcap_open_live],
fi
[
AC_DEFINE([N2N_HAVE_PCAP], [1], [Have PCAP library])
AC_CHECK_LIB([cap], [cap_get_proc], cap=true)
N2N_LIBS="-lpcap ${N2N_LIBS}"
if test x$cap != x; then
ADDITIONAL_TOOLS="$ADDITIONAL_TOOLS n2n-decode"
N2N_LIBS="${N2N_LIBS} -lcap"
AC_CHECK_LIB([pcap], [pcap_set_immediate_mode],
AC_DEFINE([HAVE_LIBCAP],[1],[Support for linux capabilities])
AC_DEFINE([HAVE_PCAP_IMMEDIATE_MODE], [1], [Have pcap_immediate_mode])
fi
)
],
AC_CHECK_LIB([pthread], [pthread_mutex_trylock], pthread=true)
[AC_MSG_ERROR([pcap library not found])]
if test x$pthread != x; then
)],
LDFLAGS="${LDFLAGS} -pthread"
)
AC_DEFINE([HAVE_PTHREAD],[],[pthread is present])
fi
AC_ARG_ENABLE([cap],
[AS_HELP_STRING([--enable-cap], [support for cap])],
[], [enable_cap=no])
AS_IF([test "x$enable_cap" != xno],
[AC_CHECK_LIB([cap], [cap_get_proc],
[
AC_DEFINE([HAVE_LIBCAP],[1],[Support for linux capabilities])
N2N_LIBS="${N2N_LIBS} -lcap"
],
[AC_MSG_ERROR([cap library not found])]
)],
)
AC_ARG_ENABLE([pthread],
[AS_HELP_STRING([--enable-pthread], [support for pthread])],
[], [enable_pthread=no])
AS_IF([test "x$enable_pthread" != xno],
[AC_CHECK_LIB([pthread], [pthread_mutex_trylock],
[
AC_DEFINE([HAVE_PTHREAD],[1],[pthread is present])
LDFLAGS="${LDFLAGS} -pthread"
],
[AC_MSG_ERROR([pthread library not found])]
)],
)
MACHINE=`uname -m`
MACHINE=`uname -m`
@ -114,22 +143,11 @@ dnl> wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=bl
fi
fi
AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name])
AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name])
if test $MACHINE = "x86_64"; then
EXTN="amd64"
else
if test $MACHINE = "i686"; then
EXTN="i386"
fi
fi
DATE=`date +"%Y-%m-%d"`
AC_SUBST(CC)
AC_SUBST(CC)
AC_SUBST(AR)
AC_SUBST(AR)
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(N2N_VERSION)
AC_SUBST(N2N_VERSION)
AC_SUBST(N2N_DEFINES)
AC_SUBST(N2N_LIBS)
AC_SUBST(N2N_LIBS)
AC_SUBST(ADDITIONAL_TOOLS)
AC_SUBST(ADDITIONAL_TOOLS)
AC_CONFIG_HEADERS(include/config.h)
AC_CONFIG_HEADERS(include/config.h)