Skip to content

Commit

Permalink
CHANGES: snmpd, snmptrapd and apps: Make ENV_SEPARATOR_CHAR configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanassche committed Oct 29, 2012
1 parent 0e1ca45 commit 1a36dee
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 28 deletions.
1 change: 1 addition & 0 deletions README.win32
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,7 @@ Cygwin allows you to compile almost the complete agent and applications.
As an example, the following configure options create a working set of
programs:

ENV_SEPARATOR=":" \
./configure \
--with-mib-modules="host agentx disman/event-mib examples/example" \
--with-out-mib-modules=host/hr_network \
Expand Down
9 changes: 0 additions & 9 deletions acconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@
*/
#ifndef NETSNMP_NO_AUTOCONF_DEFINITIONS


#if defined (WIN32) || defined (mingw32) || defined (cygwin)
#define ENV_SEPARATOR ";"
#define ENV_SEPARATOR_CHAR ';'
#else
#define ENV_SEPARATOR ":"
#define ENV_SEPARATOR_CHAR ':'
#endif

/* definitions added by configure on-the-fly */
@TOP@
@BOTTOM@
Expand Down
19 changes: 17 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -20940,15 +20940,27 @@ $as_echo_n "checking default mib files to read... " >&6; }
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
if test "x$ENV_SEPARATOR" != "x"; then
:
elif test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then
# mingw32 and cygwin use ';' as the default environment variable separator
ENV_SEPARATOR=";"
NETSNMP_DEFAULT_MIBS=`echo "$NETSNMP_DEFAULT_MIBS" | $SED 's/:/;/g'`
default_mibs=`echo "$default_mibs" | $SED 's/:/;/g'`
else
ENV_SEPARATOR=":"
fi


cat >>confdefs.h <<_ACEOF
#define ENV_SEPARATOR "$ENV_SEPARATOR"
_ACEOF


cat >>confdefs.h <<_ACEOF
#define ENV_SEPARATOR_CHAR '$ENV_SEPARATOR'
_ACEOF

cat >>confdefs.h <<_ACEOF
#define NETSNMP_DEFAULT_MIBS "$NETSNMP_DEFAULT_MIBS"
_ACEOF
Expand Down Expand Up @@ -29341,6 +29353,8 @@ ac_config_files="$ac_config_files net-snmp-create-v3-user:net-snmp-create-v3-use

ac_config_files="$ac_config_files dist/generation-scripts/gen-variables:dist/generation-scripts/gen-variables.in"

ac_config_files="$ac_config_files local/snmpconf"


ac_config_commands="$ac_config_commands default"

Expand Down Expand Up @@ -30361,6 +30375,7 @@ do
"net-snmp-config") CONFIG_FILES="$CONFIG_FILES net-snmp-config:net-snmp-config.in" ;;
"net-snmp-create-v3-user") CONFIG_FILES="$CONFIG_FILES net-snmp-create-v3-user:net-snmp-create-v3-user.in" ;;
"dist/generation-scripts/gen-variables") CONFIG_FILES="$CONFIG_FILES dist/generation-scripts/gen-variables:dist/generation-scripts/gen-variables.in" ;;
"local/snmpconf") CONFIG_FILES="$CONFIG_FILES local/snmpconf" ;;
"default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;

*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ AC_CONFIG_FILES([net-snmp-config:net-snmp-config.in],
AC_CONFIG_FILES([net-snmp-create-v3-user:net-snmp-create-v3-user.in],
[chmod +x net-snmp-create-v3-user])
AC_CONFIG_FILES([dist/generation-scripts/gen-variables:dist/generation-scripts/gen-variables.in])
AC_CONFIG_FILES([local/snmpconf])

AC_CONFIG_COMMANDS([default], echo timestamp > stamp-h)

Expand Down
10 changes: 8 additions & 2 deletions configure.d/config_modules_agent
Original file line number Diff line number Diff line change
Expand Up @@ -783,15 +783,21 @@ 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
if test "x$ENV_SEPARATOR" != "x"; then
:
elif test "x$PARTIALTARGETOS" = "xmingw32" -o "x$PARTIALTARGETOS" = "xmingw32msvc" -o "x$PARTIALTARGETOS" = "xcygwin"; then
# mingw32 and cygwin use ';' as the default environment variable separator
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([ENV_SEPARATOR], ["$ENV_SEPARATOR"],
[Environment separator character surrounded by double quotes.])
AC_DEFINE_UNQUOTED([ENV_SEPARATOR_CHAR], ['$ENV_SEPARATOR'],
[Environment separator character surrounded by single quotes.])
AC_DEFINE_UNQUOTED(NETSNMP_DEFAULT_MIBS,"$NETSNMP_DEFAULT_MIBS")
AC_SUBST(NETSNMP_DEFAULT_MIBS)
AC_MSG_RESULT($NETSNMP_DEFAULT_MIBS)
Expand Down
15 changes: 6 additions & 9 deletions include/net-snmp/net-snmp-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@
*/
#ifndef NETSNMP_NO_AUTOCONF_DEFINITIONS


#if defined (WIN32) || defined (mingw32) || defined (cygwin)
#define ENV_SEPARATOR ";"
#define ENV_SEPARATOR_CHAR ';'
#else
#define ENV_SEPARATOR ":"
#define ENV_SEPARATOR_CHAR ':'
#endif

/* definitions added by configure on-the-fly */

#define config_belongs_in(x)
Expand Down Expand Up @@ -74,6 +65,12 @@
/* Define if you want local DNSSEC validation support */
#undef DNSSEC_LOCAL_VALIDATION

/* Environment separator character surrounded by double quotes. */
#undef ENV_SEPARATOR

/* Environment separator character surrounded by single quotes. */
#undef ENV_SEPARATOR_CHAR

/* location of mount table list */
#undef ETC_MNTTAB

Expand Down
8 changes: 2 additions & 6 deletions local/snmpconf → local/snmpconf.in
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,9 @@ if ($opts{'G'}) {
}

#
# Expand the search path in case it contains multiple directories
# separated by : (Unix) or ; (Win32)
# Expand the search path in case it contains multiple directories.
#
my $ENV_SEPARATOR = ':';
if ($^O eq 'MSWin32') {
$ENV_SEPARATOR = ';';
}
my $ENV_SEPARATOR = '@ENV_SEPARATOR@';
my @searchpath = split(/$ENV_SEPARATOR/, $confpath);
push @searchpath, "/usr/local/etc/snmp";
push @searchpath, ".";
Expand Down

0 comments on commit 1a36dee

Please sign in to comment.