[prev in list] [next in list] [prev in thread] [next in thread] 

List:       snort-devel
Subject:    [Snort-devel] Enhancements to onfigure.in: looking for postgresql includes and defining exit status
From:       Javier =?iso-8859-1?Q?Fern=E1ndez-Sanguino_Pe=F1a?= <jfs () computer ! org>
Date:       2005-06-22 21:26:40
Message-ID: 20050622212640.GA27311 () dat ! etsit ! upm ! es
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi there,

While preparing the Snort packages for the Debian GNU/Linux distribution 
[1] I have found a few problems with the configure.in currently shipped 
with the Snort distribution:

- the configure.in script will not exit with an error ('1' status code) if 
required libraries are not found

- there is no way to auto-configure Snort when the include headers are in a 
different location from the dynamic library. For example, the PostgreSQL 
packages in Debian will install the headers under 
/usr/include/postgresql/8.0 while the dynamic library will be under 
/usr/lib. The configure script forces anyone to use compiled sources.

The patched attached fixes both things, it will add a new configure option 
(--with-pgsql-includes) to tell it where the header files are which will 
supersede the --with-postgresql defined directory defined. It could be easy 
to add this to Oracle, MySQL and ODBC too.

Regards

Javier


[1] Actually, an update to use PostgreSQL 8.0, see 
http://packages.debian.org/unstable/net/snort-pgsql


["configure.in.diff" (text/plain)]

--- snort-2.3.2.orig/configure.in
+++ snort-2.3.2/configure.in
@@ -288,7 +288,7 @@
   echo "   http://www.tcpdump.org"
   echo "   or use the --with-libpcap-* options, if you have it installed"
   echo "   in unusual place"
-  exit
+  exit 1
 fi
 
 default_directory="/usr /usr/local"
@@ -304,7 +304,7 @@
    done
    echo "**********************************************"
    echo
