diff options
Diffstat (limited to 'configure.d')
-rw-r--r-- | configure.d/config_modules_agent | 814 | ||||
-rw-r--r-- | configure.d/config_modules_lib | 232 | ||||
-rw-r--r-- | configure.d/config_modules_security_modules | 70 | ||||
-rw-r--r-- | configure.d/config_modules_transports | 137 | ||||
-rw-r--r-- | configure.d/config_os_functions | 324 | ||||
-rw-r--r-- | configure.d/config_os_headers | 523 | ||||
-rw-r--r-- | configure.d/config_os_libs1 | 95 | ||||
-rw-r--r-- | configure.d/config_os_libs2 | 487 | ||||
-rw-r--r-- | configure.d/config_os_misc1 | 24 | ||||
-rw-r--r-- | configure.d/config_os_misc2 | 142 | ||||
-rw-r--r-- | configure.d/config_os_misc3 | 20 | ||||
-rw-r--r-- | configure.d/config_os_misc4 | 319 | ||||
-rw-r--r-- | configure.d/config_os_progs | 437 | ||||
-rw-r--r-- | configure.d/config_os_struct_members | 754 | ||||
-rw-r--r-- | configure.d/config_project_ipv6_types | 208 | ||||
-rw-r--r-- | configure.d/config_project_manual | 170 | ||||
-rw-r--r-- | configure.d/config_project_paths | 101 | ||||
-rw-r--r-- | configure.d/config_project_perl_python | 379 | ||||
-rw-r--r-- | configure.d/config_project_types | 57 | ||||
-rw-r--r-- | configure.d/config_project_with_enable | 1150 |
20 files changed, 6443 insertions, 0 deletions
diff --git a/configure.d/config_modules_agent b/configure.d/config_modules_agent new file mode 100644 index 0000000..3272679 --- /dev/null +++ b/configure.d/config_modules_agent @@ -0,0 +1,814 @@ +# -*- autoconf -*- +# +# generate empty files +# +# Create include file list for snmp_vars.h to use. +mibdir="agent/mibgroup" +if test ! -d agent; then + mkdir agent +fi +if test ! -d agent/mibgroup; then + mkdir agent/mibgroup +fi +j="$mibdir/mib_module_includes.h $mibdir/agent_module_includes.h \ + $mibdir/mib_module_inits.h $mibdir/agent_module_inits.h \ + $mibdir/mib_module_shutdown.h $mibdir/agent_module_shutdown.h \ + include/net-snmp/agent/mib_module_config.h \ + include/net-snmp/agent/agent_module_config.h \ + $mibdir/mib_module_dot_conf.h $mibdir/agent_module_dot_conf.h" + +for i in $j; do + rm -f $i + echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $i +done + +# +# Do hairy agent module processing. +# +AC_MSG_CHECKING([for and configuring mib modules to use]) + +# set up the CPP command +MODULECPP="$CPP $PARTIALTARGETFLAGS -DNETSNMP_FEATURE_CHECKING -I${srcdir}/include -I${srcdir}/agent/mibgroup" +if test "x$enable_mfd_rewrites" = "xyes"; then + MODULECPP="$MODULECPP -DNETSNMP_ENABLE_MFD_REWRITES" +fi + +module_list="" +mib_module_list="" +agent_module_list="" +new_with_mib_modules=`echo $with_mib_modules | $SED 's/,/ /g;'` +new_with_out_mib_modules=`echo $with_out_mib_modules | $SED 's/,/ /g;'` + +# set up initial module list +new_module_list="$new_with_mib_modules default_modules" + +# minor modifications +if test "x$enable_agent" = "xno"; then + # minimum mib module list for snmptrapd + new_module_list="mibII/vacm_vars mibII/vacm_conf utilities/execute $new_with_mib_modules" + default_mibs=SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB + default_mibs_install=" " +elif test "x$mini_agent" = "xyes"; then + # define the mini agent flag to reduce our load list from default_mibs.h + MODULECPP="$MODULECPP -DNETSNMP_MINI_AGENT" +fi + +test_modules="$new_module_list" +new_module_list="" + +# remove modules that were explicitly excluded +for i in $test_modules + do + if echo " $new_with_out_mib_modules " | $GREP " $i " > /dev/null; then + mib_cfg_msg="mib module '$i' is both included and excluded." + AC_MSG_WARN([mib module conflict]) + if test "x$with_mib_cfg_checks" = "xyes"; then + AC_MSG_WARN([user with : $with_mib_modules]) + AC_MSG_WARN([final with : $new_module_list]) + AC_MSG_WARN([user without : $with_out_mib_modules]) + AC_MSG_WARN([final without: $new_with_out_mib_modules]) + AC_MSG_ERROR([$mib_cfg_msg]) + else + AC_MSG_WARN([$mib_cfg_msg It will be excluded]) + AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg It has been excluded.]) + fi + else + new_module_list="$new_module_list $i" + fi +done + +AC_MSG_RESULT([$new_module_list.]) + +#--------------------- +# loop over module list +# +all_warnings="" +if test "x$with_mib_cfg_debug" = "xyes"; then + module_debug=1 +else + module_debug=0 +fi +first_pass=1 +output_to=normal + +if test ! -d mk ; then + mkdir mk +fi + + +module_rules=mk/module_rules.mk +echo "# contents below built automatically by configure; do not edit by hand" > $module_rules + +# +# make file sub-pieces +# +for i in module_list_deps mib_module_list_deps agent_module_list_deps ; do + eval "$i=mk/${i}.mk" + echo "# contents below built automatically by configure; do not edit by hand" > mk/${i}.mk +done + +# +# variable settings sub-pieces +# +for i in module_list_code mib_module_list_code agent_module_list_code module_list mib_module_list agent_module_list ; do + eval "$i=mk/${i}.mk" + echo "# contents below built automatically by configure; do not edit by hand" > mk/${i}.mk + echo "$i= \\" >> mk/${i}.mk +done + +echo $ECHO_N "echo " $ECHO_C > mk/MODULE_LIST.mk +MODULE_LIST=mk/MODULE_LIST.mk + + +#--------------------- +# until we have an empty module list... +# (modules may add new modules, and until all dependencies are done...) +# +while test "x$new_module_list" != "x"; do + AC_MSG_MODULE_DBG(-e,"\n****************************************************************") + AC_MSG_MODULE_DBG("nml: $new_module_list") + + #--------------------- + # loop over all the modules in the current list + # + for j in $new_module_list + do + + #--------------------- + # figure out which sub-blocks to build in parts + if echo "$j" | $GREP "=" ; then + # build a shared object file + # format: sofilename=module1:module2 + # XXX: currently doesn't do this + dl_name=`echo $j | $SED 's/=.*//'` + dl_names="$dl_names $dl_name" + dl_objects=`echo $j | $SED 's/.*=//'` + module_sublist=`echo $dl_objects | $SED 's/:/ /g'` + saved_sublist="" + saved_sublist_code="" + output_to=separate + + # create output files + # these actually get nuked later + output_inits="agent/mibgroup/${dl_name}-dll.c" + output_hdrs="agent/mibgroup/${dl_name}-hdrs.h" + else + # not a special token invocation + module_sublist=$j + output_to=normal + output_t= + fi + + while test "x$module_sublist" != "x" ; do + + #--------------------- + # loop over all the modules in the sub list + for i in $module_sublist + do + + AC_MSG_MODULE_DBG(-e "\n================================================================") + AC_MSG_MODULE_DBG("testing $i") + need_header=0 + + #--------------------- + # build a pseudo include header that includes current config and + # system symbols: + rm -f conftest.$ac_ext module_tmp_header.h + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ +#include NETSNMP_SYSTEM_INCLUDE_FILE +#include "$srcdir/$mibdir/$i.h"]])]) + mv conftest.$ac_ext module_tmp_header.h + + #--------------------- + # macro: config_belongs_in(ARG) + # ARG: either + # - mib_module => libnetsnmpmibs (default) + # - agent_module => libnetsnmpagent + # + AH_TOP([#define config_belongs_in(x)]) + module_type=mib_module + if test -f $srcdir/$mibdir/$i.h; then + changequote(, ) + module_type=`$MODULECPP module_tmp_header.h | \ + $SED -n 's@.*config_belongs_in(\([^)]*\)).*@\1@p'` + changequote([, ]) + fi + if test "x$module_type" = "x" ; then + module_type=mib_module + fi + if test "x$output_to" = "xnormal" ; then + output_inits="$mibdir/${module_type}_inits.h" + output_hdrs="$mibdir/${module_type}_includes.h" + fi + + #-------------------- + # check for duplicates within the dll system. + # - if found in a dll, then remove from the dll and add to main + dblfix="" + for dltest in $dl_names ; do + eval mod_files="\"\$dl_${dltest}_files\"" + if echo " $mod_files " | $GREP " $i " > /dev/null; then + # some dll module has already seen this, unload it from that list + # and include it in the core (again) + AC_MSG_MODULE_DBG("removing $i from $dltest") + mod_files=`echo " $mod_files " | $SED "s@ $i @@"` + dblfix="__XXX__" + eval "dl_${dltest}_files=\"$mod_files\"" + + module_list="$module_list $i" + echo "read_config.lo: mibgroup/$i.h" >> $module_list_deps + if test $module_type = "agent_module" ; then + echo "snmp_vars.lo: mibgroup/$i.h" >> $agent_module_list_deps + else + echo "mib_modules.lo: mibgroup/$i.h" >> $mib_module_list_deps + fi + eval ${module_type}_list="\"\$${module_type}_list $i\"" + echo " $i \\" >> $module_list_code + echo $ECHO_N " $i" $ECHO_C >> $MODULE_LIST + eval tmpfilevar=\$`echo ${module_type}_list_code` + echo " $i \\" >> $tmpfilevar + + # XXX: add this to the main init list; this is possible not + # quite in the right spot any longer but we're stuck with it. + # Adding it back to the original ordered spot would be a + # nightmare. Ok, we're already in nightmare code so that + # wolud have to be a night-terror. + mnm=`echo $i | $SED 's/.*\///;s/\.c$//;'` + output_inits_tmp="$mibdir/${module_type}_inits.h" + echo " if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits_tmp + # XXX: even worse, we loose whether the header is needed or not. + output_hdrs_tmp="$mibdir/${module_type}_includes.h" + echo '#include "'"mibgroup/$i.h"'"' >> $output_hdrs_tmp + fi + done + + #--------------------- + # make sure module wasn't explicitly excluded, or already added + # + if test "x$dblfix" != "x" ; then + AC_MSG_MODULE_DBG("$i was duplicated -- putting into main") + elif echo " $new_with_out_mib_modules " | $GREP " $i " > /dev/null; then + AC_MSG_MODULE_DBG("$i was excluded") + elif echo " $module_list " | $GREP " $i " > /dev/null; then + AC_MSG_MODULE_DBG("$i already tested") + else + + #--------------------- + # process modules header, checking for config_ pseudo-macros + # + + #--------------------- + # does the header file for the module exist? + # macros are only processed if it does + if test -f $srcdir/$mibdir/$i.h; then + new_list="" + + #--------------------- + # macro: config_exclude(modules) + # - lists conflicts with other modules + # - EG: new MIB implementations exclude old and vice-versa + # + # check if $i has any conflicts + # + AH_TOP([#define config_exclude(x)]) + new_list_excl=`$MODULECPP module_tmp_header.h | \ + $SED -n 's/.*config_exclude(\(.*\)).*/\1/p'` + if test "x$new_list_excl" != "x"; then + AC_MSG_MODULE_DBG("$i excludes $new_list_excl") + for j in $new_list_excl + do + if echo " $module_list $new_mib_module_list $new_list_two " | $GREP " $j " > /dev/null; then + mib_cfg_msg="mib module '$i' excludes module '$j' but another module requires it" + AC_MSG_WARN([mib module error]) + if test "x$with_mib_cfg_checks" = "xyes"; then + AC_MSG_ERROR([$mib_cfg_msg]) + else + AC_MSG_WARN([$mib_cfg_msg]) + AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg]) + fi + else + new_with_out_mib_modules="$j $new_with_out_mib_modules" + AC_MSG_MODULE_DBG("$j added to excluded list") + fi + done + fi + + #--------------------- + # macro: config_arch_require(ARCH,modules) + # - lists modules required for a given ARCH + # + # check if $i has any architecture specific requirements + # + AH_TOP([#define config_arch_require(x,y)]) + changequote(, ) + new_list_arch=`$MODULECPP module_tmp_header.h | \ + $SED -n 's/.*config_arch_require( *\([^ ]*\) *, *\([^ ]*\) *).*/\1-xarchx-\2/p'` + changequote([, ]) + if test "x$new_list_arch" != "x"; then + for j in $new_list_arch + do + archtest=`echo $j | $SED 's/-xarchx-.*//'` + # target_os may have been changed to a #define of 1... + if test "x$archtest" = "x1" -o "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then + new_list="$new_list `echo $j | $SED 's/.*-xarchx-//'`" + AC_MSG_MODULE_DBG(" $i required adding arch files: `echo $j | $SED 's/.*-xarchx-//'`") + fi + done + fi + AC_MSG_MODULE_DBG(" $i required arch files: $new_list") + + #--------------------- + # macro: config_version_require((base, version, version-modules, ...)) + # - lists alternative modules used from different versions. + # + AH_TOP([#define config_version_require(x)]) + [new_list_alt3=`$MODULECPP module_tmp_header.h | \ + $AWK ' + BEGIN { + if("'"$enable_new_features"'" == "yes") + method="max"; + else if("'"$enable_old_features"'" == "yes") + method="max-less"; + else + method="max-less-equal"; + FS = "."; + split("'"$with_features_of"'", a); + version=sprintf("%03d%03d%03d%03d", a[1], a[2], a[3], a[4]); + } + /config_version_require/ { + gsub("^.*config_version_require *\\\\(\\\\(", ""); + gsub("\\\\)\\\\).*$", ""); + gsub(", *", ","); + FS = ","; + n = split($0, a); + FS = "."; + actver = "000000000000"; + actstr = a[1]; + for(i = 2; i < n; i += 2) { + split(a[i], b); + curver=sprintf("%03d%03d%03d%03d", b[1], b[2], b[3], b[4]); + if (curver > actver && (method != "max-less" || curver < version) && (method != "max-less-equal" || curver <= version)) { + actver = curver; + actstr = a[i + 1]; + } + } + printf(" %s", actstr); + }'`] + AC_MSG_MODULE_DBG(" $i required versioned features: $new_list_alt3") + new_list="${new_list}${new_list_alt3}" + + #--------------------- + # macro: config_require(modules) + # - lists modules required for this module + # + # check if $i has any other required modules + # + AH_TOP([#define config_require(x)]) + new_list="$new_list `$MODULECPP module_tmp_header.h | \ + $SED -n 's/.*config_require(\(.*\)).*/\1/p'`" + AC_MSG_MODULE_DBG(" $i will test: $new_list") + if test "x$new_list" != "x"; then + for j in $new_list + do + AC_MSG_MODULE_DBG(-n " $i wants to add $j: ") + if test ! -f $srcdir/$mibdir/$j.h -a ! -f $srcdir/$mibdir/$j.c; then + AC_MSG_WARN([mib module error]) + AC_MSG_ERROR([mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir]) + elif echo " $new_with_out_mib_modules " | $GREP " $j " > /dev/null; then + if test "x$i" != "xdefault_modules" ; then + mib_cfg_msg="mib module '$i' requires module '$j' but someone told me to compile without it" + AC_MSG_WARN([mib module error]) + if test "x$with_mib_cfg_checks" = "xyes"; then + AC_MSG_ERROR([$mib_cfg_msg]) + else + AC_MSG_WARN([$mib_cfg_msg]) + AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg]) + fi +# elif echo " $module_list $new_list_two $new_module_list " | $GREP " $j " > /dev/null; then +# AC_MSG_MODULE_DBG(" $j included previously") + fi + else + new_list_two="$new_list_two $j" + AC_MSG_MODULE_DBG(" $j included") + fi + done + fi + + #--------------------- + # macro: config_add_mib(SOME-MIB) + # - lists MIBs to be added to the default to-load list. + # + # check if $i has any mibs to add + # + AH_TOP([#define config_add_mib(x)]) + new_mibs=`$MODULECPP module_tmp_header.h | \ + $SED -n 's/.*config_add_mib(\(.*\)).*/\1/p'` + if test "x$new_mibs" != "x"; then + for j in $new_mibs + do + if test "x`echo :$default_mibs: | $GREP :$j:`" = "x"; then + default_mibs="$default_mibs:$j" + fi + if test -f $srcdir/mibs/$j.txt; then + if echo $default_mibs_install | $GREP " $j " > /dev/null; then + : + else + default_mibs_install="$default_mibs_install $j.txt" + fi + fi + done + fi # new mibs + + #------------------- + # add the current module to the list of stuff to compile, etc. + # + # add $i to module list + # + AC_MSG_MODULE_DBG(" $i added (based on $i.h)") + module_list="$module_list $i" + eval ${module_type}_list="\"\$${module_type}_list $i\"" + + echo "read_config.lo: mibgroup/$i.h" >> $module_list_deps + if test $module_type = "agent_module" ; then + echo "snmp_vars.lo: mibgroup/$i.h" >> $agent_module_list_deps + else + echo "mib_modules.lo: mibgroup/$i.h" >> $mib_module_list_deps + fi + + #------------------- + # check for unsupported config_load_mib + # + if $MODULECPP module_tmp_header.h | $GREP -q config_load_mib; then + AC_MSG_WARN([mib module error]) + AC_MSG_WARN([mib module "$i" uses the "config_load_mib" directive, which is no longer supported. It probably won't work.]) + fi # grep config_load_mib + + #------------------- + # check for config_parse_dot_conf + # (generally not used any longer; old auto-load a .conf token) + # + AH_TOP([#define config_parse_dot_conf(w,x,y,z)]) + changequote(, ) + $MODULECPP module_tmp_header.h | \ + $SED -n 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@p' >> $mibdir/mib_module_dot_conf.h + changequote([, ]) + + #--------------------- + # macro: config_error(error text) + # - used to signal a configuration error from a module + # + # check if $i has any errors, or warnings + # + AH_TOP([#define config_error(x)]) + error=`$MODULECPP module_tmp_header.h | \ + $SED -n 's/.*config_error(\(.*\)).*/\1/p'` + if test "x$error" != "x"; then + echo + echo + AC_MSG_ERROR([$i: *** $error ***]) + fi + + #--------------------- + # macro: config_warning(warning text) + # - used to signal a configuration "warning" to be printed to the user + # + AH_TOP([#define config_warning(x)]) + warning=`$MODULECPP module_tmp_header.h | \ + $SED -n 's/.*config_warning(\(.*\)).*/\1/p'` + if test "x$warning" != "x"; then + all_warnings="$all_warnings $warning +" + fi + + #--------------------- + # Check for a .c file if the .h didn't exist + # + elif test -f $srcdir/$mibdir/$i.c; then + if echo " $module_list $new_list_two $new_module_list " | $GREP " $i " > /dev/null; then + AC_MSG_MODULE_DBG(" $i already included") + else + AC_MSG_MODULE_DBG(" $i added (based on $i.c)") + module_list="$module_list $i" + mib_module_list="$mib_module_list $i" + fi + + #--------------------- + # No .h or .c = error! (typo?) + # + else # no $i.h or $i.c + AC_MSG_WARN([mib module error]) + AC_MSG_ERROR([module files $i.h or $i.c could not be found in $srcdir/$mibdir]) + fi # no $i.h + + #------------------- + # check for init/shutdown routines too + # + has_c_code=no + if test -f $srcdir/$mibdir/$i.c; then + if test "x$output_to" = "xnormal" ; then + echo " $i \\" >> $module_list_code + echo $ECHO_N " $i" $ECHO_C >> $MODULE_LIST + eval tmpfilevar=\$`echo ${module_type}_list_code` + echo " $i \\" >> $tmpfilevar + else + eval "dl_${dl_name}_files=\"\$dl_${dl_name}_files $i\"" + saved_sublist_code="$saved_sublist_code $i" + fi + mnm=`echo $i | $SED 's/.*\///;s/\.c$//;'` + AC_MSG_MODULE_DBG(-e "\nchecking '$srcdir/$mibdir/$i.c' ($mnm/`basename $i`) C file for init/shutdown") + if test "x$mnm" != "x`basename $i`"; then + AC_MSG_WARN([mib module error]) + AC_MSG_ERROR([conflicting names: $mnm != `basename $i`]) + fi + temp_init=`$GREP init_$mnm $srcdir/$mibdir/$i.c | $GREP -v _init_$mnm` + if test "x$temp_init" != "x"; then + AC_MSG_MODULE_DBG(-e "adding init_$mnm() to list") + need_header=1 + echo " if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits + fi + $GREP shutdown_$mnm $srcdir/$mibdir/$i.c > /dev/null + if test $? -eq 0 ; then + if test $module_debug -eq 1; then + echo -e "\nadding shutdown_$mnm() to list" + fi + need_header=1 + echo " if (should_init(\"$mnm\")) shutdown_$mnm();" >> $mibdir/${module_type}_shutdown.h + fi + fi # test -f $srcdir/$mibdir/$i.c + + #------------------- + # if there is a shutdown/init list, + # + if test $need_header -eq 1 ; then + echo '#include "'"mibgroup/$i.h"'"' >> $output_hdrs + else + echo '/*#include "'"mibgroup/$i.h"'"*/' >> $output_hdrs + fi + + #------------------- + # check for output directory (for building outside of source tree + # + changequote(, ) + if test "x`echo $i | $SED 's/\///g;'`" != "x$i"; then + mnd=`echo $i | $SED 's/\/[^/]*$//;'` + if test ! -d ./$mibdir/$mnd; then + module_directories="$module_directories ./$mibdir/$mnd" + fi + fi # module directory test + changequote([, ]) + + #------------------- + # define USING_*_MODULE + # + changequote(, ) + sym="`echo ${i} | $SED 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`" + changequote([, ]) + echo "/* Define if compiling with the ${i} module files. */" >> include/net-snmp/agent/${module_type}_config.h + echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/${module_type}_config.h + echo " " >> include/net-snmp/agent/${module_type}_config.h + + #------------------- + echo $ECHO_N " $i$ECHO_C" + fi # + done # for i in $module_sublist + + if test "$output_to" = "separate" ; then + if test "x$new_list_two" = "x" ; then + # no new sub-modules to add to the current target + output_to="normal" + + dllcleans="$saved_sublist_o $dllcleans" + output_inits="" + module_sublist="" + else + # a module had sub-modules required; keep goin' + saved_sublist="$saved_sublist $module_sublist" + module_sublist="$new_list_two" + new_list_two="" + fi + else + module_sublist="" + fi + + done # while module_sublist + done # for j in $new_module_list + + # remember the top level modules for later reporting + if test $first_pass = 1 ; then + # remember this list for later reporting + top_level_modules="$new_module_list => $new_list_two" + first_pass=0 + fi + #------------------- + # if $i added new modules vis config_*, + # check those modules for requirements too + # + # transfer the new module to check list to the normal variable + # + if test "x$new_list_two" ; then + output_to=normal + fi + new_module_list="$new_list_two" + new_list_two="" +done # while test "x$new_module_list" != "x"; do +echo "" + +#-------------------- +# construct the dll code files and make rules. This can't be done +# until now because duplicate use of a module means it gets removed +# from the dll and put into the main agent. +# +for i in $dl_names ; do + eval mod_files="\"\$dl_${i}_files\"" + echo "components in the $i dll: $mod_files" + + output_inits="agent/mibgroup/${i}-dll.c" + output_hdrs="agent/mibgroup/${i}-hdrs.h" + + AC_MSG_MODULE_DBG("creating dll file: $output_inits") + for ofile in $output_inits $output_hdrs ; do + if test -f $ofile ; then + if $GREP "this file created automatically by configure" $ofile > /dev/null 2>&1 ; then + : + else + AC_MSG_ERROR([$ofile already existed ; can't build dll object $i]) + fi + fi + cat > $ofile << EOFIF +/* xDo not edit; this file created automatically by configure */ +EOFIF + done + + cat >> $output_inits << EOFOC +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> +#include "${i}-hdrs.h" +void +init_$i(void) { +EOFOC + + # create the .so rule + saved_sublist_o=`echo "$mod_files " | $SED 's/^ *//g;s/ */.o /g;'` + + # create the rules for each object + for j in $mod_files ; do + cat >> $module_rules << EOFR +$j.o: $j.c + \$(CC) -c \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ \$< + +EOFR + mnm=`echo $j | $SED 's/.*\///;s/\.c$//;'` + echo " if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits + done + + # create the rule for the .so and wrapper code + cat >> $module_rules << EOFM +${i}-dll.o: ${i}-dll.c + \$(CC) -c \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ \$< + +${i}.so: $saved_sublist_o ${i}-dll.o + \$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ $saved_sublist_o ${i}-dll.o + +EOFM + cat >> $output_inits << EOFOCFIN +} +EOFOCFIN + +done + +# cleanup +rm -f conftest.$ac_ext module_tmp_header.h + +#------------------- +# build module lists for Makefiles +# +changequote(, ) + +for i in module_list_o module_list_c module_list_lo module_list_ft mib_module_list_o mib_module_list_c mib_module_list_lo mib_module_list_ft mibgroup_list_o mibgroup_list_lo mibgroup_list_ft agent_module_list_o agent_module_list_c agent_module_list_lo agent_module_list_ft agentgroup_list_o agentgroup_list_lo agentgroup_list_ft ; do + eval "$i=mk/${i}.mk" +done + +$SED 's/^module_list_code/module_list_o/;s/\([^=]\) *\\/\1.o \\/g' < $module_list_code > $module_list_o +$SED 's/^module_list_code/module_list_c/;s/\([^=]\) *\\/\1.c \\/g' < $module_list_code > $module_list_c +$SED 's/^module_list_code/module_list_lo/;s/\([^=]\) *\\/\1.lo \\/g' < $module_list_code > $module_list_lo +$SED 's/^module_list_code/module_list_ft/;s/\([^=]\) *\\/\1.ft \\/g' < $module_list_code > $module_list_ft + +$SED 's/^mib_module_list_code/mib_module_list_o/;s/\([^=]\) *\\/\1.o \\/g' < $mib_module_list_code > $mib_module_list_o +$SED 's/^mib_module_list_code/mib_module_list_c/;s/\([^=]\) *\\/\1.c \\/g' < $mib_module_list_code > $mib_module_list_c +$SED 's/^mib_module_list_code/mib_module_list_lo/;s/\([^=]\) *\\/\1.lo \\/g' < $mib_module_list_code > $mib_module_list_lo +$SED 's/^mib_module_list_code/mib_module_list_ft/;s/\([^=]\) *\\/\1.ft \\/g' < $mib_module_list_code > $mib_module_list_ft + +$SED 's/^mib_module_list_o/mibgroup_list_o/;s@\([^ ]*\)\.o@mibgroup/\1.o@g' < $mib_module_list_o > $mibgroup_list_o +$SED 's/^mib_module_list_lo/mibgroup_list_lo/;s@\([^ ]*\)\.lo@mibgroup/\1.lo@g' < $mib_module_list_lo > $mibgroup_list_lo +$SED 's/^mib_module_list_ft/mibgroup_list_ft/;s@\([^ ]*\)\.ft@mibgroup/\1.ft@g' < $mib_module_list_ft > $mibgroup_list_ft + +$SED 's/^agent_module_list_code/agent_module_list_o/;s/\([^=]\) *\\/\1.o \\/g' < $agent_module_list_code > $agent_module_list_o +$SED 's/^agent_module_list_code/agent_module_list_c/;s/\([^=]\) *\\/\1.c \\/g' < $agent_module_list_code > $agent_module_list_c +$SED 's/^agent_module_list_code/agent_module_list_lo/;s/\([^=]\) *\\/\1.lo \\/g' < $agent_module_list_code > $agent_module_list_lo +$SED 's/^agent_module_list_code/agent_module_list_ft/;s/\([^=]\) *\\/\1.ft \\/g' < $agent_module_list_code > $agent_module_list_ft + +$SED 's/^agent_module_list_o/agentgroup_list_o/;s@\([^ ]*\)\.o@mibgroup/\1.o@g' < $agent_module_list_o > $agentgroup_list_o +$SED 's/^agent_module_list_lo/agentgroup_list_lo/;s@\([^ ]*\)\.lo@mibgroup/\1.lo@g' < $agent_module_list_lo > $agentgroup_list_lo +$SED 's/^agent_module_list_ft/agentgroup_list_ft/;s@\([^ ]*\)\.ft@mibgroup/\1.ft@g' < $agent_module_list_ft > $agentgroup_list_ft + +for i in module_list_o module_list_c module_list_lo module_list_ft mib_module_list_o mib_module_list_c mib_module_list_lo mib_module_list_ft mibgroup_list_o mibgroup_list_lo mibgroup_list_ft agent_module_list_o agent_module_list_c agent_module_list_lo agent_module_list_ft agentgroup_list_o agentgroup_list_lo agentgroup_list_ft ; do + # hpux make (at least) doesn't like a trailing \ on the last + # line even when the next line contains nothing but + # whitespace. + lasttoken=`awk '{lasttoken=$1}END{print lasttoken}' mk/$i.mk` + $SED "s#$lasttoken \\\\#$lasttoken#" < mk/$i.mk > mk/$i.mk.tmp + mv mk/$i.mk.tmp mk/$i.mk + + # add a closing comment + echo "" >> mk/$i.mk + echo "# end configure generated code" >> mk/$i.mk +done + +changequote([, ]) + +if test $module_debug -eq 1; then + echo -e "\nFinal module list: $module_list_code" + exit +fi +if test "x$with_mib_cfg_checks" = "xyes"; then + AC_MSG_CACHE_ADD([Agent Module list: $module_list_code]) +fi +AC_SUBST_FILE(MODULE_LIST) +AC_SUBST_FILE(module_list_c) +AC_SUBST_FILE(module_list_o) +AC_SUBST_FILE(module_list_lo) +AC_SUBST_FILE(module_list_ft) +AC_SUBST_FILE(mib_module_list_c) +AC_SUBST_FILE(mib_module_list_o) +AC_SUBST_FILE(mib_module_list_lo) +AC_SUBST_FILE(mib_module_list_ft) +AC_SUBST_FILE(agent_module_list_c) +AC_SUBST_FILE(agent_module_list_o) +AC_SUBST_FILE(agent_module_list_lo) +AC_SUBST_FILE(agent_module_list_ft) +AC_SUBST_FILE(mibgroup_list_o) +AC_SUBST_FILE(mibgroup_list_lo) +AC_SUBST_FILE(mibgroup_list_ft) +AC_SUBST_FILE(agentgroup_list_o) +AC_SUBST_FILE(agentgroup_list_lo) +AC_SUBST_FILE(agentgroup_list_ft) + +AC_SUBST(default_mibs_install) +AC_SUBST(dllcleans) +AC_SUBST_FILE(module_rules) +AC_SUBST_FILE(module_list_deps) +AC_SUBST_FILE(mib_module_list_deps) +AC_SUBST_FILE(agent_module_list_deps) + +AC_MSG_RESULT(.) + +if test $module_debug -eq 1; then +AC_MSG_CACHE_ADD(Agent MIB code: $module_list) +fi +AC_MSG_CACHE_ADD(Agent MIB code: $top_level_modules) + +# end hairy agent module processing + +AC_MSG_CHECKING([if directories need to be created]) +for i in $module_directories; do + $srcdir/mkinstalldirs $i +done +AC_MSG_RESULT(.) + +#------------------- +# Define default mibs +# +AC_MSG_CHECKING([default mib files to read]) +if test "x$NETSNMP_DEFAULT_MIBS" = "x"; then + NETSNMP_DEFAULT_MIBS="$default_mibs" +fi +if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then + # mingw32 and cygwin use ';' as the environment variable separator char + ENV_SEPARATOR=";" + NETSNMP_DEFAULT_MIBS=`echo "$NETSNMP_DEFAULT_MIBS" | $SED 's/:/;/g'` + default_mibs=`echo "$default_mibs" | $SED 's/:/;/g'` +else + ENV_SEPARATOR=":" +fi +AC_SUBST(ENV_SEPARATOR) +AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBS,"$NETSNMP_DEFAULT_MIBS") +AC_SUBST(NETSNMP_DEFAULT_MIBS) +AC_MSG_RESULT($NETSNMP_DEFAULT_MIBS) + +#------------------- +# Define symbols for conditional compilation in makefiles +# + +if echo " $agent_module_list " | \ + fgrep ' agentx/agentx_config ' | \ + fgrep ' agentx/client ' | \ + fgrep ' agentx/protocol ' > /dev/null ; then + NETSNMP_HAVE_AGENTX_LIBS_TRUE='' + NETSNMP_HAVE_AGENTX_LIBS_FALSE='#' +else + NETSNMP_HAVE_AGENTX_LIBS_TRUE='#' + NETSNMP_HAVE_AGENTX_LIBS_FALSE='' +fi +AC_SUBST([NETSNMP_HAVE_AGENTX_LIBS_TRUE]) +AC_SUBST([NETSNMP_HAVE_AGENTX_LIBS_FALSE]) diff --git a/configure.d/config_modules_lib b/configure.d/config_modules_lib new file mode 100644 index 0000000..b6609c1 --- /dev/null +++ b/configure.d/config_modules_lib @@ -0,0 +1,232 @@ +# -*- autoconf -*- +# +# Maybe add library extensions for thread mutex locking. +# + +if test "x$with_res_locks" = "xyes"; then + AC_DEFINE(NETSNMP_REENTRANT, 1, + [Define to 1 if you want to build with reentrant/threaded + code (incomplete).]) + + case $target_os in + + aix*) + CC_RUNTIME_ARG="$CC_RUNTIME_ARG -lpthreads" + ;; + + *) + ;; + + esac +fi + +# +# Add platform-specific source files. +# +AC_MSG_CHECKING([for platform-specific source]) +other_src_list="" +other_ftobjs_list="" +other_lobjs_list="" +other_objs_list="" +other_agentobjs="" +other_lagentobjs="" +other_ftagentobjs="" +other_trapd_objects="" + +# Win32 service code +if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then + other_src_list="$other_src_list winservice.c winservicerc.rc" + other_objs_list="$other_objs_list winservice.o winservicerc.o" + other_lobjs_list="$other_lobjs_list winservice.lo winservicerc.lo" + other_ftobjs_list="$other_ftobjs_list winservice.ft winservicerc.ft" + other_agentobjs="../snmplib/winservicerc.o" + other_lagentobjs="../snmplib/winservicerc.lo" + other_ftagentobjs="../snmplib/winservicerc.lo" + other_trapd_objects="../snmplib/winservicerc.o" +fi + +# Win32 pipes +if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then + other_src_list="$other_src_list winpipe.c" + other_objs_list="$other_objs_list winpipe.o" + other_lobjs_list="$other_lobjs_list winpipe.lo" + other_ftobjs_list="$other_ftobjs_list winpipe.ft" +fi + +AC_SUBST(other_src_list) +AC_SUBST(other_objs_list) +AC_SUBST(other_lobjs_list) +AC_SUBST(other_ftobjs_list) +AC_SUBST(other_agentobjs) +AC_SUBST(other_lagentobjs) +AC_SUBST(other_ftagentobjs) +AC_SUBST(other_trapd_objects) + +AC_MSG_RESULT([$other_src_list $other_objs_list $other_lobjs_list]) +AC_MSG_RESULT([$other_agentobjs $other_lagentobjs $other_trapd_objects]) + +# +# Create directory structure for build +# +if test ! -d include; then + mkdir include +fi +if test ! -d include/net-snmp; then + mkdir include/net-snmp +fi +if test ! -d include/net-snmp/agent; then + mkdir include/net-snmp/agent +fi +if test ! -d include/net-snmp/library; then + mkdir include/net-snmp/library +fi +if test ! -d include/ucd-snmp; then + mkdir include/ucd-snmp +fi + +if test ! -d snmplib; then + mkdir snmplib +fi +if test ! -d snmplib/transports ; then + mkdir snmplib/transports +fi + +# +# Do transport module processing. +# +AC_MSG_CHECKING([for and configuring transport modules to use]) + +# include the actual code checking +m4_include(configure.d/config_modules_transports) + +AC_SUBST(transport_hdr_list) +AC_SUBST(transport_src_list) +AC_SUBST(transport_obj_list) +AC_SUBST(transport_lobj_list) +AC_SUBST(transport_ftobj_list) +for i in $transport_def_list; do + AC_DEFINE_UNQUOTED($i) +done +AC_MSG_RESULT($transport_result_list.) +AC_MSG_CACHE_ADD(Network transport support: $transport_result_list) + +# cleanup +rm -f module_tmp_header.h + +# +# Security modules to use +# + +AC_MSG_CHECKING([for security modules to use]) +m4_include(configure.d/config_modules_security_modules) +AC_SUBST(security_src_list) +AC_SUBST(security_hdr_list) +AC_SUBST(security_obj_list) +AC_SUBST(security_lobj_list) +AC_SUBST(security_ftobj_list) +AC_MSG_RESULT($new_with_security) +AC_MSG_CACHE_ADD(SNMPv3 Security Modules: $new_with_security) + +# +# Handle the special case of KSM to see which crypto API we support +# + +ac_cv_NETSNMP_USE_KERBEROS_MIT=no +rebuilt_new_with_security= +already_checked_krb5=no + +for sec in $new_with_security +do + if test "x$sec" = "xksm" -a "xyes" = "x$already_checked_krb5"; then + continue + fi + already_checked_krb5=yes + + if test x$sec != xksm; then + rebuilt_new_with_security="$rebuilt_new_with_security $sec" + else + if test no = $trykrb5; then + AC_MSG_NOTICE([configured not to use krb5. disabling ksm]) + continue + fi + + AC_PATH_PROG([krb5_config],krb5-config,[no],$krb5path/bin:$PATH) + + if test no != $krb5_config; then + CPPFLAGS="$CPPFLAGS `$krb5_config --cflags`" + LIBS="$LIBS `$krb5_config --libs`" + elif test $krb5path != no; then + AC_ADD_SEARCH_PATH($krb5path) + else + AC_ADD_SEARCH_PATH(/usr/kerberos) + fi + + AC_MSG_CHECKING([for krb5]) + AC_CACHE_VAL(ac_cv_have_krb5, + AC_CHECK_LIB(krb5, krb5_init_context, + ac_cv_have_krb5=yes, ac_cv_have_krb5=no + ) + ) + + if test $ac_cv_have_krb5 = no; then + if test "x$askedkrb5" = "xyes"; then + AC_MSG_ERROR(Asked to use krb5 but I couldn't find it.) + fi + AC_MSG_RESULT(no. disabling ksm) + continue + fi + + AC_MSG_RESULT(yes) + rebuilt_new_with_security="$rebuilt_new_with_security ksm" + + AC_MSG_CHECKING([[for heimdal]]) + AC_CACHE_VAL(ac_cv_heimdal, + [AC_TRY_COMPILE( + [#include <krb5.h>], + [const char *v = heimdal_version;], + ac_cv_heimdal=yes, + ac_cv_heimdal=no + )]) + AC_MSG_RESULT($ac_cv_heimdal) + if test $ac_cv_heimdal = yes; then + AC_DEFINE(NETSNMP_USE_KERBEROS_HEIMDAL, 1, + [Define this if you're using Heimdal Kerberos]) + if test no = $krb5_config; then + LIBS="$LIBS -lkrb5 -lasn1 -lcom_err -lroken" + fi + elif test no = $krb5_config; then + LIBS="$LIBS -lkrb5 -lcom_err" + fi + + AC_MSG_CHECKING([to see which crypto API we need to use]) + AC_CHECK_FUNC(krb5_c_encrypt,[ + AC_CACHE_VAL(ac_cv_NETSNMP_USE_KERBEROS_MIT, + AC_CHECK_LIB(k5crypto, krb5_init_context, + ac_cv_NETSNMP_USE_KERBEROS_MIT=yes, ac_cv_MIT_NEW_CRYPTo=no + ) + ) + + if test yes = $ac_cv_NETSNMP_USE_KERBEROS_MIT; then + AC_MSG_RESULT(new MIT crypto API) + AC_DEFINE(NETSNMP_USE_KERBEROS_MIT, 1, + [Define this if we're using the new MIT crypto API]) + if test no = $krb5_config; then + LIBS="$LIBS -lk5crypto" + fi + else + AC_MSG_RESULT(old MIT crypto API)]) + fi + fi +done + +new_with_security=$rebuilt_new_with_security + +# +# Detect lm_sensors version +# +if test "x$ac_cv_header_sensors_sensors_h" = "xyes"; then + AC_CHECK_DECLS([sensors_get_all_subfeatures], + [AC_DEFINE(NETSNMP_USE_SENSORS_V3, 1, + [Define this if you have lm_sensors v3 or later])],, + [[#include <sensors/sensors.h>]]) +fi diff --git a/configure.d/config_modules_security_modules b/configure.d/config_modules_security_modules new file mode 100644 index 0000000..823ca7d --- /dev/null +++ b/configure.d/config_modules_security_modules @@ -0,0 +1,70 @@ +# -*- sh -*- +security_def_list="usm" +security_src_list="" +security_obj_list="" +security_lobj_list="" +security_ftobj_list="" +security_mod_list=" " + +new_with_security= +new_with_out_security=`echo $with_out_security_modules | tr , ' '` + +# Assign additional security modules +for i in `echo $with_security_modules | tr , ' '`; do + if echo " $new_with_out_security " | $GREP " $i " > /dev/null; then + echo + AC_MSG_ERROR([security module conflict - $i both included and excluded]) + elif echo " $new_with_security " | $GREP " $i " > /dev/null ; then + : # Double define, ignore + else + new_with_security="$new_with_security $i" + fi +done + +# Add default security modules +for i in $security_def_list; do + if echo " $new_with_out_security " | $GREP " $i " > /dev/null; then + : # Excluded, ignore + elif echo " $new_with_security " | $GREP " $i " > /dev/null ; then + : # Double define, ignore + else + new_with_security="$new_with_security $i" + fi +done + +# Generate output files +: ${security_init_file:='snmplib/snmpsm_init.h'} +: ${security_shutdown_file:='snmplib/snmpsm_shutdown.h'} +: ${security_incl_file:='include/net-snmp/library/snmpv3-security-includes.h'} + +echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $security_init_file +echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $security_shutdown_file +echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $security_incl_file + +for i in $new_with_security; do + cfile="snmp"$i".c" + hfile="snmp"$i".h" + + # make sure support exists for it + if test -f $srcdir"/snmplib/"$cfile -a -f $srcdir"/include/net-snmp/library/"$hfile; then + : + else + echo + AC_MSG_ERROR(No such security module: $i / $cfile / $hfile) + fi + + # define a bunch of stuff to enable it + security_mod_list="${security_mod_list} $i" + security_src_list="$security_src_list $cfile" + security_src_list="$security_src_list $cfile" + security_hdr_list="$security_hdr_list $hfile" + security_obj_list="$security_obj_list snmp"$i".o" + security_lobj_list="$security_lobj_list snmp"$i".lo" + security_ftobj_list="$security_ftobj_list snmp"$i".ft" + echo "init_"$i"();" >> $security_init_file + echo "shutdown_"$i"();" >> $security_shutdown_file + echo "#include <net-snmp/library/$hfile>" >> $security_incl_file + def_name="AS_TR_CPP([NETSNMP_SECMOD_$i])" + AC_DEFINE_UNQUOTED($def_name) +done + diff --git a/configure.d/config_modules_transports b/configure.d/config_modules_transports new file mode 100644 index 0000000..b10b960 --- /dev/null +++ b/configure.d/config_modules_transports @@ -0,0 +1,137 @@ +# -*- sh -*- +transport_src_list="" +transport_hdr_list="" +transport_def_list="" +transport_result_list="" +transport_add_list="" +new_with_transport_list=`echo $with_transports | $SED 's/,/ /g;'` +new_with_out_transport_list=`echo $with_out_transports | $SED 's/,/ /g;'` + +# set up the CPP command +MODULECPP="$CPP $PARTIALTARGETFLAGS -I${srcdir} -I${srcdir}/include" + +# +# Add the default transports to the list +# +if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then + transport_default_list="UDP TCP Alias Callback" +else + transport_default_list="UDP TCP Alias Unix Callback" +fi +if test "x$enable_ipv6" = "xyes"; then + transport_default_list="UDPIPv6 TCPIPv6 $transport_default_list" +fi +for i in $transport_default_list; do + if echo " $new_with_transport_list " | $GREP " $i " >/dev/null; then + : + else + transport_add_list="$i $transport_add_list" + fi +done +new_transport_list="$transport_add_list $new_with_transport_list" + +if test "x$ctor_header" = "x" ; then + ctor_header="snmplib/transports/snmp_transport_inits.h" +fi + +echo "/* This file is automatically generated by configure. Do not modify by hand. */" > $ctor_header +while test "x$new_transport_list" != "x"; do + future_new_transport_list="" + for i in $new_transport_list; do + if echo " $new_with_out_transport_list " | $GREP " $i " >/dev/null; then + true + else + if test "x$enable_ipv6" != "xyes"; then + if test "x$i" = "xUDPIPv6" -o "x$i" = "xTCPIPv6"; then + AC_MSG_ERROR(IPv6 transports not available if IPv6 support is not enabled) + fi + fi + transport_src="transports/snmp"$i"Domain.c" + transport_hdr="snmp"$i"Domain.h" + rel_transport_src="snmplib/"$transport_src + rel_transport_hdr="include/net-snmp/library/"$transport_hdr + lc_i=`echo $i | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + ctor_fn="netsnmp_"$lc_i"_ctor" + if test -f "$srcdir/$rel_transport_src"; then + transport_result_list="$transport_result_list $i" + transport_src_list="$transport_src $transport_src_list" + if test -f "$srcdir/$rel_transport_hdr"; then + transport_hdr_list="$transport_hdr $transport_hdr_list" + fi + transport_def=`echo $i | $SED 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + transport_def_list="NETSNMP_TRANSPORT_"$transport_def"_DOMAIN $transport_def_list" + else + echo + AC_MSG_ERROR(Cannot find file $srcdir/$rel_transport_src to support SNMP transport domain $i.) + fi + + #--------------------- + # build a pseudo include header that includes current config and + # system symbols: + rm -f conftest.$ac_ext module_tmp_header.h + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ +#include NETSNMP_SYSTEM_INCLUDE_FILE +#undef NETSNMP_MINIMAL_CODE +#define NET_SNMP_CONFIG_H +#undef config_require +#define config_require(foo) config_checkit_require(foo) +#undef config_error +#define config_error(foo) config_checkit_error(foo) +#include "$rel_transport_hdr"]])]) + mv conftest.$ac_ext module_tmp_header.h + + # + # check for dependencies using config_require() macro + # + sub_list=`$MODULECPP module_tmp_header.h | $GREP config_checkit_require | $SED 's/.*config_checkit_require *( *\(.*\) *).*/\1/'` + if test "x$sub_list" != "x" ; then + for j in $sub_list ; do + if echo " $future_new_transport_list $new_transport_list " | $GREP " $j " > /dev/null ; then + : + else + future_new_transport_list="$future_new_transport_list $j" + fi + done + fi + + # + # check for errors using config_error() macro + # + error_list=`$MODULECPP module_tmp_header.h | $GREP config_checkit_error | $SED 's/.*config_checkit_error(\(.*\)).*/\1/g'` + if test "x$error_list" != "x" ; then + echo "" + AC_MSG_ERROR($error_list) + fi + + # + # Check for needed constructor initialization routines to call + # + found=`grep $ctor_fn $srcdir/$rel_transport_src` + if grep $ctor_fn $srcdir/$rel_transport_src > /dev/null ; then + # we add them down below instead of here to make sure + # config_require dependency constructors get called first. + tr_init_list="$ctor_fn $tr_init_list" + fi + fi + done # for each new transport + new_transport_list="$future_new_transport_list" +done # while new transports exist +transport_obj_list=`echo " $transport_src_list " | $SED 's/\.c/\.o/g'` +transport_lobj_list=`echo " $transport_src_list " | $SED 's/\.c/\.lo/g'` +transport_ftobj_list=`echo " $transport_src_list " | $SED 's/\.c/\.ft/g'` +for i in $tr_init_list ; do + echo "$i();" >> $ctor_header +done + +## win32 platforms require inet_ntop etc. +if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then + if echo "$transport_def_list" | $GREP "IPV6" >/dev/null; then + transport_obj_list="$transport_obj_list inet_ntop.o inet_pton.o" + transport_lobj_list="$transport_lobj_list inet_ntop.lo inet_pton.lo" + transport_ftobj_list="$transport_ftobj_list inet_ntop.ft inet_pton.ft" + fi +fi + +if test "x$transport_result_list" = x ; then + AC_MSG_ERROR([No transports configured, at least one must be provided]) +fi diff --git a/configure.d/config_os_functions b/configure.d/config_os_functions new file mode 100644 index 0000000..3c5385b --- /dev/null +++ b/configure.d/config_os_functions @@ -0,0 +1,324 @@ +# -*- autoconf -*- +######################################### +## +# Checks for library functions. +## +######################################### + +## +# Standard checks: +## +AC_FUNC_ALLOCA # alloca() +AC_PROG_GCC_TRADITIONAL + +if test "$cross_compiling" = yes -a "${ac_cv_func_memcmp_working+set}" != set +then + # Cross-compiling and ac_cv_func_memcmp_working has not been set - assume + # that memcmp() is available. + ac_cv_func_memcmp_working=yes +else + # Native compilation - test for the availability of memcmp(). + AC_FUNC_MEMCMP +fi + +AC_TYPE_SIGNAL + +## +# Stand-alone function checks: +## +# Core: +AC_CHECK_FUNCS([lrand48 rand random ] dnl + [signal sigset ] ) + +# Library: +AC_CHECK_FUNCS([closedir fgetc_unlocked flockfile ] dnl + [fork funlockfile getipnodebyname ] dnl + [gettimeofday if_nametoindex mkstemp ] dnl + [opendir readdir regcomp ] dnl + [setenv setitimer setlocale ] dnl + [setsid snprintf strcasestr ] dnl + [strdup strerror strncasecmp ] dnl + [sysconf times vsnprintf ] ) + +# IPv4/IPv6 function checks. AC_CHECK_FUNC() can't find these on MinGW +# since these functions have the __cdecl calling convention on MinGW. +case x$target_os in + xmingw*) + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ws2tcpip.h>], + [ gai_strerror(0); ])], + [ ac_cv_func_gai_strerror=yes + AS_ECHO "#define HAVE_GAI_STRERROR 1" >>confdefs.h + ], [ ]) + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <ws2tcpip.h>], + [ getaddrinfo(NULL, NULL, NULL, NULL); ])], + [ ac_cv_func_getaddrinfo=yes + AS_ECHO "#define HAVE_GETADDRINFO 1" >>confdefs.h + ], [ ]) + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <winsock2.h>], + [ gethostbyname(NULL); ])], + [ ac_cv_func_gethostbyname=yes + AS_ECHO "#define HAVE_GETHOSTBYNAME 1" >>confdefs.h + ], [ ]) + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <winsock2.h>], + [ gethostbyaddr(NULL); ])], + [ ac_cv_func_gethostaddr=yes + AS_ECHO "#define HAVE_GETHOSTBYADDR 1" >>confdefs.h + ], [ ]) + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <winsock2.h>], + [ gethostname(NULL, 0); ])], + [ ac_cv_func_gethostname=yes + AS_ECHO "#define HAVE_GETHOSTNAME 1" >>confdefs.h + ], [ ]) + ;; + + *) + AC_CHECK_FUNCS([gai_strerror getaddrinfo gethostbyname gethostbyname2 gethostname gethostbyaddr]) + ;; +esac + +AC_CONFIG_LIBOBJ_DIR([snmplib]) + +AC_REPLACE_FUNCS([getopt inet_ntop inet_pton ] dnl + [strlcat strlcpy strtok_r ] dnl + [strtol strtoul strtoull ] ) + +# Agent: +AC_CHECK_FUNCS([cgetnext chown execv ] dnl + [gai_strerror getgrnam ] dnl + [gethostname getloadavg ] dnl + [getpid getpwnam ] dnl + [hasmntopt initgroups ] dnl + [if_nameindex if_indextoname if_nametoindex ] dnl + [localtime_r mkstemp mktime ] dnl + [poll regcomp ] dnl + [setgid setgroups ] dnl + [setmntent setuid ] dnl + [sigaction sigblock sighold ] dnl + [sigprocmask ] dnl + [statfs statvfs stime ] dnl + [strncasecmp system ] dnl + [uname usleep ] ) + +# Apps: +AC_CHECK_FUNCS([getdtablesize ] dnl + [getgrnam getpid getpwnam ] dnl + [setgid setgroups setuid ] dnl + [tcgetattr ] ) + +# Not-Used: +AC_CHECK_FUNCS([if_freenameindex getpagesize ] dnl + [lseek64 pread64 ] dnl + [select sigalrm socket ] ) + + +## +# More complex function checks: +# (Agent) +## + +# rpmGetPath check needs clean LIBS environment (Linux) +# +if test "x$with_rpm" != "xno"; then + OLDLIBS=$LIBS + LIBS=$LMIBLIBS + AC_CHECK_FUNCS(rpmGetPath) + LIBS=$OLDLIBS +fi + +# statfs( char *, struct fs_data* ) (Ultrix) +# +AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]]) +AC_CACHE_VAL( + fu_cv_sys_stat_fs_data, + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#include <sys/types.h> +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif +#ifdef HAVE_SYS_FS_TYPES_H +#include <sys/fs_types.h> +#endif +main () +{ +struct fs_data fsd; +/* Ultrix's statfs returns 1 for success, + 0 for not mounted, -1 for failure. */ +exit (statfs (".", &fsd) != 1); +}]])], + [fu_cv_sys_stat_fs_data=yes], + [fu_cv_sys_stat_fs_data=no], + [fu_cv_sys_stat_fs_data=no])]) +AC_MSG_RESULT($fu_cv_sys_stat_fs_data) +if test $fu_cv_sys_stat_fs_data = yes; then + AC_DEFINE(STAT_STATFS_FS_DATA, 1, + [Define if statfs takes 2 args and the second argument has + type struct fs_data. @<:@Ultrix@:>@]) +fi + + +## +# Other function-related checks: +# (general build) +## + +# How to get the name of the current function +# +AC_CACHE_CHECK([how to get the name of the current function], + [netsnmp_cv__func__name],[ + netsnmp_cv__func__name=no + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM(,[[const char* cp = __func__;]])], + [netsnmp_cv__func__name=__func__]) + if test "$netsnmp_cv__func__name" = no ; then + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM(,[[const char* cp = __FUNCTION__;]])], + [netsnmp_cv__func__name=__FUNCTION__]) + fi]) +if test "$netsnmp_cv__func__name" != no; then + AC_DEFINE_UNQUOTED([NETSNMP_FUNCTION],[$netsnmp_cv__func__name], + [Should evaluate to the name of the current function if defined]) +fi + + +# Whether static inline functions are broken (SCO Unixware) +# +AC_CACHE_CHECK([[whether static inline functions are broken (Unixware)]], + [netsnmp_cv_c_broken_inline], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ +static inline int nested_inline_function(void) { + return 0; +} +inline int main_inline_function( void ) { + return nested_inline_function(); +} + ])], + netsnmp_cv_broken_inline=no, + netsnmp_cv_broken_inline=yes)) + + +# Yes - static inline functions are broken (Solaris 2.x) +# +case "$target_os" in + solaris*) + netsnmp_cv_broken_inline=yes + ;; + *) + ;; +esac + +if test "$netsnmp_cv_broken_inline" = yes ; then + AC_DEFINE(NETSNMP_BROKEN_INLINE, 1, + [Define if static inline functions are unsupported]) +fi + + +## +# Mis-placed (non-function) checks: +## + +AC_CACHE_CHECK([for SIOCGIFADDR in sys/ioctl.h], + netsnmp_cv_sys_ioctl_h_has_SIOCGIFADDR, + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#ifdef HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif +#ifndef SIOCGIFADDR +No SIOCGIFADDR found here. +#endif + ]])], + [netsnmp_cv_sys_ioctl_h_has_SIOCGIFADDR=yes], + [netsnmp_cv_sys_ioctl_h_has_SIOCGIFADDR=no])) +if test $netsnmp_cv_sys_ioctl_h_has_SIOCGIFADDR = yes; then + AC_DEFINE(SYS_IOCTL_H_HAS_SIOCGIFADDR, 1, + [define if SIOCGIFADDR exists in sys/ioctl.h]) +fi + +## +# Check how to print a size_t variable +## + +AC_CACHE_CHECK( + [the underlying type of a size_t], + netsnmp_cv_size_t_type, + [m4_foreach([TYPE], [[int],[long],[long long],[short],[char]], + [if [[ x$netsnmp_cv_size_t_type = x ]] ; then + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[AC_INCLUDES_DEFAULT() +extern unsigned TYPE variable; +extern size_t variable;], + [])], + [netsnmp_cv_size_t_type="TYPE"]) + fi + ])]) + +AC_MSG_CHECKING([how to printf a size_t]) +case "$netsnmp_cv_size_t_type" in + char|short|int) netsnmp_PRIz="" ;; + long) netsnmp_PRIz="l" ;; + "long long") netsnmp_PRIz="ll" ;; + *) AC_MSG_ERROR([underlying type of size_t not known]) ;; +esac +AC_MSG_RESULT($netsnmp_PRIz) +AC_DEFINE_UNQUOTED([NETSNMP_PRIz], ["$netsnmp_PRIz"], + [Size prefix to use to printf a size_t or ssize_t]) + +## +# Check how to print a uint32_t variable +## + +AC_CACHE_CHECK( + [the underlying type of an uint32_t], + netsnmp_cv_uint32_t_type, + [m4_foreach([TYPE], [[char],[short],[int],[long],[long long]], + [if [[ x$netsnmp_cv_uint32_t_type = x ]] ; then + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[AC_INCLUDES_DEFAULT() +extern unsigned TYPE variable; +extern uint32_t variable;], + [])], + [netsnmp_cv_uint32_t_type="TYPE"]) + fi + ])]) + +AC_MSG_CHECKING([how to printf a uint32_t]) +case "$netsnmp_cv_uint32_t_type" in + char|short|int) netsnmp_PRI32="" ;; + long) netsnmp_PRI32="l" ;; + "long long") netsnmp_PRI32="ll" ;; + *) AC_MSG_ERROR([underlying type of uint32_t not known]) ;; +esac +AC_MSG_RESULT($netsnmp_PRI32) +AC_DEFINE_UNQUOTED([NETSNMP_PRI32], ["$netsnmp_PRI32"], + [Size prefix to use to printf a uint32_t]) + +# check to see if the openssl is good enough for DTLS +# (BIO_dgram_get_peer is a macro, not a true function) +if echo " $transport_result_list " | $GREP "DTLS" > /dev/null; then + AC_CACHE_VAL( + netsnmp_cv_bio_dgram_get_peer, + AC_MSG_CHECKING([[for BIO_dgram_get_peer]]) + [ + oldLIBS="$LIBS" + LIBS="$LIBS -lcrypto" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <openssl/bio.h>]], + [[BIO_dgram_get_peer(NULL, NULL);]])], [], + [AC_MSG_ERROR(DTLS support requires a newer version of OpenSSL)]) + + LIBS="$oldLIBS" + ] + AC_MSG_RESULT(yes) + ) +fi + diff --git a/configure.d/config_os_headers b/configure.d/config_os_headers new file mode 100644 index 0000000..d903f58 --- /dev/null +++ b/configure.d/config_os_headers @@ -0,0 +1,523 @@ +######################################### +## +# Checks for header files. +## +######################################### + +## +# Standard checks: +## +# Core: +AC_HEADER_STDC # <stdlib.h>, <stdarg.h>, <string.h> & <float.h> +AC_HEADER_DIRENT # <dirent.h>, <sys/ndir.h>, <sys/dir.h> & <ndir.h> +# Apps: +AC_HEADER_SYS_WAIT # <sys/wait.h> + +# allow for quick module/library/etc processing checks +if test "x$NETSNMP_QUICK_CHECK" = "x" ; then + +## +# Stand-alone headers: +## +# Core: +AC_CHECK_HEADERS([getopt.h pthread.h regex.h ] dnl + [string.h syslog.h unistd.h ] dnl + [stdint.h inttypes.h ] dnl + [sys/param.h ] dnl + [sys/select.h ] dnl + [sys/socket.h ] dnl + [sys/time.h ] dnl + [sys/timeb.h ] dnl + [sys/un.h ]) + +# Library and Agent: +AC_CHECK_HEADERS([nlist.h],,,[ +AC_INCLUDES_DEFAULT +[ +#ifndef LIBBSD_DISABLE_DEPRECATED +#define LIBBSD_DISABLE_DEPRECATED 1 +#endif +]]) + +# Library: +AC_CHECK_HEADERS([fcntl.h io.h kstat.h ] dnl + [limits.h locale.h ] dnl + [sys/file.h sys/ioctl.h ] dnl + [sys/sockio.h sys/stat.h ] dnl + [sys/systemcfg.h sys/systeminfo.h ] dnl + [sys/times.h sys/uio.h ] dnl + [sys/utsname.h ] dnl + [netipx/ipx.h ]) + +# Agent: +AC_CHECK_HEADERS([dlfcn.h err.h fcntl.h fstab.h ] dnl + [ grp.h io.h ] dnl + [ioctls.h kstat.h kvm.h limits.h ] dnl + [ mntent.h mtab.h ] dnl + [ pkglocs.h pwd.h ] dnl + [ utmpx.h utsname.h ]) + +AC_CHECK_HEADERS([sys/diskio.h sys/dkio.h ] dnl + [sys/file.h sys/filio.h sys/fixpoint.h ] dnl + [sys/fs.h sys/ioctl.h sys/loadavg.h sys/mntent.h ] dnl + [sys/mnttab.h sys/pool.h sys/protosw.h sys/pstat.h ] dnl + [sys/sockio.h sys/stat.h sys/statfs.h sys/statvfs.h ] dnl + [sys/stream.h sys/sysget.h sys/sysmp.h ] dnl + [sys/tcpipstats.h sys/utsname.h sys/vfs.h ] dnl + [sys/vm.h sys/vmmac.h sys/vmmeter.h sys/vmparam.h ] dnl + [sys/vmsystm.h ]) + +AC_CHECK_HEADERS([asm/page.h asm/types.h ] dnl + [inet/mib2.h ] dnl + [linux/hdreg.h linux/tasks.h ] dnl + [machine/param.h ] dnl + [netinet/tcp_fsm.h ] dnl + [ufs/fs.h ] dnl + [uvm/uvm_extern.h uvm/uvm_param.h ] dnl + [vm/vm.h vm/vm_extern.h vm/vm_param.h ]) + +# Apps: +AC_CHECK_HEADERS([fcntl.h grp.h pwd.h ] dnl + [sys/cdefs.h sys/ioctl.h ] dnl + [sys/socket.h sys/sockio.h ] dnl + [sys/time.h ]) + +# Not-Used: +AC_CHECK_HEADERS([search.h sgtty.h xti.h ] dnl + [sys/dmap.h sys/poll.h ] dnl + [sys/timeout.h ] dnl + [machine/pte.h ] dnl + [pci/pci.h ]) + + +# Valgrind +AC_CHECK_HEADERS([valgrind/valgrind.h valgrind/memcheck.h]) +# OpenSSL +AC_CHECK_HEADERS([openssl/aes.h ]) # (Core) +AC_CHECK_HEADERS([openssl/dh.h ]) # (Apps) +# Not-Used: +AC_CHECK_HEADERS([openssl/des.h openssl/hmac.h ] dnl + [openssl/evp.h security/cryptoki.h]) + +# RPM subdirectory path (Agent) +if test "x$with_rpm" != "xno"; then + AC_CHECK_HEADERS([rpm/rpmts.h rpm/rpmfileutil.h], [], [], + [[#include <rpm/rpmlib.h>]]) +fi + + +## +# Pre-requisite on other headers: +## + +# requiring <sys/param.h> (MAXPATHLEN) (OpenBSD 3.4) +# Agent: +# +AC_CHECK_HEADERS(sys/swap.h,,, + AC_INCLUDES_DEFAULT([]) + [ +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + ]) + +# requiring <sys/param.h> (FreeBSD) +# +# Core: (? Tested above? ) +AC_CHECK_HEADERS([stdlib.h ],,, + [[ +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + ]]) +# +# Library: +AC_CHECK_HEADERS([malloc.h net/if_dl.h sys/sysctl.h ],,, + [[ +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + ]]) +# +# Agent: +AC_CHECK_HEADERS([malloc.h osreldate.h ] dnl + [machine/types.h net/if_dl.h net/if_types.h ] dnl + [sys/dkstat.h sys/conf.h sys/mbuf.h ] dnl + [sys/mount.h sys/proc.h sys/queue.h ] dnl + [sys/sysctl.h sys/user.h ],,, + [[ +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + ]]) + +# requiring <sys/sema.h> (IRIX 6.5) +# Agent: +# +AC_CHECK_HEADERS([sys/sema.h]) +AC_CHECK_HEADERS(sys/hashing.h,,, + AC_INCLUDES_DEFAULT([]) + [ +#if HAVE_SYS_SEMA_H +#include <sys/sema.h> +#endif + ]) + +# requiring <sys/socket.h> (Solaris 9) +# Agent: +# +AC_CHECK_HEADERS(sys/socketvar.h,,, + AC_INCLUDES_DEFAULT([]) + [ +#if HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif + ]) + +# requiring _KMEMUSER and <sys/types.h> (BSDi3/IRIX) +# Agent: +# +AC_CHECK_HEADERS(sys/vnode.h,,, + [ +#define _KMEMUSER 1 +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + ]) + +# requiring <machine/types.h> (NetBSD) +# Agent: +# +AC_CHECK_HEADERS(sys/disklabel.h,,, + [[ +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#if HAVE_MACHINE_TYPES_H +#include <machine/types.h> +#endif + ]]) + +# QNX +AC_CHECK_HEADERS([nbutil.h]) + +# UFS headers +# Agent: +# +AC_CHECK_HEADERS([ufs/ufs/dinode.h ufs/ufs/quota.h ufs/ufs/inode.h ufs/ffs/fs.h],,, + [[ +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_UFS_UFS_DINODE_H +#include <ufs/ufs/dinode.h> +#endif +#if HAVE_UFS_UFS_QUOTA_H +#include <ufs/ufs/quota.h> +#endif + ]]) + +# requiring <vm/vm.h> (BSDi2) +# Agent: +# +AC_CHECK_HEADERS(vm/swap_pager.h,,, + [[ +#if HAVE_VM_VM_H +#include <vm/vm.h> +#endif + ]]) + +# netlink/rtnetlink (Linux) +# Agent: +# +AC_CHECK_HEADERS([linux/netlink.h linux/rtnetlink.h],,, + [[ +#if HAVE_ASM_TYPES_H +#include <asm/types.h> +#endif +#if HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#if HAVE_LINUX_NETLINK_H +#include <linux/netlink.h> +#endif + ]]) + + +# Network headers +# Core or Library/Agent/Apps: +# +AC_CHECK_HEADERS([arpa/inet.h net/if.h ] dnl + [netinet/in.h netdb.h ],,, + [[ +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_TIMEOUT_H +#include <sys/timeout.h> +#endif +#if HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#if HAVE_SYS_SOCKETVAR_H +#include <sys/socketvar.h> +#endif +#if HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif +#if HAVE_NETINET_IN_SYSTM_H +#include <netinet/in_systm.h> +#endif +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_NETINET_IP_H +#include <netinet/ip.h> +#endif +#if HAVE_NET_IF_H +#include <net/if.h> +#endif +#if HAVE_NETINET_IP_VAR_H +#include <netinet/ip_var.h> +#endif +#if HAVE_NETINET_IP_ICMP_H +#include <netinet/ip_icmp.h> +#endif +#if HAVE_NETINET_TCP_H +#include <netinet/tcp.h> +#endif +#if HAVE_NETINET_UDP_H +#include <netinet/udp.h> +#endif +#if HAVE_NETINET_TCP_TIMER_H +#include <netinet/tcp_timer.h> +#endif + ]]) +# +# Agent: +AC_CHECK_HEADERS([net/if_arp.h net/if_mib.h net/if_var.h ] dnl + [netinet/if_ether.h netinet/in_systm.h netinet/in_var.h ] dnl + [netinet/ip.h netinet/ip_icmp.h ] dnl + [netinet/icmp_var.h netinet/ip_var.h ] dnl + [netinet/tcp.h netinet/tcp_timer.h netinet/tcp_var.h] dnl + [netinet/tcpip.h netinet/udp.h netinet/udp_var.h] dnl + [net/route.h netinet/icmp6.h ],,, + [[ +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_TIMEOUT_H +#include <sys/timeout.h> +#endif +#if HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#if HAVE_SYS_SOCKETVAR_H +#include <sys/socketvar.h> +#endif +#if HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif +#if HAVE_NETINET_IN_SYSTM_H +#include <netinet/in_systm.h> +#endif +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_NETINET_IP_H +#include <netinet/ip.h> +#endif +#if HAVE_NET_IF_H +#include <net/if.h> +#endif +#if HAVE_NET_IF_VAR_H +#include <net/if_var.h> +#endif +#if HAVE_NETINET_IP_VAR_H +#include <netinet/ip_var.h> +#endif +#if HAVE_NETINET_IP_ICMP_H +#include <netinet/ip_icmp.h> +#endif +#if HAVE_NETINET_TCP_H +#include <netinet/tcp.h> +#endif +#if HAVE_NETINET_UDP_H +#include <netinet/udp.h> +#endif +#if HAVE_NETINET_TCP_TIMER_H +#include <netinet/tcp_timer.h> +#endif +#if HAVE_NETINET_ICMP6_H +#include <netinet/icmp6.h> +#endif + ]]) + +# KAME (IPv6) headers +# Agent: +# +# KAME +AC_CHECK_HEADERS([netinet/ip6.h ] dnl + [netinet6/in6_var.h netinet6/in6_pcb.h ] dnl + [netinet6/ip6_var.h netinet6/nd6.h ] dnl + [netinet6/tcp6.h netinet6/tcp6_fsm.h ] dnl + [netinet6/tcp6_timer.h netinet6/tcp6_var.h],,, + [[ +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_QUEUE_H +#include <sys/queue.h> +#endif +#if HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_NETINET_IP6_H +#include <netinet/ip6.h> +#endif +#if HAVE_NET_IF_H +#include <net/if.h> +#endif +#if HAVE_NET_ROUTE_H +#include <net/route.h> +#endif + ]]) + +# requiring <netinet/in.h> (OpenBSD 2.6) +# Agent: +# +AC_CHECK_HEADERS(netinet/in_pcb.h,,, + [[ +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#if HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#if HAVE_SYS_TIMEOUT_H +#include <sys/timeout.h> +#endif +#if HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#if HAVE_SYS_SOCKETVAR_H +#include <sys/socketvar.h> +#endif +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_NETINET_IN_SYSTM_H +#include <netinet/in_systm.h> +#endif +#if HAVE_NETINET_IP_H +#include <netinet/ip.h> +#endif +#if HAVE_NET_ROUTE_H +#include <net/route.h> +#endif +#if HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif + ]]) + +## +# Pre-requisite on specific types +## + +# Special hack to get around various problems on older Linux kernels +# (major ugh!) +# Agent: +# +AC_CHECK_HEADERS([linux/ethtool.h],,, +[[ +#include <linux/types.h> +typedef __u64 u64; /* hack, so we may include kernel's ethtool.h */ +typedef __u32 u32; /* ditto */ +typedef __u16 u16; /* ditto */ +typedef __u8 u8; /* ditto */ +]]) + +## +# Headers requiring particular libraries +## + +# for HostRes (Solaris 2.x) +# Agent: +# +AC_CHECK_HEADERS(pkginfo.h, + NETSNMP_SEARCH_LIBS(pkginfo, adm, + AC_DEFINE(HAVE_PKGINFO, 1, [define if you have pkginfo]),,,LMIBLIBS)) + +case $target_os in + aix*) + # for CPU/memory statistics (AIX) + # Agent: + # + AC_CHECK_HEADERS(libperfstat.h, + NETSNMP_SEARCH_LIBS(perfstat_cpu_total, perfstat, + AC_DEFINE(HAVE_PERFSTAT, 1, [on aix, if you have perfstat]), + AC_MSG_ERROR([ + +*** To monitor CPU/memory values in AIX you need to install +*** libperfstat which can be found in bos.perf +]),, + LMIBLIBS),, + [[ +#if HAVE_SYS_PROTOSW_H +#include <sys/protosw.h> +#endif + ]]) + ;; + hpux*) + # HP-UX agent needs open_mib (XXX - not a header check!) + # + NETSNMP_SEARCH_LIBS(open_mib, nm, + AC_DEFINE(HAVE_LIBNM, 1, [define if you have libnm]),,,LMIBLIBS) + ;; + *) + ;; +esac + +# for MIB-2 info (Cygwin and MinGW) +# Core: +# +AC_CHECK_HEADERS([windows.h iphlpapi.h], [], [], [ +#ifdef HAVE_WINDOWS_H +#include <windows.h> +#endif +]) + +# for MIB-2 info (MinGW) +# Core: +# +if test x$with_socklib = xwinsock2; then + AC_CHECK_HEADERS([winsock.h winsock2.h ws2tcpip.h]) +fi + +# +# for ucd-snmp/lmsensorsMib +# +AC_CHECK_HEADERS([sensors/sensors.h picl.h]) + +fi # NETSNMP_QUICK_CHECK diff --git a/configure.d/config_os_libs1 b/configure.d/config_os_libs1 new file mode 100644 index 0000000..35f052a --- /dev/null +++ b/configure.d/config_os_libs1 @@ -0,0 +1,95 @@ +# -*- autoconf -*- +######################################### +## +# Checks for libraries that are run +# before the agent module tests. +## +######################################### + + +## +# RPM checks +# +## +AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h) + +AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no) +AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no) + +if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then + if test "x$with_rpm" = "xyes" ; then + AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support]) + else + with_rpm=no + fi +fi + +# +# rpm libraries only needed for the host resources mib software +# installed tables (on linux in particular) +# +if test "x$with_rpm" != "xno"; then + # ARG. RPM is a real pain. + # FWIW librpm.la, librpmio.la, and libpopt.la have correct dependencies. + _rpmlibs="" + + # rpm-4.0.x needs rpmio. + NETSNMP_SEARCH_LIBS(rpmGetPath, rpmio,,, $LMIBLIBS, _rpmlibs) + + # rpm-4.0.3 librpmdb actually contains what we need. + NETSNMP_SEARCH_LIBS(rpmdbOpen, rpmdb,,, $LMIBLIBS, _rpmlibs) + # now check for rpm using the appropriate libraries. + NETSNMP_SEARCH_LIBS(rpmReadConfigFiles, rpm, [ + AC_DEFINE(HAVE_LIBRPM, 1, + [Define to 1 if you have the `rpm' library (-lrpm).]) + LMIBLIBS="$_rpmlibs $LMIBLIBS" + ],, $LMIBLIBS, _rpmlibs) + + # rpm 4.6 has incompatible API, turn on the legacy one + AC_CHECK_DECL([headerGetEntry], + : , + AC_DEFINE([_RPM_4_4_COMPAT], [], [Define if you have RPM 4.6 or newer to turn on legacy API]), + [[#include <rpm/rpmlib.h>]] + ) +fi + +# +# getfsstat/getvfsstat +# +AC_SEARCH_LIBS(getfsstat, [nbutil]) +AC_CHECK_FUNCS(getfsstat) +AC_CHECK_FUNCS(getvfsstat) +AC_FUNC_GETMNTENT + +# +# kinfo_get_cpus +# +AC_SEARCH_LIBS(kinfo_get_cpus, [kinfo]) +AC_CHECK_FUNCS(kinfo_get_cpus) + +# +# diskIOLAx requires exp which may require -lm +# +AC_SEARCH_LIBS(exp, [m]) + +# +# libkvm +# +NETSNMP_SEARCH_LIBS(kvm_read, kvm,,,, LAGENTLIBS) +NETSNMP_SEARCH_LIBS(kvm_openfiles, kvm,,,, LAGENTLIBS) +NETSNMP_SEARCH_LIBS(kvm_getprocs, kvm,,,, LMIBLIBS) +NETSNMP_SEARCH_LIBS(kvm_getproc2, kvm,,,, LMIBLIBS) +NETSNMP_SEARCH_LIBS(kvm_getswapinfo, kvm,,,, LMIBLIBS) +netsnmp_save_LIBS="$LIBS" +LIBS="$LAGENTLIBS $LMIBLIBS $LIBS" +AC_CHECK_FUNCS([kvm_openfiles kvm_getprocs kvm_getproc2 kvm_getswapinfo]) +LIBS="$netsnmp_save_LIBS" + +# +# dynamic module support +# +NETSNMP_SEARCH_LIBS([dlopen], [dl],,, [$LAGENTLIBS $LSNMPLIBS], [LMIBLIBS]) +netsnmp_save_LIBS="$LIBS" +LIBS="$LMIBLIBS $LAGENTLIBS $LSNMPLIBS $LIBS" +AC_CHECK_FUNCS([dlopen]) +LIBS="$netsnmp_save_LIBS" diff --git a/configure.d/config_os_libs2 b/configure.d/config_os_libs2 new file mode 100644 index 0000000..677f3e6 --- /dev/null +++ b/configure.d/config_os_libs2 @@ -0,0 +1,487 @@ +# -*- autoconf -*- +######################################### +## +# Checks for libraries that are run +# after the agent module tests. +## +######################################### + +# HAVE_LIB Definitions used in the Net-SNMP code base: +# +# HAVE_LIBCRYPTO: apps +# HAVE_LIBRPM: agent +# + +## +# Simple checks: +## + +# AC_CHECK_LIB(des, main) +# AC_CHECK_LIB(m, asin) + +# dmalloc +# +if test "${with_dmalloc+set}" = set; then + if test "$with_dmalloc" = yes -a -d $with_dmalloc ; then + AC_ADD_SEARCH_PATH($with_dmalloc) + fi + AC_CHECK_HEADERS([dmalloc.h]) + AC_SEARCH_LIBS([dmalloc_message], [dmalloc]) +fi + +# EFence +# (This used to be on by default for developer checkout) +# +if test "x$use_efence" = "xyes"; then + AC_SEARCH_LIBS([EF_Exit], [efence]) +fi + + +# ELF libraries +# Typically used for 'nlist' (needed for uptime) +# +if test "x$with_elf" != "xno"; then +case $target_os in + linux*) # add hosts which don't use nlist here + ;; + irix*) # Check for nlist in mld (irix) + AC_CHECK_LIB(elf, nlist) + AC_CHECK_LIB(elf, nlist64) + AC_CHECK_LIB(mld, nlist) + ;; + *) # default + AC_CHECK_LIB(elf, nlist) + ;; +esac +fi + + +# libsocket +# Needed for 'socket(2)' (Solaris) +# Possibly also for 'gethostname(3)' (non-Solaris) +# (alternatively in libnsl (Solaris) +# or in libws2_32) (MinGW) +# +case x$with_socklib in +xwinsock2) + # libws2_w32 (MinGW) + # + netsnmp_save_LIBS="$LIBS" + LIBS="$LIBS -lws2_32" + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include <winsock2.h> + ], [ + socket(0, 0, 0); + gethostbyname(0); + ])], [ + # Keep LIBS. + true + ], [ + # Restore LIBS and complain. + LIBS="$netsnmp_save_LIBS" + AC_MSG_ERROR([libws2_32 not found.]) + ]) + ;; +*) + AC_SEARCH_LIBS(socket, socket,,AC_MSG_ERROR([socket(2) not found.])) + AC_SEARCH_LIBS(gethostbyname, [nsl socket]) + AC_CHECK_FUNCS(gethostbyname) + AC_SEARCH_LIBS(gethostbyaddr, [nsl socket]) + AC_CHECK_FUNCS(gethostbyaddr) + ;; +esac + + +# libiphlpapi (Cygwin and MinGW) +# +netsnmp_save_LIBS="$LIBS" +LIBS="$LIBS -liphlpapi" +AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include <winsock2.h> + #include <iphlpapi.h> +], [ + IpRenewAddress(0); +])], [ + # Keep LIBS. + true +], [ + # Restore LIBS and complain. + LIBS="$netsnmp_save_LIBS" + case x$with_socklib in + xwinsock2) + AC_MSG_ERROR([libiphlpapi not found.]) + ;; + esac +]) + + +# libregex (MinGW) +# +netsnmp_save_LIBS="$LIBS" +LIBS="$LIBS -lregex" +AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include <sys/types.h> + #include <regex.h> +], [ + regcomp(0, 0, 0); +])], [ + # Keep LIBS. + true +], [ + # Restore LIBS. + LIBS="$netsnmp_save_LIBS" +]) + + +# libsnmpapi (MinGW) +# +netsnmp_save_LIBS="$LIBS" +LIBS="$LIBS -lsnmpapi" +AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include <snmp.h> +], [ + SnmpUtilMemAlloc(0); +])], [ + # Keep LIBS. + true +], [ + # Restore LIBS. + LIBS="$netsnmp_save_LIBS" +]) + + +# kstat library (Solaris) +# +NETSNMP_SEARCH_LIBS(kstat_lookup, kstat, + AC_DEFINE(HAVE_LIBKSTAT, 1, + [Define to 1 if you have the `kstat' library (-lkstat).]),,, + LNETSNMPLIBS) + + +# +# librt +# + +NETSNMP_SEARCH_LIBS(clock_gettime, rt, + AC_DEFINE(HAVE_CLOCK_GETTIME, 1, + [Define to 1 if you have the `clock_gettime' library]),,, + LNETSNMPLIBS) + + +## +# MIB-module-specific checks +## + +# libdevstat +# (for diskIO MIB) +# +# Not-Used: HAVE_GETDEVS/HAVE_DEVSTAT_GETDEVS +# +echo " $module_list " | $GREP " ucd-snmp/diskio " >/dev/null +if test $? -eq 0 ; then + NETSNMP_SEARCH_LIBS(getdevs, devstat, + AC_DEFINE(HAVE_GETDEVS, 1, + [define if you have getdevs()]),,,LMIBLIBS) + NETSNMP_SEARCH_LIBS(devstat_getdevs, devstat, + AC_DEFINE(HAVE_DEVSTAT_GETDEVS, 1, + [define if you have devstat_getdevs()]),,,LMIBLIBS) +fi + +# libpci +# (for if-mib description) +# +NETSNMP_SEARCH_LIBS(pci_lookup_name, pci, + AC_DEFINE(HAVE_PCI_LOOKUP_NAME, 1, + [define if you have pci_lookup_name()]),,,LMIBLIBS) + +# LM-SENSORS-MIB support +# +echo " $module_list " | $GREP -i "ucd-snmp/lmsensor" > /dev/null +if test $? -eq 0 ; then + AC_MSG_CHECKING([for sensors support]) + case $target_os in + solaris*) + # Agent: HAVE_PICL_H + # + AC_CHECK_HEADER(picl.h, LMIBLIBS="${LMIBLIBS} -lpicl",) + AC_CHECK_HEADERS(picl.h) + ;; + *) + # Not-Used: HAVE_SENSORS_SENSORS_H + # + AC_CHECK_HEADER(sensors/sensors.h,, + [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])]) + NETSNMP_SEARCH_LIBS(sensors_get_detected_chips, sensors,, + [AC_MSG_ERROR([asked to use lm_sensors but I couldn't find -lsensors])],, + LMIBLIBS) + ;; + esac +fi + +# +# libnl (netlink) +# + +if test "x$with_nl" != "xno"; then + case $target_os in + linux*) # Check for libnl (linux) + NETSNMP_SEARCH_LIBS( + nl_connect, nl, + [AC_CHECK_HEADERS(netlink/netlink.h)],,, LMIBLIBS) + ;; + esac +fi + + + +## +# More complex checks: +## + +# Security related functions +# +NONAGENTLIBS=$LIBS # save old libraries +SSHPROG=no +TLSPROG=no +if test "x$tryopenssl" != "xno" -a "x$tryopenssl" != "xinternal"; then + # check for libpkcs11 if asked + if test "x$askedopenssl" != "xyes" -a "x$askedpkcs" = "xyes"; then + AC_CHECK_LIB(pkcs11, C_Initialize, + AC_DEFINE(HAVE_LIBPKCS11, 1, + [Define to 1 if you have the `pkcs11' library (-lpkcs11).]) + LIBPKCS11="-lpkcs11") + else + if test "x$tryrsaref" != "xno"; then + AC_CHECK_LIB(rsaref, RSAPrivateDecrypt) + AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref) + fi + + AC_MSG_CHECKING([for -leay32]) + netsnmp_save_LIBS="$LIBS" + LIBS="-leay32" + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include <openssl/evp.h>], + [return EVP_md5();])], + [AC_MSG_RESULT(yes); ac_cv_lib_eay32_EVP_md5=yes; CRYPTO="eay32"], + [AC_MSG_RESULT(no)] + ) + LIBS="$netsnmp_save_LIBS" + + if test x$CRYPTO = x; then + AC_CHECK_LIB([crypto], [EVP_md5], [CRYPTO="crypto"]) + fi + + if test x$CRYPTO != x; then + AC_DEFINE(HAVE_LIBCRYPTO, 1, + [Define to 1 if you have the OpenSSL library (-lcrypto or -leay32).]) + LIBCRYPTO="-l${CRYPTO}" + AC_CHECK_LIB(${CRYPTO}, AES_cfb128_encrypt, + AC_DEFINE(HAVE_AES_CFB128_ENCRYPT, 1, + [Define to 1 if you have the `AES_cfb128_encrypt' function.])) + + AC_CHECK_LIB(${CRYPTO}, EVP_MD_CTX_create, + AC_DEFINE([HAVE_EVP_MD_CTX_CREATE], [], + [Define to 1 if you have the `EVP_MD_CTX_create' function.]) + AC_DEFINE([HAVE_EVP_MD_CTX_DESTROY], [], + [Define to 1 if you have the `EVP_MD_CTX_destroy' function.])) + fi + if echo " $transport_result_list " | $GREP "DTLS" > /dev/null; then + AC_CHECK_LIB(ssl, DTLSv1_method, + AC_DEFINE(HAVE_LIBSSL_DTLS, 1, + [Define to 1 if your `ssl' library supports DTLS (-lssl).]) + LIBCRYPTO=" -lssl $LIBCRYPTO", + AC_MSG_ERROR([The DTLS based transports require the libssl library from OpenSSL to be available and support DTLS]) ,-lcrypto) + TLSPROG=yes + fi + if echo " $transport_result_list " | $GREP "TLS" > /dev/null; then + AC_CHECK_LIB(ssl, SSL_library_init, + AC_DEFINE(HAVE_LIBSSL, 1, + [Define to 1 if you have the `ssl' library (-lssl).]) + LIBCRYPTO=" -lssl $LIBCRYPTO", + AC_MSG_ERROR([The DTLS based transports require the libssl library from OpenSSL to be available]) ,-lcrypto) + TLSPROG=yes + fi + if echo " $transport_result_list " | $GREP " SSH " > /dev/null; then + AC_CHECK_LIB(ssh2, libssh2_session_startup, + AC_DEFINE(HAVE_LIBSSH2, 1, + [Define to 1 if you have the `ssh2' library (-lssh2).]) + LIBCRYPTO=" -lssh2 $LIBCRYPTO", + AC_MSG_ERROR([The SSH transport requires the libssh2 library to be available]),) + SSHPROG=yes + fi + fi +elif test "x$askedpkcs" = "xyes"; then + AC_CHECK_LIB(pkcs11, C_Initialize, + AC_DEFINE(HAVE_LIBPKCS11) + LIBPKCS11="-lpkcs11") +fi +if test "x$TLSPROG" = "xyes"; then + AC_CHECK_DECL([EVP_sha224], + : , + AC_DEFINE([HAVE_EVP_SHA224], [], [Define if you have EVP_sha224/256 in openssl]), + [[#include <openssl/evp.h>]]) + AC_CHECK_DECL([EVP_sha384], + : , + AC_DEFINE([HAVE_EVP_SHA384], [], [Define if you have EVP_sha384/256 in openssl]), + [[#include <openssl/evp.h>]]) +fi + +LIBS=$NONAGENTLIBS # restore old libraries +if test "x$SSHPROG" = "xyes"; then + NETSNMP_BUILD_SSH_PROG_TRUE='' + NETSNMP_BUILD_SSH_PROG_FALSE='#' +else + NETSNMP_BUILD_SSH_PROG_TRUE='#' + NETSNMP_BUILD_SSH_PROG_FALSE='' +fi +if test "x$TLSPROG" = "xyes" -a "x$enable_read_only" != "xyes" ; then + NETSNMP_BUILD_TLS_PROG_TRUE='' + NETSNMP_BUILD_TLS_PROG_FALSE='#' +else + NETSNMP_BUILD_TLS_PROG_TRUE='#' + NETSNMP_BUILD_TLS_PROG_FALSE='' +fi +if echo " ${security_mod_list} " | grep ' usm ' ; then + if test "x$enable_read_only" != "xyes" ; then + NETSNMP_BUILD_USM_PROG_TRUE='' + NETSNMP_BUILD_USM_PROG_FALSE='#' + else + NETSNMP_BUILD_USM_PROG_TRUE='#' + NETSNMP_BUILD_USM_PROG_FALSE='' + fi +else + NETSNMP_BUILD_USM_PROG_TRUE='#' + NETSNMP_BUILD_USM_PROG_FALSE='' +fi +if test "x$enable_read_only" != "xyes" ; then + NETSNMP_BUILD_SET_PROG_TRUE="" + NETSNMP_BUILD_SET_PROG_FALSE="#" +else + NETSNMP_BUILD_SET_PROG_TRUE="#" + NETSNMP_BUILD_SET_PROG_FALSE="" +fi +AC_SUBST(NETSNMP_BUILD_SSH_PROG_TRUE) +AC_SUBST(NETSNMP_BUILD_SSH_PROG_FALSE) +AC_SUBST(NETSNMP_BUILD_TLS_PROG_TRUE) +AC_SUBST(NETSNMP_BUILD_TLS_PROG_FALSE) +AC_SUBST(NETSNMP_BUILD_USM_PROG_TRUE) +AC_SUBST(NETSNMP_BUILD_USM_PROG_FALSE) +AC_SUBST(NETSNMP_BUILD_SET_PROG_TRUE) +AC_SUBST(NETSNMP_BUILD_SET_PROG_FALSE) + +# +# If we're using internal crypto support we need to compile in extra files +# +crypto_files_c="" +crypto_files_o="" +crypto_files_lo="" +if test "x$tryopenssl" != "xno" -a "x$CRYPTO" = "x"; then + # If we: + # 1) couldn't find needed openssl support + # 2) OR were asked to use internal support + # 3) AND we have the needed files + # then use it + CRYPTO="internal" + crypto_files_c="openssl/openssl_sha1.c openssl/openssl_md5.c openssl/openssl_set_key.c openssl/openssl_des_enc.c openssl/openssl_cbc_enc.c openssl/openssl_aes_cfb.c openssl/openssl_aes_core.c openssl/openssl_cfb128.c" + crypto_files_o="openssl/openssl_sha1.o openssl/openssl_md5.o openssl/openssl_set_key.o openssl/openssl_des_enc.o openssl/openssl_cbc_enc.o openssl/openssl_aes_cfb.o openssl/openssl_aes_core.oo openssl/openssl_cfb128.o" + crypto_files_lo="openssl/openssl_sha1.lo openssl/openssl_md5.lo openssl/openssl_set_key.lo openssl/openssl_des_enc.lo openssl/openssl_cbc_enc.lo openssl/openssl_aes_cfb.lo openssl/openssl_aes_core.lo openssl/openssl_cfb128.lo" + AC_DEFINE(HAVE_AES_CFB128_ENCRYPT) +fi +AC_SUBST(crypto_files_c) +AC_SUBST(crypto_files_o) +AC_SUBST(crypto_files_lo) + +# +# if we can do any sort of crypto then note it +# +if test "x$CRYPTO" != "x" ; then + AC_DEFINE(NETSNMP_CAN_DO_CRYPTO, 1, "Define if crytography support is possible") +fi + +# TCP wrapper support +# +_cppflags="${CPPFLAGS}" +_ldflags="${LDFLAGS}" +if test "$with_libwrap" != "no"; then + if test "$with_libwrap" != "yes"; then + CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include" + LDFLAGS="${LDFLAGS} -L$with_libwrap/lib" + fi + + _libs=${LIBS} + AC_CHECK_HEADER(tcpd.h, , + AC_MSG_ERROR([Asked to use libwrap but I couldn't find tcpd.h.])) + + LIBS="$LIBS -lwrap" + AC_MSG_CHECKING([for TCP wrappers library -lwrap]) + # XXX: should check for hosts_ctl + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> + #include <tcpd.h> + int allow_severity = 0; + int deny_severity = 0;]], + [[hosts_access((void *)0)]])], + [AC_MSG_RESULT([yes]) + AC_DEFINE(NETSNMP_USE_LIBWRAP) + test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib" + _wraplibs="$_wraplibs -lwrap"], + [AC_MSG_RESULT([no]) + # Linux RedHat 6.1 won't link libwrap without libnsl + AC_CHECK_FUNC(yp_get_default_domain, , + AC_CHECK_LIB(nsl, yp_get_default_domain)) + AC_MSG_CHECKING([for TCP wrappers library -lwrap linked with -lnsl]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> + #include <tcpd.h> + int allow_severity = 0; + int deny_severity = 0;]], + [[hosts_access((void *)0)]])], + [AC_MSG_RESULT(yes) + AC_DEFINE(NETSNMP_USE_LIBWRAP) + test "$with_libwrap" != no -a "$with_libwrap" != yes && _wraplibs="-L$with_libwrap/lib" + _wraplibs="$_wraplibs -lwrap -lnsl"], + [AC_MSG_RESULT(no) + AC_MSG_ERROR(Asked to use libwrap but I couldn't find it.)])]) + LAGENTLIBS="$_wraplibs" + CPPFLAGS=${_cppflags} + LDFLAGS=${_ldflags} + LIBS=${_libs} +fi + + +## +# mysql +## +if test "x$with_mysql" = "xyes" ; then + AC_PATH_PROGS(MYSQLCONFIG,mysql_config) + AC_CHECK_HEADERS(mysql/mysql.h) + AC_CHECK_HEADER(mysql/mysql.h,mysql_h=yes,mysql_h=no) + if test "x$MYSQLCONFIG" = "x" -o "x$mysql_h" = "xno"; then + AC_MSG_ERROR([Could not find mysql_config or mysql.h and was specifically asked to use MySQL support]) + fi + MYSQL_LIBS=`$MYSQLCONFIG --libs` + MYSQL_INCLUDES=`$MYSQLCONFIG --cflags` + AC_MSG_CHECKING([whether MY_INIT() works]) + _libs="${LIBS}" + _cppflags="${CPPFLAGS}" + LIBS="${LIBS} ${MYSQL_LIBS}" + CPPFLAGS="${CPPFLAGS} ${MYSQL_INCLUDES}" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mysql/my_global.h> + #include <mysql/my_sys.h>]], [[MY_INIT("my_init_test")]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no) + AC_DEFINE([HAVE_BROKEN_LIBMYSQLCLIENT], 1, + [Define if using MY_INIT() causes a linker error])]) + CPPFLAGS="${_cppflags}" + LIBS="${_libs}" + AC_MSG_CACHE_ADD(MYSQL Trap Logging: enabled) +else + AC_MSG_CACHE_ADD(MYSQL Trap Logging: unavailable) +fi +AC_SUBST(MYSQL_LIBS) +AC_SUBST(MYSQL_INCLUDES) + + +## +# Non-library checks +## + +# nlist +AC_CHECK_FUNCS(nlist nlist64 knlist) + diff --git a/configure.d/config_os_misc1 b/configure.d/config_os_misc1 new file mode 100644 index 0000000..feec9a9 --- /dev/null +++ b/configure.d/config_os_misc1 @@ -0,0 +1,24 @@ +# -*- autoconf -*- +######################################### +## +# Miscellaneous checks +## +######################################### + +## +# Compilation-related +## + +# Dynamic modules require Position-Independent Code +# LIB_CFLAGS/DLLIBS: used in agent Makefile only +# +AC_MSG_CHECKING([whether we have to build PIC code]) +echo " $module_list " | $GREP " ucd-snmp/dlmod " >/dev/null +if test $? -eq 0 ; then + LIB_CFLAGS="$LIB_CFLAGS $SHLIB_CFLAGS" + AC_MSG_RESULT(yes) +else + DLLIBS="" + AC_MSG_RESULT(no) +fi + diff --git a/configure.d/config_os_misc2 b/configure.d/config_os_misc2 new file mode 100644 index 0000000..e2a8ff5 --- /dev/null +++ b/configure.d/config_os_misc2 @@ -0,0 +1,142 @@ +# -*- autoconf -*- +######################################### +## +# Miscellaneous checks +## +######################################### + +## +# Package characteristics +# Authentication/Encryption support +## + +# Check for PKCS11 +# +AC_MSG_CHECKING([for authentication support]) +useopenssl=no +usepkcs=no +if test "x$ac_cv_lib_pkcs11_C_Initialize" != "xyes" -o "x$ac_cv_header_security_cryptoki_h" != "xyes"; then + if test "x$askedpkcs" = "xyes"; then + AC_MSG_ERROR(Asked to use PKCS11 but I couldn't find it.) + fi +else + if test "x$askedpkcs" = "xyes"; then + usepkcs=yes + fi +fi + +# Check for OpenSSL +# +if test "x$ac_cv_lib_crypto_EVP_md5" != "xyes" -a "x$ac_cv_lib_eay32_EVP_md5" != "xyes" -o "x$ac_cv_header_openssl_hmac_h" != "xyes"; then + if test "x$askedopenssl" = "xyes"; then + AC_MSG_ERROR(Asked to use OpenSSL but I couldn't find it.) + fi +else + if test "x$askedopenssl" = "xyes"; then + useopenssl=yes + elif test "x$tryopenssl" = "xyes"; then + if test "x$usepkcs" != "xyes"; then + useopenssl=yes + fi + fi +fi + +# Available authentication/encryption modes +# +if test "x$CRYPTO" = "xinternal" ; then + authmodes="MD5 SHA1" + if test "x$enable_privacy" != "xno" ; then + encrmodes="DES AES" + else + encrmodes="[disabled]" + fi + AC_DEFINE(NETSNMP_USE_INTERNAL_CRYPTO, 1, "Define if internal cryptography code should be used") + AC_MSG_RESULT(Internal Crypto Support) +elif test "x$useopenssl" != "xno" ; then + authmodes="MD5 SHA1" + if test "x$enable_privacy" != "xno" ; then + if test "x$ac_cv_header_openssl_aes_h" = "xyes" ; then + encrmodes="DES AES" + else + encrmodes="DES" + fi + else + encrmodes="[disabled]" + fi + AC_DEFINE(NETSNMP_USE_OPENSSL) + LNETSNMPLIBS="$LNETSNMPLIBS $LIBCRYPTO" + AC_MSG_RESULT(OpenSSL Support) +elif test "x$usepkcs" != "xno" ; then + authmodes="MD5 SHA1" + if test "x$enable_privacy" != "xno" ; then + encrmodes="DES" + else + encrmodes="[disabled]" + fi + AC_DEFINE(NETSNMP_USE_PKCS11, 1, + [Define if you are using the codeS11 library ...]) + LNETSNMPLIBS="$LNETSNMPLIBS $LIBPKCS11" + AC_MSG_RESULT(PKCS11 Support) +elif test "x$enable_md5" != "xno"; then + authmodes="MD5" + encrmodes="" + AC_DEFINE(NETSNMP_USE_INTERNAL_MD5) + AC_MSG_RESULT(Internal MD5 Support) +fi +if test "x$enable_md5" = "xno"; then + authmodes=`echo $authmodes | $SED 's/MD5 *//;'` +fi +AC_SUBST(LNETSNMPLIBS) +AC_SUBST(LAGENTLIBS) + +AC_MSG_CACHE_ADD(Crypto support from: $CRYPTO) +AC_MSG_CACHE_ADD(Authentication support: $authmodes) +AC_MSG_CACHE_ADD(Encryption support: $encrmodes) + +if test "x$all_warnings" != "x"; then + AC_MSG_CACHE_ADD(WARNING: $all_warnings) +fi + +# +# Check whether user wants DNSSEC local validation support +# +_libs=${LIBS} +if ! test "x-$want_dnssec" = "x-no" ; then + AC_CHECK_HEADERS([validator/validator-config.h]) + if test "$ac_cv_header_validator_validator_config_h" != yes; then + AC_MSG_ERROR(Can't find validator.h) + fi + if test "x$ac_cv_lib_crypto_EVP_md5" != "xyes" -a \ + "x$ac_cv_lib_eay32_EVP_md5" != "xyes" -o \ + "x$ac_cv_header_openssl_hmac_h" != "xyes"; then + AC_MSG_ERROR(Couldn't find OpenSSL for local DNSSEC validation support.) + fi + LIBS="$LIBS $LIBCRYPTO" + AC_CHECK_LIB(sres, query_send,,AC_MSG_ERROR([Can't find libsres])) + VAL_LIBS="-lsres $LIBCRYPTO" + LIBS="$LIBS -lsres" + AC_CHECK_LIB(val, p_val_status, + LIBS="$LIBS -lval" + VAL_LIBS="$VAL_LIBS -lval" + have_val_res_query=yes, + [ AC_CHECK_LIB(pthread, pthread_rwlock_init) + AC_CHECK_LIB(val-threads, p_val_status, + have_val_res_query=yes + LIBS="-lval-threads $LIBS" + VAL_LIBS="-lval-threads -lpthread $VAL_LIBS" + LIBVAL_SUFFIX="-threads", + AC_MSG_ERROR(Can't find libval or libval-threads)) + ]) + AC_DEFINE(DNSSEC_LOCAL_VALIDATION, 1, + [Define if you want local DNSSEC validation support]) + DNSSEC="enabled" +else + DNSSEC="disabled" +fi + +LIBS=${_libs} + +AC_SUBST(VAL_LIBS) +AC_MSG_CACHE_ADD(Local DNSSEC validation: $DNSSEC) + + diff --git a/configure.d/config_os_misc3 b/configure.d/config_os_misc3 new file mode 100644 index 0000000..17aff48 --- /dev/null +++ b/configure.d/config_os_misc3 @@ -0,0 +1,20 @@ +# -*- autoconf -*- +######################################### +## +# Miscellaneous checks +## +######################################### + +## +# Compilation characteristics +## + +# Byte order +# +if test "$with_endianness" = "big"; then + ac_cv_c_bigendian=yes +elif test "$with_endianness" = "little" ; then + ac_cv_c_bigendian=no +fi +AC_C_BIGENDIAN(,, + [AC_MSG_ERROR([Failed to figure out host endianness, please use --with-endianness to specify it.])]) diff --git a/configure.d/config_os_misc4 b/configure.d/config_os_misc4 new file mode 100644 index 0000000..b6cb040 --- /dev/null +++ b/configure.d/config_os_misc4 @@ -0,0 +1,319 @@ +# -*- autoconf -*- +######################################### +## +# Miscellaneous Operating-System characteristics +## +######################################### + + +# Determine how to test for character devices +# [We assume that /dev/null does actually exist!] +# +if test -c /dev/null; then + CDEV_TEST_FLAG="-c" +elif test -f /dev/null; then + CDEV_TEST_FLAG="-f" +else + AC_MSG_WARN([Can't reliably detect character devices]) + # Is it actually sensible to fall back on "test -f" ? + CDEV_TEST_FLAG="-f" +fi + +# Kernel Location +# used in library/agent +# +AC_CACHE_CHECK([for location of system kernel], + ac_cv_KERNEL_LOC, + [ac_cv_KERNEL_LOC="unknown" + for i in /vmunix /hp-ux /stand/vmunix /dev/ksyms /kernel/unix /kernel/genunix /netbsd /unix /kernel /bsd /mach_kernel /boot/kernel/kernel + do + if test $CDEV_TEST_FLAG $i; then + ac_cv_KERNEL_LOC="$i" + break; + fi + done + # + # In principle, this test is meant to provide a default path to the kernel + # In practice, the test is broken and the kernel path is set to "unknown" + # + # Note that on certain systems (e.g. some Linux distributions), + # it is impossible to predict the name of the kernel, + # particularly if it includes the kernel version, architecture, etc + # + # Since this default will never actually be used, then don't try to set it + # + if test $i = "unknown"; then + AC_MSG_WARN([Can't find system kernel... hopefully this won't be needed!]) + fi +]) +AC_DEFINE_UNQUOTED(KERNEL_LOC,"$ac_cv_KERNEL_LOC", [location of UNIX kernel]) + + +# /dev/kmem existence +# used in agent only +# +AC_CACHE_CHECK([for /dev/kmem], + ac_cv_HAVE_KMEM, + [if test $CDEV_TEST_FLAG /dev/kmem; then + ac_cv_HAVE_KMEM="/dev/kmem" + fi +]) +# +# Note that it's OK if this device is not found +# +if test "x$ac_cv_HAVE_KMEM" = "x/dev/kmem"; then + AC_DEFINE_UNQUOTED(HAVE_KMEM,"$ac_cv_HAVE_KMEM", [Define if you have /dev/kmem]) +fi + + +# Swap device Location +# (/dev/dmem or /dev/drum) +# used in agent only +# +AC_CACHE_CHECK([for location of swap device], + ac_cv_DMEM_LOC, + [if test $CDEV_TEST_FLAG /dev/dmem; then + ac_cv_DMEM_LOC="/dev/dmem" + elif test $CDEV_TEST_FLAG /dev/drum; then + ac_cv_DMEM_LOC="/dev/drum" + else + ac_cv_DMEM_LOC="none" + fi +]) +# +# Note that it's OK if this device is not found +# +if test "x$ac_cv_DMEM_LOC" != "xnone"; then + AC_DEFINE_UNQUOTED(DMEM_LOC,"$ac_cv_DMEM_LOC", [location of swap device]) +fi + + +# Mount table Location +# used in agent only +# +AC_CACHE_CHECK([for mount table location], + ac_cv_ETC_MNTTAB, + [ac_cv_ETC_MNTTAB="${with_mnttab:-unknown}" + if test "$ac_cv_ETC_MNTTAB" = "unknown"; then + for i in /etc/mnttab /etc/mtab /etc/filesystems /dev/mnttab + do + if test -f $i -o -c $i; then + ac_cv_ETC_MNTTAB="$i" + break; + fi + done + fi +]) +AC_DEFINE_UNQUOTED(ETC_MNTTAB,"$ac_cv_ETC_MNTTAB", [location of mount table list]) + + +# Printing +# used in agent only +# +AC_PATH_PROG([LPSTAT_PATH],lpstat) +if test x$LPSTAT_PATH != x; then + AC_DEFINE_UNQUOTED(LPSTAT_PATH, "$LPSTAT_PATH", + [Path to the lpstat command]) + AC_DEFINE(HAVE_LPSTAT, 1, [Set if the lpstat command is available]) +fi +if test -r /etc/printcap; then + AC_DEFINE(HAVE_PRINTCAP, 1, [Set if /etc/printcap exists]) +fi + + +# Check ps args +# used in agent only +# +AC_CACHE_CHECK([for correct flags to ps], + ac_cv_ps_flags, + [ +if test "`($PSPROG -e 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then + ac_cv_ps_flags="-e" +elif test "`($PSPROG -el 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then + ac_cv_ps_flags="-el" +elif test "`($PSPROG acx 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then + ac_cv_ps_flags="acx" +elif test "`($PSPROG -acx 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then + ac_cv_ps_flags="-acx" +elif test "`($PSPROG -o pid,tt,state,time,ucomm 2>&1) | $EGREP ' ps *$' | awk '{print $NF}'`" = "ps" ; then + ac_cv_ps_flags="-o pid,tt,state,time,ucomm" +elif test "`($PSPROG ax 2>&1) | $EGREP ' (ps) *$' | awk '{print $NF}'`" = "ps" ; then + ac_cv_ps_flags="ax" +elif test "x$PARTIALTARGETOS" = "xcygwin"; then + ac_cv_ps_flags="-e" +elif test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc"; then + ac_cv_ps_flags="-e" +else + AC_MSG_WARN([Unable to determine valid ps flags... defaulting...]) + ac_cv_ps_flags="-acx" +fi +]) + +PSCMD="$PSPROG $ac_cv_ps_flags" +AC_SUBST(PSCMD) +AC_DEFINE_UNQUOTED(PSCMD, "$PSPROG $ac_cv_ps_flags", + [Command to generate ps output, the final column must be the process + name withOUT arguments]) + + +## +# System/Compilation-related +## + +# Test for SIGHUP +# + +AC_MSG_CHECKING([for SIGHUP]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([#include <signal.h>], [return SIGHUP])], + [netsnmp_have_sighup=yes], + [netsnmp_have_sighup=no] +) +AC_MSG_RESULT([$netsnmp_have_sighup]) +if test "x$netsnmp_have_sighup" = xyes; then + AC_DEFINE([HAVE_SIGHUP], [1], + [Define if SIGHUP is defined in <signal.h>.]) +fi + + +# Check whether sysctl() is usable +# used in library/agent +# +if test $cross_compiling = yes; then + AC_MSG_WARN([Can't check sysctl, manually define NETSNMP_CAN_USE_SYSCTL if platform support available]) +else + AC_CACHE_CHECK([if sysctl can read kernel information], + ac_cv_NETSNMP_CAN_USE_SYSCTL, + [AC_TRY_RUN([ +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +#if HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif +#include <sys/types.h> +#if HAVE_SYS_SYSCTL_H +# include <sys/sysctl.h> +#endif + +main() { + int mib[2]; + size_t len; + struct timeval boottime; + + mib[0] = CTL_KERN; + mib[1] = KERN_BOOTTIME; + + len = sizeof(boottime); + sysctl(mib, 2, &boottime, &len, NULL, NULL); + if (boottime.tv_sec != 0) + exit(0); + else + exit(1); +} + ], + ac_cv_NETSNMP_CAN_USE_SYSCTL=yes, + ac_cv_NETSNMP_CAN_USE_SYSCTL=no, + ac_cv_NETSNMP_CAN_USE_SYSCTL=no)]) +fi + +if test "x$ac_cv_NETSNMP_CAN_USE_SYSCTL" = "xyes"; then + AC_DEFINE(NETSNMP_CAN_USE_SYSCTL, 1, [sysctl works to get boottime, etc...]) +fi + + +# Check whether TCP timer constants are indeed constant +# or depend on the kernel clock tick 'hz'. (FreeBSD 4.x) +# +# If the latter, then we will need to have a local +# variable 'hz' defined and with a suitable value, +# whenever we want to use one one of these 'constants'. +# +# used in agent only +# +AC_CACHE_CHECK([whether TCP timers depend on 'hz'], + ac_cv_TCPTV_NEEDS_HZ, + [AC_EGREP_CPP(hz, + [ +#include <netinet/tcp_timer.h> +TCPTV_SRTTDFLT + ], + ac_cv_TCPTV_NEEDS_HZ=yes, + ac_cv_TCPTV_NEEDS_HZ=no)]) + +if test "x$ac_cv_TCPTV_NEEDS_HZ" = "xyes"; then + AC_DEFINE(TCPTV_NEEDS_HZ, 1, + [Define if the TCP timer constants in <netinet/tcp_timer.h> + depend on the integer variable 'hz'. @<:@FreeBSD 4.x@:>@]) +fi + + +# Check whether IP Route table is cached (Solaris) +# used in agent only +# +case $target_os in + solaris*) + # Header checks (Solaris 2.6/7) + # + AC_CHECK_HEADERS(inet/common.h) + AC_CHECK_HEADERS(inet/ip.h,ac_inet_ip_h=yes,ac_inet_ip_h=no, + AC_INCLUDES_DEFAULT([]) + [ +#if HAVE_SYS_STREAM_H +#include <sys/stream.h> +#endif +#if HAVE_INET_COMMON_H +#include <inet/common.h> +#endif + ]) + if test $ac_inet_ip_h = yes ; then + AC_CACHE_CHECK([for mib2_ipRouteEntry_t in inet/mib2.h], + ac_cv_mib2_ipRouteEntry_t, + [AC_TRY_COMPILE([ +#if HAVE_INET_MIB2_H +#include <inet/mib2.h> +#endif + ],[ + mib2_ipRouteEntry_t testit; + if(sizeof(testit)) + return(0); + ], + ac_cv_mib2_ipRouteEntry_t=yes, + ac_cv_mib2_ipRouteEntry_t=no)]) + + if test "x$ac_cv_mib2_ipRouteEntry_t" = "xyes" ; then + AC_CACHE_CHECK([whether IRE_CACHE is defined in inet/ip.h], + ac_cv_ire_cache, + [AC_TRY_COMPILE([ +#if HAVE_INET_IP_H +#include <inet/ip.h> +#endif + ],[ + int testit=IRE_CACHE; + if(testit) + return(0); + ], + ac_cv_ire_cache=yes, + ac_cv_ire_cache=no)]) + else + ac_cv_ire_cache=no + fi + + if test "x$ac_cv_ire_cache" = "xyes" ; then + AC_DEFINE(HAVE_DEFINED_IRE_CACHE,[], + [define to 1 if you have IRE_CACHE defined in <inet/ip.h> header file.]) + else + AC_MSG_WARN([It seems that you have inet/ip.h, but IRE_CACHE is not defined. \ +That means that your query to ipRoute MIB could generate over 20k results! \ +And this can be very slow.]) + fi + fi # "test $ac_inet_ip_h = yes" + ;; +esac diff --git a/configure.d/config_os_progs b/configure.d/config_os_progs new file mode 100644 index 0000000..6ab38f4 --- /dev/null +++ b/configure.d/config_os_progs @@ -0,0 +1,437 @@ +# -*- autoconf -*- +######################################### +## +# Checks for programs +## +######################################### + +## +# Shell checks: +## + +# Check for 'sh' overflow (HP-UX) +# (taken from Perl's configure script) +# +AC_MSG_CHECKING([if I need to feed myself to ksh]) +if test -f /hp-ux -a -f /bin/ksh; then + if (PATH=.; alias -x) >/dev/null 2>&1; then + AC_MSG_RESULT(no) + else + AC_MSG_RESULT(yes) + if test "x$1" = "x"; then + exec /bin/ksh $0 + else + exec /bin/ksh $0 "$@" + fi + fi +else + AC_MSG_RESULT(no) +fi + + +## +# Standard and path program checks: +## + +AC_PROG_EGREP +AC_PROG_GREP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +AC_PROG_SED + +AC_CHECK_PROGS([FILE], [file]) +if test x$ac_cv_prog_FILE = x; then + # The file program is not included in the default Cygwin setup, although + # this program is essential for libtool to work properly. It is nontrivial + # to deduce from the message printed by libtool that the 'file' tool is + # missing and libtool does not abort when the file program is not found. So + # stop now if the file program has not been found. + AC_MSG_ERROR([file program not found although it is needed by libtool.], [1]) +fi + +AC_CHECK_PROGS(FIND, find) +AC_CHECK_PROGS(WHOAMI, whoami logname, whoami) + +AC_PATH_PROG(AUTOCONF, autoconf) +AC_PATH_PROG(AUTOHEADER, autoheader) +AC_PATH_PROG([PERLPROG], perl) +AC_PATH_PROG([PSPROG], ps) +AC_PATH_PROG([PYTHONPROG],python) + +AC_PATH_PROG([UNAMEPROG], uname) +AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG", [Where is the uname command]) + +if test "x$ac_cv_prog_AUTOCONF" = "x"; then + AUTOCONF=":" + AC_SUBST(AUTOCONF) +fi +if test "x$ac_cv_prog_AUTOHEADER" = "x"; then + AUTOHEADER=":" + AC_SUBST(AUTOHEADER) +fi + +MAKE=${MAKE-"make"} +$MAKE -v -f /dev/null 2>/dev/null | $GREP GNU >/dev/null +have_gnu_make=$? + + +## +# The Perl function system() is used for running the Net-SNMP regression +# tests. Find out whether that function invokes a POSIX shell, which is +# necessary in order to run the regression tests. When using Windows + MSYS +# + ActiveState Perl, Perl's system() function does invoke Windows' cmd.exe +# which is not a POSIX shell. +## + +AC_MSG_CHECKING([whether the Perl function system() invokes a POSIX shell]) +if test "x$PERLPROG" != 'x' && test -x "$PERLPROG" && test "x`$PERLPROG -e 'system('"'"'echo $OSTYPE'"'"');'`" != 'x$OSTYPE'; then + PERL_SYSTEM_INVOKES_POSIX_SHELL=yes +else + PERL_SYSTEM_INVOKES_POSIX_SHELL=no +fi +AC_SUBST([PERL_SYSTEM_INVOKES_POSIX_SHELL]) +AC_MSG_RESULT([yes]) + + +## +# Compilation-related program checks: +## + +AC_LANG([C]) +AC_PROG_CC +AC_PROG_CPP +LINKCC=${LINKCC-"$CC"} +AC_SUBST(LINKCC) + +AC_AIX +AC_C_CONST +AC_C_INLINE + +# libtool stuff for shared/static libraries. +# +LT_PREREQ([2.2.6]) +LT_INIT([win32-dll]) +AC_SUBST(LIBTOOL_DEPS) + + +## +# Build environment: +## + +# developer build +# (enabled by default when building from SVN checkout) +# +if test "x$developer" != "xno" -a -f $srcdir/remove-files; then + developer="yes" +fi +AC_MSG_CHECKING([for developer gcc flags]) +if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then + + # WWWXXX - strict type checking + # + DEVFLAGS="-Wall -Wstrict-prototypes -Wwrite-strings -Wcast-qual" +else + DEVFLAGS="" +fi +AC_MSG_RESULT($DEVFLAGS) +AC_SUBST(DEVFLAGS) + + +# building outside source directory +# +# a) ensure build include paths are before source +# b) ensure GNU make uses 'vpath' instead of 'VPATH' +# +NON_GNU_VPATH="VPATH =" +GNU_vpath="#vpath" + +# define include paths relative to top_srcdir +# tweak includes if we're building outside of the source dir +# +if test "x$srcdir" = "x."; then + TOP_INCLUDES=SRC_TOP_INCLUDES + SNMPLIB_INCLUDES=SRC_SNMPLIB_INCLUDES + AGENT_INCLUDES=SRC_AGENT_INCLUDES + HELPER_INCLUDES=SRC_HELPER_INCLUDES + MIBGROUP_INCLUDES=SRC_MIBGROUP_INCLUDES +else + TOP_INCLUDES=BLD_TOP_INCLUDES + SNMPLIB_INCLUDES=BLD_SNMPLIB_INCLUDES + AGENT_INCLUDES=BLD_AGENT_INCLUDES + HELPER_INCLUDES=BLD_HELPER_INCLUDES + MIBGROUP_INCLUDES=BLD_MIBGROUP_INCLUDES + if test $have_gnu_make -eq 0 ; then + NON_GNU_VPATH="#VPATH =" + GNU_vpath="vpath" + fi +fi +AC_SUBST(TOP_INCLUDES) +AC_SUBST(SNMPLIB_INCLUDES) +AC_SUBST(AGENT_INCLUDES) +AC_SUBST(HELPER_INCLUDES) +AC_SUBST(MIBGROUP_INCLUDES) +AC_SUBST(GNU_vpath) +AC_SUBST(NON_GNU_VPATH) + + +## +# System-related compilation checks: +## + +# What system are we building for +# +AC_CANONICAL_TARGET +changequote(, ) +PARTIALTARGETOS=`echo $target_os | sed 's/[-._].*//'` +changequote([, ]) +AC_MSG_CACHE_ADD(Building for: $PARTIALTARGETOS) + + +# +# Whether or not Cygwin's ld recognizes the flag -no-undefined. +# + +case x$target_os in +xcygwin*) + saved_LDFLAGS=$LDFLAGS + + AC_MSG_CHECKING([whether the linker supports -no-undefined]) + LDFLAGS="$saved_LDFLAGS -Wl,-no-undefined" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AC_MSG_RESULT([yes]); dnl + LD_NO_UNDEFINED=-no-undefined], + [AC_MSG_RESULT([no])]) + + LDFLAGS="$saved_LDFLAGS" + ;; +esac + +AC_SUBST(LD_NO_UNDEFINED) + + +# +# Socket library: either 'default' (non-MinGW) or 'winsock2' (MinGW). +# +case x$target_os in + xmingw*) + with_socklib=winsock2 + if test "x$enable_ipv6" = "xyes"; then + CFLAGS="-D_WIN32_WINNT=0x0501 $CFLAGS" + fi + ;; + *) + with_socklib=default;; +esac + + +# Check system define behaviour +# Does "-Ux -Dx=x" work as expected? +# +AC_MSG_CHECKING([whether to un-define target system token (before redefining)]) +OLD_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-U$PARTIALTARGETOS -D$PARTIALTARGETOS=$PARTIALTARGETOS" + +AC_EGREP_CPP(yes, + [[ +#ifdef $PARTIALTARGETOS +yes +#endif + ]], + [ PARTIALTARGETFLAGS="-U$PARTIALTARGETOS -D$PARTIALTARGETOS=$PARTIALTARGETOS" + AC_MSG_RESULT([yes])], + [ PARTIALTARGETFLAGS="-D$PARTIALTARGETOS=$PARTIALTARGETOS" + AC_MSG_RESULT([no])]) +CFLAGS="$CFLAGS $PARTIALTARGETFLAGS" +CPPFLAGS="$OLD_CPPFLAGS" + + +# Determine appropriate <net-snmp/system/{os}.h> include +# +AC_MSG_CHECKING([for system include file]) +changequote(, ) +filebase=$target_os +# ignore binary format indication +filebase=`echo $filebase | $SED 's/elf//'` +filebase=`echo $filebase | $SED 's/aout//'` +filebase=`echo $filebase | $SED 's/ecoff//'` +filebase=`echo $filebase | $SED 's/coff//'` +while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/system/$filebase.h +do + last=$filebase + filebase=`echo $filebase | $SED 's/[-._][^-._]*$//'` + if test "x$filebase" = "x$last"; then + filebase=`echo $filebase | $SED 's/[0-9]*$//'` + fi +done + +if test "x$filebase" = "x$last"; then + filebase="generic" +fi +ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE="net-snmp/system/$filebase.h" +changequote([, ]) +AC_MSG_RESULT($ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE) +AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_INCLUDE_FILE, "$ac_cv_NETSNMP_SYSTEM_INCLUDE_FILE") + + +# Determine appropriate <net-snmp/machine/{cpu}.h> include +# +AC_MSG_CHECKING([for machine-type include file]) +changequote(, ) +filebase=$target_cpu +while test "x$filebase" != "x$last" -a ! -f $srcdir/include/net-snmp/machine/$filebase.h +do + last=$filebase + filebase=`echo $filebase | $SED 's/[-._][^-._]*$//'` +done + +if test "x$filebase" = "x$last"; then + filebase="generic" +fi +ac_cv_NETSNMP_MACHINE_INCLUDE_FILE="net-snmp/machine/$filebase.h" +changequote([, ]) +AC_MSG_RESULT([$ac_cv_NETSNMP_MACHINE_INCLUDE_FILE]) +AC_DEFINE_UNQUOTED(NETSNMP_MACHINE_INCLUDE_FILE, "$ac_cv_NETSNMP_MACHINE_INCLUDE_FILE") + + +## +# Platform-specific compilation checks: +## + +# Preprocessor checks: +# + +# More sensible system identifier (MinGW) +# +if test "x$PARTIALTARGETOS" = "xmingw32msvc"; then + CFLAGS="$CFLAGS -Dmingw32" +fi + +# Handle .in file extension (GCC) +# +AC_MSG_CHECKING([for additional cpp flags]) +if test "x$GCC" = "xyes" -a "x$CPP" = "x$CC -E"; then + EXTRACPPFLAGS="-x c" +else + EXTRACPPFLAGS="" +fi + +# Solaris extra CPP flags (Solaris) +# +if test "x$GCC" != "xyes"; then + case $target_os in + solaris*) EXTRACPPFLAGS="$EXTRACPPFLAGS -Xs" ;; + esac +fi + +AC_SUBST(EXTRACPPFLAGS) +AC_MSG_RESULT($EXTRACPPFLAGS) + + +# Compiler checks: +# + +AC_PATH_PROG([CCPATH],$CC) +case $target_os in + bsdi*) + # Check for bundled compiler (BSDi) + # + if test "x$CCPATH" = "x/usr/ucb/cc" -o "x$CCPATH" = "x/usr/bin/cc"; then + AC_MSG_ERROR([ + +*** The BSDI /usr/ucb/cc compiler does not work with this package. +*** Please run configure with --with-cc=gcc +]) + fi + ;; + solaris*) + # Check for bundled compiler (Solaris) + # + if test "x$CCPATH" = "x/usr/ucb/cc"; then + AC_MSG_ERROR([ + +*** The solaris /usr/ucb/cc compiler does not work with this package. +*** Please put a different compiler in your path first or run +*** configure with --with-cc=XX, where XX is the compiler you want to use. +]) + fi + ;; +esac + + +# Compiler flags: +# + +# The Net-SNMP source code is not strict-aliasing safe, so add +# -fno-strict-aliasing to $CFLAGS if the compiler supports it. +AC_MSG_CHECKING([whether the compiler supports -fno-strict-aliasing]) +netsnmp_save_CFLAGS="$CFLAGS" +CFLAGS="-fno-strict-aliasing $CFLAGS" +AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [AC_MSG_RESULT([yes])], [ + AC_MSG_RESULT([no]) + CFLAGS="$netsnmp_save_CFLAGS" +]) + + +# Linker checks: +# + +case $target_os in + aix4.2*|aix4.3*|aix5*|aix6*|aix7*) + # Runtime linking flags (AIX) + # + AC_MSG_CHECKING([what linker flags to add to enable runtime linking on AIX]) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + netsnmp_aix_runtimelinking_flags_ok=yes + break + fi + done + if test "X$netsnmp_aix_runtimelinking_flags_ok" != "Xyes"; then + if test "x$GCC" = "xyes"; then + netsnmp_aix_ldflags="-Wl,-brtl" + else + netsnmp_aix_ldflags="-brtl" + fi + LDFLAGS="$netsnmp_aix_ldflags $LDFLAGS" + AC_MSG_RESULT($netsnmp_aix_ldflags) + else + AC_MSG_RESULT([none]) + fi + ;; + + darwin8*|darwin9*|darwin10*) + # Flat Namespace linking (Mac OS/X) + # + AC_MSG_CHECKING([whether darwin ld might need -flat_namespace]) + if test -z "$MACOSX_DEPLOYMENT_TARGET"; then + LDFLAGS="-flat_namespace $LDFLAGS" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + + *) + ;; +esac + + +# dpkg package (swintst_apt) +# used in agent only +# +AC_PATH_PROG([DPKG_QUERY_PATH], dpkg-query) +if test x$DPKG_QUERY_PATH != x; then + AC_DEFINE(HAVE_DPKG_QUERY, 1, [Set if the dpkg-query command is available]) +fi + + +## +# Non-program/compilation checks: +## + +# Substitute version number. +# +AC_SUBST(VERSION, $PACKAGE_VERSION) +AC_MSG_CACHE_ADD(Net-SNMP Version: $PACKAGE_VERSION) + diff --git a/configure.d/config_os_struct_members b/configure.d/config_os_struct_members new file mode 100644 index 0000000..b26cf77 --- /dev/null +++ b/configure.d/config_os_struct_members @@ -0,0 +1,754 @@ +# -*- autoconf -*- +######################################### +## +# Checks for data structures & members +## +######################################### + +## +# Simple checks: +## + +# struct arphd +# Agent: +# +AC_CHECK_MEMBERS([struct arphd.at_next],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#include <net/if.h> +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_NETINET_IF_ETHER_H +#include <netinet/if_ether.h> +#endif + ]]) + +# struct des_ks_struct +# ('weak_key' indicates older version of OpenSSL) +# Library: +# +if test "x$ac_cv_header_openssl_des_h" = "xyes" ; then + AC_CHECK_MEMBERS([struct des_ks_struct.weak_key],,,[[ +#ifdef HAVE_OPENSSL_DES_H +#include <openssl/des.h> +#endif + ]]) +fi + +# struct dirent +# (see also AC_STRUCT_DIRENT_D_TYPE) +# Library: +# +AC_CHECK_MEMBERS([struct dirent.d_type],,,[ + AC_INCLUDES_DEFAULT() + [ +#if HAVE_DIRENT_H +#include <dirent.h> +#endif + ]]) + +# struct ethtool_cmd +# +if test "x$ac_cv_header_linux_ethtool_h" = "xyes" ; then +AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_LINUX_ETHTOOL_H +#include <linux/ethtool.h> +#endif + ]]) +fi + +# struct ipstat +# Agent: +# +AC_CHECK_MEMBERS([struct ipstat.ips_cantfrag, + struct ipstat.ips_delivered, + struct ipstat.ips_fragdropped, + struct ipstat.ips_fragmented, + struct ipstat.ips_localout, + struct ipstat.ips_noproto, + struct ipstat.ips_noroute, + struct ipstat.ips_odropped, + struct ipstat.ips_ofragments, + struct ipstat.ips_reassembled],,,[ + AC_INCLUDES_DEFAULT() + [ +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_NETINET_IP_VAR_H +#include <netinet/ip_var.h> +#endif + ]]) +# +# Not-Used: +AC_CHECK_MEMBERS([struct ipstat.ips_cantforward, + struct ipstat.ips_fragtimeout],,,[ + AC_INCLUDES_DEFAULT() + [ +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_NETINET_IP_VAR_H +#include <netinet/ip_var.h> +#endif + ]]) + +# struct mbstat +# Not-Used: +# +AC_CHECK_MEMBERS([struct mbstat.m_clusters, + struct mbstat.m_clfree, + struct mbstat.m_mbufs],,,[ + AC_INCLUDES_DEFAULT() + [ +#if HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#if HAVE_SYS_MBUF_H +#include <sys/mbuf.h> +#endif + ]]) + +# struct nlist +# +AC_CHECK_MEMBERS([struct nlist.n_value, + struct nlist64.n_value],,,[ + AC_INCLUDES_DEFAULT() + [ +#if HAVE_NLIST_H +#include <nlist.h> +#endif + ]]) + +# struct sigaction +# Agent: +# +AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SIGNAL_H +#include <sys/signal.h> +#endif + ]]) + +# struct sockaddr +# Library: +# +AC_CHECK_MEMBERS([struct sockaddr.sa_len, + struct sockaddr.sa_union.sa_generic.sa_family2, + struct sockaddr_storage.ss_family, + struct sockaddr_storage.__ss_family],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#elif defined(HAVE_WINSOCK2_H) +#include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +#include <ws2tcpip.h> +#endif + ]]) + +# struct sockaddr_in6 (see RFC 2553) +# Library: +# +AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#ifdef HAVE_WINSOCK2_H +#include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +#include <ws2tcpip.h> +#endif + ]]) + +# struct msghdr +# Library: +# +AC_CHECK_MEMBERS([struct msghdr.msg_control, + struct msghdr.msg_flags],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#ifdef HAVE_WINSOCK2_H +#include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +#include <ws2tcpip.h> +#endif + ]]) + +# struct sockaddr_un +# Library: +# +AC_CHECK_SIZEOF([sockaddr_un.sun_path],,[ + AC_INCLUDES_DEFAULT + [ +#if HAVE_SYS_UN_H +#include <sys/un.h> +#endif +struct sockaddr_un sockaddr_un; + ]]) + +# struct statfs +# Agent: +# +AC_CHECK_MEMBERS([struct statfs.f_favail, + struct statfs.f_ffree, + struct statfs.f_files, + struct statfs.f_flags, + struct statfs.f_frsize],,,[ + AC_INCLUDES_DEFAULT() + [ +#if HAVE_SYS_STATFS_H +#include <sys/statfs.h> +#endif +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_MOUNT_H +#include <sys/mount.h> +#endif +#ifdef HAVE_NBUTIL_H +#include <nbutil.h> +#endif + ]]) + +# struct statvfs +# Agent: +# +AC_CHECK_MEMBERS([struct statvfs.f_files, + struct statvfs.f_frsize, + struct statvfs.mnt_dir],,,[ + AC_INCLUDES_DEFAULT() + [ +#if HAVE_SYS_STATFS_H +#include <sys/statfs.h> +#endif +#if HAVE_SYS_STATVFS_H +#include <sys/statvfs.h> +#endif + ]]) + +# struct swdevt +# Not-Used: +# +AC_CHECK_MEMBERS([struct swdevt.sw_nblksenabled],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#if HAVE_SYS_CONF_H +#include <sys/conf.h> +#endif + ]]) + +# struct tcpstat +# Agent: +# +AC_CHECK_MEMBERS([struct tcpstat.tcp_rcvmemdrop],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_TIMEOUT_H +#include <sys/timeout.h> +#endif +#ifdef HAVE_NETINET_TCP_H +#include <netinet/tcp.h> +#endif +#ifdef HAVE_NETINET_TCP_TIMER_H +#include <netinet/tcp_timer.h> +#endif +#ifdef HAVE_NETINET_TCP_VAR_H +#include <netinet/tcp_var.h> +#endif + ]]) + +# struct tm +# Library: +# +AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[ + AC_INCLUDES_DEFAULT() + [ +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + ]]) + +# extern timezone +AC_MSG_CHECKING([extern timezone]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +]], [[ + return timezone; +]])], [ +AC_MSG_RESULT([yes]) +AC_DEFINE([HAVE_TIMEZONE_VARIABLE], [1], [Define if a timezone variable is declared in <sys/time.h>]) +], [ +AC_MSG_RESULT([no]) +]) + +# struct timezone +# Library: +# +AC_CHECK_MEMBERS([struct timezone.tz_dsttime],,,[ + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_TIMEB_H +# include <sys/timeb.h> +#endif +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + ]]) + +# struct udpstat +# Agent: +# +AC_CHECK_MEMBERS([struct udpstat.udps_discard, + struct udpstat.udps_fullsock, + struct udpstat.udps_noport, + struct udpstat.udps_noportbcast, + struct udpstat.udps_opackets],,,[ + AC_INCLUDES_DEFAULT() + [ +#if HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#if HAVE_NETINET_IP_VAR_H +#include <netinet/ip_var.h> +#endif +#if HAVE_NETINET_UDP_H +#include <netinet/udp.h> +#endif +#if HAVE_NETINET_UDP_VAR_H +#include <netinet/udp_var.h> +#endif + ]]) + + + +## +# ifnet-related checks: +## + +# Does "struct ifnet" need _KERNEL defined? (Irix) +# +AC_CACHE_CHECK([if _KERNEL needs to be defined for if_mtu], + [ac_cv_IFNET_NEEDS_KERNEL], + [ac_cv_IFNET_NEEDS_KERNEL=unknown + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ +#include <sys/types.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif +#ifdef HAVE_NET_IF_VAR_H +#include <net/if_var.h> +#endif + ], [[struct ifnet test; test.if_mtu = 0;]])], + [ac_cv_IFNET_NEEDS_KERNEL=no]) + if test "$ac_cv_IFNET_NEEDS_KERNEL" = unknown ; then + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ +#define _KERNEL 1 +#include <sys/types.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif +#ifdef HAVE_NET_IF_VAR_H +#include <net/if_var.h> +#endif + ], [[struct ifnet test; test.if_mtu = 0;]])], + [ac_cv_IFNET_NEEDS_KERNEL=yes]) + fi]) + +if test "x$ac_cv_IFNET_NEEDS_KERNEL" = "xyes"; then + AC_DEFINE(NETSNMP_IFNET_NEEDS_KERNEL, 1, + [ifnet needs to have _KERNEL defined]) +fi + +# Does "struct ifnet" need _KERNEL_STRUCTURES defined? (DragonFly 3) +# +AC_CACHE_CHECK([if _KERNEL_STRUCTURES needs to be defined for if_mtu], + [ac_cv_IFNET_NEEDS_KERNEL_STRUCTURES], + [ac_cv_IFNET_NEEDS_KERNEL_STRUCTURES=unknown + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ +#include <sys/types.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif +#ifdef HAVE_NET_IF_VAR_H +#include <net/if_var.h> +#endif + ], [[struct ifnet test; test.if_mtu = 0;]])], + [ac_cv_IFNET_NEEDS_KERNEL_STRUCTURES=no]) + if test "$ac_cv_IFNET_NEEDS_KERNEL_STRUCTURES" = unknown ; then + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ +#define _KERNEL_STRUCTURES 1 +#include <sys/types.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif +#ifdef HAVE_NET_IF_VAR_H +#include <net/if_var.h> +#endif + ], [[struct ifnet test; test.if_mtu = 0;]])], + [ac_cv_IFNET_NEEDS_KERNEL_STRUCTURES=yes]) + fi]) + +if test "x$ac_cv_IFNET_NEEDS_KERNEL_STRUCTURES" = "xyes"; then + AC_DEFINE(NETSNMP_IFNET_NEEDS_KERNEL_STRUCTURES, 1, + [ifnet needs to have _KERNEL_STRUCTURES defined]) +fi + + +# struct ifaddr +# Not-Used: +# +AC_CHECK_MEMBERS([struct ifaddr.ifa_next],,,[ + [ +#ifdef NETSNMP_IFNET_NEEDS_KERNEL_STRUCTURES +#define _KERNEL_STRUCTURES 1 +#endif +#ifdef NETSNMP_IFNET_NEEDS_KERNEL +#define KERNEL +#if !defined(__DragonFly__) +#define _KERNEL 1 +#endif +#endif + ] + AC_INCLUDES_DEFAULT() + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif +#ifdef HAVE_NET_IF_VAR_H +#include <net/if_var.h> +#endif + ]]) + +# struct ifnet +# (Broken on FreeBSD - #define'd in <net/if.h>) +# Agent: (?or Not-Used?) +# +AC_CHECK_MEMBERS([struct ifnet.if_addrlist, + struct ifnet.if_addrhead.tqh_first, + struct ifnet.if_baudrate, + struct ifnet.if_baudrate.ifs_value, + struct ifnet.if_ibytes, + struct ifnet.if_imcasts, + struct ifnet.if_iqdrops, + struct ifnet.if_lastchange.tv_sec, + struct ifnet.if_lastchange.tv_nsec, + struct ifnet.if_mtu, + struct ifnet.if_noproto, + struct ifnet.if_obytes, + struct ifnet.if_omcasts, + struct ifnet.if_speed, + struct ifnet.if_type, + struct ifnet.if_xname],,,[[ +#ifdef NETSNMP_IFNET_NEEDS_KERNEL_STRUCTURES +#define _KERNEL_STRUCTURES 1 +#endif +#ifdef NETSNMP_IFNET_NEEDS_KERNEL +#define KERNEL +#if !defined(__DragonFly__) +#define _KERNEL 1 +#endif +#endif +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#ifdef HAVE_NET_IF_H +#include <net/if.h> +#endif +#ifdef HAVE_NET_IF_VAR_H +#include <net/if_var.h> +#endif +#ifdef HAVE_SYS_QUEUE_H +#include <sys/queue.h> +#endif +#ifdef linux +struct ifnet { + char *if_name; /* name, e.g. "en" or "lo" */ + short if_unit; /* sub-unit for lower level driver */ + short if_mtu; /* maximum transmission unit */ + short if_flags; /* up/down, broadcast, etc. */ + int if_metric; /* routing metric (external only) */ + char if_hwaddr [6]; /* ethernet address */ + int if_type; /* interface type: 1=generic, + 28=slip, ether=6, loopback=24 */ + int if_speed; /* interface speed: in bits/sec */ + + struct sockaddr if_addr; /* interface's address */ + struct sockaddr ifu_broadaddr; /* broadcast address */ + struct sockaddr ia_subnetmask; /* interface's mask */ + + struct ifqueue { + int ifq_len; + int ifq_drops; + } if_snd; /* output queue */ + int if_ibytes; /* octets received on interface */ + int if_ipackets; /* packets received on interface */ + int if_ierrors; /* input errors on interface */ + int if_iqdrops; /* input queue overruns */ + int if_obytes; /* octets sent on interface */ + int if_opackets; /* packets sent on interface */ + int if_oerrors; /* output errors on interface */ + int if_collisions; /* collisions on csma interfaces */ +/* end statistics */ + struct ifnet *if_next; +}; +#endif + ]]) + + +## +# rtentry structure checks: +## + +# Check struct rtentry for common fields +# Agent: +# +AC_CHECK_MEMBERS([struct rtentry.rt_dst, + struct rtentry.rt_hash, + struct rtentry.rt_next, + struct rtentry.rt_refcnt, + struct rtentry.rt_unit, + struct rtentry.rt_use],,, + [ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#include <sys/types.h> +#ifdef NETSNMP_IFNET_NEEDS_KERNEL_STRUCTURES +#define _KERNEL_STRUCTURES 1 +#endif +#ifdef HAVE_SYS_SOCKET_H +#ifdef NETSNMP_IFNET_NEEDS_KERNEL +#define KERNEL +#if !defined(__DragonFly__) +#define _KERNEL 1 +#endif +#endif +#include <sys/socket.h> +#undef KERNEL +#undef _KERNEL +#endif +#ifdef HAVE_NET_ROUTE_H +#include <net/route.h> +#endif + ]) + + +# Check for BSD 4.3 vs 4.4 struct rtentry +# +AC_CACHE_CHECK([type of rtentry structure], + [ac_cv_RTENTRY_TYPE], + [ + # BSD 4.4 compatible structure + # ('rt_nodes' array) + # + AC_TRY_COMPILE([ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#include <sys/types.h> +#ifdef NETSNMP_IFNET_NEEDS_KERNEL_STRUCTURES +#define _KERNEL_STRUCTURES 1 +#endif +#ifdef NETSNMP_IFNET_NEEDS_KERNEL +#define KERNEL +#if !defined(__DragonFly__) +#define _KERNEL 1 +#endif +#endif +#include <sys/socket.h> +#undef KERNEL +#undef _KERNEL +#include <net/route.h> + ],[ + +#ifndef HAVE_STRUCT_RTENTRY_RT_DST +#define rt_dst rt_nodes->rn_key +#endif + + struct rtentry rt; + rt.rt_nodes[0].rn_flags = 1; + rt.rt_dst; + ], ac_cv_RTENTRY_TYPE="BSD-4.4") + + if test "x$ac_cv_RTENTRY_TYPE" = "x"; then + # BSD 4.3 compatible structure + # ('rt_hash') + # + AC_TRY_COMPILE([ +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#include <sys/types.h> +#ifdef NETSNMP_IFNET_NEEDS_KERNEL_STRUCTURES +#define _KERNEL_STRUCTURES 1 +#endif +#ifdef NETSNMP_IFNET_NEEDS_KERNEL +#define KERNEL +#if !defined(__DragonFly__) +#define _KERNEL 1 +#endif +#endif +#include <sys/socket.h> +#undef KERNEL +#undef _KERNEL +#include <net/route.h> + ],[ + +struct rtentry rt; +rt.rt_hash; + ], ac_cv_RTENTRY_TYPE="BSD-4.3") + fi + + if test "x$ac_cv_RTENTRY_TYPE" = "x"; then + # Neither BSD 4.3 nor 4.4 compatible structure + # + ac_cv_RTENTRY_TYPE="unknown" + fi + ]) + +if test "x$ac_cv_RTENTRY_TYPE" = "xBSD-4.4"; then + AC_DEFINE(RTENTRY_4_4, 1, [Use BSD 4.4 routing table entries?]) +fi + +# Check for ortentry (Alpha) +# +if test "x$ac_cv_RTENTRY_TYPE" = "xunknown"; then + AC_CACHE_CHECK([for struct rtentry], + [ac_cv_struct_rtentry], + [AC_EGREP_CPP(ortentry, + [ +#define KERNEL +#include <net/route.h> + ], + [ac_cv_struct_rtentry=ortentry], + [ac_cv_struct_rtentry=rtentry ]) + if test "x$ac_cv_struct_rtentry" = "xrtentry" ; then + ac_cv_struct_rtentry="rtentry" + else + ac_cv_struct_rtentry="ortentry" + fi + ]) +else + RTENTRY_TYPE="rtentry" + ac_cv_struct_rtentry="rtentry" +fi + +if test "x$ac_cv_struct_rtentry" = "x"; then + ac_cv_struct_rtentry=rtentry +fi +AC_DEFINE_UNQUOTED(RTENTRY,struct ${ac_cv_struct_rtentry}, + [define rtentry to ortentry on SYSV machines (alphas)]) + diff --git a/configure.d/config_project_ipv6_types b/configure.d/config_project_ipv6_types new file mode 100644 index 0000000..35886a1 --- /dev/null +++ b/configure.d/config_project_ipv6_types @@ -0,0 +1,208 @@ +# -*- autoconf -*- +######################################### +## +# Checks for types +## +######################################### + +## +# Standard checks: +## + +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) +AC_CHECK_SIZEOF(intmax_t) + +AC_TYPE_INT8_T +AC_TYPE_INT16_T +AC_TYPE_INT32_T +AC_TYPE_INT64_T +AC_TYPE_INTMAX_T +AC_TYPE_UINT8_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT64_T +AC_TYPE_UINTMAX_T +AC_TYPE_INTPTR_T +AC_TYPE_UINTPTR_T + +## +# Other type checks: +## + +AC_CHECK_TYPES([off64_t]) +AC_CHECK_TYPES([nfds_t],,,[#include <sys/poll.h>]) + +# Solaris specific checks +# (taken from Perl's configure script) +# +AC_CHECK_TYPES([Counter64],,,[#include <inet/mib2.h>]) +AC_CHECK_TYPES([mib2_ipIfStatsEntry_t],,,[#include <inet/mib2.h>]) + +# N.B: The above checks could safely be moved to +# the later 'config_types' sub-script +# + + +## +# Determine the IPv6 stack type +## + +# These checks also set the LIBS/CFLAGS variables, +# which may be needed for subsequent function tests +# + +if test "x$enable_ipv6" = "xyes"; then + v6type=unknown + v6lib=none + v6trylibc=no + + AC_MSG_CHECKING([[ipv6 stack type]]) + for i in v6d toshiba kame inria zeta linux-glibc linux-inet6 cygwin winsock2 generic; do + case $i in + v6d) + AC_EGREP_CPP(yes, [ +#include </usr/local/v6/include/sys/types.h> +#ifdef __V6D__ +yes +#endif], + [v6type=$i; v6lib=v6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-I/usr/local/v6/include $CFLAGS"]) + ;; + toshiba) + AC_EGREP_CPP(yes, [ +#include <sys/param.h> +#ifdef _TOSHIBA_INET6 +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"]) + ;; + kame) + AC_EGREP_CPP(yes, [ +#include <netinet/in.h> +#ifdef __KAME__ +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + v6trylibc=yes; + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"]) + ;; + inria) + AC_EGREP_CPP(yes, [ +#include <netinet/in.h> +#ifdef IPV6_INRIA_VERSION +yes +#endif], + [v6type=$i; + v6lib=dummy; + v6libdir=none; + v6trylibc=yes; + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"]) + ;; + zeta) + AC_EGREP_CPP(yes, [ +#include <sys/param.h> +#ifdef _ZETA_MINAMI_INET6 +A +yes +#endif], + [v6type=$i; v6lib=inet6; + v6libdir=/usr/local/v6/lib; + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"]) + ;; + linux-glibc) + AC_EGREP_CPP(yes, [ +#include <features.h> +#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC_ > 2)) +yes +#endif], + [v6type=$i; + v6lib=dummy; + v6libdir=none; + v6trylibc=yes; + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"]) + ;; + linux-inet6) + if test -d /usr/inet6; then + v6type=$i + v6lib=inet6 + v6libdir=/usr/inet6/lib + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS" + fi + ;; + cygwin) + AC_EGREP_CPP(yes, [ +#include <netinet/in.h> +#ifdef _CYGWIN_IN6_H +yes +#endif], + [v6type=$i; + v6lib=dummy; + v6libdir=none + v6trylibc=yes; + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"]) + ;; + winsock2) + AC_EGREP_CPP(yes, [ +#include <ws2tcpip.h> +#if defined(_WS2TCPIP_H) +yes +#endif], + [v6type=$i; + v6lib=dummy; + v6libdir=none + v6trylibc=yes; + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS"]) + ;; + generic) + AC_MSG_RESULT([[postponed]]) + AC_CHECK_MEMBER([struct sockaddr_in6.sin6_addr],,,[ +AC_INCLUDES_DEFAULT() +[#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +]]) + AC_MSG_CHECKING([[ipv6 stack type]]) + if test "x$ac_cv_member_struct_sockaddr_in6_sin6_addr" = "xyes"; then + v6type=$i + v6lib=dummy + v6libdir=none + v6trylibc=yes + CFLAGS="-DNETSNMP_ENABLE_IPV6 $CFLAGS" + fi + ;; + esac + if test "$v6type" != "unknown"; then + break + fi + done + + if test "$v6lib" != "none"; then + if test -d $v6libdir -a -f $v6libdir/lib$v6lib.a; then + LIBS="-L$v6libdir -l$v6lib $LIBS" + enable_ipv6="yes" + AC_MSG_RESULT(["$v6type, $enable_ipv6, using lib$v6lib"]) + elif test "$v6trylibc" = "yes"; then + enable_ipv6="yes" + AC_MSG_RESULT(["$v6type, $enable_ipv6, using libc"]) + else + AC_MSG_ERROR(no IPv6 library lib$v6lib.a found.) + exit 1 + fi + else + enable_ipv6="no" + AC_MSG_RESULT(["$v6type, $enable_ipv6"]) + fi +fi diff --git a/configure.d/config_project_manual b/configure.d/config_project_manual new file mode 100644 index 0000000..31efdd3 --- /dev/null +++ b/configure.d/config_project_manual @@ -0,0 +1,170 @@ +# -*- autoconf -*- +# +# Prompt for various bits of user information +# + +if test "x$ac_cv_user_prompt_NETSNMP_LOGFILE" = "x" -o "x$ac_cv_user_prompt_NETSNMP_SYS_LOC" = "x" -o "x$ac_cv_user_prompt_NETSNMP_SYS_CONTACT" = "x" -o "x$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "x"; then +AC_CACHE_CHECK(whether to prompt for values, ac_cv_have_warned, +[ +if test "x$defaults" = "xno"; then +AC_MSG_NOTICE([ + + ************** Configuration Section ************** + + You are about to be prompted with a series of questions. Answer +them carefully, as they determine how the SNMP agent and related +applications are to function. + + After the configure script finishes, you can browse the newly +created net-snmp-config.h file for further - less important - parameters to +modify. Be careful if you re-run configure though, since net-snmp-config.h +will be overwritten. + +-Press return to continue- +]) + +read tmpinput <&AS_ORIGINAL_STDIN_FD +ac_cv_have_warned="yes" +else + ac_cv_have_warned="no" +fi +]) +else + ac_cv_have_warned="yes" +fi + +ME=`$WHOAMI` +if test -f /etc/resolv.conf; then + LOC=`awk '/^domain/{loc=$NF}END{print loc}' /etc/resolv.conf` +fi +if test "x$LOC" = x; then + LOC="@no.where" +fi + +AC_PROMPT_USER(NETSNMP_DEFAULT_SNMP_VERSION,[ + +*** Default SNMP Version: + + Starting with Net-SNMP 5.0, you can choose the default version of +the SNMP protocol to use when no version is given explicitly on the +command line, or via an 'snmp.conf' file. In the past this was set to +SNMPv1, but you can use this to switch to SNMPv3 if desired. SNMPv3 +will provide a more secure management environment (and thus you're +encouraged to switch to SNMPv3), but may break existing scripts that +rely on the old behaviour. (Though such scripts will probably need to +be changed to use the '-c' community flag anyway, as the SNMPv1 +command line usage has changed as well.). + At this prompt you can select \"1\", \"2\" (for SNMPv2c), or \"3\" as +the default version for the command tools (snmpget, ...) to use. This +can always be overridden at runtime using the -v flag to the tools, or +by using the \"defVersion\" token in your snmp.conf file. + Providing the --with-default-snmp-version=\"x\" parameter to ./configure +will avoid this prompt. + +Default version of SNMP to use],3,unquoted) + +# we tested this above before the prompt, but the prompt may give a new value. +case "${ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION}" in + [[123]]) ;; + 2c) ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION=2 ;; + *) + AC_MSG_ERROR([Illegal version number. Only 1, 2 (for SNMPv2c) and 3 are supported.]) + ;; +esac + +AC_PROMPT_USER(NETSNMP_SYS_CONTACT,[ + +*** System Contact Information: + + Describes who should be contacted about the host the agent is +running on. This information is available in the MIB-II tree. This +can also be over-ridden using the \"syscontact\" syntax in the agent's +configuration files. + Providing the --with-sys-contact=\"contact\" parameter to ./configure +will avoid this prompt. + +System Contact Information],$ME@$LOC,quoted) + +AC_PROMPT_USER(NETSNMP_SYS_LOC,[ + +*** System Location: + + Describes the location of the system. This information is +available in the MIB-II tree. this can also be over-ridden using the +\"syslocation\" syntax in the agent's configuration files. + Providing the --with-sys-location=\"location\" parameter to ./configure +will avoid this prompt. + +System Location],Unknown,quoted) + +if test -d /var/log; then + defaultlog="/var/log/snmpd.log" +else + defaultlog="/usr/adm/snmpd.log" +fi + +AC_PROMPT_USER(NETSNMP_LOGFILE,[ + +*** Logfile location: + + Enter the default location for the snmpd agent to dump +information & errors to. If not defined (enter the keyword \"none\" +at the prompt below) the agent will use stdout and stderr instead. +(Note: This value can be over-ridden using command line options.) + Providing the --with-logfile=\"path\" parameter to ./configure +will avoid this prompt. + +Location to write logfile],$defaultlog,quoted) + +if test -d /var; then + defaultstore="/var/net-snmp" + ucddefaultstore="/var/ucd-snmp" +else + defaultstore="/etc/net-snmp" + ucddefaultstore="/etc/ucd-snmp" +fi + +AC_PROMPT_USER(NETSNMP_PERSISTENT_DIRECTORY,[ + +*** snmpd persistent storage location: + + Enter a directory for the SNMP library to store persistent +data in the form of a configuration file. This default location is +different than the old default location (which was for ucd-snmp). If +you stay with the new path, I'll ask you in a second if you wish to +copy your files over to the new location (once only). If you pick +some other path than the default, you'll have to copy them yourself. +There is nothing wrong with picking the old path ($ucddefaultstore) if +you'd rather. + Providing the --with-persistent-directory=\"path\" parameter to +./configure will avoid this prompt. + +Location to write persistent information],$defaultstore,quoted) + +PERSISTENT_DIRECTORY=$ac_cv_user_prompt_NETSNMP_PERSISTENT_DIRECTORY +AC_SUBST(PERSISTENT_DIRECTORY) +UCDPERSISTENT_DIRECTORY=$ucddefaultstore +AC_SUBST(UCDPERSISTENT_DIRECTORY) + +if test $PERSISTENT_DIRECTORY = "$defaultstore" -a -d "$ucddefaultstore" -a ! -d "$defaultstore" ; then +AC_CACHE_CHECK(If we should copy the old persistent directory, ac_cv_user_prompt_COPY_PERSISTENT_FILES, +[ +AC_PROMPT_USER_NO_DEFINE(ac_cv_user_prompt_COPY_PERSISTENT_FILES,[ + +*** Copying old ucd-snmp persistent files to net-snmp persistent directory: + + Would you like to copy the older ucd-snmp persistent files +into your new net-snmp persistent file path? This will functionally +save all your ucd-snmp data and let it be used within the net-snmp +tools. This will only be done once when you run make install. If you +wish to do this, enter "yes" at the prompt. + Providing the --with-copy-persistent-files=\"no\" (or \"yes\") +parameters to ./configure will avoid this prompt. + +Copy ucd-snmp data into the net-snmp data directory],"yes") +]) +else +ac_cv_user_prompt_COPY_PERSISTENT_FILES="no" +fi +COPY_PERSISTENT_FILES="$ac_cv_user_prompt_COPY_PERSISTENT_FILES" +AC_SUBST(COPY_PERSISTENT_FILES) diff --git a/configure.d/config_project_paths b/configure.d/config_project_paths new file mode 100644 index 0000000..9690c84 --- /dev/null +++ b/configure.d/config_project_paths @@ -0,0 +1,101 @@ +# -*- autoconf -*- +######################################### +## +# Configure paths +## +######################################### + +## +# Prefix paths: +## + +# Main prefix +# +if test "x$prefix" = "xNONE"; then + prefix=/usr/local +fi + +# Prefix must be an absolute path +# i.e. begin with "/" (Unix) +# or "[A-Z]:" (Windows) +# +firstchar=`echo $prefix | $SED 's/\(.\).*/\1/'` +if test "x$firstchar" != "x/" ; then + secondchar=`echo $prefix | $SED 's/.\(.\).*/\1/'` + if test "x$secondchar" != "x:" ; then + prefix=`pwd`/$prefix + echo "adjusting prefix to $prefix" + fi +fi + + +# Exec prefix +# +# Prefix must be an absolute path +# i.e. begin with "/" (Unix) +# or "[A-Z]:" (Windows) +# +if test "x$exec_prefix" = "xNONE"; then + exec_prefix='${prefix}' +else + firstchar=`echo $exec_prefix | $SED 's/\(.\).*/\1/'` + if test "x$firstchar" != "x/" ; then + secondchar=`echo $exec_prefix | $SED 's/.\(.\).*/\1/'` + if test "x$secondchar" != "x:" ; then + exec_prefix=`pwd`/$exec_prefix + echo "adjusting exec_prefix to $exec_prefix" + fi + fi +fi + + +## +# Environmental variables: +## + +# SNMPLIBPATH +# +SNMPLIBPATH="" +tmpset="$libdir/snmp" +while test "x$tmpset" != "x$SNMPLIBPATH"; do + SNMPLIBPATH="$tmpset" + eval tmpset="$tmpset" +done +AC_DEFINE_UNQUOTED(SNMPLIBPATH,"$SNMPLIBPATH") +AC_SUBST(SNMPLIBPATH) +AC_DEFINE_UNQUOTED(SNMPDLMODPATH,"$SNMPLIBPATH/dlmod") + +# SNMPSHAREPATH +# +SNMPSHAREPATH="" +tmpset="$datadir/snmp" +while test "x$tmpset" != "x$SNMPSHAREPATH"; do + SNMPSHAREPATH="$tmpset" + eval tmpset="$tmpset" +done +AC_DEFINE_UNQUOTED(SNMPSHAREPATH,"$SNMPSHAREPATH") +AC_SUBST(SNMPSHAREPATH) + +# MIBDIRS (default) +# +if test "x$NETSNMP_DEFAULT_MIBDIRS" = "x"; then + NETSNMP_DEFAULT_MIBDIRS="\$HOME/.snmp/mibs:$SNMPSHAREPATH/mibs" + if test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then + # + # USe Windows-style path separator + NETSNMP_DEFAULT_MIBDIRS=`echo "$NETSNMP_DEFAULT_MIBDIRS" | $SED 's/:/;/g'` + fi + AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBDIRS,"$NETSNMP_DEFAULT_MIBDIRS") +fi +AC_SUBST(NETSNMP_DEFAULT_MIBDIRS) + +# SNMPCONFPATH +# +SNMPCONFPATH="" +tmpset="$sysconfdir/snmp" +while test "x$tmpset" != "x$SNMPCONFPATH"; do + SNMPCONFPATH="$tmpset" + eval tmpset="$tmpset" +done +AC_DEFINE_UNQUOTED(SNMPCONFPATH,"$SNMPCONFPATH") +AC_SUBST(SNMPCONFPATH) diff --git a/configure.d/config_project_perl_python b/configure.d/config_project_perl_python new file mode 100644 index 0000000..23f8c7e --- /dev/null +++ b/configure.d/config_project_perl_python @@ -0,0 +1,379 @@ +# -*- autoconf -*- +######################################### +## +# Perl & Python support +## +######################################### + +## +# Check whether Net-SNMP configuration will support Perl +## + +# Inputs: +# install_perl: whether or not to install the Perl modules +# yes/no/try (i.e. 'maybe' - the default) +# embed_perl: whether or not to embed Perl support within the agent +# yes/no/try (i.e. 'maybe' - the default) +# +# ac_cv_path_PERLPROG: Path to perl binary + + +# Embedded Perl requires Perl modules, and the perl binary +# +if test "x$embed_perl" = "xtry" ; then + if test "x$install_perl" = "xno" ; then + install_perl="try" + fi + if test "x$ac_cv_path_PERLPROG" = "x" -o "x$ac_cv_path_PERLPROG" = "xno" ; then + install_perl="no" + embed_perl="no" + fi +fi + +# Perl modules require the perl binary +# +if test "x$install_perl" != "xno" ; then + myperl=$ac_cv_path_PERLPROG + if test $myperl = "no" ; then + if test "x$install_perl" = "xtry" ; then + install_perl="no" + else + AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found) + fi + fi +fi + +# Perl modules require shared libraries +# +if test "x$install_perl" != "xno" ; then + if test "x$enable_shared" != "xyes"; then + if test "x$install_perl" = "xtry" ; then + install_perl="no" + else + AC_MSG_ERROR(Perl support requires --enable-shared) + fi + fi +fi + +# Perl modules can only be installed from within the source tree +# +if test "x$install_perl" != "xno" ; then + AC_MSG_CHECKING([if we are in the source tree so we can install Perl modules]) + if test "x$srcdir" = "x." -o -d perl/agent/default_store ; then + AC_MSG_RESULT([Yes]) + else + if test "x$install_perl" = "xtry" ; then + install_perl="no" + AC_MSG_RESULT([No]) + else + AC_MSG_ERROR([Perl modules can not be built outside the source directory]) + fi + fi +fi + + +# The rest of the Perl-related checks aren't relevant +# if we're not using the Perl modules +# +if test "x$install_perl" != "xno" ; then + + +## +# Check compiler compatability +## + + # What compiler was used to build the perl binary? + # + if test "xenable_perl_cc_checks" != "xno" ; then + AC_MSG_CHECKING([for Perl cc]) + changequote(, ) + PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-=\w\s\/]+).;\s*/$1/);'` + changequote([, ]) + if test "x$PERLCC" != "x" ; then + AC_MSG_RESULT([$PERLCC]) + else + if test "x$install_perl" = "xtry" ; then + install_perl="no" + else + AC_MSG_ERROR([Could not determine the compiler that was used to build $myperl. Either set the environment variable PERLPROG to a different perl binary or use --without-perl-modules to build without Perl.]) + fi + fi + fi + + # Was GCC used to build the perl binary? + # + if test "x$install_perl" != "xno" ; then + AC_MSG_CHECKING([whether $PERLCC is a GNU C compiler]) + OLDCC=$CC + CC="$PERLCC" + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([], [[ +#ifndef __GNUC__ + choke me +#endif + ]])], [perlcc_is_gnu=yes], [perlcc_is_gnu=no]) + AC_MSG_RESULT([$perlcc_is_gnu]) + CC=$OLDCC + + # Check compatability: Gnu Net-SNMP vs Non-Gnu perl + # + if test "x$GCC" = "xyes" -a "x$perlcc_is_gnu" = "xno" ; then + if test "x$install_perl" = "xtry" ; then + install_perl="no" + else + AC_MSG_ERROR([This build is using a GNU C compiler ($CC) while Perl has been compiled with a non-GNU (or non-working) compiler ($PERLCC). This likely won't work for building with Perl support. Either specify a different compiler (--with-cc=PATH), disable this check (--disable-perl-cc-checks) or build without Perl (--without-perl-modules).]) + fi + fi + fi + + # Check compatability: Non-Gnu Net-SNMP vs Gnu perl + # + if test "x$install_perl" != "xno" ; then + if test "x$GCC" != "xyes" -a "x$perlcc_is_gnu" = "xyes" ; then + if test "x$install_perl" = "xtry" ; then + install_perl="no" + else + AC_MSG_ERROR([This build is using a non-GNU C compiler ($CC) while Perl has been compiled with a GNU compiler ($PERLCC). This likely won't work for building with Perl support. Either specify a different compiler (--with-cc=PATH), disable this check (--disable-perl-cc-checks) or build without Perl (--without-perl-modules).]) + fi + fi + fi + + # Are we clear to proceed? + # + if test "x$install_perl" = "xtry" ; then + install_perl="yes" + else + if test "x$install_perl" = "xno" ; then + install_perl="no" + embed_perl="no" + fi + fi + + +## +# Determine compilation environment needed for embedded Perl +## + +# System-specific requirements +# +case $target_os in + solaris*) + if test "x$embed_perl" != "xno" ; then + # Check for LARGEFILE support (Solaris) + # + AC_MSG_CHECKING([for problematic Perl cc flags on Suns]) + if $myperl -V:ccflags | $GREP LARGEFILE > /dev/null ; then + if test "x$embed_perl" = "xtry" ; then + embed_perl="no" + else + AC_MSG_ERROR([Perl was compiled with LARGEFILE support which will break Net-SNMP. Either set the environment variable PERLPROG to a different perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.]) + fi + else + AC_MSG_RESULT([none known]) + fi + fi + ;; + + # Embedded perl typically fails on HP-UX and Mac OS X + # We really need to investigate why, and check for this explicitly + # But for the time being, turn this off by default + hpux*|darwin8*|darwin9*|darwin10*) + if test "x$embed_perl" = "xtry" ; then + AC_MSG_WARN([Embedded perl defaulting to off]) + embed_perl="no" + fi + ;; + + *) + ;; +esac + +# Compiler flags +# +if test "x$embed_perl" != "xno" ; then + AC_MSG_CHECKING([for Perl CFLAGS]) + perlcflags=`$myperl -MExtUtils::Embed -e ccopts` + if test "x$perlcflags" != "x" ; then + AC_MSG_RESULT([$perlcflags]) + CFLAGS="$CFLAGS $perlcflags" + else + if test "x$embed_perl" = "xtry" ; then + embed_perl="no" + else + AC_MSG_ERROR([Could not determine the C compiler flags that were used to build $myperl. Either set the environment variable PERLPROG to a different Perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.]) + fi + fi +fi + +# Linker flags +# +if test "x$embed_perl" != "xno" ; then + AC_MSG_CHECKING([for Perl LDFLAGS]) + netsnmp_perlldopts=`$myperl -MExtUtils::Embed -e ldopts` + if test "x$netsnmp_perlldopts" != "x" ; then + AC_MSG_RESULT([$netsnmp_perlldopts]) + else + if test "x$embed_perl" = "xtry" ; then + embed_perl="no" + else + AC_MSG_ERROR([Could not determine the linker options that were used to build $myperl. Either set the environment variable PERLPROG to a different Perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.]) + fi + fi + if test "x$enable_as_needed" != "xno" ; then + # Just-in-time linking will embed the Perl library within + # the Net-SNMP library (rather than the agent application) + # + PERLLDOPTS_FOR_LIBS="$netsnmp_perlldopts" + # Perl ccdlflags (RPATH to libperl, hopefully) + # + AC_MSG_CHECKING([for Perl CCDLFLAGS]) + changequote(, ) + netsnmp_perlccdlflags=`$myperl -V:ccdlflags | $myperl -n -e 'print $1 '"if (/^\s*ccdlflags='([^']+)';/);"` + changequote([, ]) + AC_MSG_RESULT([$netsnmp_perlccdlflags]) + PERLLDOPTS_FOR_APPS="$netsnmp_perlccdlflags" + else + # Otherwise embed the Perl library within the application + # + PERLLDOPTS_FOR_LIBS="$netsnmp_perlldopts" + # link *applications* against libperl + PERLLDOPTS_FOR_APPS="$netsnmp_perlldopts" + fi +fi + +# 'Perl_eval_pv' function (and equivalents) +# +if test "x$embed_perl" != "xno" ; then + # Three possible versions of this routine: + # eval_pv (to 5.003_97d) + # perl_eval_pv (5.004/5.005) + # Perl_eval_pv (from 5.6ff) + # + OLDLIBS="$LIBS" + LIBS="$LIBS $netsnmp_perlldopts" + AC_CHECK_FUNCS(eval_pv) + AC_CHECK_FUNC(perl_eval_pv, + AC_DEFINE(HAVE_PERL_EVAL_PV_LC, 1, + [Define to 1 if you have `the perl_eval_pv' function.])) + AC_CHECK_FUNC(Perl_eval_pv, + AC_DEFINE(HAVE_PERL_EVAL_PV_UC, 1, + [Define to 1 if you have the `Perl_eval_pv' function.])) + LIBS="$OLDLIBS" + # + # Note that autoconf flattens case when defining tokens, + # so we need to explicitly distinguish between the latter two. + + if test "x$ac_cv_func_perl_eval_pv" != "xyes" -a "x$ac_cv_func_Perl_eval_pv" != "xyes" -a "x$ac_cv_func_eval_pv" != "xyes" ; then + if test "x$embed_perl" = "xtry" ; then + embed_perl="no" + else + AC_MSG_ERROR([Could not find the eval_pv, perl_eval_pv or Perl_eval_pv functions needed for embedded Perl support. Either set the environment variable PERLPROG to a different perl binary or use --disable-embedded-perl to turn off embedded Perl functionality altogether.]) + fi + else + # Activate Embedded Perl + # + AC_DEFINE(NETSNMP_EMBEDDED_PERL, 1, + [Define if you are embedding perl in the main agent.]) + OTHERAGENTLIBOBJS="snmp_perl.o" + OTHERAGENTLIBLOBJS="snmp_perl.lo" + OTHERAGENTLIBLFTS="snmp_perl.ft" + + EMBEDPERLINSTALL="embedperlinstall" + EMBEDPERLUNINSTALL="embedperluninstall" + embed_perl="yes" + fi +else + EMBEDPERLINSTALL="" + EMBEDPERLUNINSTALL="" + embed_perl="no" + fi +fi + + +## +# Report and configure results +## + +AC_SUBST(EMBEDPERLINSTALL) +AC_SUBST(EMBEDPERLUNINSTALL) +AC_SUBST(PERLLDOPTS_FOR_LIBS) +AC_SUBST(PERLLDOPTS_FOR_APPS) + +# Results of Embedded Perl checks +# +AC_MSG_CHECKING([for potential embedded Perl support]) +if test "x$embed_perl" != "xyes" ; then + AC_MSG_CACHE_ADD(Embedded Perl support: disabled) + AC_MSG_RESULT([disabled]) +else + AC_MSG_CACHE_ADD(Embedded Perl support: enabled) + AC_MSG_RESULT([enabled]) +fi + +# Results of Perl Module checks +# +PERLTARGS="" +PERLINSTALLTARGS="" +PERLUNINSTALLTARGS="" +PERLFEATURES="" +AC_MSG_CHECKING([if we can install the Perl modules]) +if test "x$install_perl" = "xyes" ; then + PERLTARGS="perlmodules" + PERLINSTALLTARGS="perlinstall" + PERLUNINSTALLTARGS="perluninstall" + PERLFEATURES="perlfeatures" + if test "x$embed_perl" = "xyes" ; then + AC_MSG_CACHE_ADD(SNMP Perl modules: building -- embeddable) + AC_MSG_RESULT([yes -- and embeddable]) + else + AC_MSG_CACHE_ADD(SNMP Perl modules: building -- not embeddable) + AC_MSG_RESULT([yes -- not embeddable]) + fi +else + AC_MSG_RESULT([no]) + AC_MSG_CACHE_ADD(SNMP Perl modules: disabled) +fi +AC_SUBST(PERLTARGS) +AC_SUBST(PERLINSTALLTARGS) +AC_SUBST(PERLUNINSTALLTARGS) +AC_SUBST(PERLARGS) +AC_SUBST(PERLFEATURES) + + +# Reset LIBS to pre-libwrap value (???) +# +AGENTLIBS=$LIBS +LIBS=$NONAGENTLIBS + + + +## +# Python checks +## + +PYTHONTARGS="" +PYTHONINSTALLTARGS="" +PYTHONUNINSTALLTARGS="" +PYTHONCLEANTARGS="" +PYTHONFEATURES="" +AC_MSG_CHECKING([if we should install the python bindings]) +if test "x$install_python" = "xyes" ; then + PYTHONTARGS="pythonmodules" + PYTHONINSTALLTARGS="pythoninstall" + PYTHONUNINSTALLTARGS="pythonuninstall" + PYTHONCLEANTARGS="pythonclean" + PYTHONFEATURES="pythonfeatures" + AC_MSG_CACHE_ADD(SNMP Python modules: building for $PYTHONPROG) + AC_MSG_RESULT([yes]) +else + AC_MSG_CACHE_ADD(SNMP Python modules: disabled) + AC_MSG_RESULT([no]) +fi +AC_SUBST(PYTHONTARGS) +AC_SUBST(PYTHONINSTALLTARGS) +AC_SUBST(PYTHONUNINSTALLTARGS) +AC_SUBST(PYTHONCLEANTARGS) +AC_SUBST(PYTHONARGS) +AC_SUBST(PYTHONFEATURES) + + diff --git a/configure.d/config_project_types b/configure.d/config_project_types new file mode 100644 index 0000000..ec9c85a --- /dev/null +++ b/configure.d/config_project_types @@ -0,0 +1,57 @@ +# -*- autoconf -*- +######################################### +## +# Checks for types +## +######################################### + +## +# Standard checks: +## + +# Checks for typedefs, structures, and compiler characteristics. +AC_TYPE_OFF_T +AC_TYPE_PID_T +AC_HEADER_TIME + + +## +# More complex checks: +## + +# Check for 'socklen_t' (HP-UX) +# +AC_CHECK_TYPES([socklen_t],,,[ +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif]) + + +# Check for 'in_addr_t' +# May be in <netinet/in.h> (AIX) +# +AC_CHECK_TYPES([in_addr_t],,,[ +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif]) + + +# Check for 'ssize_t' +# Not necessarily in <sys/types.h> (older MinGW) +# +AC_CHECK_TYPES([ssize_t],,,[ +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif]) diff --git a/configure.d/config_project_with_enable b/configure.d/config_project_with_enable new file mode 100644 index 0000000..61ba026 --- /dev/null +++ b/configure.d/config_project_with_enable @@ -0,0 +1,1150 @@ +# -*- autoconf -*- +######################################### +## +# Command-line processing - --with/--enable +## +######################################### + +## +# System: Compiler settings +## + +AC_ARG_WITH(cc, [ +Compiler Options: + --with-cc=CC use CC to compile (default=gcc).], + [CC=$with_cc;export CC]) + +AC_ARG_WITH(linkcc, [ + --with-linkcc=CC use CC to link (default=gcc).], + [LINKCC=$with_linkcc;export LINKCC]) + +AC_ARG_WITH(ar, +[ --with-ar=AR use AR as the archiver.], + [AR=$with_ar; export AR]) + +AC_ARG_WITH(endianness, +[ --with-endianness=big|little define endianness of target platform when + cross-compiling.], + [if test $with_endianness != "big" -a $with_endianness != "little" ; then + AC_MSG_ERROR([Endianness must be big or little, not "$with_endianness".]); + fi +]) + +AC_ARG_WITH(cflags, +[ --with-cflags=CFLAGS use CFLAGS as compile time arguments.], + [CFLAGS=$with_cflags; export CFLAGS]) + +AC_ARG_WITH(ldflags, +[ --with-ldflags=LDFLAGS use LDFLAGS as link time arguments to ld.], + [LDFLAGS=$with_ldflags; export LDFLAGS]) + +AC_ARG_ENABLE(as-needed, +[ --disable-as-needed Link libperl against applications rather + than Net-SNMP libraries. Use only if the other + way doesn't work.]) + +AC_ARG_WITH(libs, +[ --with-libs=LIBS use LIBS as link time arguments to ld.], + [LIBS=$with_libs; export LIBS]) + +AC_ARG_ENABLE(silent-libtool, +[ --enable-silent-libtool Pass --silent to libtool.], + LIBTOOLFLAGS=--silent) +AC_SUBST(LIBTOOLFLAGS) + + +## +# System: Library settings +## + +NETSNMP_ARG_WITH(dmalloc, + AS_HELP_STRING([--with-dmalloc=PATH], + [Use dmalloc library (www.dmalloc.com)])) + +NETSNMP_ARG_WITH(efence, +[ --with-efence Look for and use libefence (malloc).], + use_efence="$withval") + +tryrsaref=no +NETSNMP_ARG_WITH(rsaref, +[ --with-rsaref=PATH Look for librsaref in PATH/lib.], + if test "x$withval" = "xyes"; then + tryrsaref=yes + elif test "x$withval" = "xno"; then + tryrsaref=no + elif test -d "$withval"; then + AC_ADD_SEARCH_PATH($withval) + tryrsaref=yes + fi, +) + +tryopenssl=defaultyes +askedopenssl=no +NETSNMP_ARG_WITH(openssl, +[ --with-openssl=PATH Look for openssl in PATH/lib, + or PATH may be "internal" to build with + minimal copied OpenSSL code for USM only.], + if test "x$withval" = "xyes"; then + tryopenssl=yes + askedopenssl=yes + elif test "x$withval" = "xinternal"; then + tryopenssl=internal + askedopenssl=internal + elif test "x$withval" = "xno"; then + tryopenssl=no + elif test -d "$withval"; then + if test -d "$withval/lib/MinGW"; then + LDFLAGS="-L$withval/lib/MinGW $LDFLAGS" + CPPFLAGS="-I$withval/include $CPPFLAGS" + else + AC_ADD_SEARCH_PATH($withval) + fi + tryopenssl=yes + askedopenssl=yes + fi, +) +if test "x$tryopenssl" = "xdefaultyes"; then + AC_ADD_SEARCH_PATH(/usr/local/ssl) + tryopenssl=yes +fi +AC_ARG_WITH([ssl],,NETSNMP_INVALID_WITH([openssl])) +AC_ARG_ENABLE([ssl],,NETSNMP_INVALID_WITH([openssl])) + +askedpkcs=no +NETSNMP_ARG_WITH(pkcs, +[ --with-pkcs=PATH Look for pkcs11 in PATH/lib.], + if test "x$withval" = "xyes"; then + askedpkcs=yes + elif test "x$withval" = "xno"; then + askedpkcs=no + elif test -d "$withval"; then + AC_ADD_SEARCH_PATH($withval) + askedpkcs=yes + fi, +) + +trykrb5=defaultyes +askedkrb5=no +NETSNMP_ARG_WITH(krb5, +[ --with-krb5=PATH Look for krb5 in PATH/lib.], + if test "x$withval" = "xyes"; then + trykrb5=yes + askedkrb5=yes + krb5path=undef + elif test "x$withval" = "xno"; then + trykrb5=no + krb5path=undef + elif test -d "$withval"; then + trykrb5=yes + askedkrb5=yes + krb5path=$withval + fi, +) +if test "x$trykrb5" = "xdefaultyes"; then + trykrb5=yes + krb5path=/usr/kerberos +fi + +AC_ARG_WITH(dnssec-local-validation, + [ --with-dnssec-local-validation Enable local DNSSEC validation using libval (no)], want_dnssec=$withval, want_dnssec=no) +AC_ARG_ENABLE([dnssec-local-validation],, + NETSNMP_INVALID_WITH([dnssec-local-validation])) +AC_ARG_WITH([dnssec],,NETSNMP_INVALID_WITH([dnssec-local-validation])) +AC_ARG_ENABLE([dnssec],,NETSNMP_INVALID_WITH([dnssec-local-validation])) + +NETSNMP_ARG_WITH(rpm, +[ --without-rpm Don't include support for the RPM package + management system when building the host MIB + module.]) + + +## +# Project: Build configuration settings +## + +# Install prefix +# +AC_ARG_WITH(install-prefix, +[ --with-install-prefix=PATH Just for installing, prefix all + directories with PATH. This is known not + to work on some systems with shared + libraries (eg, HPUX)], + INSTALL_PREFIX="$withval") + +if test "x$INSTALL_PREFIX" = "xyes" ; then + AC_MSG_ERROR([--with-install-prefix requires an argument]) +fi +if test "x$INSTALL_PREFIX" = "xno" ; then + INSTALL_PREFIX="" +fi +AC_SUBST(INSTALL_PREFIX) + + +# +# Subsystems to build: +# Library +# +FEATUREHEADERS="library/features.h" +FTMAINSUBS="" + +# +# Agent +# +NETSNMP_ARG_ENABLE(agent, +[ --disable-agent Do not build the agent (snmpd).]) +if test "x$enable_agent" != "xno"; then + SNMPD='snmpd$(EXEEXT)' + MAINSUBS="$MAINSUBS agent" + FEATUREHEADERS="$FEATUREHEADERS agent/features-mibgroups.h agent/features.h" + FTMAINSUBS="agent $FTMAINSUBS" + TRAPLIBS='$(TRAPDWITHAGENT)' + USETRAPLIBS='$(USEAGENTLIBS)' +else + SNMPD="" + # we still need/want the agentlibs (for subagents, e.g. snmptrapd) + MAINSUBS="$MAINSUBS agent" + # building snmptrapd w/o agentlibs doesn't work atm + #TRAPLIBS='$(TRAPDWITHOUTAGENT)' + #USETRAPLIBS='$(USELIBS)' + TRAPLIBS='$(TRAPDWITHAGENT)' + USETRAPLIBS='$(USEAGENTLIBS)' + AC_DEFINE([NETSNMP_DISABLE_AGENT], 1, [Define if no agent is built]) +fi + +AC_SUBST(SNMPD) +AC_SUBST(TRAPLIBS) +AC_SUBST(USETRAPLIBS) + +# Applications +# +NETSNMP_ARG_ENABLE(applications, +[ --disable-applications Do not build the apps (snmpget, ...).]) +if test "x$enable_applications" != "xno"; then + MAINSUBS="$MAINSUBS apps" + FEATUREHEADERS="$FEATUREHEADERS features-snmpnetstat.h features-apps.h" + FTMAINSUBS="apps $FTMAINSUBS" +else + AC_DEFINE([NETSNMP_DISABLE_APPS], 1, [Define if no apps are built]) +fi + +# Manual pages +# +NETSNMP_ARG_ENABLE(manuals, +[ --disable-manuals Do not install the manuals.]) +if test "x$enable_manuals" != "xno"; then + MAINSUBS="$MAINSUBS man" +fi + +# Supporting scripts +# +NETSNMP_ARG_ENABLE(scripts, +[ --disable-scripts Do not install the scripts (mib2c, ...).]) +if test "x$enable_scripts" != "xno"; then + MAINSUBS="$MAINSUBS local" +fi + +# MIB files +# +AC_ARG_ENABLE(mibs, +[ --disable-mibs Do not install the mib files.]) +if test "x$enable_mibs" != "xno"; then + MAINSUBS="$MAINSUBS mibs" +fi +# with-mibs is valid too, but means something else + +AC_SUBST(MAINSUBS) +AC_SUBST(FTMAINSUBS) +AC_MSG_CHECKING([what to build and install]) +AC_MSG_RESULT([$MAINSUBS]) + + +# MIB module validation (during "configure") +# +NETSNMP_ARG_ENABLE(mib-config-checking, +[ --enable-mib-config-checking Turns on extra checks during configuration + of mib modules. Any conflicts will cause + configure to abort (default is to issue a + warning and continue.)], + [if test "$enableval" = yes -o "$enableval" = no ; then + with_mib_cfg_checks="$enableval" + else + AC_MSG_ERROR([Please use --enable/--disable-mib-config-checking]) + fi], + [with_mib_cfg_checks="no"]) + +NETSNMP_ARG_ENABLE(mib-config-debug, +[ --enable-mib-config-debug Turns on verbose output during mib module + configure processing.], + [if test "$enableval" = yes -o "$enableval" = no ; then + with_mib_cfg_debug="$enableval" + else + AC_MSG_ERROR([Please use --enable/--disable-mib-config-debug]) + fi], + [with_mib_cfg_debug="no"]) + + +# Version-specific features +# +AC_ARG_ENABLE([new-features], + [AS_HELP_STRING([--enable-new-features], + [Compile in new MIB modules and other experimental features + which are due to be included in future releases.])]) + +AC_ARG_ENABLE([old-features], + [AS_HELP_STRING([--enable-old-features], + [Compile in old MIB modules and other deprecated features + which were replaced in the default build of this release.])]) + +AC_ARG_WITH([features-of], + [AS_HELP_STRING([--with-features-of=version], + [Compile in MIB modules and other features as if this was + release "version" (default is ]AC_PACKAGE_VERSION[).])],, + [with_features_of=$PACKAGE_VERSION]) + + +# Manual prompting during "configure" +# +NETSNMP_ARG_WITH(defaults, +[ +Miscellaneous: + --with-defaults Use defaults for prompted values.], + [if test "$withval" = yes -o "$withval" = no ; then + defaults="$withval" + else + AC_MSG_ERROR([Please use --with/--without-defaults]) + fi], + [defaults="no"]) + + +# UCD compatability +# +NETSNMP_ARG_ENABLE(ucd-snmp-compatibility, +[ --enable-ucd-snmp-compatibility Install ucd-snmp look-alike headers and libs. +]) + +if test "x$enable_ucd_snmp_compatibility" = "xyes" ; then + installucdheaders=installucdheaders + installucdlibs=installucdlibs + AC_MSG_CACHE_ADD(UCD-SNMP compatability: enabled) +fi +AC_SUBST(installucdheaders) +AC_SUBST(installucdlibs) + + +## +# Project: Library: MIB configuration settings +## + +NETSNMP_ARG_ENABLE(mib-loading, +[ --disable-mib-loading Do not include code that parses and + manipulates the mib files.]) +if test "x$enable_mib_loading" = "xno"; then + AC_DEFINE([NETSNMP_DISABLE_MIB_LOADING], 1, + [Define if mib loading and parsing code should not be included]) +fi + +NETSNMP_ARG_WITH(mibdirs, +[ --with-mibdirs="dir1:dir2:" Default directories to look for mibs. + (Default: \$HOME/.snmp/mibs:DATADIR/snmp/mibs)], + [NETSNMP_DEFAULT_MIBDIRS="$with_mibdirs" + AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBDIRS,"$with_mibdirs", + [default location to look for mibs to load using the above tokens + and/or those in the MIBS envrionment variable])]) + +AC_ARG_WITH(mibs, +[ --with-mibs="item1:item2:" Default mib IDs to read. + (The default list is + "SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB" + with the addition of any mibs used + by the mib modules the agent is + configured with)], + NETSNMP_DEFAULT_MIBS="$with_mibs") +# enable-mibs is valid too, but means something else + +NETSNMP_ARG_WITH(mibfiles, +[ --with-mibfiles="file1:file2" Default mib files to load. + (Default: none. uses IDs above instead.)], + AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBFILES,"$with_mibfiles", + [default mib files to load, specified by path.])) + + +## +# Project: Library: Security configuration +## + +NETSNMP_ARG_ENABLE(des, +[ --disable-des Do not support DES encryption.]) +if test "x$enable_des" = "xno"; then + AC_DEFINE([NETSNMP_DISABLE_DES], 1, + [Define if DES encryption should not be supported]) +fi + +NETSNMP_ARG_ENABLE(privacy, +[ --disable-privacy Don't compile in support for privacy (encryption).]) +if test "x$enable_privacy" != "xno"; then + AC_DEFINE(NETSNMP_ENABLE_SCAPI_AUTHPRIV, 1, + [define if you want to compile support for both authentication and + privacy support.]) +fi + +NETSNMP_ARG_ENABLE(md5, +[ --disable-md5 Do not support MD5 authentication.]) +if test "x$enable_md5" = "xno"; then + AC_DEFINE([NETSNMP_DISABLE_MD5], 1, + [Define if MD5 authentication should not be supported]) +fi + +NETSNMP_ARG_ENABLE(internal-md5, +[ --enable-internal-md5 Use the internal MD5 support.]) +if test "x$enable_internal_md5" = "xyes"; then + if test "x$enable_md5" = "xno"; then + AC_MSG_ERROR(You can not specify both --enable-internal-md5 and --disable-md5) + else + AC_DEFINE(NETSNMP_USE_INTERNAL_MD5, 1, + [define if you are using the MD5 code ...]) + fi +fi + + +## +# Project: Library: Misc configuration +## + +NETSNMP_ARG_WITH(opaque-special-types, +[ --without-opaque-special-types Don't use special opaque encodings. + SNMP normally cannot handle + floating numbers, nor large 64 bit + integers well. By default, the + net-snmp package compiles in + support for these extra datatypes + (in a legal way)]) +# Only define if specifically chosen as --without (i.e., default to true). +if test "x$with_opaque_special_types" != "xno"; then + AC_DEFINE(NETSNMP_WITH_OPAQUE_SPECIAL_TYPES, 1, + [Should we compile to use special opaque types: float, double, counter64, + i64, ui64, union?]) +fi + +NETSNMP_ARG_ENABLE(ipv6, +[ --enable-ipv6 Generate IPv6 ready version.], + [if test "x$enable_ipv6" = "xyes"; then + AC_DEFINE(NETSNMP_ENABLE_IPV6, 1, + [define if you want to enable IPv6 support]) + fi]) + +NETSNMP_ARG_WITH(logfile, +[ --with-logfile="location" Default log file location for snmpd.], + ac_cv_user_prompt_NETSNMP_LOGFILE="$with_logfile") +if test "$ac_cv_user_prompt_NETSNMP_LOGFILE" = "no"; then + ac_cv_user_prompt_NETSNMP_LOGFILE="none" +fi + +NETSNMP_ARG_WITH(persistent-directory, +[ --with-persistent-directory="directory" + Default directory for persistent data storage.],ac_cv_user_prompt_NETSNMP_PERSISTENT_DIRECTORY="$with_persistent_directory") + +NETSNMP_ARG_WITH(persistent-mask, +[ --with-persistent-mask="mask" Default mask for persistent data storage. + (Default: 077)], + [if test [`expr "X$withval" : 'X[0-7]*$'`] -eq 4 ; then + AC_MSG_RESULT([using persistent mask $withval]) + withval="0$withval" + else + AC_MSG_ERROR([Please provide a three digit octal persistent mask value]) + fi], + [withval=077 + AC_MSG_RESULT([using default persistent mask $withval])]) +AC_DEFINE_UNQUOTED(NETSNMP_PERSISTENT_MASK,$withval, + [umask permissions to set up persistent files with]) + +NETSNMP_ARG_WITH(copy_persistent_files, +[ --with-copy-persistent-files="no" Don't copy persistent files + (or use "yes" to copy them). + (Default: yes)], + ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files") + +default_temp_file_pattern="/tmp/snmpdXXXXXX" +NETSNMP_ARG_WITH(temp-file-pattern, +[ --with-temp-file-pattern=PATTERN Pattern of temporary files (Default: /tmp/snmpdXXXXXX)], + [if test `expr "X$withval" : ".*XXXXXX$"` -ne 0 ; then + AC_MSG_RESULT(using temporary file pattern $withval) + else + AC_MSG_ERROR([temporary file pattens must end with 6 X's]) + fi], + [withval="$default_temp_file_pattern" + AC_MSG_RESULT(using default temporary file pattern $withval)]) +AC_DEFINE_UNQUOTED(NETSNMP_TEMP_FILE_PATTERN,"$withval", + [Pattern of temporary files]) + + +## +# Project: Library: Version configuration +## + +SNMP_VERSIONS="" +NETSNMP_ARG_ENABLE(snmpv1, +[ --disable-snmpv1 Do not include code that implements SNMPv1.]) +if test "x$enable_snmpv1" = "xno"; then + AC_DEFINE([NETSNMP_DISABLE_SNMPV1], 1, + [Define if SNMPv1 code should not be included]) +else + SNMP_VERSIONS="$SNMP_VERSIONS 1" +fi + +NETSNMP_ARG_ENABLE(snmpv2c, +[ --disable-snmpv2c Do not include code that implements SNMPv2c.]) +if test "x$enable_snmpv2c" = "xno"; then + AC_DEFINE([NETSNMP_DISABLE_SNMPV2C], 1, + [Define if SNMPv2c code should not be included]) +else + SNMP_VERSIONS="$SNMP_VERSIONS 2c" +fi + +SNMP_VERSIONS="$SNMP_VERSIONS 3" +AC_MSG_CACHE_ADD(SNMP Versions Supported: $SNMP_VERSIONS) + +NETSNMP_ARG_WITH(default-snmp-version, +[ --with-default-snmp-version="3" Default version of SNMP to use. + (Default: 3) + Legal values: 1, 2 (for SNMPv2c) or 3.], + ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="$with_default_snmp_version") + +# we test this now and later as well. we test it now so configure can die +# early on with an error rather than waiting till the end of the script. +case "${ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION-3}" in + [[123]]) ;; + 2c) ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION=2 ;; + *) + AC_MSG_ERROR([Illegal version number. Only 1, 2 (for SNMPv2c) and 3 are supported.]) + ;; +esac + + +## +# Project: Library: Transport modules +## + +AC_ARG_WITH(transports, +[ --with-transports="t1 t2 ..." Compile in the given SNMP transport + modules (space or comma separated list).]) +AC_ARG_WITH(out_transports, +[ --with-out-transports="t1 ..." Exclude listed SNMP transports + (space or comma separated list). + + Available SNMP transport modules are: + + UDP support for SNMP over UDP/IP. + This transport is always compiled in. + UDPIPv6 support for SNMP over UDP/IPv6. + This transport is available for Linux, Solaris and + FreeBSD at least. + This transport is compiled in by default if IPv6 support is enabled. + TCPIPv6 support for SNMP over UDP/IPv6. + This transport is available for Linux, Solaris and + FreeBSD at least. + This transport is compiled in by default if IPv6 support is enabled. + TCP support for SNMP over TCP/IP. + This transport is compiled in by default, but may be omitted. + Unix support for SNMP over Unix domain protocols. + This transport is compiled in by default except on Win32 + platforms, and may be omitted. + Callback support for SNMP over an internal locally connected pair + of snmp_sessions. + Alias The alias transport simply lets you define more complex + transport strings and alias them to simple names in + the snmp.conf file. + AAL5PVC support for SNMP over AAL5 PVCs. + This transport is presently only available for Linux, + is never compiled in by default and may be omitted. + IPX support for SNMP over IPX per RFC 1420. + This transport is presently only available for Linux, + is never compiled in by default and may be omitted. + DTLSUDP support for tunneling SNMP over DTLS/UDP + TLSTCP support for tunneling SNMP over TLS/TCP + SSH (alpha) support for tunneling SNMP over SSH +]) + +# +# Catch common mistakes in transport options +# +AC_ARG_WITH(transport,, NETSNMP_INVALID_WITH([transports])) +AC_ARG_WITH(out-transport,, NETSNMP_INVALID_WITH([out-transports])) + + +## +# Project: Library: Security modules +## + +NETSNMP_ARG_WITH(security-modules, +[ --with-security-modules="s1 s2 ..." Compile in the given SNMP security + module services (space separated list). + + Available SNMP security services: + + usm support for user based SNMP security + ksm support for kerberos based SNMP security + tsm support for the Transport-based security + (for use with the SSH, DTLSUDP and TLSTCP transports) +]) + +NETSNMP_ARG_WITH(out-security-modules, +[ --with-out-security-modules="s1 s2 ..." Removes the given SNMP security + module services from the default list. +]) + + +## +# Project: Library: Developer-related settings +## + +NETSNMP_ARG_ENABLE(debugging, +[ --enable-debugging Outputs extra debugging information at all + times. Normally, you should not enable this, + but instead use the -D flag of the commands, + which toggles debuging output at runtime. + --disable-debugging Disallows debugging code to be built in. + This might provide some speed benefits.], + AC_DEFINE(NETSNMP_ALWAYS_DEBUG)) +if test "x$enable_debugging" = "xno"; then + AC_DEFINE(NETSNMP_NO_DEBUGGING) +fi + +NETSNMP_ARG_ENABLE(developer, +[ --enable-developer Turns on super-duper-extra-compile-warnings + when using gcc.], + [if test "$enableval" = yes ; then + developer="yes" + elif test "$enableval" != no ; then + AC_MSG_ERROR([Please use --enable/--disable-developer]) + else + developer="no" + fi]) + +NETSNMP_ARG_ENABLE(testing-code, +[ --enable-testing-code Enables some code sections that should + only be used for testing of certain + SNMP functionalities. This should *not* + be turned on for production use. Ever.], + [if test "$enableval" = yes ; then + AC_DEFINE(NETSNMP_ENABLE_TESTING_CODE, 1, [testing code sections.]) + elif test "$enableval" != no ; then + AC_MSG_ERROR([Please use --enable/--disable-testing-code]) + fi]) + +NETSNMP_ARG_ENABLE(reentrant, +[ --enable-reentrant Enables locking functions that protect + library resources in some multi-threading + environments. This does not guarantee + thread-safe operation. + Currently an experimental setting.], + [if test "$enableval" = yes -o "$enableval" = no ; then + with_res_locks="$enableval" + else + AC_MSG_ERROR([Please use --enable/--disable-reentrant]) + fi], + [with_res_locks="no"]) + +NETSNMP_ARG_ENABLE(deprecated, +[ --disable-deprecated Don't compile in deprecated functions.]) +if test "$enable_deprecated" = no ; then + AC_DEFINE([NETSNMP_NO_DEPRECATED_FUNCTIONS], 1, + [Define to suppress inclusion of deprecated functions]) +fi + + + +## +# Project: Agent configuration settings +## + +NETSNMP_ARG_WITH(root-access, +[ +Configuring the agent: + --without-root-access The snmpd agent won't require root access to + run it. The information it returns in the + mib-II tree may not be correct, however.]) +# Only define if specifically chosen as --without (i.e., default to true). +if test "x$with_root_access" = "xno"; then + AC_DEFINE(NETSNMP_NO_ROOT_ACCESS, 1, + [If you don't have root access don't exit upon kmem errors]) +fi + +NETSNMP_ARG_WITH(kmem-usage, +[ --without-kmem-usage Do not include any code related to the use + of kmem.]) +# Only define if specifically chosen as --without (i.e., default to true). +if test "x$with_kmem_usage" = "xno"; then + AC_DEFINE(NETSNMP_NO_KMEM_USAGE, 1, [If we don't want to use kmem.]) +fi + +NETSNMP_ARG_WITH(dummy-values, +[ --with-dummy-values Provide 'placeholder' dummy values where + the necessary information is not available. + This is technically not compliant with the + SNMP specifications, but was how the agent + operated for versions < 4.0.]) +# Define unless specifically suppressed (i.e., option defaults to false). +if test "x$with_dummy_values" != "xyes"; then + AC_DEFINE(NETSNMP_NO_DUMMY_VALUES, 1, + [If you don't want the agent to report on variables it doesn't have + data for]) +fi + +NETSNMP_ARG_ENABLE(set-support, +[ --disable-set-support Do not allow SNMP set requests.]) +if test "x$enable_set_support" = "xno"; then + AC_DEFINE([NETSNMP_DISABLE_SET_SUPPORT], 1, + [Define if SNMP SET support should be disabled]) +fi + + +NETSNMP_ARG_WITH(sys_contact, +[ --with-sys-contact="who@where" Default system contact. + (Default: LOGIN@DOMAINNAME)], + ac_cv_user_prompt_NETSNMP_SYS_CONTACT="$with_sys_contact") + +NETSNMP_ARG_WITH(sys_location, +[ --with-sys-location="location" Default system location. + (Default: Unknown)], + ac_cv_user_prompt_NETSNMP_SYS_LOC="$with_sys_location") + + + +## +# Project: Agent: Extensibility configuration +## + +NETSNMP_ARG_ENABLE(local-smux, +[ --enable-local-smux Restrict SMUX connections to localhost (by default).], + [if test "x$enable_local_smux" = "xyes"; then + AC_DEFINE(NETSNMP_ENABLE_LOCAL_SMUX, 1, + [define if you want to restrict SMUX connections to localhost + by default]) + fi]) + +NETSNMP_ARG_ENABLE(agentx-dom-sock-only, +[ --enable-agentx-dom-sock-only Disable UDP/TCP transports for agentx.], +AC_DEFINE(NETSNMP_AGENTX_DOM_SOCK_ONLY, 1, + [define if agentx transport is to use domain sockets only])) + +NETSNMP_ARG_ENABLE(snmptrapd-subagent, +[ --disable-snmptrapd-subagent Disable agentx subagent code in snmptrapd.]) +if test "x$enable_snmptrapd_subagent" = "xno"; then + AC_DEFINE(NETSNMP_SNMPTRAPD_DISABLE_AGENTX, 1, + [define if you do not want snmptrapd to register as an AgentX subagent]) +fi + +default_agentx_socket="/var/agentx/master" +NETSNMP_ARG_WITH(agentx-socket, +[ --with-agentx-socket=FILE AgentX socket (Default: /var/agentx/master as specified in RFC2741)],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a full path ]); + fi + AC_MSG_RESULT(using AgentX socket $withval) +],[ + withval=$default_agentx_socket + AC_MSG_RESULT(using default AgentX socket $default_agentx_socket) +]) +AC_DEFINE_UNQUOTED(NETSNMP_AGENTX_SOCKET,"$withval", + [Unix domain socket for AgentX master-subagent communication]) + +# +# feature addition/removal and minimialist support +# +FEATURE_ADD_FLAGS="" +NETSNMP_ARG_WITH(features, +[ --with-features="feat1 feat2" Request extra features to be turned on. + (only useful with --enable-minimalist)],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a list of features ]); + fi + FEATURE_ADD_FLAGS="--add $withval" + AC_MSG_RESULT(adding in features: $withval) +]) +AC_SUBST(FEATURE_ADD_FLAGS) + + +FEATURE_REMOVE_FLAGS="" +NETSNMP_ARG_WITH(out-features, +[ --with-out-features="feat1..." Remove specific features. + (implies --enable-minimalist)],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a list of features ]); + fi + FEATURE_REMOVE_FLAGS="--remove $withval" + FEATURETARGS="features" + AC_DEFINE(NETSNMP_MINIMAL_CODE, 1, + [Define if you want to remove all non-essential code features.]) + AC_MSG_RESULT(removing features: $withval) +]) +AC_SUBST(FEATURE_REMOVE_FLAGS) + + +# Catch common mistakes +AC_ARG_WITH(feature,, NETSNMP_INVALID_WITH([features])) +AC_ARG_WITH(out-feature,, NETSNMP_INVALID_WITH([out-features])) + +FEATURETARGS="" +NETSNMP_ARG_ENABLE(minimalist, +[ --enable-minimalist Remove all non-essential code features.]) +if test "x$enable_minimalist" = "xyes"; then + # we'll assume the mini agent is desired here as well + mini_agent="yes" + FEATURETARGS="features" + + # needed to bootstrap later checks + echo "" > include/net-snmp/feature-details.h + AC_DEFINE(NETSNMP_MINIMAL_CODE, 1, + [Define if you want to remove all non-essential code features.]) +else + FEATUREHEADERS="" +fi +AC_ARG_WITH([minimalist],,NETSNMP_INVALID_ENABLE([minimalist])) +AC_SUBST(FEATURETARGS) +AC_SUBST(FEATUREHEADERS) + +NETSNMP_ARG_ENABLE(notify-only, +[ --enable-notify-only Build tools that can only send notifications.]) +if test "x$enable_notify_only" = "xyes"; then + AC_DEFINE(NETSNMP_NOTIFY_ONLY, 1, + [Define if you want to only support sending notifications]) +fi +AC_ARG_WITH([notify-only],,NETSNMP_INVALID_ENABLE([notify-only])) +AC_ARG_ENABLE([notifyonly],,NETSNMP_INVALID_ENABLE([notify-only])) + +NETSNMP_ARG_ENABLE(no-listen, +[ --enable-no-listen Build tools that can't listen to ports.]) +if test "x$enable_no_listen" = "xyes" -o "x$enable_notify_only" = "xyes"; then + enable_no_listen="yes" + AC_DEFINE(NETSNMP_NO_LISTEN_SUPPORT, 1, + [Define if you want to remove all listening support from the code]) +fi +AC_ARG_WITH([no-listen],,NETSNMP_INVALID_ENABLE([no-listen])) +AC_ARG_ENABLE([nolisten],,NETSNMP_INVALID_ENABLE([no-listen])) + +NETSNMP_ARG_ENABLE(read-only, +[ --enable-read-only Remove all SET support from the code.]) +if test "x$enable_read_only" = "xyes" -o "x$enable_notify_only" = "xyes" ; then + enable_read_only="yes" + AC_DEFINE(NETSNMP_NO_WRITE_SUPPORT, 1, + [Define if you want to remove all SET/write access from the code]) +fi +AC_ARG_WITH([read-only],,NETSNMP_INVALID_ENABLE([read-only])) +AC_ARG_ENABLE([readonly],,NETSNMP_INVALID_ENABLE([read-only])) + + +## +# Project: Agent: MIB module configuration +## + +NETSNMP_ARG_ENABLE(mini_agent, +[ --enable-mini-agent Build a minimal agent.]) +if test "x$enable_mini_agent" = "xyes"; then + mini_agent="yes" +else + mini_agent="no" +fi +AC_ARG_WITH([miniagent],,NETSNMP_INVALID_ENABLE([mini-agent])) +AC_ARG_ENABLE([miniagent],,NETSNMP_INVALID_ENABLE([mini-agent])) + + + + +NETSNMP_ARG_ENABLE(mfd-rewrites, +[ --enable-mfd-rewrites Use new MFD rewrites of mib modules, + where available. (default is to use + original mib module code).]) +if test "x$enable_mfd_rewrites" = "xyes"; then + AC_DEFINE(NETSNMP_ENABLE_MFD_REWRITES, 1, + [Define if you want to build MFD module rewrites]) +fi + + +NETSNMP_ARG_WITH(mib_modules, +[ --with-mib-modules="item1 ..." Compile with additional mib modules + (Space separated list).]) + +NETSNMP_ARG_WITH(out_mib_modules, +[ --with-out-mib-modules="list" Compile without these mib modules. + + Default mib modules compiled into the agent (which can be removed): + + mibII support for the mib-II tree. + snmpv3mibs support for the snmpv3 mib modules. + ucd_snmp UCD-SNMP-MIB specific extensions. + agent_mibs NET-SNMP-AGENT-MIB extensions + agentx AgentX support (see below) + notification mibs supporting specification of trap destinations. + target Support for the SNMP WGs TARGET-MIB. + utilities general agent configuration utilities. + disman/event support for the DISMAN-EVENT-MIB + (supports self monitoring and notification + delivery when error conditions are found) + disman/schedule support for the DISMAN-SCHEDULE-MIB + (trigger SET requests at specified times) + host host resources mib support. + (only on major supported platforms) + + Optional mib modules that can be built into the agent include: + smux smux support to allow subagents to attach to snmpd. + mibII/mta_sendmail Sendmail statistics monitoring (MTA-MIB) + ucd-snmp/diskio Table of io-devices and how much data they have + read/written. (only tested on Solaris, Linux) + disman/old-event-mib previous implementation of the DISMAN-EVENT-MIB + + Optional modules for specific platforms + Linux + ucd-snmp/lmSensors hardware monitoring (LM-SENSORS-MIB) + ip-mib/ipv4InterfaceTable (experimental) + ip-mib/ipv6InterfaceTable (experimental) + tunnel Linux TUNNEL-MIB support (ifTable extension) + mibII/interfaces (old ifTable implementation) + misc/ipfwacc accounting rules IP firewall information + ipfwchains/ipfwchains firewall chains under ipfw + (See agent/mibgroup/ipfwchains/README) + sctp-mib support for the SCTP-MIB + etherlike-mib support for the EtherLike-MIB + + Solaris + ucd-snmp/lmSensors hardware monitoring (LM-SENSORS-MIB) + if-mib IF-MIB rewrite (add --enable-mfd-rewrites) + tcp-mib TCP-MIB rewrite (tcpConnectionTable and + tcpListenerTable; add --enable-mfd-rewrites) + udp-mib UDP-MIB rewrite (udpEndpointTable; + add --enable-mfd-rewrites) + + FreeBSD/OpenBSD + if-mib IF-MIB rewrite (add --enable-mfd-rewrites) + + AgentX support: + agentx/subagent allows the agent to run as either a snmp agent + or as an agentX sub-agent. + agentx/master makes the agent run as an agentX master agent + as well as a normal snmp agent. + agentx includes both agentx/master and agentx/client. + + Optional modules for C coders to look at and/or include as extension examples: + + examples/ucdDemoPublic SNMPv3 interoperability testing mib. + examples/example example C code extension.]) + + +# +# Catch common mistakes in configure options +# +AC_ARG_WITH(mib-module,, NETSNMP_INVALID_WITH([mib-modules])) +AC_ARG_WITH(module,, NETSNMP_INVALID_WITH([mib-modules])) +AC_ARG_WITH(modules,, NETSNMP_INVALID_WITH([mib-modules])) + +AC_ARG_WITH(out-mib-module,, NETSNMP_INVALID_WITH([out-mib-modules])) +AC_ARG_WITH(out-module,, NETSNMP_INVALID_WITH([out-mib-modules])) +AC_ARG_WITH(out-modules,, NETSNMP_INVALID_WITH([out-mib-modules])) + + +## +# Project: Enterprise settings (? Agent/Library/Both?) +## + +NETSNMP_ARG_WITH(enterprise-oid, +[Enterprise OIDs: (warning: this should be used with caution.) + + --with-enterprise-oid The enterprise number assigned to the + vendor by IANA. See + http://www.iana.org/cgi-bin/enterprise.pl + to get one, though using the default is + probably the right choice is most cases. + (default 8072 = "enterprise.net-snmp")],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a value for the enterprise number ]); + fi + AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_OID, $withval) + ent_oid="1,3,6,1,4,1,$withval" + AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_MIB, $ent_oid) + ent_dot_oid="1.3.6.1.4.1.$withval" + AC_DEFINE_UNQUOTED(NETSNMP_ENTERPRISE_DOT_MIB, $ent_dot_oid) + AC_MSG_RESULT(using enterprise number $withval) +],[ + AC_MSG_RESULT(using default "enterprise.net-snmp") +]) + +NETSNMP_ARG_WITH(enterprise-sysoid, +[ + --with-enterprise-sysoid The base OID for the sysObjectID + of the system group + (default .1.3.6.1.4.1.8072.3.2... = + "netSnmpAgentOIDs...")],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a base OID value ]); + fi + sys_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'` + AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_MIB, $sys_oid) + sys_dot_oid=`echo "$withval" | sed 's/^\.//'` + AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_DOT_MIB, $sys_dot_oid) + sysoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'` + AC_DEFINE_UNQUOTED(NETSNMP_SYSTEM_DOT_MIB_LENGTH, $sysoid_len) + AC_MSG_RESULT(using enterprise sysOID $withval ....) +],[ + AC_MSG_RESULT(using default enterprise sysOID "NET-SNMP-MIB::netSnmpAgentOIDs...") +]) + +NETSNMP_ARG_WITH(enterprise-notification-oid, +[ + --with-enterprise-notification-oid The OID used for the root of + enterprise specific notifications. + (default .1.3.6.1.4.1.8072.4 = + "netSnmpNotificationPrefix")],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a base OID value ]); + fi + notification_oid=`echo "$withval" | sed 's/^\.//' | sed 's/\./\,/g'` + AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_MIB, $notification_oid) + notification_dot_oid=`echo "$withval" | sed 's/^\.//'` + AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_DOT_MIB, $notification_dot_oid) + notificationoid_len=`echo "$withval" | sed 's/[^\.]//g' | awk -F\. '{ print NF }'` + AC_DEFINE_UNQUOTED(NETSNMP_NOTIFICATION_DOT_MIB_LENGTH, $notificationoid_len) + AC_MSG_RESULT(using enterprise notifications $withval) +],[ + AC_MSG_RESULT(using default notifications "NET-SNMP-MIB::netSnmpNotifications") +]) + + +## +# Project: Perl settings +## + +NETSNMP_ARG_WITH(perl-modules, +[ +Perl: + --with-perl-modules[=ARGS] Install the Perl modules along with the rest + of the net-snmp toolkit. If ARGS is + specified, they're passed to the + Makefile.PL script.],[ + if test "$withval" = "no"; then + install_perl="no" + else + install_perl="yes" + if test "$withval" != "yes"; then + PERLARGS="$withval" + fi + fi +], install_perl="try") + +NETSNMP_ARG_ENABLE(embedded-perl, +[ --disable-embedded-perl Disable embedded Perl in the SNMP agent and + snmptrapd. [enabled by default]], + embed_perl="$enableval", embed_perl="try") + +NETSNMP_ARG_ENABLE(perl-cc-checks, +[ --disable-perl-cc-checks Disable configure checks for whether Perl's + C Compiler is compatible with ours when + embedded Perl is enabled.]) + + +## +# Project: Python settings +## + +AC_ARG_WITH(python-modules, +[ +Python: + --with-python-modules[=ARGS] Install the python bindings along with the + rest of the net-snmp toolkit. If ARGS is + specified, they're passed to the + setup.py script as arguments.],[ + install_python="yes" + if test "$withval" = "yes"; then + PYTHONARGS="" + elif test "$withval" = "no"; then + PYTHONARGS="" + install_python="no" + else + PYTHONARGS="$withval" + fi +], install_python="no") + + +## +# Project: Library settings +## + +NETSNMP_ARG_WITH(server-send-buf, +[ +Network Buffers: + --with-server-send-buf[=ARG] Use ARG for the default UDP/TCP send buffer instead + of the OS buffer for server sockets that are + created (snmpd, snmptrapd). + This default can be overridden in the runtime + configuration files. + The ARG should be the size in bytes],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a positive number for the server send buffer ]) + fi + AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_SERVER_SEND_BUF, $withval)], + AC_MSG_RESULT([using OS default send buffer size for server sockets]) ) + +NETSNMP_ARG_WITH(server-recv-buf, +[ --with-server-recv-buf[=ARG] Similar as previous option, but for receive buffer],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a positive number for the server recv buffer ]) + fi + AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_SERVER_RECV_BUF, $withval)], + AC_MSG_RESULT([using OS default recv buffer size for server sockets]) ) + +NETSNMP_ARG_WITH(client-send-buf, +[ --with-client-send-buf[=ARG] Similar as previous options, but for the + receive buffer of client sockets],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a positive number for the client send buffer ]) + fi + AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_CLIENT_SEND_BUF, $withval)], + AC_MSG_RESULT([using OS default send buffer size for client sockets]) ) + +NETSNMP_ARG_WITH(client-recv-buf, +[ --with-client-recv-buf[=ARG] Similar as previous options, but for the send buffer],[ + if test "$withval" = yes; then + AC_MSG_ERROR([ Please provide a positive number for the client recv buffer ]) + fi + AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_CLIENT_RECV_BUF, $withval)], + AC_MSG_RESULT([using OS default recv buffer size for client sockets]) ) + +## +# System: library settings (more) +## + +NETSNMP_ARG_WITH(elf, + [AS_HELP_STRING([--without-elf],[use elf libraries])]) + +NETSNMP_ARG_WITH(nl, + [AS_HELP_STRING([--with-nl],[use libnl to get netlink data (linux only).])]) + +NETSNMP_ARG_WITH(libwrap, + [ --with-libwrap[=LIBPATH] Compile in libwrap (tcp_wrappers) support.], + [], + [with_libwrap="no"]) + +NETSNMP_ARG_WITH(zlib, + [ --with-zlib[=DIR] use libz in DIR], + [], + [with_zlib="no"]) + +AC_ARG_WITH(bzip2, + [ --with-bzip2[=DIR] use libbz2 in DIR], + [], + [with_bzip2="no"]) + +NETSNMP_ARG_WITH( + [mnttab], + AS_HELP_STRING( + [--with-mnttab="/etc/mnttab"], + [Mount table location. The default is to autodetect this.])) + +## +# Project: mysql +## + +NETSNMP_ARG_WITH(mysql, + [ --with-mysql Include support for MySQL.]) +if test "x$with_mysql" = "xyes"; then + AC_DEFINE(NETSNMP_USE_MYSQL, 1, + [define if you are using the mysql code for snmptrapd ...]) +fi |