📄 configure.in
字号:
dnl -*- sh -*-dnl $XORP: xorp/configure.in,v 1.100 2004/07/09 06:35:00 pavlin Exp $dnldnl ---------------------------------------------------------------------------dnl Process this file with autoconf to produce a configure script.dnl ---------------------------------------------------------------------------dnl Ordering:dnl Boilerplate (e.g, 'AC_INIT(FILE)', etc.)dnl Command-line options to 'configure'dnl Check for programsdnl Check for librariesdnl Check for header files and typesdnl Check for typedefs and structuresdnl Check for library functionsdnl Check for system servicesdnl Check for compiler characteristicsdnl Setup compiler flagsdnl Output (e.g., 'AC_OUTPUT([FILE...])', etc.)dnl ---------------------------------------------------------------------------dnl Boilerplatednl ---------------------------------------------------------------------------AC_PREREQ(2.13)dnldnl To disable config.cache loading and saving, redefine the following twodnl macros _before_ calling AC_INIT, but make sure to keep the trailing dnl.dnldnl define([AC_CACHE_LOAD], )dnldnl define([AC_CACHE_SAVE], )dnlAC_INIT(libxorp/xorp.h)AC_CONFIG_AUX_DIR(config)AC_CANONICAL_SYSTEMAC_CONFIG_SUBDIRS(cli/libtecla)AM_INIT_AUTOMAKE(xorp, 1.0)AM_CONFIG_HEADER(config.h)dnldnl Change the default installation prefixdnlAC_PREFIX_DEFAULT(/usr/local/xorp)test "$prefix" = NONE && prefix="${ac_default_prefix}"AC_DEFINE_UNQUOTED(XORP_ROOT, "${prefix}", [Define the path to the root of the XORP installation])AC_DEFINE_UNQUOTED(XORP_INSTALL_ROOT, "${prefix}", [Define the path to the root of the XORP installation])AC_DEFINE_UNQUOTED(XORP_BUILD_ROOT, "${PWD}", [Define path to the top-level build directory])# We'd like to use ac_abs_srcdir, except it's not available just here.AC_DEFINE_UNQUOTED(XORP_SRC_ROOT, "`cd ${srcdir} && echo ${PWD}`", [Define path to the top-level source directory])# Add --enable-maintainer-mode as a command-line option for folks who# want to play with auto* tools.AM_MAINTAINER_MODEdnl ----------------------------dnl XXX: libtool optionsdnl ----------------------------dnl AC_DISABLED_STATICdnl AC_DISABLE_SHAREDdnl AC_PROG_LIBTOOLdnl ----------------------------dnl Set host, host_alias, host_cpu, host_vendor, host_osdnl ----------------------------case "${host_os}" in bsdi* ) AC_DEFINE(HOST_OS_BSDI, 1, [Define to 1 if the OS is BSDI]) ;; darwin* ) AC_DEFINE(HOST_OS_MACOSX, 1, [Define to 1 if the OS is MacOS X]) ;; freebsd* ) AC_DEFINE(HOST_OS_FREEBSD, 1, [Define to 1 if the OS is FreeBSD]) ;; linux* ) AC_DEFINE(HOST_OS_LINUX, 1, [Define to 1 if the OS is Linux]) ;; netbsd* ) AC_DEFINE(HOST_OS_NETBSD, 1, [Define to 1 if the OS is NetBSD]) ;; openbsd* ) AC_DEFINE(HOST_OS_OPENBSD, 1, [Define to 1 if the OS is OpenBSD]) ;; solaris* ) AC_DEFINE(HOST_OS_SOLARIS, 1, [Define to 1 if the OS is Solaris]) ;;esacAC_VALIDATE_CACHED_SYSTEM_TUPLE( echo "Removing stale config.cache and restarting configure" rm -f config.cache exec ./configure)dnl ---------------------------------------------------------------------------dnl Command line optionsdnl ---------------------------------------------------------------------------dnl ----------------------------dnl --disable-debugdnl ----------------------------AC_ARG_ENABLE(debug, [ --disable-debug disable debug messages ], [], [enable_debug=yes;] dnl XXX: enable by default)dnl ----------------------------dnl --enable-debug-msgsdnl ----------------------------AC_ARG_ENABLE(debug-msgs, [ --enable-debug-msgs enable debug messages ],)dnl ----------------------------dnl --enable-debug-fnames (GCC)dnl ----------------------------AC_ARG_ENABLE(debug-fnames, [ --enable-debug-fnames enable function names in debug messages (requires GCC)],)dnl ----------------------------dnl --enable-optimizednl ----------------------------AC_ARG_ENABLE(optimize, [ --enable-optimize enable compiler optimizations],)dnl ----------------------------dnl --enable-profilednl ----------------------------AC_ARG_ENABLE(profile, [ --enable-profile turn on profiling],)dnl ----------------------------dnl --enable-callback-debugdnl ----------------------------AC_ARG_ENABLE(callback-debug, [ --enable-callback-debug enable callback debugging ], AC_DEFINE(DEBUG_CALLBACKS, 1, [Define to enable callback debugging]) ,)dnl ----------------------------dnl --disable-ipv6dnl ----------------------------AC_ARG_ENABLE(ipv6, [ --disable-ipv6 disable IPv6 support], [], [enable_ipv6=yes;] dnl XXX: enable by default)dnl ----------------------------dnl --enable-simdnl ----------------------------TRY_USE_SIM=falseAC_ARG_ENABLE(sim, [ --enable-sim enable simulator (not implemented yet)], if test "${enable_sim}" = "yes"; then TRY_USE_SIM=true; else TRY_USE_SIM=false; fi ,)AM_CONDITIONAL(TRY_USE_SIM, test "${enable_sim}" = "yes")dnl ----------------------------dnl --enable-advanced-mcast-apidnl ----------------------------AC_ARG_ENABLE(advanced-mcast-api, [ --enable-advanced-mcast-api enable advanced multicast API ],)if test "${enable_advanced_mcast_api}" = "yes" ; then AC_DEFINE(ENABLE_ADVANCED_MCAST_API, 1, [Define to 1 to enable advanced multicast API])fidnl ----------------------------dnl --with-dmallocdnl ----------------------------dnl XXX: XR_WITH_DMALLOC_DIR (a local modified version of AM_WITH_DMALLOC)dnl is specified later, so it will overwrite -ldbuiltin(include, config/dmalloc.m4)dnl ----------------------------dnl --with-openssldnl ----------------------------AC_ARG_WITH(openssl, [ --with-openssl=DIR specify root of OpenSSL installation ], [ xr_openssl_prefix="$withval" ])dnl ----------------------------dnl --with-path-to-snmpddnl ----------------------------AC_ARG_WITH(path-to-snmpd, [ --with-path-to-snmpd=DIR specify path to the snmpd executable], [snmpd=${withval}/snmpd;], [snmpd="not_found";])dnl ----------------------------dnl --with-path-to-net-snmp-srcdnl ----------------------------AC_ARG_WITH(path-to-net-snmp-src, [ --with-path-to-net-snmpd-src=DIR specify path to the net-snmpd source tree], [path_to_net_snmp_src=${withval};], [path_to_net_snmp_src="no";])dnl ----------------------------dnl --without-snmpdnl ----------------------------AC_ARG_WITH(snmp, [ --without-snmp do not build XORP MIBs for Net-SNMP], [snmp="no";], [snmp="yes";])dnl ---------------------------------------------------------------------------dnl Compiler probingdnl ---------------------------------------------------------------------------AC_PROG_CCAC_PROG_CXXAC_PROG_CXXCPPAC_LANG_CPLUSPLUSdnldnl Include the macros for testing compiler-supported command-line optionsdnlbuiltin(include, config/compiler_flags.m4)dnl ----------------------------dnl Get project-specific macrosdnl ----------------------------builtin(include, config/acxorp.m4)dnl ---------------------------------------------------------------------------dnl Additional tool probesdnl ---------------------------------------------------------------------------dnl ----------------------------dnl CPP GNU variable argumentsdnl ----------------------------AC_CACHE_CHECK( [whether preprocessor supports GNU style variable argument macros], xorp_cv_cpp_gnu_va_args, AC_TRY_CPP( [ #define SOME_PRINTF(args...) printf(args) SOME_PRINTF("hello %s %d", "world", '\n'); ], xorp_cv_cpp_gnu_va_args=yes, xorp_cv_cpp_gnu_va_args=no ))if test "${xorp_cv_cpp_gnu_va_args}" = "yes" ; then AC_DEFINE(CPP_SUPPORTS_GNU_VA_ARGS, 1, [Define to 1 if the preprocessor supports GNU style variable argument macros])fiAC_PROG_INSTALLdnl XXX: AUTOMAKEdnl AM_PROG_LIBTOOLAC_PROG_LN_SAC_PROG_RANLIBAC_CHECK_TOOL(AR, ar)AC_CACHE_CHECK([if GNU make is installed], xorp_cv_gmake_name, for g in ${GMAKE} make gmake gnumake; do if ($g -version) < /dev/null > /dev/null 2>&1 ; then GMAKE_NAME="$g" break fi done xorp_cv_gmake_name=${GMAKE_NAME})AC_CHECK_PROGS(PYTHON, python2.2 python2 python, "NO_PYTHON")if test "${PYTHON}" != "NO_PYTHON" ; then AC_CACHE_CHECK( [python version 2.0 or above], xorp_python_good, changequote(<<,>>)dnl PY_VERSION=`$PYTHON -c 'import sys; print sys.version[[:3]]' | tr -cd '[[:digit:]]'` changequote([,])dnl if test 0${PY_VERSION} -ge 20 ; then xorp_python_good="yes" else xorp_python_good="no" fi )fiPY_BUILD="#"if test "${xorp_python_good}" = "yes" ; then PY_BUILD=''fiAC_SUBST(PY_BUILD)AC_SUBST(PYTHON)dnl ----------------------------dnl OpenSSL (Strictly OpenSSL MD5 implementation)dnl ----------------------------fail_openssl(){ echo "Could not find part of OpenSSL or one it's components in $1" echo "Use --with-openssl=DIR to specify OpenSSL directory" exit 1}if test "${xr_openssl_prefix}" = "" ; then# User has not specified an OpenSSL prefix, may be in cache, otherwise take# a guess AC_CACHE_CHECK( [OpenSSL installation prefix], xr_cv_openssl_prefix, [ # Prefer base install over local install, assume base if not found for xr_cv_openssl_prefix in /usr /usr/local /usr ; do if test -d ${xr_cv_openssl_prefix}/include/openssl; then break fi done ])elif test "${xr_openssl_prefix}" != "${xr_cv_openssl_prefix}"; then # User has specified a new OpenSSL prefix, flush cache state of # header files and libraries that we care about to force a # re-check. unset ac_cv_header_openssl_md5_h unset ac_cv_lib_crypto_MD5_Init unset xr_cv_openssl_prefix # This cache check is doomed to fail because we unset variable, # but use it for consistent looking output. AC_CACHE_CHECK([OpenSSL installation prefix], xr_cv_openssl_prefix, xr_cv_openssl_prefix="${xr_openssl_prefix}")fiif test -d ${xr_cv_openssl_prefix}/include/openssl; then if test "${xr_cv_openssl_prefix}" != "/usr"; then CPPFLAGS="${CPPFLAGS} -I${xr_cv_openssl_prefix}/include" LIBS="${LIBS} -L${xr_cv_openssl_prefix}" fi AC_HEADER_CHECK(openssl/md5.h, , fail_openssl "${xr_cv_openssl_prefix}") AC_CHECK_LIB(crypto, MD5_Init, , fail_openssl "${xr_cv_openssl_prefix}")else fail_openssl "${xr_cv_openssl_prefix}"fidnl ---------------------------------------------------------------------------dnl Check for programsdnl ---------------------------------------------------------------------------dnl ---------------------------------------------------------------------------dnl SNMPdnl ---------------------------------------------------------------------------if test "${snmp}" = "yes"; then AC_CHECK_PROG(net_snmp_found, net-snmp-config, "true")else net_snmp_found="skip_check" snmpd="skip_check"fiif test "${net_snmp_found}" = "true"; then net_snmp_v=`net-snmp-config --version` net_snmp_maj=`echo $net_snmp_v | cut -f 1 -d.` net_snmp_min=`echo $net_snmp_v | cut -f 2 -d.` net_snmp_rev=`echo $net_snmp_v | cut -f 3 -d.` dnl dnl XXX: if the revision number is missing, then give it value of 0 dnl if test "${net_snmp_rev}" = ""; then net_snmp_rev=0 fi AC_CACHE_CHECK([if net-snmp version equal or newer than 5.0.6], ac_cv_net_snmp_usable, net_snmp_too_old=true while test "${net_snmp_too_old}" = "true"; do if test "${net_snmp_maj}" -lt "5" ; then break; fi if test "${net_snmp_maj}" -gt "5" ; then net_snmp_too_old=false break; fi if test "${net_snmp_min}" -lt "0" ; then break; fi if test "${net_snmp_min}" -gt "0" ; then net_snmp_too_old=false break; fi if test "${net_snmp_rev}" -lt "6" ; then break; fi if test "${net_snmp_rev}" -gt "6" ; then net_snmp_too_old=false break; fi net_snmp_too_old=false break; done if test "${net_snmp_too_old}" != "true"; then ac_cv_net_snmp_usable=yes else ac_cv_net_snmp_usable=no snmpd="skip_check" fi ) if test "${ac_cv_net_snmp_usable}" != "yes" ; then AC_MSG_WARN(net-snmp version too old) fielif test "${net_snmp_found}" = "no"; then AC_MSG_WARN(Net-SNMP not found! MIB modules will not be built) snmpd="skip_check"fiif test "${snmpd}" = "not_found"; then AC_PATH_PROG(snmpd, snmpd, "not_found", /usr/local/sbin)fiif test "${snmpd}" = "not_found"; then echo "checking again for snmpd in another directory" AC_PATH_PROG(snmpd2, snmpd, "not_found", /usr/sbin) snmpd=$snmpd2fisnmpd_valid="no"if test "${snmpd}" = "not_found" ; then AC_MSG_WARN(snmpd not found: snmp test scripts will not work)elif test "${snmpd}" = "skip_check"; then AC_MSG_CHECKING(if snmpd can be started) AC_MSG_RESULT(skipped)else AC_MSG_CHECKING(if snmpd can be started) # use the dlmod directive to see if the agent was compiled with dynamic # MIB support. dummy MIB modules will only generate warnings echo 'dlmod dummy doubledummy' > conftestsnmp.conf test_ports='51510 51520 51530 51540 51550' snmpd_base_args="-f -r -l conftestsnmp.log -c conftestsnmp.conf" # On Linux snmpd seems to need the "-p" flag. for args in "" "-p" do for p in ${test_ports} do ${snmpd} ${snmpd_base_args} ${args} udp:localhost:$p& pid=$! sleep 3 if ps -p ${pid} > /dev/null then kill ${pid} snmpd_valid="yes" break 2 fi done done if test "${snmpd_valid}" = "yes" ; then # Verify that dlmod directive was recognized if ( grep -i -e 'Unknown.*token.*dlmod' conftestsnmp.log ); then echo "-------------------------------------------------------------" echo "It looks like your Net-SNMP agent was not compiled with " echo "support for shared libraries. This is option is enabled by " echo "default if your platform supports it. You may try to recom- " echo "compile Net-SNMP with the option --enable-shared. "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -