Hi,

In attachment I include a patch (svn diff) so the database package can be compiled on Fedora and CentOS (and of course RHEL) with mysql installed.

Current package does find mysql include file but doesn't find mysql library.

This patch fixes this by setting LDFLAGS for different library directories and using AC_CHECK_LIB to see if the library exists in that directory. It should not break compilation on any other system.

Who can check this change into the svn tree?
(trunk/octave-forge/main/database/src)

With kind regards
Index: configure.base
===================================================================
--- configure.base      (revision 6114)
+++ configure.base      (working copy)
@@ -179,6 +179,7 @@
 AC_SUBST(CFLAGS)
 AC_SUBST(CPPFLAGS)
 AC_SUBST(CPICFLAG)
+AC_SUBST(LDFLAGS)
 
 dnl Fortran compiler and flags
 F77=`$MKOCTFILE -p F77`
@@ -368,6 +369,31 @@
     MYSQL_STATUS="yes"
     AC_SUBST(DEFHAVE_MYSQL)
     DEFHAVE_MYSQL="HAVE_MYSQL=1"
+
+    # check for libmysqlclient
+    AC_DEFINE(found_libmysqlclient)
+    AC_CHECK_LIB(mysqlclient, mysql_init, found_libmysqlclient=yes, 
found_libmysqlclient=no)
+    if test $found_libmysqlclient = no ; then
+        # check in /usr/lib/mysql
+        OLD_LDFLAGS=$LDFLAGS
+        LDFLAGS="$LDFLAGS -L/usr/lib/mysql"
+        AC_CHECK_LIB(mysqlclient, mysql_real_query, found_libmysqlclient=yes, 
found_libmysqlclient=no)
+        if test $found_libmysqlclient = no ; then
+            LDFLAGS=$OLD_LDFLAGS
+        fi
+    fi
+    if test $found_libmysqlclient = no ; then
+        # check in /usr/lib64/mysql
+        OLD_LDFLAGS=$LDFLAGS
+        LDFLAGS="$LDFLAGS -L/usr/lib64/mysql"
+        AC_CHECK_LIB(mysqlclient, mysql_real_connect, 
found_libmysqlclient=yes, found_libmysqlclient=no)
+        if test $found_libmysqlclient = no ; then
+            LDFLAGS=$OLD_LDFLAGS
+        fi
+    fi
+    if test $found_libmysqlclient = no ; then
+        AC_MSG_ERROR(libmysqlclient not found)
+    fi
 else
     MYSQL_STATUS="mysql/mysql.h not found"
 fi
Index: Makeconf.in
===================================================================
--- Makeconf.in (revision 6114)
+++ Makeconf.in (working copy)
@@ -42,6 +42,7 @@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 CPICFLAG = @CPICFLAG@
+LDFLAGS = @LDFLAGS@
 CXX = @CXX@
 CXXFLAGS = @CXXFLAGS@
 CXXPICFLAG = @CXXPICFLAG@
Index: Makefile
===================================================================
--- Makefile    (revision 6114)
+++ Makefile    (working copy)
@@ -3,7 +3,7 @@
 # disable optimizations since gcc consumes too much memory
 # this line can be removed
 CXXFLAGS_NO_OPT := $(filter-out -O2, $(CXXFLAGS))
-MKOCTFILE:=CXXFLAGS="$(CXXFLAGS_NO_OPT)" $(MKOCTFILE)
+MKOCTFILE:=CXXFLAGS="$(CXXFLAGS_NO_OPT)" $(MKOCTFILE) $(LDFLAGS)
 
 .PHONY: clean check
 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to