dnl Process this file with autoconf to produce a configure script. AC_INIT(app/about.c) GXSNMP_MAJOR_VERSION=0 GXSNMP_MINOR_VERSION=0 GXSNMP_MICRO_VERSION=15 GXSNMP_VERSION=$GXSNMP_MAJOR_VERSION.$GXSNMP_MINOR_VERSION.$GXSNMP_MICRO_VERSION # for automake VERSION=$GXSNMP_VERSION PACKAGE=gxsnmp AM_INIT_AUTOMAKE($PACKAGE, $VERSION) AM_CONFIG_HEADER(config.h) AM_ACLOCAL_INCLUDE(macros) AC_ISC_POSIX client=no GNOME_INIT_HOOK([ client=yes ],continue) GNOME_XML_CHECK AM_PATH_GLIB(1.2.0) if test "x$client" = "xyes" then AM_PATH_GTK(1.2.0) dnl Enable the gtk layout engine (gle) AC_SUBST(GLE_LIBS) AC_ARG_WITH(gle, [ --with-gle Use the gtk layout engine [default=no]], if eval "test x$with_gle = xyes"; then AC_DEFINE(USE_GLE) GLE_LIBS="-lgle" fi) fi dnl Allow user to specify alternate location for mysql libs/incs AC_SUBST(MYSQL_PREFIX) AC_ARG_WITH(mysql-prefix, [ --with-mysql-prefix=PFX Specify prefix for Mysql files (optional)], mysql_libs="$withval/lib/mysql" mysql_includes="$withval/include/mysql" LDFLAGS="$LDFLAGS -L$mysql_libs" CFLAGS="$CFLAGS -I$mysql_includes") dnl Allow user to specify alternate location for postgresql libs/incs AC_SUBST(POSTGRESQL_PREFIX) AC_ARG_WITH(postgresql-prefix, [ --with-pgsql-prefix=PFX Specify prefix for postgresql files (optional)], pgsql_libs="$withval/lib/pgsql" pgsql_includes="$withval/include/pgsql" LDFLAGS="$LDFLAGS -L$pgsql_libs" CFLAGS="$CFLAGS -I$pgsql_includes") dnl Checks for programs. AC_PROG_CC AC_PROG_GCC_TRADITIONAL AM_PROG_LEX AC_PROG_YACC AC_PROG_INSTALL AC_PROG_MAKE_SET AM_PROG_LIBTOOL dnl ***** Check for gcc and enable gcc features ***** if test "x${GCC}" = "xyes" then CFLAGS="$CFLAGS -Wall -Wshadow" AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug, AC_TRY_RUN([ int main(void) { static int Array[[3]]; unsigned int B = 3; int i; for(i=0; i #include main () { if (g_module_supported ()) exit (0); else exit (1); } ], dynworks=true) LIBS="$oLIBS" CFLAGS="$oCFLAGS" dnl Now we check to see if our libtool supports shared lib deps dnl (in a rather ugly way even) if $dynworks; then gxsnmp_libtool_config="${CONFIG_SHELL-/bin/sh} libtool --config" gxsnmp_deplibs_check=`$gxsnmp_libtool_config | \ grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \ sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'` if test "x$gxsnmp_deplibs_check" = "xnone" || \ test "x$gxsnmp_deplibs_check" = "x"; then dynworks=false fi fi if $dynworks; then AC_DEFINE(USE_GMODULE) GMODULE_LIBS="`glib-config --libs gmodule`" GMODULE_FLAGS="`glib-config --cflags gmodule`" AC_SUBST(GMODULE_LIBS) AC_SUBST(GMODULE_FLAGS) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl This is ugly.. AC_SUBST(PERL_CFLAGS) AC_SUBST(PERL_LDFLAGS) AC_PATH_PROGS(PERL, perl5 perl perl5.005 perl5.004, perl) AC_MSG_CHECKING(For the perl cflags) PERL_CFLAGS=`$PERL -MExtUtils::Embed -e ccopts 2>/dev/null` AC_MSG_RESULT($PERL_CFLAGS) AC_MSG_CHECKING(For the perl ldflags) PERL_LDFLAGS=`$PERL -MExtUtils::Embed -e ldopts 2>/dev/null` AC_MSG_RESULT($PERL_LDFLAGS) dnl more ugly ORBit things AC_SUBST(ORBIT_CLIENT_CFLAGS) AC_SUBST(ORBIT_CLIENT_LDFLAGS) AC_SUBST(ORBIT_SERVER_CFLAGS) AC_SUBST(ORBIT_SERVER_LDFLAGS) AC_MSG_CHECKING(For ORBit client cflags) ORBIT_CLIENT_CFLAGS=`orbit-config --cflags client 2>/dev/null` AC_MSG_RESULT($ORBIT_CLIENT_CFLAGS) AC_MSG_CHECKING(For ORBit client ldflags) ORBIT_CLIENT_LDFLAGS=`orbit-config --libs client 2>/dev/null` AC_MSG_RESULT($ORBIT_CLIENT_LDFLAGS) AC_MSG_CHECKING(For ORBit server cflags) ORBIT_SERVER_CFLAGS=`orbit-config --cflags server 2>/dev/null` AC_MSG_RESULT($ORBIT_SERVER_CFLAGS) AC_MSG_CHECKING(For ORBit server ldflags) ORBIT_SERVER_LDFLAGS=`orbit-config --libs server 2>/dev/null` AC_MSG_RESULT($ORBIT_SERVER_LDFLAGS) OAF_CFLAGS=`$GNOME_CONFIG --cflags oaf` AC_SUBST(OAF_CFLAGS) OAF_LIBS=`$GNOME_CONFIG --libs oaf` AC_SUBST(OAF_LIBS) dnl dnl old bonobo vars dnl BONOBO_CFLAGS=`$GNOME_CONFIG --cflags bonobo` AC_SUBST(BONOBO_CFLAGS) BONOBO_LIBS=`$GNOME_CONFIG --libs bonobo` AC_SUBST(BONOBO_LIBS) BONOBOX_CFLAGS=`$GNOME_CONFIG --cflags bonobox` AC_SUBST(BONOBOX_CFLAGS) BONOBOX_LIBS=`$GNOME_CONFIG --libs bonobox` AC_SUBST(BONOBOX_LIBS) BONOBOX_PRINT_CFLAGS=`$GNOME_CONFIG --cflags bonobox_print` AC_SUBST(BONOBOX_PRINT_CFLAGS) BONOBOX_PRINT_LIBS=`$GNOME_CONFIG --libs bonobox_print` AC_SUBST(BONOBOX_PRINT_LIBS) dnl dnl For building tests within bonobo dnl BONOBO_TEST_CFLAGS=`$GNOME_CONFIG --cflags oaf glib gtk gnome` BONOBO_TEST_LIBS=`$GNOME_CONFIG --libs oaf glib gtk gnome` BONOBOX_TEST_CFLAGS=`$GNOME_CONFIG --cflags oaf gnomeui gdk_pixbuf print` BONOBOX_TEST_LIBS=`$GNOME_CONFIG --libs oaf gnomeui gdk_pixbuf print` AC_SUBST(BONOBO_TEST_LIBS) AC_SUBST(BONOBO_TEST_CFLAGS) AC_SUBST(BONOBOX_TEST_LIBS) AC_SUBST(BONOBOX_TEST_CFLAGS) AC_SUBST(SNMP_LIBS) SNMP_LIBS="-lsnmp" dnl Check for various library functions. dnl Most of this is for solaris sillyness AC_CHECK_FUNCS(basename snprintf) AC_CHECK_FUNC(socket,,[ AC_CHECK_LIB(socket,socket,[SNMP_LIBS="-lsocket"])]) AC_CHECK_FUNC(gethostbyname,,[ AC_CHECK_LIB(nsl,gethostbyname,[SNMP_LIBS="-lnsl $SNMP_LIBS"],,$SNMP_LIBS)]) AC_CHECK_FUNC(inet_aton,,[ AC_CHECK_LIB(resolv,inet_aton,[SNMP_LIBS="-lresolv $SNMP_LIBS"],,$SNMP_LIBS)]) AC_FUNC_MEMCMP AC_FUNC_WAIT3 SMI_LIB="" AC_CHECK_LIB(smi,smiInit,SMI_LIB="-lsmi", [ echo "ERROR: gxsnmp needs the SMI Library." echo "At least version 0.2 is required." echo "You can obtain it from:" echo "http://www.ibr.cs.tu-bs.de/projects/libsmi/" echo "ftp://ftp.ibr.cs.tu-bs.de/pub/local/libsmi/" AC_MSG_ERROR([Fatal Error: no libsmi detected.])]) AC_SUBST(SMI_LIB) dnl **** Check for mysql libs and headers **** AC_SUBST(MYSQL_LIBS) AC_SUBST(MYSQL_INCLUDEDIR) AC_MSG_CHECKING([for mysql]) AC_TRY_CPP([#include ], [xmysql_found=xyes], [ for ac_dir in $mysql_includes \ /opt/mysql/include \ /usr/local/mysql/include \ /usr/local/mysql/include/mysql \ /usr/mysql/include \ /usr/unsupported/mysql/include \ /usr/include/mysql \ /usr/local/include/mysql \ ; \ do if test -r "$ac_dir/mysql.h"; then mysql_found=yes ac_mysql_includes=$ac_dir break; fi done]) if test x$mysql_found = xno; then AC_MSG_WARN(mysql libraries and header files were not found) fi if test x$mysql_found = xyes; then AC_DEFINE(USE_MYSQL) AC_DEFINE(HAVE_SQL) ac_save_LIBS="$LIBS" ac_mysql_libs="-lmysqlclient" LIBS="-lmysqlclient $LIBS" AC_TRY_LINK(, [mysql_connect()],, [LIBS="$ac_save_LIBS" for ac_dir in $mysql_libs \ /usr/lib \ /usr/lib/mysql \ /usr/local/lib/mysql \ /usr/local/mysql/lib \ /opt/mysql/lib \ /usr/unsupported/mysql/lib \ ; \ do for ac_extension in a so sl; do if test -r "$ac_dir/libmysqlclient.$ac_extension"; then ac_mysql_libs="-L$ac_dir -lmysqlclient" break 2; fi done done]) fi AC_MSG_RESULT([libraries $ac_mysql_libs, headers $ac_mysql_includes]) if test x$mysql_found = xyes; then AC_DEFINE(HAVE_SQL) MYSQL_LIBS=$ac_mysql_libs MYSQL_INCLUDEDIR=$ac_mysql_includes fi LIBS="$ac_save_LIBS" dnl **** Check for postgresql libs and headers **** AC_SUBST(POSTGRESQL_LIBS) AC_SUBST(POSTGRESQL_INCLUDEDIR) AC_MSG_CHECKING([for postgresql]) AC_TRY_CPP([#include ], [xpostgresql_found=xyes], [ for ac_dir in $postgresql_includes \ /opt/pgsql/include \ /usr/local/pqsql/include \ /usr/local/pqsql/include/mysql \ /usr/pqsql/include \ /usr/lib/pgsql/include \ /usr/unsupported/pqsql/include \ /usr/include/pqsql \ /usr/local/include/pqsql \ ; \ do if test -r "$ac_dir/libpq-fe.h"; then postgresql_found=yes ac_postgresql_includes=$ac_dir break; fi done]) if test x$postgresql_found = xno; then AC_MSG_WARN(postgresql libraries and header files were not found) fi if test x$postgresql_found = xyes; then AC_DEFINE(USE_POSTGRESQL) AC_DEFINE(HAVE_SQL) ac_save_LIBS="$LIBS" ac_postgresql_libs="-lpq -lcrypt" LIBS="-lpq -lcrypt $LIBS" AC_TRY_LINK(, [PGsetdbLogin()],, [LIBS="$ac_save_LIBS" for ac_dir in $postgresql_libs \ /usr/lib \ /usr/lib/pgsql \ /usr/lib/pgsql/lib \ /usr/local/lib/pgsql \ /usr/local/pgsql/lib \ /opt/pgsql/lib \ /usr/unsupported/pgsql/lib \ ; \ do for ac_extension in a so sl; do if test -r "$ac_dir/libpq.$ac_extension"; then ac_postgresql_libs="-L$ac_dir -lpq -lcrypt" break 2; fi done done]) fi AC_MSG_RESULT([libraries $ac_postgresql_libs, headers $ac_postgresql_includes]) if test x$postgresql_found = xyes; then AC_DEFINE(HAVE_SQL) POSTGRESQL_LIBS=$ac_postgresql_libs POSTGRESQL_INCLUDEDIR=$ac_postgresql_includes fi LIBS="$ac_save_LIBS" dnl ****** Check for the sys/select.h fd_set madness ****** AC_MSG_CHECKING([fd_set and sys/select]) AC_TRY_COMPILE([#include ], [fd_set readMask, writeMask;], fd_ok=yes, fd_ok=no) if test $fd_ok = no; then AC_HEADER_EGREP(fd_mask, sys/select.h, fd_ok=yes) if test $fd_ok = yes; then AC_DEFINE(HAVE_SYS_SELECT_H) fi fi AC_MSG_RESULT($fd_ok) if test $fd_ok = no; then AC_DEFINE(NO_FD_SET) fi # Check for gxsnmp_save_CPPFLAGS="$CPPFLAGS" gxsnmp_save_LDFLAGS="$LDFLAGS" gxsnmp_save_LIBS="$LIBS" if test $client = yes; then CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" LDFLAGS="$LDFLAGS `echo $GTK_LIBS | sed 's/\(.*\)\(-lgtk.*\)/\1/'`" LIBS="$LIBS $GTK_LIBS" fi AM_CONDITIONAL(COMPILE_CLIENT, test $client = yes) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_FUNCS(strchr memcpy) AC_CHECK_HEADERS(netinet/ip_icmp.h sys/file.h sys/ioctl.h sys/filio.h memory.h) AC_CHECK_HEADERS(fcntl.h unistd.h stdlib.h) dnl Sort out the sys/time.h madness AC_HEADER_TIME AC_CHECK_HEADER(sys/time.h) dnl Check for struct icmp AC_MSG_CHECKING([for struct icmp in netinet/ip_icmp.h]) AC_TRY_COMPILE([#include #include #include #include #include #include ], [struct icmp *icp;], struct_icmp_ok=yes, struct_icmp_ok=no) AC_MSG_RESULT($struct_icmp_ok) if test $struct_icmp_ok = yes ; then AC_DEFINE(HAVE_STRUCT_ICMP) fi dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_C_BIGENDIAN dnl Checks for library functions. dnl Checks for available network protocols. dnl Always assume IPv4 is available. This might change sometime... AC_DEFINE(HAVE_INET) dnl Check for IPv6 using GLIBC-2.1 with included IPv6 functions. dnl Simply check for presence of /proc/net/ipv6_route. dnl glibc 2.0 or libc5 users might have to add a special library for IPv6 dnl support. Please add additional tests for this kind of setup. AC_MSG_CHECKING([for IPv6 support]) if [ test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route" ] then AC_DEFINE(HAVE_INET6) AC_MSG_RESULT(Linux 2.1.x IPv6) else AC_MSG_RESULT(no) fi dnl Check for IPX support of Linux 2.x. AC_MSG_CHECKING([for IPX support]) if [ test x`ls /proc/net/ipx 2>/dev/null` = x"/proc/net/ipx" ] then AC_DEFINE(HAVE_IPX) AC_MSG_RESULT(Linux 2.x IPX) else AC_MSG_RESULT(no) fi AC_CHECK_FUNCS(getopt_long,, need_getopt=yes) AM_CONDITIONAL(WANT_GETOPT, test x$need_getopt = xyes) CPPFLAGS="$gxsnmp_save_CPPFLAGS" LDFLAGS="$gxsnmp_save_LDFLAGS" LIBS="$gxsnmp_save_LIBS" AC_OUTPUT([ gxsnmp.spec Makefile src/Makefile app/Makefile app/widgets/Makefile plugins/Makefile plugins/sample/Makefile plugins/mtr/Makefile plugins/mysql/Makefile plugins/postgresql/Makefile plugins/informix/Makefile plugins/turtle/Makefile plugins/keepalive/Makefile plugins/route_table/Makefile plugins/traffic/Makefile plugins/process_table/Makefile plugins/software/Makefile lib/Makefile jms/Makefile widgets/Makefile pixmaps/Makefile database3/Makefile database3/lib/Makefile database3/server/Makefile database3/tables/Makefile mibs/Makefile collector/Makefile discovery/Makefile tools/Makefile tools/traps/Makefile tools/traps/lib/Makefile tools/traps/evdpysrvd/Makefile tools/traps/gxevents/Makefile tools/traps/trapd/Makefile tools/traps/netmon/Makefile docs/Makefile docs/C/Makefile po/Makefile.in intl/Makefile])