Complete.Org: Mailing Lists: Archives: freeciv-dev: November 1998:
[Freeciv-Dev] remaining configure issues
Home

[Freeciv-Dev] remaining configure issues

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] remaining configure issues
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sun, 29 Nov 1998 17:20:43 +1100

After realizing I was barking up the wrong tree with X_PRE_LIBS
(X_LIBS contains -L but no -l, X_EXTRA_LIBS contains the -l's, so its 
ok to have the order X_LIBS X_PRE_LIBS X_EXTRA_LIBS), and noting that
the compile link line has LIBS rightmost, so it makes sense for the 
autoconf trial link line in FC_CHECK_X_LIB to do the same, I consider
those problems solved...  (now in cvs).

I propose the attached patch to fix a remaining problem, that on
Solaris AC_PATH_XTRA adds -lnsl -lsocket to X_EXTRA_LIBS, so adding 
them again to LIBS later duplicates them on the link line.  This patch
should also fix the problem in SGI/IRIX with wrong compatiability libs 
being linked in, though I can't test that.

I first tried putting the tests for these libs before AC_PATH_XTRA
to try to trick AC_PATH_XTRA into no adding the libs again, but that 
didn't work because of autoconf cache issues.
Instead I've now used a new variable SERVER_LIBS, which I'm not sure is
ideal, but seems to work.

Any autoconf-knowledgable people see any problems with this approach?
(Eg, ubiquitous link line order problems... :-/

One test which makes me hopeful that this works properly is that I did manage 
to get freeciv compiled with native cc on Solaris (using configure),
though I did have to jump through a few hoops:
1. patch the Makefile.in's to look like those produced by 'make dist'
   to avoid trying to calculate dependencies, which are gcc-specific
2. use the FAQ approach of
    ./configure --x-includes="/usr/local/include -I/usr/openwin/include" 
       --x-libraries="/usr/local/lib -L /usr/openwin/lib"
   to find the xpm includes, since cc doesn't seem to put /usr/local/include
   in its header search path like gcc does.

One slight remaining problem is that AC_CHECK_FUNCS no longer finds socket
(possibly also gethostname on some platforms), because -lsocket is
now in X_EXTRA_LIBS and SERVER_LIBS and not LIBS.  This is more a cosmetic
problem than a real one though.  

-- David
diff -u -r --exclude-from exclude_auto freeciv-cvs/configure.in 
freeciv-mod/configure.in
--- freeciv-cvs/configure.in    Sun Nov 29 15:22:46 1998
+++ freeciv-mod/configure.in    Sun Nov 29 15:29:55 1998
@@ -105,8 +105,22 @@
 fi
 
 dnl Checks for non-X libraries:
-AC_CHECK_LIB(socket,main)
-AC_CHECK_LIB(nsl,main)
+if test x$client = xtrue; then
+    dnl For the client, these libs (if required) should already be present
+    dnl in X_EXTRA_LIBS, due to AC_PATH_XTRA, and we don't want to include 
+    dnl them multiple times on the link line.
+    dnl The use of AC_CHECK_FUNC is to avoid wrong libs on IRIX.
+    AC_CHECK_FUNC(gethostbyname)
+    if test $ac_cv_func_gethostbyname = no; then
+        AC_CHECK_LIB(nsl, gethostbyname, SERVER_LIBS="-lnsl $SERVER_LIBS")
+    fi
+    AC_CHECK_FUNC(connect)
+    if test $ac_cv_func_connect = no; then
+        AC_CHECK_LIB(socket, connect, SERVER_LIBS="-lsocket $SERVER_LIBS")
+    fi
+fi
+AC_SUBST(SERVER_LIBS)
+
 AC_CHECK_LIB(nls,main)
 
 dnl Checks for header files.
diff -u -r --exclude-from exclude_auto freeciv-cvs/server/Makefile.am 
freeciv-mod/server/Makefile.am
--- freeciv-cvs/server/Makefile.am      Sun Nov 15 12:42:27 1998
+++ freeciv-mod/server/Makefile.am      Sun Nov 29 15:27:39 1998
@@ -44,5 +44,5 @@
 
 
 civserver_DEPENDENCIES = ../common/libcivcommon.a ../ai/libcivai.a
-civserver_LDADD        = ../common/libcivcommon.a ../ai/libcivai.a
+civserver_LDADD        = ../common/libcivcommon.a ../ai/libcivai.a  
$(SERVER_LIBS)
 

[Prev in Thread] Current Thread [Next in Thread]