1. The variable $GXX will be "yes" if the C++ compiler is G++.
2. Much better to use autoconf tests for ncurses.h and curses.h
3. Better to check if crypt() is part of libc using AC_CHECK_FUNC.
4. Better checks for nsl and socket and whether or not the
getdomainname() function prototype is available.
I have more configure.in diffs to submit but want to do more testing.
Please let me know if these will be applied.
--
albert chin ([EMAIL PROTECTED])
-- snip snip
--- configure.in.orig Fri Oct 27 12:47:20 2000
+++ configure.in Sun Oct 29 01:27:23 2000
@@ -312,15 +312,13 @@
dnl>
-dnl> OPTIONAL Look a C++ Compiler.
+dnl> OPTIONAL Look for a C++ Compiler
dnl>
if test ".$ac_disable_ri" = ".no"; then
AC_PROG_CXX
- case "$CC" in
- gcc )
- CXXFLAGS="$CXXFLAGS -fhandle-exceptions"
- ;;
- esac
+ if test ".$GXX" = ".yes"; then
+ CXXFLAGS="$CXXFLAGS -fhandle-exceptions"
+ fi
else
REMOTEINTERFACE=
fi
@@ -400,18 +398,9 @@
dnl> OPTIONAL curses headers
if test ".$ac_disable_curses" = ".no"; then
-
- if test -f "/usr/include/ncurses.h"; then
- echo "checking for ncurses.h... yes"
- AC_DEFINE(HAVE_NCURSES_H)
- else
- if test -f "/usr/include/curses.h"; then
- echo "checking for curses.h... yes"
- AC_DEFINE(HAVE_CURSES_H)
- else
- AC_MSG_WARN([It looks that you don't have ncurses.h/curses.h installed. Some
ntop's features will be disabled.])
- fi
- fi
+ AC_CHECK_HEADERS(ncurses.h, ,
+ AC_CHECK_HEADERS(curses.h, ,
+ AC_MSG_WARN([neither ncurses.h nor curses.h found. Some ntop features will be
+disabled])))
fi
dnl> OPTIONAL memory related headers
@@ -497,9 +486,9 @@
dnl>
dnl> check for `crypt' in -lcrypt (MANDATORY)
dnl>
-AC_CHECK_LIB(c, crypt, AC_MSG_RESULT("found in libc"), [AC_CHECK_LIB(crypt, crypt,
MORELIBS="$MORELIBS -lcrypt", [
-echo "ERROR: You need libcrypt to build ntop. Verify that you have libcrypt.a or
libcrypt.so installed.";
- AC_MSG_ERROR([Fatal: libcrypt not found.])], $MORELIBS)])
+AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(c, crypt, ,
+ [AC_CHECK_LIB(crypt, crypt, MORELIBS="$MORELIBS -lcrypt",
+ AC_MSG_ERROR(you need the crypt library to build ntop), $MORELIBS)]))
dnl>
dnl> GDChart uses functions from math library,
@@ -521,23 +510,21 @@
dnl> and then check for `accept' in -lsocket
dnl> and then check for `inet_aton' in -lresolv
dnl>
-AC_CHECK_LIB(nsl, gethostname)
-if test ".`echo $LIBS | grep nsl`" = .; then
- AC_CHECK_LIB(nsl, gethostbyname)
-fi
-AC_CHECK_LIB(socket, accept)
-AC_CHECK_LIB(resolv, inet_aton)
-
-dnl> both Solaris and AIX lack definition of `getdomainname'
-case "$host" in
- *-sun-solaris2* )
- AC_DEFINE(NEED_GETDOMAINNAME)
- ;;
- *-ibm-aix4.[12].* )
- AC_DEFINE(NEED_GETDOMAINNAME)
- ;;
-esac
+AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
+AC_CHECK_FUNC(accept, , AC_CHECK_LIB(socket, accept))
+AC_CHECK_FUNC(inet_aton, , AC_CHECK_LIB(resolv, inet_aton))
+dnl>
+dnl> Check for function prototype of getdomainname()
+dnl>
+
+AC_MSG_CHECKING(if prototype for getdomainname exists)
+AC_EGREP_CPP(getdomainname,[
+#include <stdlib.h>
+#include <unistd.h>],
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no)
+ AC_DEFINE(NEED_GETDOMAINNAME))
dnl>
dnl> TCP Wrappers library