#!/bin/sh # # $Id$ # # this shell script is designed to merely dump the configuration # information about how the net-snmp package was compiled. The # information is particularly useful for applications that need to # link against the net-snmp libraries and hence must know about any # other libraries that must be linked in as well. check_build_dir() { build_dir=$1 if test "x$build_dir" = "x" ; then echo "You must specify a build directory." exit 1 fi # is it the src dir? if test -f $build_dir/net-snmp-config.in ; then return fi # make sure we can find build dir if test ! -d $build_dir/snmplib/.libs ; then echo "$build_dir does not appear to be a build directory." exit 1 fi } # usage: index n arguments # effect: returns the (n+1)th argument index() { eval echo \$`expr $1 + 1` } # usage: count arguments # effect: returns the number of arguments count() { echo $# } prefix=/usr exec_prefix=/usr includedir=${prefix}/include libdir=${exec_prefix}/lib datarootdir=${prefix}/share NSC_LDFLAGS="-L/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/usr/lib -L/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/lib -L/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/usr/lib -L/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/lib -L/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/usr/lib " NSC_LIBS="-lm " NSC_LNETSNMPLIBS="" NSC_LAGENTLIBS=" " NSC_LMIBLIBS="-ldl " NSC_INCLUDEDIR=${includedir} NSC_LIBDIR=-L${libdir} NSC_SNMPLIBS="-lnetsnmp ${NSC_LNETSNMPLIBS}" NSC_SUBAGENTLIBS="-lnetsnmpagent ${NSC_LAGENTLIBS} ${NSC_SNMPLIBS}" NSC_AGENTLIBS="-lnetsnmpmibs ${NSC_LMIBLIBS} ${NSC_SUBAGENTLIBS}" NSC_PREFIX=$prefix NSC_EXEC_PREFIX=$exec_prefix NSC_SRCDIR=. NSC_INCDIR=${NSC_PREFIX}/include NSC_BASE_SNMP_LIBS="-lnetsnmp" NSC_BASE_SUBAGENT_LIBS="-lnetsnmpagent ${NSC_BASE_SNMP_LIBS}" NSC_BASE_AGENT_LIBS="-lnetsnmpmibs ${NSC_BASE_SUBAGENT_LIBS}" NSC_SRC_LIBDIRS="agent/.libs snmplib/.libs" NSC_SRC_LIBDEPS="agent/.libs/libnetsnmpmibs.a agent/.libs/libnetsnmpagent.a snmplib/.libs/libnetsnmp.a" if test "x$NSC_SRCDIR" = "x." ; then NSC_SRCDIR="NET-SNMP-SOURCE-DIR" fi if test "x$1" = "x"; then usage="yes" else while test "x$done" = "x" -a "x$1" != "x" -a "x$usage" != "xyes"; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac unset shifted case $1 in --prefix=*) prefix=$optarg NSC_PREFIX=${prefix} NSC_INCLUDEDIR=${prefix}/include NSC_LIBDIR=-L${prefix}/lib ;; --exec-prefix=*) exec_prefix=$optarg NSC_EXEC_PREFIX=${exec_prefix} NSC_LIBDIR=-L${exec_prefix}/lib ;; --debug-tokens|--deb*|--dbg*) echo "find $NSC_SRCDIR -name \"*.c\" -print | xargs grep DEBUGMSGT | grep \\\" | cut -f 2 -d\\\" | sort -u" if test "x$NSC_SRCDIR" != "xNET-SNMP-SOURCE-DIR" ; then /usr/bin/find $NSC_SRCDIR -name "*.c" -print | xargs grep DEBUGMSGT | grep \" | cut -f 2 -d\" | sort -u fi ;; --indent-options|--in*) echo "indent -orig -nbc -bap -nut -nfca `(cd $NSC_INCDIR/net-snmp; perl -n -e 'print "-T $1 " if (/}\s*(netsnmp_\w+)\s*;/);' */*.h)`" ;; --configure-options|--con*) echo " '--target=mips-openwrt-linux' '--host=mips-openwrt-linux' '--build=x86_64-linux-gnu' '--program-prefix=' '--program-suffix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--sysconfdir=/etc' '--datadir=/usr/share' '--localstatedir=/var' '--mandir=/usr/man' '--infodir=/usr/info' '--disable-nls' '--enable-mfd-rewrites' '--enable-shared' '--enable-static' '--with-endianness=big' '--with-logfile=/var/log/snmpd.log' '--with-persistent-directory=/usr/lib/snmp/' '--with-default-snmp-version=1' '--with-sys-contact=root@localhost' '--with-sys-location=Unknown' '--enable-applications' '--disable-debugging' '--disable-manuals' '--disable-scripts' '--with-out-mib-modules=agent_mibs agentx disman/event disman/schedule hardware host if-mib mibII notification notification-log-mib snmpv3mibs target tcp-mib ucd_snmp udp-mib utilities ' '--with-mib-modules=host/hr_device host/hr_disk host/hr_filesys host/hr_network host/hr_partition host/hr_proc host/hr_storage host/hr_system ieee802dot11 if-mib/ifXTable mibII/at mibII/icmp mibII/ifTable mibII/ip mibII/snmp_mib mibII/sysORTable mibII/system_mib mibII/tcp mibII/udp mibII/vacm_context mibII/vacm_vars snmpv3/snmpEngine snmpv3/snmpMPDStats snmpv3/usmConf snmpv3/usmStats snmpv3/usmUser tunnel ucd-snmp/disk ucd-snmp/dlmod ucd-snmp/extensible ucd-snmp/loadave ucd-snmp/memory ucd-snmp/pass ucd-snmp/proc ucd-snmp/vmstat util_funcs utilities/execute ' '--with-out-transports=TCP TCPIPv6 Unix' '--with-transports=Callback UDP UDPIPv6' '--with-openssl=internal' '--without-libwrap' '--without-rpm' '--without-zlib' '--without-nl' '--enable-ipv6' 'build_alias=x86_64-linux-gnu' 'host_alias=mips-openwrt-linux' 'target_alias=mips-openwrt-linux' 'CC=mips-openwrt-linux-uclibc-gcc' 'CFLAGS=-Os -pipe -mno-branch-likely -mips32r2 -mtune=74kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fpic ' 'LDFLAGS=-L/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/usr/lib -L/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/lib -L/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/usr/lib -L/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/lib -L/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/usr/lib ' 'CPPFLAGS=-I/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/usr/include -I/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/include -I/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/usr/include -I/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/include '" ;; --snmpd-module-list|--mod*) echo host/hr_device host/hr_disk host/hr_filesys host/hr_network host/hr_partition host/hr_proc host/hr_storage host/hr_system ieee802dot11 mibII/at mibII/icmp mibII/ip mibII/snmp_mib mibII/sysORTable mibII/system_mib mibII/tcp mibII/udp mibII/vacm_context mibII/vacm_vars snmpv3/snmpEngine snmpv3/snmpMPDStats snmpv3/usmConf snmpv3/usmStats snmpv3/usmUser ucd-snmp/disk ucd-snmp/dlmod ucd-snmp/extensible ucd-snmp/loadave ucd-snmp/memory ucd-snmp/pass ucd-snmp/proc ucd-snmp/vmstat util_funcs utilities/execute if-mib/ifXTable/ifXTable mibII/kernel_linux mibII/ipAddr mibII/var_route mibII/route_write mibII/updates mibII/tcpTable mibII/udpTable util_funcs/header_generic mibII/vacm_conf tunnel/tunnel util_funcs/header_simple_table ucd-snmp/pass_common hardware/cpu/cpu hardware/cpu/cpu_linux hardware/memory/hw_mem hardware/memory/memory_linux if-mib/data_access/interface if-mib/ifTable/ifTable_interface if-mib/ifTable/ifTable_data_access if-mib/ifTable/ifTable if-mib/ifXTable/ifXTable_interface if-mib/ifXTable/ifXTable_data_access if-mib/data_access/interface_linux if-mib/data_access/interface_ioctl ip-mib/data_access/ipaddress_common ip-mib/data_access/ipaddress_linux ip-mib/data_access/ipaddress_ioctl ;; --default-mibs|--mibs|--MIBS) echo :SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DLMOD-MIB:NET-SNMP-PASS-MIB ;; --default-mibdirs|--mibdirs|--MIBDIRS) echo $HOME/.snmp/mibs:/usr/share/snmp/mibs ;; --env-separator) echo ":" ;; --exeext) echo "" ;; --snmpconfpath|--SNMPCONFPATH) echo "/etc/snmp:/usr/share/snmp:/usr/lib/snmp:$HOME/.snmp:/usr/lib/snmp/" ;; --persistent-directory|--persistent-dir) echo /usr/lib/snmp/ ;; --perlprog|--perl) echo /mnt/src/qsdk/staging_dir/host/bin/perl ;; #################################################### compile --base-cflags) echo -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -Os -pipe -mno-branch-likely -mips32r2 -mtune=74kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fpic -Ulinux -Dlinux=linux -I/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/usr/include -I/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/include -I/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/usr/include -I/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/include -I${NSC_INCLUDEDIR} ;; --cflags|--cf*) echo -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -Os -pipe -mno-branch-likely -mips32r2 -mtune=74kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fpic -Ulinux -Dlinux=linux -I/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/usr/include -I/mnt/src/qsdk/staging_dir/target-mips_74kc_uClibc-1.0.14/include -I/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/usr/include -I/mnt/src/qsdk/staging_dir/toolchain-mips_74kc_gcc-4.8-linaro_uClibc-1.0.14/include -I. -I${NSC_INCLUDEDIR} ;; --srcdir) echo $NSC_SRCDIR ;; #################################################### linking --libdir|--lib-dir) echo $NSC_LIBDIR ;; --ldflags|--ld*) echo $NSC_LDFLAGS ;; --build-lib-dirs) shift build_dir=$1 check_build_dir $build_dir for dir in $NSC_SRC_LIBDIRS; do result="$result -L$build_dir/$dir" done echo $result ;; --build-lib-deps) shift build_dir=$1 check_build_dir $build_dir for dir in $NSC_SRC_LIBDEPS; do result="$result $build_dir/$dir" done echo $result ;; --build-includes) shift build_dir=$1 check_build_dir $build_dir result="-I$build_dir/include" if test "$build_dir" != "$NSC_SRCDIR" -a "$NSC_SRCDIR" != "NET-SNMP-SOURCE-DIR" then result="$result -I$NSC_SRCDIR/include" fi echo $result ;; --build-command) echo "mips-openwrt-linux-uclibc-gcc -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -Os -pipe -mno-branch-likely -mips32r2 -mtune=74kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -fpic -Ulinux -Dlinux=linux " ;; #################################################### client lib --libs) # use this one == --netsnmp-libs + --external-libs echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_SNMPLIBS $NSC_LIBS ;; --netsnmp-libs) echo $NSC_LIBDIR $NSC_BASE_SNMP_LIBS ;; --external-libs) echo $NSC_LDFLAGS $NSC_LNETSNMPLIBS $NSC_LIBS ;; #################################################### agent lib --base-agent-libs) echo $NSC_BASE_AGENT_LIBS ;; --base-subagent-libs) echo $NSC_BASE_SUBAGENT_LIBS ;; --agent-libs) # use this one == --netsnmp-agent-libs + --external-libs echo $NSC_LDFLAGS $NSC_LIBDIR $NSC_AGENTLIBS $NSC_LIBS ;; --netsnmp-agent-libs) echo $NSC_LIBDIR $NSC_BASE_AGENT_LIBS ;; --external-agent-libs) echo $NSC_LDFLAGS $NSC_LMIBLIBS $NSC_LAGENTLIBS $NSC_LNETSNMPLIBS $NSC_LIBS ;; #################################################### --version|--ver*) echo 5.7.3 ;; --help) usage="yes" ;; --prefix|--pre*) echo $NSC_PREFIX ;; --exec-prefix) echo $NSC_EXEC_PREFIX ;; #################################################### --create-snmpv3-user) done=1 shift net-snmp-create-v3-user $* exit $? ;; #################################################### --compile-subagent) shift shifted=1 while test "x$done" = "x" -a "x$1" != "x" ; do case $1 in --norm) norm=1 shift ;; --cflags) shift if test "x$1" = "x" ; then echo "You must specify the extra cflags" exit 1 fi cflags=$1 echo "setting extra cflags: $cflags" shift ;; --ldflags) shift if test "x$1" = "x" ; then echo "You must specify the extra ldflags" exit 1 fi ldflags=$1 echo "setting extra ldflags: $ldflags" shift ;; --*) echo "unknown suboption to --compile-subagent: $1" exit 1 ;; *) if test "x$outname" = "x"; then outname=$1 shift else done=1 fi ;; esac done tmpfile=netsnmptmp.$$.c if test -f $tmpfile; then echo "Ack. Can't create $tmpfile: already exists" exit 1 fi echo "generating the temporary code file: $tmpfile" rm -f $tmpfile cat > $tmpfile < #ifdef HAVE_SIGNAL #include #endif /* HAVE_SIGNAL */ #include #include EOF # If we were only given a single filename # (and no explicit output name) # then use that as the base of the output name # # If we weren't even given that, then bomb out if test "x$1" = "x"; then if test "x$outname" = "x"; then echo "No MIB module codefile specified" rm -f $tmpfile exit 1 else cfiles=$outname outname=`basename $cfiles | sed 's/\.[co]$//'` if test -f $outname.h; then if grep "init_$outname" $outname.h; then echo " #include \"$outname.h\"" >> $tmpfile fi fi fi fi # add include files while test "$1" != ""; do cfiles="$cfiles $1" name=`basename $1 | sed 's/\.[co]$//'` if test -f $name.h; then if grep "init_$name" $name.h; then echo " #include \"$name.h\"" >> $tmpfile fi fi shift done cat >> $tmpfile <> $tmpfile fi done # handle the main loop cat >> $tmpfile <> $tmpfile fi i=`expr $i - 1` done # finish file cat >> $tmpfile <