AC_ISC_POSIX
AC_PATH_PROG(PATH_SH, sh)
AC_PATH_PROG(PATH_PERL, perl)
-AC_PATH_PROG(PATH_NET_SNMP_CONFIG, net-snmp-config)
+
+AC_ARG_WITH(net-snmp-config,
+ AC_HELP_STRING([--with-net-snmp-config], [+ =net-snmp-config]),
+[ans=$withval], [ans=yes])
+case "$ans" in
+ no) ;;
+ yes)
+ ans=net-snmp-config
+ ;;
+ /*) ;;
+ */*)
+ AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
+ ;;
+ *)
+ ;;
+esac
+AC_MSG_CHECKING(for net-snmp-config)
+AC_MSG_RESULT($ans)
+PROG_NET_SNMP_CONFIG=$ans
+
+case "$PROG_NET_SNMP_CONFIG" in
+ no) ;;
+ /*)
+ PATH_NET_SNMP_CONFIG=$PROG_NET_SNMP_CONFIG
+ ;;
+ *) AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
+ ;;
+esac
case "$host" in
*-*-vxworks*)
AC_MSG_CHECKING(if we want to build ntpsnmpd)
AC_ARG_WITH(ntpsnmpd,
- AC_HELP_STRING([--with-ntpsnmpd], [? Build the ntpsnmpd code?]),
+ AC_HELP_STRING([--with-ntpsnmpd], [s Build the ntpsnmpd code?]),
[ans=$withval],
[case "$PATH_NET_SNMP_CONFIG" in
/*) ans=yes ;;
yes)
case "$PATH_NET_SNMP_CONFIG" in
/*)
- NTPSNMPD_DIR=ntpsnmpd
SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
AC_SUBST(SNMP_LIBS)
+ # HMS: we really want to separate CPPFLAGS and CFLAGS
+ foo=`$PATH_NET_SNMP_CONFIG --cflags`
+ SNMP_CPPFLAGS=
+ SNMP_CFLAGS=
+ for i in $foo; do
+ case "$i" in
+ -D*|-U*|-I*)
+ SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
+ ;;
+ *) SNMP_CFLAGS="$SNMP_CFLAGS $i"
+ ;;
+ esac
+ done
+ AC_SUBST(SNMP_CPPFLAGS)
+ AC_SUBST(SNMP_CFLAGS)
+ NTPSNMPD_DIR=ntpsnmpd
;;
*) AC_MSG_WARN([Cannot build ntpsnmpd as desired - net-snmp-config cannot be found])
;;
noinst_HEADERS= ntpSnmpSubagentObject.h
# HMS: we probably want a version.o file here, too.
LDADD= ../ntpq/libntpq.a ../libntp/libntp.a @SNMP_LIBS@
-AM_CPPFLAGS= -I$(top_srcdir)/ntpq -I$(top_srcdir)/include `net-snmp-config --cflags`
-
-#CFLAGS=-I. -I../ntp-dev/ntpq -I../ntp-dev/include -I../net-snmp/include `net-snmp-config --cflags` -g
-#BUILDLIBS=`net-snmp-config --libs`
-#BUILDAGENTLIBS=`net-snmp-config --agent-libs`
-#BUILDNTPLIBS=-L ../ntp-dev/libntp -lntp -L../ntp-dev/ntpq -lntpq
-
-#ntpsnmpd: $(OBJS)
-# $(CC) -o ntpsnmpd $(OBJS) $(BUILDNTPLIBS) $(BUILDAGENTLIBS)
-#
-#ntpSnmpPluginObject.so: ntpSnmpPluginObject.c Makefile
-# $(CC) $(CFLAGS) $(DLFLAGS) -c -o ntpSnmpPluginObject.o ntpSnmpPluginObject.c
-# $(CC) $(CFLAGS) $(DLFLAGS) -o ntpSnmpPluginObject.so ntpSnmpPluginObject.o
+AM_CPPFLAGS= -I$(top_srcdir)/ntpq -I$(top_srcdir)/include @SNMP_CPPFLAGS@
+AM_CFLAGS= @SNMP_CFLAGS@