File: config_modules_transports

package info (click to toggle)
net-snmp 5.9+dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 36,760 kB
  • sloc: ansic: 283,039; perl: 17,712; sh: 11,887; makefile: 2,705; xml: 663; python: 623; pascal: 62; sql: 47
file content (137 lines) | stat: -rw-r--r-- 5,249 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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 $CPPFLAGS $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