From: Jason Parker Date: Wed, 16 Jan 2008 19:41:25 +0000 (+0000) Subject: Partially revert r93898, because it broke the way netsnmp was being detected. X-Git-Tag: 1.6.0-beta1~3^2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19b4c52bf42d238fe287a6ecaba34ff1a3d851a5;p=thirdparty%2Fasterisk.git Partially revert r93898, because it broke the way netsnmp was being detected. rizzo, do you want to discuss so we can rethink this, or do you have another way? git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98971 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/configure b/configure index a0f26a63a2..62c1b2ec8b 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 98605 . +# From configure.ac Revision: 98952 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.4. # @@ -957,7 +957,7 @@ GC_CFLAGS GC_LDFLAGS AST_DECLARATION_AFTER_STATEMENT GSM_INTERNAL -CONFIG_NETSNMP +NETSNMP_CONFIG PG_CONFIG PTLIB_CONFIG PWLIBDIR @@ -34792,29 +34792,30 @@ _ACEOF fi -# XXX do we need to check for snmp_register_callback ? - - if test "x${PBX_NETSNMP}" != "x1" -a "${USE_NETSNMP}" != "no"; then - PBX_NETSNMP=0 - if test -n "$ac_tool_prefix"; then +NETSNMP_CONFIG=No +if test "${USE_NETSNMP}" != "no"; then + if test "x${NETSNMP_DIR}" != "x"; then + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}net-snmp-config", so it can be a program name with args. set dummy ${ac_tool_prefix}net-snmp-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CONFIG_NETSNMP+set}" = set; then +if test "${ac_cv_path_NETSNMP_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$CONFIG_NETSNMP"; then - ac_cv_prog_CONFIG_NETSNMP="$CONFIG_NETSNMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + case $NETSNMP_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_NETSNMP_CONFIG="$NETSNMP_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in ${NETSNMP_DIR}/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CONFIG_NETSNMP="${ac_tool_prefix}net-snmp-config" + ac_cv_path_NETSNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -34822,12 +34823,13 @@ done done IFS=$as_save_IFS + ;; +esac fi -fi -CONFIG_NETSNMP=$ac_cv_prog_CONFIG_NETSNMP -if test -n "$CONFIG_NETSNMP"; then - { echo "$as_me:$LINENO: result: $CONFIG_NETSNMP" >&5 -echo "${ECHO_T}$CONFIG_NETSNMP" >&6; } +NETSNMP_CONFIG=$ac_cv_path_NETSNMP_CONFIG +if test -n "$NETSNMP_CONFIG"; then + { echo "$as_me:$LINENO: result: $NETSNMP_CONFIG" >&5 +echo "${ECHO_T}$NETSNMP_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } @@ -34835,26 +34837,101 @@ fi fi -if test -z "$ac_cv_prog_CONFIG_NETSNMP"; then - ac_ct_CONFIG_NETSNMP=$CONFIG_NETSNMP +if test -z "$ac_cv_path_NETSNMP_CONFIG"; then + ac_pt_NETSNMP_CONFIG=$NETSNMP_CONFIG # Extract the first word of "net-snmp-config", so it can be a program name with args. set dummy net-snmp-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CONFIG_NETSNMP+set}" = set; then +if test "${ac_cv_path_ac_pt_NETSNMP_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$ac_ct_CONFIG_NETSNMP"; then - ac_cv_prog_ac_ct_CONFIG_NETSNMP="$ac_ct_CONFIG_NETSNMP" # Let the user override the test. + case $ac_pt_NETSNMP_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_NETSNMP_CONFIG="$ac_pt_NETSNMP_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in ${NETSNMP_DIR}/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_NETSNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_NETSNMP_CONFIG=$ac_cv_path_ac_pt_NETSNMP_CONFIG +if test -n "$ac_pt_NETSNMP_CONFIG"; then + { echo "$as_me:$LINENO: result: $ac_pt_NETSNMP_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_NETSNMP_CONFIG" >&6; } else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_pt_NETSNMP_CONFIG" = x; then + NETSNMP_CONFIG="No" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + NETSNMP_CONFIG=$ac_pt_NETSNMP_CONFIG + fi +else + NETSNMP_CONFIG="$ac_cv_path_NETSNMP_CONFIG" +fi + + if test x"${NETSNMP_CONFIG}" = xNo; then + { echo "$as_me:$LINENO: ***" >&5 +echo "$as_me: ***" >&6;} + { echo "$as_me:$LINENO: *** net-snmp-config was not found in the path you specified:" >&5 +echo "$as_me: *** net-snmp-config was not found in the path you specified:" >&6;} + { echo "$as_me:$LINENO: *** ${NETSNMP_DIR}/bin" >&5 +echo "$as_me: *** ${NETSNMP_DIR}/bin" >&6;} + { echo "$as_me:$LINENO: *** Either correct the installation, or run configure" >&5 +echo "$as_me: *** Either correct the installation, or run configure" >&6;} + { echo "$as_me:$LINENO: *** including --without-netsnmp" >&5 +echo "$as_me: *** including --without-netsnmp" >&6;} + exit 1 + fi + else + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}net-snmp-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}net-snmp-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_NETSNMP_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $NETSNMP_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_NETSNMP_CONFIG="$NETSNMP_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CONFIG_NETSNMP="net-snmp-config" + ac_cv_path_NETSNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -34862,19 +34939,63 @@ done done IFS=$as_save_IFS + ;; +esac +fi +NETSNMP_CONFIG=$ac_cv_path_NETSNMP_CONFIG +if test -n "$NETSNMP_CONFIG"; then + { echo "$as_me:$LINENO: result: $NETSNMP_CONFIG" >&5 +echo "${ECHO_T}$NETSNMP_CONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + fi +if test -z "$ac_cv_path_NETSNMP_CONFIG"; then + ac_pt_NETSNMP_CONFIG=$NETSNMP_CONFIG + # Extract the first word of "net-snmp-config", so it can be a program name with args. +set dummy net-snmp-config; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_ac_pt_NETSNMP_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_NETSNMP_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_NETSNMP_CONFIG="$ac_pt_NETSNMP_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_NETSNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac fi -ac_ct_CONFIG_NETSNMP=$ac_cv_prog_ac_ct_CONFIG_NETSNMP -if test -n "$ac_ct_CONFIG_NETSNMP"; then - { echo "$as_me:$LINENO: result: $ac_ct_CONFIG_NETSNMP" >&5 -echo "${ECHO_T}$ac_ct_CONFIG_NETSNMP" >&6; } +ac_pt_NETSNMP_CONFIG=$ac_cv_path_ac_pt_NETSNMP_CONFIG +if test -n "$ac_pt_NETSNMP_CONFIG"; then + { echo "$as_me:$LINENO: result: $ac_pt_NETSNMP_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_NETSNMP_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi - if test "x$ac_ct_CONFIG_NETSNMP" = x; then - CONFIG_NETSNMP="No" + if test "x$ac_pt_NETSNMP_CONFIG" = x; then + NETSNMP_CONFIG="No" else case $cross_compiling:$ac_tool_warned in yes:) @@ -34886,26 +35007,91 @@ whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac - CONFIG_NETSNMP=$ac_ct_CONFIG_NETSNMP + NETSNMP_CONFIG=$ac_pt_NETSNMP_CONFIG fi else - CONFIG_NETSNMP="$ac_cv_prog_CONFIG_NETSNMP" + NETSNMP_CONFIG="$ac_cv_path_NETSNMP_CONFIG" fi - if test ! "x${CONFIG_NETSNMP}" = xNo; then - if test x"" = x ; then A=--cflags ; else A="" ; fi - NETSNMP_INCLUDE=$(${CONFIG_NETSNMP} $A) - if test x"--agent-libs" = x ; then A=--libs ; else A="--agent-libs" ; fi - NETSNMP_LIB=$(${CONFIG_NETSNMP} $A) - PBX_NETSNMP=1 + fi +fi +if test x"${NETSNMP_CONFIG}" != xNo; then + NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs` -cat >>confdefs.h <<\_ACEOF + { echo "$as_me:$LINENO: checking for snmp_register_callback in -lnetsnmp" >&5 +echo $ECHO_N "checking for snmp_register_callback in -lnetsnmp... $ECHO_C" >&6; } +if test "${ac_cv_lib_netsnmp_snmp_register_callback+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnetsnmp ${NETSNMP_LIBS} $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char snmp_register_callback (); +int +main () +{ +return snmp_register_callback (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_netsnmp_snmp_register_callback=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_netsnmp_snmp_register_callback=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_netsnmp_snmp_register_callback" >&5 +echo "${ECHO_T}$ac_cv_lib_netsnmp_snmp_register_callback" >&6; } +if test $ac_cv_lib_netsnmp_snmp_register_callback = yes; then + +cat >>confdefs.h <<_ACEOF #define HAVE_NETSNMP 1 _ACEOF - fi - fi +fi + if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then + NETSNMP_LIB="${NETSNMP_libs}" + PBX_NETSNMP=1 + fi +fi if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then @@ -49497,7 +49683,7 @@ GC_CFLAGS!$GC_CFLAGS$ac_delim GC_LDFLAGS!$GC_LDFLAGS$ac_delim AST_DECLARATION_AFTER_STATEMENT!$AST_DECLARATION_AFTER_STATEMENT$ac_delim GSM_INTERNAL!$GSM_INTERNAL$ac_delim -CONFIG_NETSNMP!$CONFIG_NETSNMP$ac_delim +NETSNMP_CONFIG!$NETSNMP_CONFIG$ac_delim PG_CONFIG!$PG_CONFIG$ac_delim PTLIB_CONFIG!$PTLIB_CONFIG$ac_delim PWLIBDIR!$PWLIBDIR$ac_delim diff --git a/configure.ac b/configure.ac index 4d656c0ad7..bcc3bbb839 100644 --- a/configure.ac +++ b/configure.ac @@ -828,8 +828,32 @@ AST_EXT_LIB_CHECK([NBS], [nbs], [nbs_connect], [nbs.h]) AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h]) -# XXX do we need to check for snmp_register_callback ? -AST_EXT_TOOL_CHECK([NETSNMP], [net-snmp], , [--agent-libs]) +NETSNMP_CONFIG=No +if test "${USE_NETSNMP}" != "no"; then + if test "x${NETSNMP_DIR}" != "x"; then + AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No, [${NETSNMP_DIR}/bin]) + if test x"${NETSNMP_CONFIG}" = xNo; then + AC_MSG_NOTICE([***]) + AC_MSG_NOTICE([*** net-snmp-config was not found in the path you specified:]) + AC_MSG_NOTICE([*** ${NETSNMP_DIR}/bin]) + AC_MSG_NOTICE([*** Either correct the installation, or run configure]) + AC_MSG_NOTICE([*** including --without-netsnmp]) + exit 1 + fi + else + AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No) + fi +fi +if test x"${NETSNMP_CONFIG}" != xNo; then + NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs` + + AC_CHECK_LIB([netsnmp], [snmp_register_callback], AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1, + [Define to indicate the Net-SNMP library]), [], ${NETSNMP_LIBS}) + if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then + NETSNMP_LIB="${NETSNMP_libs}" + PBX_NETSNMP=1 + fi +fi AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h]) diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 3e9217689e..cae42a2e33 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -499,7 +499,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H -/* Define if your system has the NETSNMP libraries. */ +/* Define to indicate the Net-SNMP library */ #undef HAVE_NETSNMP /* Define this to indicate the ${NEWT_DESCRIP} library */