Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2006:
[Freeciv-Dev] Re: (PR#14851) remove userdb, add mysql to server for auth
Home

[Freeciv-Dev] Re: (PR#14851) remove userdb, add mysql to server for auth

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#14851) remove userdb, add mysql to server for authentication
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 4 Jan 2006 19:10:57 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14851 >

attached is a patch to m4/auth.m4 that attempts to find the correct
LIBRARY_PATH and put it in LDFLAGS. This is required for pubserver.

-mike

Index: m4/auth.m4
===================================================================
--- m4/auth.m4  (revision 11413)
+++ m4/auth.m4  (working copy)
@@ -6,7 +6,7 @@
 [
   dnl  no=do not compile in authentication,  yes=compile in auth,  *=error
   AC_ARG_ENABLE(auth, 
-  [  --enable-auth        do not compile in authentication],
+  [  --enable-auth        compile in authentication],
   [case "${enableval}" in
     yes) auth=true ;;
     no)  auth=false ;;
@@ -19,14 +19,43 @@
                     [AC_MSG_WARN([couldn't find mysql header: disabling auth]);
                      auth=false])
 
+    dnl we need to set -L correctly, we will check once in standard locations
+    dnl then we will check with other LDFLAGS. if none of these work, we fail.
+ 
     AC_CHECK_LIB(mysqlclient, mysql_query, 
-                [AUTH_LIBS="-lmysqlclient $AUTH_LIBS";
-                  AUTH_DEPS="$AUTH_LIBS"],
-                 [AC_MSG_WARN([couldn't find mysql libs: disabling auth]);
+                [AUTH_LIBS="-lmysqlclient $AUTH_LIBS"],
+                 [AC_MSG_WARN([couldn't find mysql libs in normal locations]);
                   auth=false])
 
+    fc_preauth_LDFLAGS=$LDFLAGS
+    fc_mysql_lib_loc="-L/usr/lib/mysql -L/usr/local/lib/mysql \
+                      -L$HOME/lib -L$HOME/lib/mysql"
+
+    for __ldpath in $fc_mysql_lib_loc; do
+      unset ac_cv_lib_mysqlclient_mysql_query
+      LDFLAGS="$LDFLAGS $__ldpath"
+      auth=true
+
+      AC_CHECK_LIB(mysqlclient, mysql_query,
+                   [AUTH_LIBS="-lmysqlclient $AUTH_LIBS";
+                    AC_MSG_WARN([had to add $__ldpath to LDFLAGS])],
+                    [AC_MSG_WARN([couldn't find mysql libs in $__ldpath]);
+                     auth=false])
+
+      if test x$auth = xtrue; then
+        break
+      else
+        LDFLAGS=$fc_preauth_LDFLAGS
+      fi
+
+    done
+
+    if test x$auth = xfalse; then
+      AC_MSG_WARN([can't find mysql -- disabling authentication])
+    fi
+
+    AC_SUBST(LDFLAGS)
     AC_SUBST(AUTH_LIBS)
-    AC_SUBST(AUTH_DEPS)
   fi
 
   if test x$auth = xtrue; then
Index: server/Makefile.am
===================================================================
--- server/Makefile.am  (revision 11413)
+++ server/Makefile.am  (working copy)
@@ -93,7 +93,7 @@
       ../dependencies/lua/src/liblua.a \
       ../dependencies/lua/src/lib/liblualib.a \
       ../dependencies/tolua/libtolua.a \
-      ./generator/libgenerator.a $(AUTH_DEPS)
+      ./generator/libgenerator.a
 civserver_LDFLAGS = @GGZDMOD_LDFLAGS@
 civserver_LDADD        = ../utility/libcivutility.a ../common/libcivcommon.a \
       ../ai/libcivai.a ../utility/libcivutility.a ./libcivserver.a @INTLLIBS@ \
Index: manual/Makefile.am
===================================================================
--- manual/Makefile.am  (revision 11413)
+++ manual/Makefile.am  (working copy)
@@ -18,7 +18,7 @@
       ../dependencies/lua/src/liblua.a \
       ../dependencies/lua/src/lib/liblualib.a \
       ../dependencies/tolua/libtolua.a \
-      ../server/generator/libgenerator.a $(AUTH_DEPS)
+      ../server/generator/libgenerator.a
 civmanual_LDFLAGS = @GGZDMOD_LDFLAGS@
 civmanual_LDADD        = ../utility/libcivutility.a ../common/libcivcommon.a \
       ../ai/libcivai.a ../utility/libcivutility.a ../server/libcivserver.a \

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#14851) remove userdb, add mysql to server for authentication, Mike Kaufman <=