-   exit
+   exit 1
 ])
 
 AC_ARG_WITH(libpcre_includes,
@@ -335,7 +335,7 @@
   echo
   echo "   ERROR!  Libpcre header not found, go get it from"
   echo "   http://www.pcre.org"
-  exit
+  exit 1
 fi
 
 # Verify that we have the library
@@ -346,7 +346,7 @@
     echo "    ERROR!  Libpcre library not found, go get it from"
     echo "    http://www.pcre.org"
     echo
-    exit
+    exit 1
 fi
 
 AC_ARG_WITH(libnet_includes,
@@ -511,6 +511,11 @@
     [ with_postgresql="$withval" ],
     [ with_postgresql=no ])
 
+AC_ARG_WITH(pgsql_includes,
+    [  --with-pgsql-includes=DIR  postgresql include directory],
+    [with_pgsql_includes="$withval" ],
+    [with_pgsql_includes=no ])
+
 if test "$with_postgresql" != "no"; then
   if test "$with_postgresql" = "yes"; then
     postgresql_directory="$default_directory /usr/local/pgsql /usr/pgsql /usr/local"
@@ -525,54 +530,76 @@
 
   AC_MSG_CHECKING(for postgresql)
 
-  for i in $postgresql_directory; do
-    if test -r $i/include/pgsql/libpq-fe.h; then
-      POSTGRESQL_DIR=$i
-      POSTGRESQL_INC_DIR=$i/include/pgsql
-    elif test -r $i/include/libpq-fe.h; then
-      POSTGRESQL_DIR=$i
-      POSTGRESQL_INC_DIR=$i/include
-    elif test -r $i/include/postgresql/libpq-fe.h; then
-      POSTGRESQL_DIR=$i
-      POSTGRESQL_INC_DIR=$i/include/postgresql
-    fi
-  done
+  if test "$with_pgsql_includes" != "no"; then
+    for i in $with_pgsql_includes $postgresql_directory; do
+      if test -r $i/libpq-fe.h; then
+        POSTGRESQL_INC_DIR=$i
+      elif test -r $i/include/pgsql/libpq-fe.h; then
+        POSTGRESQL_INC_DIR=$i/include/pgsql
+      elif test -r $i/include/libpq-fe.h; then
+        POSTGRESQL_INC_DIR=$i/include
+      elif test -r $i/include/postgresql/libpq-fe.h; then
+        POSTGRESQL_INC_DIR=$i/include/postgresql
+      fi
+    done
+  fi
 
-  if test -z "$POSTGRESQL_DIR"; then
+  if test -z "$POSTGRESQL_INC_DIR"; then
+    for i in $postgresql_directory; do
+      if test -r $i/include/pgsql/libpq-fe.h; then
+        POSTGRESQL_DIR=$i
+        POSTGRESQL_INC_DIR=$i/include/pgsql
+      elif test -r $i/include/libpq-fe.h; then
+        POSTGRESQL_DIR=$i
+        POSTGRESQL_INC_DIR=$i/include
+      elif test -r $i/include/postgresql/libpq-fe.h; then
+        POSTGRESQL_DIR=$i
+        POSTGRESQL_INC_DIR=$i/include/postgresql
+      fi
+    done
+  fi
+
+  if test -z "$POSTGRESQL_INC_DIR"; then
     if test "$postgresql_fail" != "no"; then
       tmp=""
-      for i in $postgesql_directory; do
+      if test "$with_pgsql_includes" != "no"; then
+        tmp="$tmp $with_pgsql_includes"
+      fi
+      for i in $postgresql_directory; do
         tmp="$tmp $i/include $i/include/pgsql"
       done
       FAIL_MESSAGE("postgresql header file (libpq-fe.h)", $tmp)
     else
       AC_MSG_RESULT(no)
     fi
-  else
+  fi
 
-    for i in lib lib/pgsql; do
-      str="$POSTGRESQL_DIR/$i/libpq.*"
-      for j in `echo $str`; do
-        if test -r $j; then
-          POSTGRESQL_LIB_DIR="$POSTGRESQL_DIR/$i"
-          break 2
-        fi
-      done
-    done
+  if test -z "$POSTGRESQL_DIR"; then
+    for dir in $postgresql_directory; do
+       for i in lib lib/pgsql; do
+         str="$dir/$i/libpq.*"
+         for j in `echo $str`; do
+           if test -r $j; then
+  	     POSTGRESQL_LIB_DIR="$dir/$i"
+             break 2
+           fi
+         done
+       done
+   done
+  fi
 
-    if test -z "$POSTGRESQL_LIB_DIR"; then
-      if test "$postgresql_fail" != "no"; then
-        FAIL_MESSAGE("postgresql library libpq",
-        "$POSTGRESQL_DIR/lib $POSTGRESQL_DIR/lib/pgsql")
-      else
-        AC_MSG_RESULT(no);
-      fi
-    else
-      AC_MSG_RESULT(yes)
-      LDFLAGS="${LDFLAGS} -L${POSTGRESQL_LIB_DIR}"
-      CPPFLAGS="${CPPFLAGS} -I${POSTGRESQL_INC_DIR} -DENABLE_POSTGRESQL"
-      LIBS="${LIBS} -lpq"
-    fi
+  if test -z "$POSTGRESQL_LIB_DIR"; then
+     if test "$postgresql_fail" != "no"; then
+       FAIL_MESSAGE("postgresql library libpq",
+       "$POSTGRESQL_DIR/lib $POSTGRESQL_DIR/lib/pgsql")
+     else
+       AC_MSG_RESULT(no);
+     fi
+  else
+     AC_MSG_RESULT(yes)
+     LDFLAGS="${LDFLAGS} -L${POSTGRESQL_LIB_DIR}"
+     CPPFLAGS="${CPPFLAGS} -I${POSTGRESQL_INC_DIR} -DENABLE_POSTGRESQL"
+     LIBS="${LIBS} -lpq"
   fi
 fi
 
@@ -681,7 +708,7 @@
                echo "   www.netfilter.org or use the --with-libipq-* options, "
                echo "   if you have it installed in unusual place"
                echo
-               exit
+               exit 1
            fi
         fi
 
@@ -737,7 +764,7 @@
     echo "   http://www.packetfactory.net/projects/libnet/"
     echo "   or use the --with-libnet-* options, if you have it installed"
     echo "   in unusual place"
-    exit
+    exit 1
   fi
 
   AC_MSG_CHECKING(for libnet version 1.0.2a)
@@ -781,7 +808,7 @@
     echo "   http://www.packetfactory.net/projects/libnet/"
     echo "   or use the --with-libnet-* options, if you have it installed"
     echo "   in unusual place"
-    exit
+    exit 1
   fi
 
 fi

["signature.asc" (application/pgp-signature)]
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Snort-devel mailing list
Snort-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/snort-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic