Re: with-pgsql-libraries

Brian Harring <[email protected]> Tue, 13 Apr 2004 12:55:58 -0500
Newsgroups gmane.comp.db.rekall.devel
Message-ID <1081878958.21841.61.camel@exodus>
On Tue, 2004-04-13 at 04:26, Chris wrote:
> Hi,
> 
> there is a tiny problem in the configure script for rekall 2.2.0 beta 3.
> That is, the option --with-pgsql-libraries is actually ignored.
> 
> I understand there is some confusion between --with_pgsqllibdir and
> --with-pgsql-libraries in the code to configure?
>  
> I had to manually add my non-standard psql lib path to the configure
> script.
> 
> Maybe a developer could fix this?
> 
> Bye, Chris.
The fix is pretty straightforward- just tweaking
db/pgsql/configure.in.in 

-AC_ARG_WITH(pgsqlincdir,
+AC_ARG_WITH(pgsql_includes,

-AC_ARG_WITH(pgsqllibdir,
+AC_ARG_WITH(pgsql_libraries,

and then make -f Makefile.cvs (kde3|qt3) to regenerate the root level
configure.in
... alternatively, you could just tweak the root configure/configure.in
and fix the AC_ARG_WITH definitions listed above.

I've also attached a patch with a few further db/*/configure.in.in
tweaks- pretty much, adjusts --enable's behaviour, such that if a db
plugin is explicitly enabled (eg configure --enable-mysql), and
configure is unable to determine all necessary mysql settings (libdir,
includes, etc), it now throws a fit and bails.

If the user doesn't explicitly specify an enable/disable option, then
the patch still behaves the same- auto determine if it can find needed
files, enabling based on what it finds.

There is one further tweak to mysql's configure.in.in and Makefile.am-
addition of support for using a mysqlclient archive, a holdover from my
playing w/ rekall on OSX.

At the moment, it's kind of an oddball functionality that most people
won't need, so could easily be thrown out.
~brian

_______________________________________________
Rekall-devel mailing list
[email protected]
http://www.mailman.a-i-s.co.uk/cgi-bin/mailman/listinfo/rekall-devel
rekall-2.2.0-beta3-db.patch (text/x-patch, 11.7 KB)
diff -urN --exclude-from=../exclude.lst rekall-2.2.0-beta3-orig/db/mysql/Makefile.am rekall-2.2.0-beta3/db/mysql/Makefile.am
--- rekall-2.2.0-beta3-orig/db/mysql/Makefile.am	2004-01-21 06:12:55.000000000 -0600
+++ rekall-2.2.0-beta3/db/mysql/Makefile.am	2004-04-13 12:35:45.137174008 -0500
@@ -7,11 +7,9 @@
 
 libkbase_driver_mysql_la_LIBADD = \
 	../../libs/common/libkbase_common.la 		\
-	$(LIBQT)					\
-	-lmysqlclient
+	$(LIBQT) $(MYSQL_OBJS)
 
-libkbase_driver_mysql_la_LDFLAGS = \
-	-L$(MYSQL_LIBDIR) 
+libkbase_driver_mysql_la_LDFLAGS = -module $(MYSQL_LIBDIR) $(MYSQL_LIBS)
 
 services_DATA = rekall_driver_mysql.desktop
 servicesdir = $(kde_datadir)/$(APPDIR)/services
diff -urN --exclude-from=../exclude.lst rekall-2.2.0-beta3-orig/db/mysql/configure.in.in rekall-2.2.0-beta3/db/mysql/configure.in.in
--- rekall-2.2.0-beta3-orig/db/mysql/configure.in.in	2003-12-20 15:55:59.000000000 -0600
+++ rekall-2.2.0-beta3/db/mysql/configure.in.in	2004-04-13 12:42:33.511091736 -0500
@@ -2,8 +2,14 @@
 dnl checks for MySQL
 dnl ================
 
-AC_ARG_ENABLE(mysql, [  --enable-mysql              build MySQL-plugin [default=yes]],
-              mysql_plugin=$enableval, mysql_plugin=yes)
+AC_ARG_ENABLE(mysql, [  --enable-mysql              build MySQL-plugin [default=auto]],
+[  case $enableval in
+      no)   mysql_plugin=no  ;;
+      yes)  mysql_plugin=yes ;;
+      auto) mysql_plugin=auto ;;
+      *)    AC_MSG_ERROR([--enable-mysql value $withval is not valid; please choose yes, no, or auto.]) ;;
+   esac
+], mysql_plugin=auto)
 
 AC_ARG_WITH(mysql_includes,
 [  --with-mysql-includes=DIR   use MySQL-includes installed in this directory ],
@@ -25,33 +31,42 @@
 
 AC_MSG_CHECKING([for MySQL])
 
-compile_mysql_plugin="yes"
-
-if test "x$mysql_plugin" != "xyes"; then
-  compile_mysql_plugin="no"
-fi
-
-dnl check header files
-mysql_incdirs="$ac_mysql_incdir /usr/include /usr/include/mysql /usr/local/include/mysql /usr/local/include"
-AC_FIND_FILE(mysql.h, $mysql_incdirs, mysql_incdir)
-if test ! -r $mysql_incdir/mysql.h; then
-  compile_mysql_plugin="no"
-else
-  MYSQL_INCDIR=$mysql_incdir
-fi
-
-dnl check libraries
-mysql_libdirs="$ac_mysql_libdir /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/lib"
-AC_FIND_FILE(libmysqlclient.so, $mysql_libdirs, mysql_libdir)
-if test ! -r $mysql_libdir/libmysqlclient.so; then
-    AC_FIND_FILE(libmysqlclient.so, $mysql_libdirs, mysql_libdir)
-    if test ! -r $mysql_libdir/libmysqlclient.so; then
+if test "x$mysql_plugin" = "xyes" || test "x$mysql_plugin" = "xauto"; then
+  dnl check header files
+  mysql_incdirs="$ac_mysql_incdir /usr/include /usr/include/mysql /usr/local/include/mysql /usr/local/include"
+  AC_FIND_FILE(mysql.h, $mysql_incdirs, mysql_incdir)
+  if test ! -r $mysql_incdir/mysql.h; then
+    compile_mysql_plugin="no"
+  else
+    MYSQL_INCDIR=$mysql_incdir
+  fi
+
+  dnl check libraries
+  mysql_libdirs="$ac_mysql_libdir /usr/lib /usr/lib/mysql /usr/local/lib/mysql /usr/local/lib"
+  AC_FIND_FILE([libmysqlclient.so libmysqlclient.dylib], $mysql_libdirs, mysql_libdir)
+  if test "$mysql_libdir" = 'no'; then
+      AC_FIND_FILE(libmysqlclient.a, $mysql_libdirs, mysql_libdir)
+      if test "$mysql_libdir" = 'NO'; then
         compile_mysql_plugin="no"
-    else
-        MYSQL_LIBDIR=$mysql_libdir
-    fi
+      else
+	compile_mysql_plugin="yes"
+	MYSQL_LIBDIR=
+	MYSQL_OBJS=$mysql_libdir/libmysqlclient.a
+      fi
+  else
+    compile_mysql_plugin="yes"
+    MYSQL_LIBDIR="-L$mysql_libdir"
+    MYSQL_LIBS='-lmysqlclient'
+  fi
+
+  if test "x$mysql_plugin" = "xyes" && test "$compile_mysql_plugin" = "no"; then
+    AC_MSG_ERROR([
+mysql plugin was enabled, but a suitable libmysqlclient wasn't found.  Please check config.log
+
+])
+  fi
 else
-  MYSQL_LIBDIR=$mysql_libdir
+  compile_mysql_plugin="no"
 fi
 
 if test "$compile_mysql_plugin" = "yes"; then
@@ -64,5 +79,7 @@
 AC_SUBST(MYSQL_INCDIR)
 AC_SUBST(MYSQL_LIBDIR)
 AC_SUBST(MYSQL_SUBDIR)
+AC_SUBST(MYSQL_OBJS)
+AC_SUBST(MYSQL_LIBS)
 
 BUILDING_WITH("$compile_mysql_plugin" = "yes","Building with MySQL Driver","MySQL driver will not build")
diff -urN --exclude-from=../exclude.lst rekall-2.2.0-beta3-orig/db/pgsql/configure.in.in rekall-2.2.0-beta3/db/pgsql/configure.in.in
--- rekall-2.2.0-beta3-orig/db/pgsql/configure.in.in	2004-02-04 02:19:58.000000000 -0600
+++ rekall-2.2.0-beta3/db/pgsql/configure.in.in	2004-04-13 12:15:25.091649120 -0500
@@ -4,17 +4,23 @@
 
 dnl add configure-args
 
-AC_ARG_ENABLE(pgsql, [  --enable-pgsql              build PostgreSQL-plugin [default=yes] ],
-              pgsql_plugin=$enableval, pgsql_plugin=yes)
+AC_ARG_ENABLE(pgsql, [  --enable-pgsql              build PostgreSQL-plugin [default=auto]],
+[ 
+case $enableval in
+  no)   pgsql_plugin=no ;;
+  yes)  pgsql_plugin=yes ;;
+  auto) pgsql_plugin=auto ;;
+  *)    AC_MSG_ERROR([unknown option '$enableval' given to --enable-pgsql]) ;;
+esac ], pgsql_plugin=auto)
 
