511
519
AC_ARG_WITH(persistent-directory,
512
520
[ --with-persistent-directory=\"directory\"
513
Default directory for persistent data storage.],ac_cv_user_prompt_PERSISTENT_DIRECTORY="$with_persistent_directory")
521
Default directory for persistent data storage.],ac_cv_user_prompt_NETSNMP_PERSISTENT_DIRECTORY="$with_persistent_directory")
514
522
AC_ARG_ENABLE(persistent-directory,,
515
523
AC_MSG_ERROR([ Invalid option. Use --with-persistent-directory/--without-persistent-directory instead ]) )
525
default_persistent_mask=077
526
AC_ARG_WITH(persistent-mask,
527
[ --with-persistent-mask=\"mask\" Default mask for persistent data storage.
529
if test "$withval" = yes; then
530
AC_MSG_ERROR([ Please provide a mask value ]);
532
AC_MSG_RESULT(using default persistent mask $withval)
533
AC_DEFINE_UNQUOTED(NETSNMP_PERSISTENT_MASK,$withval)
535
AC_MSG_RESULT(using default persistent mask $default_persistent_mask)
536
AC_DEFINE_UNQUOTED(NETSNMP_PERSISTENT_MASK,$default_persistent_mask)
538
AC_ARG_ENABLE(persistent-mask,,
539
AC_MSG_ERROR([ Invalid option. Use --with-persistent-mask instead ]) )
517
541
AC_ARG_WITH(copy_persistent_files,
518
542
[ --with-copy-persistent-files=\"no\" Don't copy persistent files
519
(or use \"yes\" to copy them).
543
(or use \"yes\" to copy them).
521
545
ac_cv_user_prompt_COPY_PERSISTENT_FILES="$with_copy_persistent_files")
522
546
AC_ARG_ENABLE(copy_persistent_files,,
523
547
AC_MSG_ERROR([ Invalid option. Use --with-copy_persistent_files/--without-copy_persistent_files instead ]) )
549
default_agentx_socket="/var/agentx/master"
550
AC_ARG_WITH(agentx-socket,
551
[ --with-agentx-socket=FILE AgentX socket (Default: /var/agentx/master as specified in RFC2741)],[
552
if test "$withval" = yes; then
553
AC_MSG_ERROR([ Please provide a full path ]);
555
AC_MSG_RESULT(using AgentX socket $withval)
556
AC_DEFINE_UNQUOTED(NETSNMP_AGENTX_SOCKET,"$withval",[Unix domain socket for AgentX master-subagent communication])
558
AC_MSG_RESULT(using default AgentX socket $default_agentx_socket)
559
AC_DEFINE_UNQUOTED(NETSNMP_AGENTX_SOCKET,"$default_agentx_socket",[Unix domain socket for AgentX master-subagent communication])
561
AC_ARG_ENABLE(agentx-socket,,
562
AC_MSG_ERROR([ Invalid option. Use --with-agentx-socket instead ]) )
525
564
AC_ARG_WITH(default-snmp-version,
526
565
[ --with-default-snmp-version=\"3\" Default version of SNMP to use.
528
567
Legal values: 1, 2 (for SNMPv2c) or 3.],
529
ac_cv_user_prompt_DEFAULT_SNMP_VERSION="$with_default_snmp_version")
568
ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="$with_default_snmp_version")
530
569
AC_ARG_ENABLE(default-snmp-version,,
531
570
AC_MSG_ERROR([ Invalid option. Use --with-default-snmp-version/--without-default-snmp-version instead ]) )
533
572
# we test this now and later as well. we test it now so configure can die
534
573
# early on with an error rather than waiting till the end of the script.
535
if test "x$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "x"; then
536
if test "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_DEFAULT_SNMP_VERSION" != "3"; then
574
if test "x$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "x"; then
575
if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" = "2c"; then
576
ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION="2"
578
if test "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "1" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "2" -a "$ac_cv_user_prompt_NETSNMP_DEFAULT_SNMP_VERSION" != "3"; then
537
579
AC_MSG_ERROR(Illegal version number passed to --with-default-snmp-version)
778
824
AC_ARG_WITH(perl-modules,
781
--with-perl-modules[=ARGS] Install the perl modules along with the rest
827
--with-perl-modules[=ARGS] Install the Perl modules along with the rest
782
828
of the net-snmp toolkit. If ARGS is
783
829
specified, they're passed to the
784
830
Makefile.PL script.],[
786
if test "$withval" = yes; then
831
if test "$withval" = "no"; then
835
if test "$withval" != "yes"; then
839
], install_perl="try")
793
841
AC_ARG_ENABLE(embedded-perl,
794
[ --enable-embedded-perl Embed perl in the SNMP agent and snmptrapd.
795
[forces --with-perl-modules as well.]],
796
embed_perl="$enableval", embed_perl="no")
842
[ --disable-embedded-perl Disable embedded Perl in the SNMP agent and
843
snmptrapd. [enabled by default]],
844
embed_perl="$enableval", embed_perl="try")
846
AC_ARG_ENABLE(perl-cc-checks,
847
[ --disable-perl-cc-checks Disable configure checks for whether Perl's
848
C Compiler is compatible with ours when
849
embedded Perl is enabled.])
798
851
# Common perl mistakes
799
852
AC_ARG_ENABLE(perl-modules,,
800
853
AC_MSG_ERROR([ Invalid option. Use --with-perl-modules/--without-perl-modules instead ]) )
801
854
AC_ARG_WITH(embedded-perl,,
802
AC_MSG_ERROR([ Invalid option. Use --enable-embedded-perl=(yes|no) instead ]) )
855
AC_MSG_ERROR([ Invalid option. Use --enable-embedded-perl/--disable-embedded-perl instead ]) )
856
AC_ARG_WITH(perl-cc-checks,,
857
AC_MSG_ERROR([ Invalid option. Use --enable-perl-cc-checks/--disable-perl-cc-checks instead ]) )
863
AC_ARG_WITH(python-modules,
866
--with-python-modules[=ARGS] Install the python bindings along with the
867
rest of the net-snmp toolkit. If ARGS is
868
specified, they're passed to the
869
setup.py script as arguments.],[
871
if test "$withval" = "yes"; then
873
elif test "$withval" = "no"; then
877
PYTHONARGS="$withval"
879
], install_python="no")
804
883
AC_ARG_WITH(server-send-buf,
1703
1837
# Do hairy agent module processing.
1705
1839
AC_MSG_CHECKING([for and configuring mib modules to use])
1841
# set up the CPP command
1842
MODULECPP="$CPP $PARTIALTARGETFLAGS -I${srcdir}/include -I${srcdir}/agent/mibgroup"
1843
if test "x$enable_mfd_rewrites" = "xyes"; then
1844
MODULECPP="$MODULECPP -DNETSNMP_ENABLE_MFD_REWRITES"
1710
1848
mib_module_list=""
1711
mib_module_list_code=""
1712
1849
agent_module_list=""
1713
agent_module_list_code=""
1714
1850
new_with_mib_modules=`echo $with_mib_modules | sed 's/,/ /g;'`
1715
1851
new_with_out_mib_modules=`echo $with_out_mib_modules | sed 's/,/ /g;'`
1853
# set up initial module list
1854
new_module_list="$new_with_mib_modules default_modules"
1856
# minor modifications
1717
1857
if test "x$enable_agent" = "xno"; then
1718
1858
# minimum mib module list for snmptrapd
1719
1859
new_module_list="mibII/vacm_vars utilities/execute $new_with_mib_modules"
1720
1860
default_mibs=SNMPv2-MIB:RFC1213-MIB
1721
1861
default_mibs_install=" "
1722
1862
elif test "x$mini_agent" = "xyes"; then
1723
new_module_list="snmpv3mibs mibII/snmp_mib mibII/system_mib mibII/sysORTable mibII/vacm_vars utilities/execute $new_with_mib_modules"
1724
default_mibs=SNMPv2-MIB:RFC1213-MIB
1725
default_mibs_install=" "
1727
new_module_list="mibII ucd_snmp snmpv3mibs notification notification-log-mib target agent_mibs agentx disman/event-mib disman/schedule utilities $new_with_mib_modules"
1728
default_mibs=IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:SNMPv2-MIB:RFC1213-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB
1731
linux* | freebsd* | dynix* | solaris2* | hpux* )
1732
new_module_list="$new_module_list host"
1739
if test "x$transport_callback_disabled" = "xyes"; then
1741
AC_MSG_WARN(Disabling Callback transport will disable AgentX support.)
1743
new_with_out_mib_modules="agentx $new_with_out_mib_modules"
1746
if test "x$enable_ipv6" = "xyes"; then
1747
new_module_list="$new_module_list mibII/ipv6"
1863
# define the mini agent flag to reduce our load list from default_mibs.h
1864
MODULECPP="$MODULECPP -DNETSNMP_MINI_AGENT"
1750
1867
test_modules="$new_module_list"
1751
1868
new_module_list=""
1754
1870
# remove modules that were explicity excluded
1755
1871
for i in $test_modules
1757
1873
if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
1759
1874
mib_cfg_msg="mib module '$i' is both included and excluded."
1760
1875
AC_MSG_WARN([mib module conflict])
1761
1876
if test "x$with_mib_cfg_checks" = "xyes"; then
1905
if test ! -d mk ; then
1910
module_rules=mk/module_rules.mk
1911
echo "# contents below built automatically by configure; do not edit by hand" > $module_rules
1914
# make file sub-pieces
1916
for i in module_list_deps mib_module_list_deps agent_module_list_deps ; do
1917
eval "$i=mk/${i}.mk"
1918
echo "# contents below built automatically by configure; do not edit by hand" > mk/${i}.mk
1922
# variable settings sub-pieces
1924
for i in module_list_code mib_module_list_code agent_module_list_code module_list mib_module_list agent_module_list ; do
1925
eval "$i=mk/${i}.mk"
1926
echo "# contents below built automatically by configure; do not edit by hand" > mk/${i}.mk
1927
echo "$i= \\" >> mk/${i}.mk
1930
echo $ECHO_N "echo " $ECHO_C > mk/MODULE_LIST.mk
1931
MODULE_LIST=mk/MODULE_LIST.mk
1934
#---------------------
1935
# until we have an empty module list...
1936
# (modules may add new modules, and until all dependencies are done...)
1796
1938
while test "x$new_module_list" != "x"; do
1797
if test $module_debug -eq 1; then
1798
echo -e "\n****************************************************************"
1799
echo "nml: $new_module_list"
1801
for i in $new_module_list
1939
AC_MSG_MODULE_DBG(-e,"\n****************************************************************")
1940
AC_MSG_MODULE_DBG("nml: $new_module_list")
1942
#---------------------
1943
# loop over all the modules in the current list
1945
for j in $new_module_list
1803
if test $module_debug -eq 1; then
1804
echo -e "\n================================================================"
1948
#---------------------
1949
# figure out which sub-blocks to build in parts
1950
if echo "$j" | grep "=" ; then
1951
# build a shared object file
1952
# format: sofilename=module1:module2
1953
# XXX: currently doesn't do this
1954
dl_name=`echo $j | sed 's/=.*//'`
1955
dl_names="$dl_names $dl_name"
1956
dl_objects=`echo $j | sed 's/.*=//'`
1957
module_sublist=`echo $dl_objects | sed 's/:/ /g'`
1959
saved_sublist_code=""
1962
# create output files
1963
# these actually get nuked later
1964
output_inits="agent/mibgroup/${dl_name}-dll.c"
1965
output_hdrs="agent/mibgroup/${dl_name}-hdrs.h"
1967
# not a special token invocation
1973
while test "x$module_sublist" != "x" ; do
1975
#---------------------
1976
# loop over all the modules in the sub list
1977
for i in $module_sublist
1980
AC_MSG_MODULE_DBG(-e "\n================================================================")
1981
AC_MSG_MODULE_DBG("testing $i")
1984
#---------------------
1985
# build a pseudo include header that includes current config and
1987
AC_LANG_CONFTEST(AC_LANG_SOURCE([[
1988
#include NETSNMP_SYSTEM_INCLUDE_FILE
1989
#include "$srcdir/$mibdir/$i.h"]]))
1990
mv conftest.$ac_ext module_tmp_header.h
1992
#---------------------
1993
# macro: config_belongs_in(ARG)
1995
# - mib_module => libnetsnmpmibs (default)
1996
# - agent_module => libnetsnmpagent
1998
module_type=mib_module
1999
if test -f $srcdir/$mibdir/$i.h; then
2001
module_type=`$MODULECPP module_tmp_header.h | grep config_belongs_in | sed 's@.*config_belongs_in(\([^)]*\)).*@\1@'`
2004
if test "x$module_type" = "x" ; then
2005
module_type=mib_module
2007
if test "x$output_to" = "xnormal" ; then
2008
output_inits="$mibdir/${module_type}_inits.h"
2009
output_hdrs="$mibdir/${module_type}_includes.h"
2012
#--------------------
2013
# check for duplicates within the dll system.
2014
# - if found in a dll, then remove from the dll and add to main
2016
for dltest in $dl_names ; do
2017
eval mod_files="\"\$dl_${dltest}_files\""
2018
if echo " $mod_files " | grep " $i " > /dev/null; then
2019
# some dll module has already seen this, unload it from that list
2020
# and include it in the core (again)
2021
AC_MSG_MODULE_DBG("removing $i from $dltest")
2022
mod_files=`echo " $mod_files " | sed "s@ $i @@"`
2024
eval "dl_${dltest}_files=\"$mod_files\""
2026
module_list="$module_list $i"
2027
echo "read_config.lo: mibgroup/$i.h" >> $module_list_deps
2028
if test $module_type = "agent_module" ; then
2029
echo "snmp_vars.lo: mibgroup/$i.h" >> $agent_module_list_deps
2031
echo "mib_modules.lo: mibgroup/$i.h" >> $mib_module_list_deps
2033
eval ${module_type}_list="\"\$${module_type}_list $i\""
2034
echo " $i \\" >> $module_list_code
2035
echo $ECHO_N " $i" $ECHO_C >> $MODULE_LIST
2036
eval tmpfilevar=\$`echo ${module_type}_list_code`
2037
echo " $i \\" >> $tmpfilevar
2039
# XXX: add this to the main init list; this is possible not
2040
# quite in the right spot any longer but we're stuck with it.
2041
# Adding it back to the original ordered spot would be a
2042
# nightmare. Ok, we're already in nightmare code so that
2043
# wolud have to be a night-terror.
2044
mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
2045
output_inits_tmp="$mibdir/${module_type}_inits.h"
2046
echo " if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits_tmp
2047
# XXX: even worse, we loose whether the header is needed or not.
2048
output_hdrs_tmp="$mibdir/${module_type}_includes.h"
2049
echo '#include "'"mibgroup/$i.h"'"' >> $output_hdrs_tmp
1808
2053
#---------------------
1809
2054
# make sure module wasn't explicity excluded, or already added
1811
if echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
1812
if test $module_debug -eq 1; then
1813
echo "$i was excluded"
2056
if test "x$dblfix" != "x" ; then
2057
AC_MSG_MODULE_DBG("$i was duplicated -- putting into main")
2058
elif echo " $new_with_out_mib_modules " | grep " $i " > /dev/null; then
2059
AC_MSG_MODULE_DBG("$i was excluded")
1815
2060
elif echo " $module_list " | grep " $i " > /dev/null; then
1816
if test $module_debug -eq 1; then
1817
echo "$i already tested"
2061
AC_MSG_MODULE_DBG("$i already tested")
1820
2064
#---------------------
1821
2065
# process modules header, checking for config_ pseudo-macros
1823
module_type=mib_module
1824
if test -f $srcdir/$mibdir/$i.h; then
1825
module_type=`$MODULECPP $srcdir/$mibdir/$i.h | grep config_belongs_in | sed 's@.*config_belongs_in(\([^)]*\)).*@\1@'`
1827
if [ "x$module_type" = "x" ]; then
1828
module_type=mib_module
2068
#---------------------
2069
# does the header file for the module exist?
2070
# macros are only processed if it does
1830
2071
if test -f $srcdir/$mibdir/$i.h; then
1832
2074
#---------------------
2075
# macro: config_exclude(modules)
2076
# - lists conflicts with other modules
2077
# - EG: new MIB implementations exclude old and vice-versa
1833
2079
# check if $i has any conflicts
1835
new_list_excl="`$MODULECPP $srcdir/$mibdir/$i.h | grep config_exclude | sed 's/.*config_exclude(\(.*\)).*/\1/'`"
2081
new_list_excl=`$MODULECPP module_tmp_header.h | grep config_exclude | sed 's/.*config_exclude(\(.*\)).*/\1/'`
1836
2082
if test "x$new_list_excl" != "x"; then
1837
if test $module_debug -eq 1; then
1838
echo "$i excludes $new_list_excl"
2083
AC_MSG_MODULE_DBG("$i excludes $new_list_excl")
1840
2084
for j in $new_list_excl
1842
2086
if echo " $module_list $new_mib_module_list $new_list_two " | grep " $j " > /dev/null; then
1844
2087
mib_cfg_msg="mib module '$i' excludes module '$j' but another module requires it"
1845
2088
AC_MSG_WARN([mib module error])
1846
2089
if test "x$with_mib_cfg_checks" = "xyes"; then
1849
2092
AC_MSG_WARN([$mib_cfg_msg])
1850
2093
AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg])
1854
2096
new_with_out_mib_modules="$j $new_with_out_mib_modules"
1855
if test $module_debug -eq 1; then
1856
echo "$j added to excluded list"
2097
AC_MSG_MODULE_DBG("$j added to excluded list")
1861
2102
#---------------------
2103
# macro: config_arch_require(ARCH,modules)
2104
# - lists modules required for a given ARCH
1862
2106
# check if $i has any architecture specific requirements
1864
new_list_arch=`grep config_arch_require $srcdir/$mibdir/$i.h | sed 's/.*config_arch_require(\(.*\), *\(.*\)).*/\1-xarchx-\2/'`
2109
new_list_arch=`$MODULECPP module_tmp_header.h | grep config_arch_require | sed 's/.*config_arch_require( *\([^ ]*\) *, *\([^ ]*\) *).*/\1-xarchx-\2/'`
1865
2111
if test "x$new_list_arch" != "x"; then
1866
2112
for j in $new_list_arch
1868
2114
archtest=`echo $j | sed 's/-xarchx-.*//'`
1869
if test "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
2115
# target_os may have been changed to a #define of 1...
2116
if test "x$archtest" = "x1" -o "x$target_os" = "x$archtest" -o "x$PARTIALTARGETOS" = "x$archtest"; then
1870
2117
new_list="$new_list `echo $j | sed 's/.*-xarchx-//'`"
2118
AC_MSG_MODULE_DBG(" $i required adding arch files: `echo $j | sed 's/.*-xarchx-//'`")
1874
if test $module_debug -eq 1; then
1875
echo " $i required arch files: $new_list_arch"
2122
AC_MSG_MODULE_DBG(" $i required arch files: $new_list")
1877
2124
#---------------------
2125
# macro: config_require(modules)
2126
# - lists modules required for this module
1878
2128
# check if $i has any other required modules
1880
new_list="$new_list `$MODULECPP $srcdir/$mibdir/$i.h | grep config_require | sed 's/.*config_require(\(.*\)).*/\1/'`"
1881
if test $module_debug -eq 1; then
1882
echo " $i will test: $new_list"
2130
new_list="$new_list `$MODULECPP module_tmp_header.h | grep config_require | sed 's/.*config_require(\(.*\)).*/\1/'`"
2131
AC_MSG_MODULE_DBG(" $i will test: $new_list")
1884
2132
if test "x$new_list" != "x"; then
1885
2133
for j in $new_list
1887
if test $module_debug -eq 1; then
1888
echo -n " $i wants to add $j: "
2135
AC_MSG_MODULE_DBG(-n " $i wants to add $j: ")
1890
2136
if test ! -f $srcdir/$mibdir/$j.h -a ! -f $srcdir/$mibdir/$j.c; then
1892
2137
AC_MSG_WARN([mib module error])
1893
2138
AC_MSG_ERROR([mib module "$i" requires module "$j" but $j.h or $j.c could not be found in $srcdir/$mibdir])
1895
2139
elif echo " $new_with_out_mib_modules " | grep " $j " > /dev/null; then
1897
mib_cfg_msg="mib module '$i' requires module '$j' but someone told me to compile without it"
1898
AC_MSG_WARN([mib module error])
1899
if test "x$with_mib_cfg_checks" = "xyes"; then
1900
AC_MSG_ERROR([$mib_cfg_msg])
1902
AC_MSG_WARN([$mib_cfg_msg])
1903
AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg])
1906
elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
1907
if test $module_debug -eq 1; then
1908
echo " $j included previously"
2140
if test "x$i" != "xdefault_modules" ; then
2141
mib_cfg_msg="mib module '$i' requires module '$j' but someone told me to compile without it"
2142
AC_MSG_WARN([mib module error])
2143
if test "x$with_mib_cfg_checks" = "xyes"; then
2144
AC_MSG_ERROR([$mib_cfg_msg])
2146
AC_MSG_WARN([$mib_cfg_msg])
2147
AC_MSG_CACHE_ADD([*** MIB Module warning *** $mib_cfg_msg])
2149
# elif echo " $module_list $new_list_two $new_module_list " | grep " $j " > /dev/null; then
2150
# AC_MSG_MODULE_DBG(" $j included previously")
1911
2153
new_list_two="$new_list_two $j"
1912
if test $module_debug -eq 1; then
2154
AC_MSG_MODULE_DBG(" $j included")
1918
2159
#---------------------
2160
# macro: config_add_mib(SOME-MIB)
2161
# - lists MIBs to be added to the default to-load list.
1919
2163
# check if $i has any mibs to add
1921
new_mibs=`$MODULECPP $srcdir/$mibdir/$i.h | grep config_add_mib | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
2165
new_mibs=`$MODULECPP module_tmp_header.h | grep config_add_mib | sed 's/.*config_add_mib(\(.*\)).*/\1/'`
1922
2166
if test "x$new_mibs" != "x"; then
1923
2167
for j in $new_mibs
1937
2182
#-------------------
2183
# add the current module to the list of stuff to compile, etc.
1938
2185
# add $i to module list
1940
if test $module_debug -eq 1; then
1941
echo " $i added (based on $i.h)"
2187
AC_MSG_MODULE_DBG(" $i added (based on $i.h)")
1943
2188
module_list="$module_list $i"
1944
module_list_h="$module_list_h mibgroup/$i.h"
1945
2189
eval ${module_type}_list="\"\$${module_type}_list $i\""
1946
eval ${module_type}_list_h="\"\$${module_type}_list_h mibgroup/$i.h\""
2191
echo "read_config.lo: mibgroup/$i.h" >> $module_list_deps
2192
if test $module_type = "agent_module" ; then
2193
echo "snmp_vars.lo: mibgroup/$i.h" >> $agent_module_list_deps
2195
echo "mib_modules.lo: mibgroup/$i.h" >> $mib_module_list_deps
1947
2198
#-------------------
1948
2199
# check for unsupported config_load_mib
1950
if $MODULECPP $srcdir/$mibdir/$i.h | grep config_load_mib > /dev/null 2>&1; then
2201
if $MODULECPP module_tmp_header.h | grep config_load_mib > /dev/null 2>&1; then
1952
2202
AC_MSG_WARN([mib module error])
1953
2203
AC_MSG_WARN([mib module "$i" uses the "config_load_mib" directive, which is no longer supported. It probably won't work.])
1955
2204
fi # grep config_load_mib
1956
2206
#-------------------
1957
2207
# check for config_parse_dot_conf
2208
# (generally not used any longer; old auto-load a .conf token)
1959
$MODULECPP $srcdir/$mibdir/$i.h | grep config_parse_dot_conf | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
2211
$MODULECPP module_tmp_header.h | grep config_parse_dot_conf | sed 's@.*config_parse_dot_conf(\([^)]*\), *\([^),]*\), *\([^),]*\), *\([^),]*\)).*@register_config_handler("snmpd",\1, \2, \3, \4);@' >> $mibdir/mib_module_dot_conf.h
1960
2214
#---------------------
2215
# macro: config_error(error text)
2216
# - used to signal a configuration error from a module
1961
2218
# check if $i has any errors, or warnings
1963
error=`$MODULECPP $srcdir/$mibdir/$i.h | grep config_error | sed 's/.*config_error(\(.*\)).*/\1/'`
2220
error=`$MODULECPP module_tmp_header.h | grep config_error | sed 's/.*config_error(\(.*\)).*/\1/'`
1964
2221
if test "x$error" != "x"; then
1968
2224
AC_MSG_ERROR([$i: *** $error ***])
1971
warning=`$MODULECPP $srcdir/$mibdir/$i.h | grep config_warning | sed 's/.*config_warning(\(.*\)).*/\1/'`
2227
#---------------------
2228
# macro: config_warning(warning text)
2229
# - used to signal a configuration "warning" to be printed to the user
2231
warning=`$MODULECPP module_tmp_header.h | grep config_warning | sed 's/.*config_warning(\(.*\)).*/\1/'`
1972
2232
if test "x$warning" != "x"; then
1973
2233
all_warnings="$all_warnings $warning
2237
#---------------------
2238
# Check for a .c file if the .h didn't exist
1976
2240
elif test -f $srcdir/$mibdir/$i.c; then
1977
2241
if echo " $module_list $new_list_two $new_module_list " | grep " $i " > /dev/null; then
1978
if test $module_debug -eq 1; then
1979
echo " $i already included"
2242
AC_MSG_MODULE_DBG(" $i already included")
1982
if test $module_debug -eq 1; then
1983
echo " $i added (based on $i.c)"
2244
AC_MSG_MODULE_DBG(" $i added (based on $i.c)")
1985
2245
module_list="$module_list $i"
1986
2246
mib_module_list="$mib_module_list $i"
2249
#---------------------
2250
# No .h or .c = error! (typo?)
1988
2252
else # no $i.h or $i.c
1990
2253
AC_MSG_WARN([mib module error])
1991
2254
AC_MSG_ERROR([module files $i.h or $i.c could not be found in $srcdir/$mibdir])
1994
2257
#-------------------
1995
2258
# check for init/shutdown routines too
1997
2261
if test -f $srcdir/$mibdir/$i.c; then
1998
module_list_code="$module_list_code $i"
1999
eval ${module_type}_list_code="\"\$${module_type}_list_code $i\""
2262
if test "x$output_to" = "xnormal" ; then
2263
echo " $i \\" >> $module_list_code
2264
echo $ECHO_N " $i" $ECHO_C >> $MODULE_LIST
2265
eval tmpfilevar=\$`echo ${module_type}_list_code`
2266
echo " $i \\" >> $tmpfilevar
2268
eval "dl_${dl_name}_files=\"\$dl_${dl_name}_files $i\""
2269
saved_sublist_code="$saved_sublist_code $i"
2000
2271
mnm=`echo $i | sed 's/.*\///;s/\.c$//;'`
2001
if test $module_debug -eq 1; then
2002
echo -e "\nchecking '$srcdir/$mibdir/$i.c' ($mnm/`basename $i`) C file for init/shutdown"
2272
AC_MSG_MODULE_DBG(-e "\nchecking '$srcdir/$mibdir/$i.c' ($mnm/`basename $i`) C file for init/shutdown")
2004
2273
if test "x$mnm" != "x`basename $i`"; then
2006
2274
AC_MSG_WARN([mib module error])
2007
2275
AC_MSG_ERROR([conflicting names: $mnm != `basename $i`])
2010
2277
temp_init=`grep init_$mnm $srcdir/$mibdir/$i.c | grep -v _init_$mnm`
2011
2278
if test "x$temp_init" != "x"; then
2012
if test $module_debug -eq 1; then
2013
echo -e "adding init_$mnm() to list"
2279
AC_MSG_MODULE_DBG(-e "adding init_$mnm() to list")
2016
echo " if (should_init(\"$mnm\")) init_$mnm();" >> $mibdir/${module_type}_inits.h
2281
echo " if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits
2018
2283
grep shutdown_$mnm $srcdir/$mibdir/$i.c > /dev/null
2019
2284
if test $? -eq 0 ; then
2024
2289
echo " if (should_init(\"$mnm\")) shutdown_$mnm();" >> $mibdir/${module_type}_shutdown.h
2026
2291
fi # test -f $srcdir/$mibdir/$i.c
2027
2293
#-------------------
2028
2294
# if there is a shutdown/init list,
2030
2296
if test $need_header -eq 1 ; then
2031
echo '#include "'"mibgroup/$i.h"'"' >> $mibdir/${module_type}_includes.h
2033
echo '/*#include "'"mibgroup/$i.h"'"*/' >> $mibdir/${module_type}_includes.h
2297
echo '#include "'"mibgroup/$i.h"'"' >> $output_hdrs
2299
echo '/*#include "'"mibgroup/$i.h"'"*/' >> $output_hdrs
2035
2302
#-------------------
2036
2303
# check for output directory (for building outside of source tree
2038
2306
if test "x`echo $i | sed 's/\///g;'`" != "x$i"; then
2039
2307
mnd=`echo $i | sed 's/\/[^/]*$//;'`
2040
2308
if test ! -d ./$mibdir/$mnd; then
2041
2309
module_directories="$module_directories ./$mibdir/$mnd"
2043
2311
fi # module directory test
2044
2314
#-------------------
2045
2315
# define USING_*_MODULE
2047
2318
sym="`echo ${i} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
2048
2320
echo "/* Define if compiling with the ${i} module files. */" >> include/net-snmp/agent/${module_type}_config.h
2049
2321
echo "#define USING_${sym}_MODULE 1" >> include/net-snmp/agent/${module_type}_config.h
2050
2322
echo " " >> include/net-snmp/agent/${module_type}_config.h
2051
2324
#-------------------
2053
2325
echo $ECHO_N " $i$ECHO_C"
2056
done # for i in $new_module_list
2327
done # for i in $module_sublist
2329
if test "$output_to" = "separate" ; then
2330
if test "x$new_list_two" = "x" ; then
2331
# no new sub-modules to add to the current target
2334
dllcleans="$saved_sublist_o $dllcleans"
2338
# a module had sub-modules required; keep goin'
2339
saved_sublist="$saved_sublist $module_sublist"
2340
module_sublist="$new_list_two"
2347
done # while module_sublist
2348
done # for j in $new_module_list
2350
# remember the top level modules for later reporting
2351
if test $first_pass = 1 ; then
2352
# remember this list for later reporting
2353
top_level_modules="$new_module_list => $new_list_two"
2057
2356
#-------------------
2058
# if $i added new modules vis config_*, check those modules for requirements too
2357
# if $i added new modules vis config_*,
2358
# check those modules for requirements too
2360
# transfer the new module to check list to the normal variable
2362
if test "x$new_list_two" ; then
2060
2365
new_module_list="$new_list_two"
2061
2366
new_list_two=""
2062
2367
done # while test "x$new_module_list" != "x"; do
2370
#--------------------
2371
# construct the dll code files and make rules. This can't be done
2372
# until now because dulpicate use of a module means it gets removed
2373
# from the dll and put into the main agent.
2375
for i in $dl_names ; do
2376
eval mod_files="\"\$dl_${i}_files\""
2377
echo "components in the $i dll: $mod_files"
2379
output_inits="agent/mibgroup/${i}-dll.c"
2380
output_hdrs="agent/mibgroup/${i}-hdrs.h"
2382
AC_MSG_MODULE_DBG("creating dll file: $output_inits")
2383
for ofile in $output_inits $output_hdrs ; do
2384
if test -f $ofile ; then
2385
if grep "this file created automatically by configure" $ofile > /dev/null 2>&1 ; then
2388
AC_MSG_ERROR([$ofile already existed ; can't build dll object $i])
2391
cat > $ofile << EOFIF
2392
/* xDo not edit; this file created automatically by configure */
2396
cat >> $output_inits << EOFOC
2397
#include <net-snmp/net-snmp-config.h>
2398
#include <net-snmp/net-snmp-includes.h>
2399
#include <net-snmp/agent/net-snmp-agent-includes.h>
2400
#include "${i}-hdrs.h"
2405
# create the .so rule
2406
saved_sublist_o=`echo "$mod_files " | sed 's/^ *//g;s/ */.o /g;'`
2408
# create the rules for each object
2409
for j in $mod_files ; do
2410
cat >> $module_rules << EOFR
2412
\$(CC) -c \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ \$<
2415
mnm=`echo $j | sed 's/.*\///;s/\.c$//;'`
2416
echo " if (should_init(\"$mnm\")) init_$mnm();" >> $output_inits
2419
# create the rule for the .so and wrapper code
2420
cat >> $module_rules << EOFM
2421
${i}-dll.o: ${i}-dll.c
2422
\$(CC) -c \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ \$<
2424
${i}.so: $saved_sublist_o ${i}-dll.o
2425
\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(DLFLAGS) -o \$@ $saved_sublist_o ${i}-dll.o
2428
cat >> $output_inits << EOFOCFIN
2435
rm -f module_tmp_header.h
2064
2437
#-------------------
2065
2438
# build module lists for Makefiles
2067
module_list_o=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
2068
module_list_lo=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
2069
module_list_c=`echo "$module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
2071
mib_module_list_o=`echo "$mib_module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
2072
mib_module_list_lo=`echo "$mib_module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
2073
mib_module_list_c=`echo "$mib_module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
2074
mibgroup_list_o=`echo " $mib_module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
2075
mibgroup_list_lo=`echo " $mib_module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
2077
agent_module_list_o=`echo "$agent_module_list_code " | sed 's/\([^ ]\) /\1.o /g'`
2078
agent_module_list_lo=`echo "$agent_module_list_code " | sed 's/\([^ ]\) /\1.lo /g'`
2079
agent_module_list_c=`echo "$agent_module_list_code " | sed 's/\([^ ]\) /\1.c /g'`
2080
agentgroup_list_o=`echo " $agent_module_list_o " | sed 's@ \([^ ]*\)\.o@ mibgroup/\1.o @g'`
2081
agentgroup_list_lo=`echo " $agent_module_list_lo " | sed 's@ \([^ ]*\)\.lo@ mibgroup/\1.lo @g'`
2442
for i in module_list_o module_list_c module_list_lo mib_module_list_o mib_module_list_c mib_module_list_lo mibgroup_list_o mibgroup_list_lo agent_module_list_o agent_module_list_c agent_module_list_lo agentgroup_list_o agentgroup_list_lo ; do
2443
eval "$i=mk/${i}.mk"
2446
sed 's/^module_list_code/module_list_o/;s/\([^=]\) *\\/\1.o \\/g' < $module_list_code > $module_list_o
2447
sed 's/^module_list_code/module_list_c/;s/\([^=]\) *\\/\1.c \\/g' < $module_list_code > $module_list_c
2448
sed 's/^module_list_code/module_list_lo/;s/\([^=]\) *\\/\1.lo \\/g' < $module_list_code > $module_list_lo
2450
sed 's/^mib_module_list_code/mib_module_list_o/;s/\([^=]\) *\\/\1.o \\/g' < $mib_module_list_code > $mib_module_list_o
2451
sed 's/^mib_module_list_code/mib_module_list_c/;s/\([^=]\) *\\/\1.c \\/g' < $mib_module_list_code > $mib_module_list_c
2452
sed 's/^mib_module_list_code/mib_module_list_lo/;s/\([^=]\) *\\/\1.lo \\/g' < $mib_module_list_code > $mib_module_list_lo
2454
sed 's/^mib_module_list_o/mibgroup_list_o/;s@\([^ ]*\)\.o@mibgroup/\1.o@g' < $mib_module_list_o > $mibgroup_list_o
2455
sed 's/^mib_module_list_lo/mibgroup_list_lo/;s@\([^ ]*\)\.lo@mibgroup/\1.lo@g' < $mib_module_list_lo > $mibgroup_list_lo
2457
sed 's/^agent_module_list_code/agent_module_list_o/;s/\([^=]\) *\\/\1.o \\/g' < $agent_module_list_code > $agent_module_list_o
2458
sed 's/^agent_module_list_code/agent_module_list_c/;s/\([^=]\) *\\/\1.c \\/g' < $agent_module_list_code > $agent_module_list_c
2459
sed 's/^agent_module_list_code/agent_module_list_lo/;s/\([^=]\) *\\/\1.lo \\/g' < $agent_module_list_code > $agent_module_list_lo
2461
sed 's/^agent_module_list_o/agentgroup_list_o/;s@\([^ ]*\)\.o@mibgroup/\1.o@g' < $agent_module_list_o > $agentgroup_list_o
2462
sed 's/^agent_module_list_lo/agentgroup_list_lo/;s@\([^ ]*\)\.lo@mibgroup/\1.lo@g' < $agent_module_list_lo > $agentgroup_list_lo
2464
for i in module_list_o module_list_c module_list_lo mib_module_list_o mib_module_list_c mib_module_list_lo mibgroup_list_o mibgroup_list_lo agent_module_list_o agent_module_list_c agent_module_list_lo agentgroup_list_o agentgroup_list_lo ; do
2465
# hpux make (at least) doesn't like a trailing \ on the last
2466
# line even when the next line contains nothing but
2468
lasttoken=`tail -1 mk/$i.mk | awk '{print $1}'`
2469
sed "s#$lasttoken \\\\#$lasttoken#" < mk/$i.mk > mk/$i.mk.tmp
2470
mv mk/$i.mk.tmp mk/$i.mk
2472
# add a closing comment
2474
echo "# end configure generated code" >> mk/$i.mk
2083
2479
if test $module_debug -eq 1; then
2084
2480
echo -e "\nFinal module list: $module_list_code"
2088
2483
if test "x$with_mib_cfg_checks" = "xyes"; then
2089
2484
AC_MSG_CACHE_ADD([Agent Module list: $module_list_code])
2091
MODULE_LIST=$module_list_code
2092
AC_SUBST(MODULE_LIST)
2093
AC_SUBST(module_list_c)
2094
AC_SUBST(module_list_h)
2095
AC_SUBST(module_list_o)
2096
AC_SUBST(module_list_lo)
2097
AC_SUBST(mib_module_list_c)
2098
AC_SUBST(mib_module_list_h)
2099
AC_SUBST(mib_module_list_o)
2100
AC_SUBST(mib_module_list_lo)
2101
AC_SUBST(agent_module_list_c)
2102
AC_SUBST(agent_module_list_h)
2103
AC_SUBST(agent_module_list_o)
2104
AC_SUBST(agent_module_list_lo)
2105
AC_SUBST(mibgroup_list_o)
2106
AC_SUBST(mibgroup_list_lo)
2107
AC_SUBST(agentgroup_list_o)
2108
AC_SUBST(agentgroup_list_lo)
2109
AC_SUBST(module_list)
2110
AC_SUBST(mib_module_list)
2111
AC_SUBST(agent_module_list)
2486
AC_SUBST_FILE(MODULE_LIST)
2487
AC_SUBST_FILE(module_list_c)
2488
AC_SUBST_FILE(module_list_o)
2489
AC_SUBST_FILE(module_list_lo)
2490
AC_SUBST_FILE(mib_module_list_c)
2491
AC_SUBST_FILE(mib_module_list_o)
2492
AC_SUBST_FILE(mib_module_list_lo)
2493
AC_SUBST_FILE(agent_module_list_c)
2494
AC_SUBST_FILE(agent_module_list_o)
2495
AC_SUBST_FILE(agent_module_list_lo)
2496
AC_SUBST_FILE(mibgroup_list_o)
2497
AC_SUBST_FILE(mibgroup_list_lo)
2498
AC_SUBST_FILE(agentgroup_list_o)
2499
AC_SUBST_FILE(agentgroup_list_lo)
2500
AC_SUBST_FILE(agent_module_list)
2502
#AC_SUBST_FILE(mib_module_list)
2503
#AC_SUBST(module_list)
2112
2504
AC_SUBST(default_mibs_install)
2506
AC_SUBST_FILE(module_rules)
2507
AC_SUBST_FILE(module_list_deps)
2508
AC_SUBST_FILE(mib_module_list_deps)
2509
AC_SUBST_FILE(agent_module_list_deps)
2114
2511
AC_MSG_RESULT(.)
2116
2513
if test $module_debug -eq 1; then
2117
2514
AC_MSG_CACHE_ADD(Agent MIB code: $module_list)
2516
AC_MSG_CACHE_ADD(Agent MIB code: $top_level_modules)
2120
2518
# end hairy agent module processing
2274
2673
AC_CHECK_LIB(socket, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)
2275
2674
LIBS="${LIBS} -lsocket"))
2277
AC_CHECK_FUNC(getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME),
2278
AC_CHECK_LIB(socket, getservbyname, AC_DEFINE(HAVE_GETSERVBYNAME)
2279
LIBS="${LIBS} -lsocket"))
2677
AC_CHECK_LIB(kstat, kstat_lookup,
2678
AC_DEFINE(HAVE_LIBKSTAT, 1, [Define to 1 if you have the `kstat' library (-lkstat).])
2679
LNETSNMPLIBS="${LNETSNMPLIBS} -lkstat")
2281
# Replace `main' with a function in -lkstat:
2282
AC_CHECK_LIB(kstat, kstat_lookup)
2681
# Check for libraries that the agent needs
2682
# saving old libraries
2284
2685
# Check for security related functions
2285
2686
if test "x$tryopenssl" != "xno"; then
2286
2687
if test "x$askedopenssl" != "xyes" -a "x$askedpkcs" = "xyes"; then
2287
AC_CHECK_LIB(pkcs11, C_Initialize)
2688
AC_CHECK_LIB(pkcs11, C_Initialize, AC_DEFINE(HAVE_LIBPKCS11, 1, [Define to 1 if you have the `pkcs11' library (-lpkcs11).])
2689
LIBPKCS11="-lpkcs11")
2289
2691
if test "x$tryrsaref" != "xno"; then
2290
2692
AC_CHECK_LIB(rsaref, RSAPrivateDecrypt)
2291
2693
AC_CHECK_LIB(RSAglue, RSA_PKCS1_RSAref)
2294
AC_CHECK_LIB(crypto, EVP_md5)
2295
AC_CHECK_FUNCS(AES_cfb128_encrypt)
2696
AC_CHECK_LIB(crypto, EVP_md5, AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
2697
LIBCRYPTO="-lcrypto")
2698
AC_CHECK_LIB(crypto, AES_cfb128_encrypt,
2699
AC_DEFINE(HAVE_AES_CFB128_ENCRYPT, 1, [Define to 1 if you have the `AES_cfb128_encrypt' function.]))
2297
2701
elif test "x$askedpkcs" = "xyes"; then
2298
AC_CHECK_LIB(pkcs11, C_Initialize)
2702
AC_CHECK_LIB(pkcs11, C_Initialize, AC_DEFINE(HAVE_LIBPKCS11)
2703
LIBPKCS11="-lpkcs11")
2301
# Check for libraries that the agent needs
2302
# saving old libraries
2305
2708
# check for tcp wrapper support
2306
2709
_cppflags="${CPPFLAGS}"
2414
2831
# now check for rpm using the appropriate libraries.
2415
2832
AC_CHECK_LIB(rpm, rpmGetFilesystemList,[
2416
2833
AC_DEFINE(HAVE_LIBRPM)
2417
LIBS="-lrpm $_rpmlibs $LIBS"
2834
LMIBLIBS="-lrpm $_rpmlibs $LMIBLIBS"
2418
2835
CFLAGS="$CFLAGS -I/usr/include/rpm"
2420
2837
# rpm-4.0.3 librpmdb actually contains what we need.
2421
2838
AC_CHECK_LIB(rpmdb, rpmdbOpen,[
2422
2839
AC_DEFINE(HAVE_LIBRPM)
2423
LIBS="-lrpmdb -lrpm $_rpmlibs $LIBS"
2840
LMIBLIBS="-lrpmdb -lrpm $_rpmlibs $LMIBLIBS"
2424
2841
CFLAGS="$CFLAGS -I/usr/include/rpm"
2425
2842
],,-lrpm $_rpmlibs)
2429
# Replace `main' with a function in -lkvm:
2430
AC_CHECK_LIB(kvm, kvm_read)
2847
AC_CHECK_LIB(kvm, kvm_read, [_libkvm="-lkvm"])
2848
AC_CHECK_FUNC(kvm_openfiles, AC_DEFINE(HAVE_KVM_OPENFILES, 1, [Define to 1 if you have the `kvm_openfiles' function.]),
2849
AC_CHECK_LIB(kvm, kvm_openfiles, AC_DEFINE(HAVE_KVM_OPENFILES, 1, [Define to 1 if you have the `kvm_openfiles' function.])
2851
AC_CHECK_FUNC(kvm_getprocs, AC_DEFINE(HAVE_KVM_GETPROCS, 1, [Define to 1 if you have the `kvm_getprocs' function.]),
2852
AC_CHECK_LIB(kvm, kvm_getprocs, AC_DEFINE(HAVE_KVM_GETPROCS, 1, [Define to 1 if you have the `kvm_getprocs' function.])
2854
AC_CHECK_FUNC(kvm_getswapinfo, AC_DEFINE(HAVE_KVM_GETSWAPINFO, 1, [Define to 1 if you have the `kvm_getswapinfo' function.]),
2855
AC_CHECK_LIB(kvm, kvm_getswapinfo, AC_DEFINE(HAVE_KVM_GETSWAPINFO, 1, [Define to 1 if you have the `kvm_getswapinfo' function.])
2857
if test "x${_libkvm}" != "x"; then
2858
AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the `kvm' library (-lkvm).])
2859
LAGENTLIBS="$LAGENTLIBS ${_libkvm}"
2431
2862
# DYNAMIC MODULE SUPPORT
2432
AC_CHECK_LIB(dl, dlopen)
2433
AC_CHECK_FUNCS(dlopen)
2435
AC_CHECK_FUNCS(kvm_openfiles nlist knlist kvm_getprocs kvm_getswapinfo)
2863
AC_CHECK_FUNC(dlopen, AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.]),
2864
AC_CHECK_LIB(dl, dlopen, AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have the `dlopen' function.])
2865
AC_DEFINE(HAVE_LIBDL, 1, [Define to 1 if you have the `dl' library (-ldl).])
2866
LMIBLIBS="${LMIBLIBS} -ldl"))
2869
AC_CHECK_FUNCS(nlist nlist64 knlist)
2871
# whether we need -ldevstat for diskio MIB
2436
2872
echo " $module_list " | grep " ucd-snmp/diskio " >/dev/null
2437
# whether we need -ldevstat for diskio MIB
2438
2873
if test $? -eq 0 ; then
2439
2874
AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_GETDEVS),
2440
2875
AC_CHECK_LIB(devstat, getdevs, AC_DEFINE(HAVE_GETDEVS)
2441
LIBS="${LIBS} -ldevstat"))
2876
LMIBLIBS="${LMIBLIBS} -ldevstat"))
2442
2877
AC_CHECK_FUNC(getdevs, AC_DEFINE(HAVE_DEVSTAT_GETDEVS),
2443
2878
AC_CHECK_LIB(devstat, devstat_getdevs, AC_DEFINE(HAVE_DEVSTAT_GETDEVS)
2444
LIBS="${LIBS} -ldevstat"))
2879
LMIBLIBS="${LMIBLIBS} -ldevstat"))
2447
2882
# LM-SENSORS-MIB support
2450
2885
AC_MSG_CHECKING([for sensors support])
2451
2886
case $target_os in
2453
AC_CHECK_HEADER(picl.h,LIBS="${LIBS} -lpicl",)
2888
AC_CHECK_HEADER(picl.h, LMIBLIBS="${LMIBLIBS} -lpicl",)
2454
2889
AC_CHECK_HEADERS(picl.h)
2457
2892
AC_CHECK_HEADER(sensors/sensors.h,,
2458
2893
[AC_MSG_ERROR([asked to use lm_sensors but I couldn't find sensors/sensors.h])])
2459
AC_CHECK_LIB(sensors, sensors_get_detected_chips, LIBS="${LIBS} -lsensors",
2894
AC_CHECK_LIB(sensors, sensors_get_detected_chips, [
2895
LMIBLIBS="${LMIBLIBS} -lsensors" ;
2460
2897
[AC_MSG_ERROR([asked to use lm_sensors but I couldn't find -lsensors])])
2466
# Install the various perl modules
2469
if test "x$embed_perl" = "xyes" ; then
2470
if test "x$install_perl" = "xno" -o "x$install_perl" = "x" ; then
2474
if test "x$install_perl" != "x" -a "x$install_perl" != "xno"; then
2475
PERLTARGS="perlmodules"
2476
PERLINSTALLTARGS="perlinstall"
2477
PERLUNINSTALLTARGS="perluninstall"
2479
AC_SUBST(PERLINSTALLTARGS)
2480
AC_SUBST(PERLUNINSTALLTARGS)
2482
if test "x$embed_perl" = "xyes" ; then
2483
AC_MSG_CACHE_ADD(SNMP Perl modules: building -- embeddable)
2485
AC_MSG_CACHE_ADD(SNMP Perl modules: building -- not embeddable)
2488
AC_MSG_CACHE_ADD(SNMP Perl modules: disabled)
2902
######################################################################
2904
######################################################################
2907
# test to see if we can attempt to build embedded Perl so far
2909
if test "x$embed_perl" = "xtry" ; then
2910
if test "x$install_perl" = "xno" ; then
2913
if test "x$ac_cv_path_PERLPROG" = "x" -o "x$ac_cv_path_PERLPROG" = "xno" ; then
2492
2921
# Embedded Perl specific stuff
2494
if test "x$embed_perl" = "xyes"; then
2925
if test "x$install_perl" != "xno" ; then
2495
2926
myperl=$ac_cv_path_PERLPROG
2496
if test $myperl = "no"; then
2497
AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
2500
AC_MSG_CHECKING([for perl CFLAGS])
2927
if test $myperl = "no" ; then
2928
if test "x$install_perl" = "xtry" ; then
2931
AC_MSG_ERROR(--enable-embedded-perl requested but no perl executable found)
2936
# test for shared libraries support
2937
if test "x$install_perl" != "xno" ; then
2938
# embedded Perl requires shared libraries
2939
if test "x$enable_shared" != "xyes"; then
2940
if test "x$install_perl" = "xtry" ; then
2943
AC_MSG_ERROR(Perl support requires --enable-shared)
2948
if test "x$install_perl" != "xno" ; then
2949
AC_MSG_CHECKING([if we are in the source tree so we can install Perl modules])
2950
if test "x$srcdir" = "x." -o -d perl/agent/default_store ; then
2951
AC_MSG_RESULT([Yes])
2953
if test "x$install_perl" = "xtry" ; then
2957
AC_MSG_ERROR([Perl modules can not be built outside the source directory])
2962
# check the Perl compiler name
2963
if test "x$install_perl" != "xno" ; then
2967
if test "xenable_perl_cc_checks" != "xno" ; then
2968
AC_MSG_CHECKING([for Perl cc])
2970
PERLCC=`$myperl -V:cc | $myperl -n -e 'print if (s/^\s*cc=.([-\w\s\/]+).;\s*/$1/);'`
2972
if test "x$PERLCC" != "x" ; then
2973
AC_MSG_RESULT([$PERLCC])
2975
if test "x$install_perl" = "xtry" ; then
2978
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.])
2983
# check the Perl compiler compatibility
2984
if test "x$install_perl" != "xno" ; then
2985
AC_MSG_CHECKING([whether $PERLCC is a GNU C compiler])
2988
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
2992
]])], [perlcc_is_gnu=yes], [perlcc_is_gnu=no])
2993
AC_MSG_RESULT([$perlcc_is_gnu])
2995
if test "x$GCC" = "xyes" -a "x$perlcc_is_gnu" = "xno" ; then
2996
if test "x$install_perl" = "xtry" ; then
2999
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).])
3004
# check if they're both gnu
3005
if test "x$install_perl" != "xno" ; then
3006
if test "x$GCC" != "xyes" -a "x$perlcc_is_gnu" = "xyes" ; then
3007
if test "x$install_perl" = "xtry" ; then
3010
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).])
3015
# we have enough support for installing the modules at least.
3016
if test "x$install_perl" = "xtry" ; then
3019
if test "x$install_perl" = "xno" ; then
3025
####################
3026
# on to embedding...
3028
# check the compiler flags for illegal tokens
3031
if test "x$embed_perl" != "xno" ; then
3035
AC_MSG_CHECKING([for problematic Perl cc flags on Suns])
3036
if $myperl -V:ccflags | grep LARGEFILE > /dev/null ; then
3037
if test "x$embed_perl" = "xtry" ; then
3040
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.])
3043
AC_MSG_RESULT([none known])
3054
if test "x$embed_perl" != "xno" ; then
3055
AC_MSG_CHECKING([for Perl CFLAGS])
2501
3056
perlcflags=`$myperl -MExtUtils::Embed -e ccopts`
2502
AC_MSG_RESULT($perlcflags)
2503
CPPFLAGS="$CPPFLAGS $perlcflags"
2505
AC_MSG_CHECKING([for perl LDFLAGS])
2506
perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
2507
AC_MSG_RESULT($perlldopts)
2508
PERLLDOPTS="$perlldopts"
3057
if test "x$perlcflags" != "x" ; then
3058
AC_MSG_RESULT([$perlcflags])
3059
CPPFLAGS="$CPPFLAGS $perlcflags"
3061
if test "x$embed_perl" = "xtry" ; then
3064
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.])
3070
if test "x$embed_perl" != "xno" ; then
3071
AC_MSG_CHECKING([for Perl LDFLAGS])
3072
netsnmp_perlldopts=`$myperl -MExtUtils::Embed -e ldopts`
3073
if test "x$netsnmp_perlldopts" != "x" ; then
3074
AC_MSG_RESULT([$netsnmp_perlldopts])
3076
if test "x$embed_perl" = "xtry" ; then
3079
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.])
3082
if test "x$enable_as_needed" = "xyes" ; then
3083
# link *libraries* with libperl
3084
PERLLDOPTS_FOR_LIBS="$netsnmp_perlldopts"
3085
# Perl ccdlflags (RPATH to libperl, hopefully)
3086
AC_MSG_CHECKING([for Perl CCDLFLAGS])
3088
netsnmp_perlccdlflags=`$myperl -V:ccdlflags | $myperl -n -e 'print $1 '"if (/^\s*ccdlflags='([^']+)';/);"`
3090
AC_MSG_RESULT([$netsnmp_perlccdlflags])
3091
PERLLDOPTS_FOR_APPS="$netsnmp_perlccdlflags"
3093
# link *applications* against libperl
3094
PERLLDOPTS_FOR_APPS="$netsnmp_perlldopts"
3098
# check needed functions
3099
if test "x$embed_perl" != "xno" ; then
2510
3100
OLDLDFLAGS="$LDFLAGS"
2511
LDFLAGS="$LDFLAGS $PERLLDOPTS"
3101
LDFLAGS="$LDFLAGS $netsnmp_perlldopts"
2513
3103
# newer perl vs older perl call functions
2514
AC_CHECK_FUNCS(Perl_eval_pv eval_pv perl_eval_pv)
3104
AC_CHECK_FUNCS(eval_pv)
3106
# sigh: this has a CAPITAL P in Perl, which ends up being the same
3107
# autoconf define as the lower case so we have to treat them *BOTH*
3108
# specially. Wonderful.
3109
AC_CHECK_FUNC(perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_LC))
3110
AC_CHECK_FUNC(Perl_eval_pv, AC_DEFINE(HAVE_PERL_EVAL_PV_UC))
2516
3112
LDFLAGS="$OLDLDFLAGS"
2518
AC_DEFINE(NETSNMP_EMBEDDED_PERL)
2519
OTHERAGENTLIBOBJS="snmp_perl.o"
2520
OTHERAGENTLIBLOBJS="snmp_perl.lo"
2522
EMBEDPERLINSTALL="embedperlinstall"
2523
EMBEDPERLUNINSTALL="embedperluninstall"
2524
AC_MSG_CACHE_ADD(Embedded perl support: enabled)
3115
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
3116
if test "x$embed_perl" = "xtry" ; then
3119
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.])
3122
AC_DEFINE(NETSNMP_EMBEDDED_PERL)
3123
OTHERAGENTLIBOBJS="snmp_perl.o"
3124
OTHERAGENTLIBLOBJS="snmp_perl.lo"
3126
EMBEDPERLINSTALL="embedperlinstall"
3127
EMBEDPERLUNINSTALL="embedperluninstall"
2527
EMBEDPERLUNINSTALL=""
2528
AC_MSG_CACHE_ADD(Embedded perl support: disabled)
3133
EMBEDPERLUNINSTALL=""
2530
3137
AC_SUBST(EMBEDPERLINSTALL)
2531
3138
AC_SUBST(EMBEDPERLUNINSTALL)
2532
AC_SUBST(PERLLDOPTS)
3139
AC_SUBST(PERLLDOPTS_FOR_LIBS)
3140
AC_SUBST(PERLLDOPTS_FOR_APPS)
3142
# embedded Perl results
3143
AC_MSG_CHECKING([for potential embedded Perl support])
3144
if test "x$embed_perl" != "xyes" ; then
3145
AC_MSG_CACHE_ADD(Embedded Perl support: disabled)
3146
AC_MSG_RESULT([disabled])
3148
AC_MSG_CACHE_ADD(Embedded Perl support: enabled)
3149
AC_MSG_RESULT([enabled])
3152
# install Perl module results
3155
PERLUNINSTALLTARGS=""
3156
AC_MSG_CHECKING([if we can install the Perl modules])
3157
if test "x$install_perl" = "xyes" ; then
3158
PERLTARGS="perlmodules"
3159
PERLINSTALLTARGS="perlinstall"
3160
PERLUNINSTALLTARGS="perluninstall"
3161
if test "x$embed_perl" = "xyes" ; then
3162
AC_MSG_CACHE_ADD(SNMP Perl modules: building -- embeddable)
3163
AC_MSG_RESULT([yes -- and embeddable])
3165
AC_MSG_CACHE_ADD(SNMP Perl modules: building -- not embeddable)
3166
AC_MSG_RESULT([yes -- not embeddable])
3170
AC_MSG_CACHE_ADD(SNMP Perl modules: disabled)
3173
AC_SUBST(PERLINSTALLTARGS)
3174
AC_SUBST(PERLUNINSTALLTARGS)
2535
3180
AGENTLIBS=$LIBS
2536
3181
LIBS=$NONAGENTLIBS
3187
PYTHONINSTALLTARGS=""
3188
PYTHONUNINSTALLTARGS=""
3190
AC_MSG_CHECKING([if we should install the python bindings])
3191
if test "x$install_python" = "xyes" ; then
3192
PYTHONTARGS="pythonmodules"
3193
PYTHONINSTALLTARGS="pythoninstall"
3194
PYTHONUNINSTALLTARGS="pythonuninstall"
3195
PYTHONCLEANTARGS="pythonclean"
3196
AC_MSG_CACHE_ADD(SNMP Python modules: building for $PYTHONPROG)
3197
AC_MSG_RESULT([yes])
3199
AC_MSG_CACHE_ADD(SNMP Python modules: disabled)
3202
AC_SUBST(PYTHONTARGS)
3203
AC_SUBST(PYTHONINSTALLTARGS)
3204
AC_SUBST(PYTHONUNINSTALLTARGS)
3205
AC_SUBST(PYTHONCLEANTARGS)
3206
AC_SUBST(PYTHONARGS)
2538
3210
# Checks for header files.
2540
3212
AC_HEADER_DIRENT
2541
3213
AC_HEADER_SYS_WAIT
2542
AC_CHECK_HEADERS(stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/param.h)
3214
AC_CHECK_HEADERS(stdarg.h string.h fcntl.h limits.h sys/file.h sys/ioctl.h syslog.h unistd.h sys/dmap.h machine/pte.h xti.h sys/sockio.h sys/socket.h sys/param.h sys/uio.h)
2543
3215
# at least Solaris 9 needs sys/socket.h to compile sys/socketvar.h
2544
3216
AC_CHECK_HEADERS(sys/socketvar.h,,,
2545
3217
AC_INCLUDES_DEFAULT([])