-AC_ARG_WITH(pgsqlincdir,
+AC_ARG_WITH(pgsql_includes,
 [  --with-pgsql-includes=DIR   use PostgreSQL-includes installed in this directory ],
 [
   ac_pgsql_dir=$withval
 ], ac_pgsql_dir=/usr/local/include
 )
 
-AC_ARG_WITH(pgsqllibdir,
+AC_ARG_WITH(pgsql_libraries,
 [  --with-pgsql-libraries=DIR  use PostgreSQL-libraries installed in this directory ],
 [
   ac_pgsql_libdir=$withval
@@ -27,35 +33,39 @@
 
 AC_MSG_CHECKING([for PostgreSQL])
 
-compile_postgresql_plugin="yes"
+if test "x$pgsql_plugin" = "xyes" || test "x$pgsql_plugin" = "xauto"; then
+  dnl check header files
+  pgsql_incdirs="$ac_pgsql_incdir /usr/include /usr/include/pgsql /usr/include/postgresql /usr/local/include /usr/local/pgsql/include /opt/postgres/include"
+  AC_FIND_FILE(libpq-fe.h, $pgsql_incdirs, pgsql_incdir)
+  if test ! -r $pgsql_incdir/libpq-fe.h; then
+    compile_postgresql_plugin="no"
+    AC_MSG_CHECKING([include ])
+  else
+    PG_INCDIR=$pgsql_incdir
+  fi
+
+  dnl check libraries
+  pgsql_libdirs="$ac_pgsql_libdir /usr/lib64 /usr/lib /usr/local/lib /usr/local/pgsql/lib /opt/postgres/lib"
+  AC_FIND_FILE(libpq.so, $pgsql_libdirs, pgsql_libdir)
+  if test ! -r $pgsql_libdir/libpq.so; then
+    compile_postgresql_plugin="no"
+    AC_MSG_CHECKING([library ])
+  else
+    PG_LIBDIR=$pgsql_libdir
+  fi
+
+  if test "$compile_postgresql_plugin" = "no" && test "x$pgsql_plugin" = "xyes"; then
+    AC_MSG_ERROR([
+postgresql support was enabled, but no usable pq lib was found.  Please check config.log for details
 
-if test "x$pgsql_plugin" != "xyes"; then
-  compile_postgresql_plugin="no"
-fi
-
-dnl check header files
-pgsql_incdirs="$ac_pgsql_incdir /usr/include /usr/include/pgsql /usr/include/postgresql /usr/local/include /usr/local/pgsql/include /opt/postgres/include"
-AC_FIND_FILE(libpq-fe.h, $pgsql_incdirs, pgsql_incdir)
-if test ! -r $pgsql_incdir/libpq-fe.h; then
-  compile_postgresql_plugin="no"
-  AC_MSG_CHECKING("include ")
+])
+  fi
 else
-  PG_INCDIR=$pgsql_incdir
-fi
-
-dnl check libraries
-pgsql_libdirs="$ac_pgsql_libdir /usr/lib64 /usr/lib /usr/local/lib /usr/local/pgsql/lib /opt/postgres/lib"
-AC_FIND_FILE(libpq.so, $pgsql_libdirs, pgsql_libdir)
-if test ! -r $pgsql_libdir/libpq.so; then
   compile_postgresql_plugin="no"
-  AC_MSG_CHECKING("library ")
-else
-  PG_LIBDIR=$pgsql_libdir
 fi
 
 if test "$compile_postgresql_plugin" = "yes"; then
   AC_MSG_RESULT([libraries $pgsql_libdir, headers $pgsql_incdir])
-  
   PGSQL_SUBDIR="pgsql"
 else
   AC_MSG_RESULT(not found)
diff -urN --exclude-from=../exclude.lst rekall-2.2.0-beta3-orig/db/xbase/configure.in.in rekall-2.2.0-beta3/db/xbase/configure.in.in
--- rekall-2.2.0-beta3-orig/db/xbase/configure.in.in	2004-02-04 02:19:58.000000000 -0600
+++ rekall-2.2.0-beta3/db/xbase/configure.in.in	2004-04-06 22:09:57.000000000 -0500
@@ -3,10 +3,14 @@
 dnl ================
 
 AC_ARG_ENABLE(xbase,
-	[  --enable-xbase              build XBase/XBSQL-plugin [default=yes]],
-           xbase_plugin=$enableval,
-	   xbase_plugin=yes
-)
+[  --enable-xbase              build XBase/XBSQL-plugin [default=auto]],
+[ case $enableval in
+   no)   xbase_plugin=no   ;; 
+   yes)  xbase_plugin=yes  ;;
+   auto) xbase_plugin=auto ;;
+   *)    AC_MSG_ERROR([--enable-xbase accepts only no, yes, or auto- you past it $enableval.  Please choose a valid setting.])
+  esac
+], xbase_plugin=auto)
 
 AC_ARG_WITH(xbase_includes,
 [  --with-xbase-includes=DIR   use XBase-includes installed in this directory ],
@@ -42,54 +46,59 @@
 
 AC_MSG_CHECKING([for xbase/xbsql])
 
-compile_xbase_plugin="yes"
-
-if test "x$xbase_plugin" != "xyes"; then
-  compile_xbase_plugin="no"
-fi
-
-dnl check header files
-xbase_incdirs="$ac_xbase_incdir /usr/include /usr/include/xbase /usr/local/include/xbase /usr/local/include"
-AC_FIND_FILE(xbase.h, $xbase_incdirs, xbase_incdir)
-if test ! -r $xbase_incdir/xbase.h; then
-  compile_xbase_plugin="no"
-else
-  XBASE_INCDIR=$xbase_incdir/..
-fi
-
-xbsql_incdirs="$ac_xbsql_incdir /usr/include /usr/include/xbsql /usr/local/include/xbsql /usr/local/include"
-AC_FIND_FILE(xbsql.h, $xbsql_incdirs, xbsql_incdir)
-if test ! -r $xbsql_incdir/xbsql.h; then
-  compile_xbsql_plugin="no"
-else
-  XBSQL_INCDIR=$xbsql_incdir
-fi
-
-dnl check libraries
-xbase_libdirs="$ac_xbase_libdir /usr/lib64 /usr/lib /usr/lib/xbase /usr/local/lib/xbase /usr/local/lib"
-AC_FIND_FILE(libxbase.so, $xbase_libdirs, xbase_libdir)
-if test ! -r $xbase_libdir/libxbase.so; then
+if test "x$xbase_plugin" = "xyes" || test "x$xbase_plugin" = "xauto"; then
+  dnl check header files
+  xbase_incdirs="$ac_xbase_incdir /usr/include /usr/include/xbase /usr/local/include/xbase /usr/local/include"
+  AC_FIND_FILE(xbase.h, $xbase_incdirs, xbase_incdir)
+  if test ! -r $xbase_incdir/xbase.h; then
+    compile_xbase_plugin="no"
+  else
+    XBASE_INCDIR=$xbase_incdir/..
+  fi
+
+  xbsql_incdirs="$ac_xbsql_incdir /usr/include /usr/include/xbsql /usr/local/include/xbsql /usr/local/include"
+  AC_FIND_FILE(xbsql.h, $xbsql_incdirs, xbsql_incdir)
+  if test ! -r $xbsql_incdir/xbsql.h; then
+    compile_xbsql_plugin="no"
+  else
+    XBSQL_INCDIR=$xbsql_incdir
+  fi
+
+  dnl check libraries
+  xbase_libdirs="$ac_xbase_libdir /usr/lib64 /usr/lib /usr/lib/xbase /usr/local/lib/xbase /usr/local/lib"
+  AC_FIND_FILE(libxbase.so, $xbase_libdirs, xbase_libdir)
+  if test ! -r $xbase_libdir/libxbase.so; then
     AC_FIND_FILE(libxbase.so, $xbase_libdirs, xbase_libdir)
     if test ! -r $xbase_libdir/libxbase.so; then
-        compile_xbase_plugin="no"
+      compile_xbase_plugin="no"
     else
-        XBASE_LIBDIR=$xbase_libdir
+      XBASE_LIBDIR=$xbase_libdir
     fi
-else
-  XBASE_LIBDIR=$xbase_libdir
-fi
-
-xbsql_libdirs="$ac_xbsql_libdir /usr/lib64 /usr/lib /usr/lib/xbsql /usr/local/lib/xbsql /usr/local/lib"
-AC_FIND_FILE(libxbsql.so, $xbsql_libdirs, xbsql_libdir)
-if test ! -r $xbsql_libdir/libxbsql.so; then
+  else
+    XBASE_LIBDIR=$xbase_libdir
+  fi
+
+  xbsql_libdirs="$ac_xbsql_libdir /usr/lib64 /usr/lib /usr/lib/xbsql /usr/local/lib/xbsql /usr/local/lib"
+  AC_FIND_FILE(libxbsql.so, $xbsql_libdirs, xbsql_libdir)
+  if test ! -r $xbsql_libdir/libxbsql.so; then
     AC_FIND_FILE(libxbsql.so, $xbsql_libdirs, xbsql_libdir)
     if test ! -r $xbsql_libdir/libxbsql.so; then
         compile_xbase_plugin="no"
     else
         XBSQL_LIBDIR=$xbsql_libdir
     fi
+  else
+    XBSQL_LIBDIR=$xbsql_libdir
+  fi
+
+  if test "$compile_xbase_plugin" = "no" && test "x$xbase_plugin" = "xyes"; then
+     AC_MSG_ERROR([
+xbase plugin was enabled, but wasn't fully found.  Please check config.log
+
+])
+  fi
 else
-  XBSQL_LIBDIR=$xbsql_libdir
+  compile_xbase_plugin="no"
 fi
 
 if test "$compile_xbase_plugin" = "yes"; then
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQBAfCmuvdBxRoA3VU0RAnhyAJ4q1rpdW9E+IoYAnKiZxRtbWPOYxwCgqnKt
nHOylPZI08HktdJL//eFjd8=
=sv4R
-----END PGP SIGNATURE-----