Re: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Greg Wooledge wrote:
> Sverker Wiberg (sverkerw@xxxxxxxxxxxx) wrote:
>
> > This means that listing the resolver in LIBS will link the X libraries
> > *after* and *without* the resolver, causing spurious link failures.
> > In short, I believe that LIBS should be appended to
> > linker lines instead of prepended (LDFLAGS is prepended, btw).
> It looks like this (on Debian
> GNU/Linux):
>
> After AC PATH XTRA: LIBS=, X_LIBS= -L/usr/X11R6/lib, X_PRE_LIBS= -lSM
> -lICE, X_EXTRA_LIBS=
>
> See, they've put -L/dir into X_LIBS, which normally goes *after*
> X_PRE_LIBS, which contains the libraries that -L/dir points to.
Is there any reason at all that the freeciv configure puts X_PRE_LIBS
_after_ X_LIBS, given that according to the autoconf docs, (talking
about AC_PATH_XTRA)
% And it checks for
% special X11R6 libraries that need to be linked with before
% `-lX11', and adds any found to the output variable `X_PRE_LIBS'.
I propose the attached patch, which puts X_PRE_LIBS in their place,
and also puts LIBS last, as Sverker wanted. This also fixes the
problem Greg pointed out previously of including the X_PRE_LIBS
twice on the line to link the client.
I have though found another similar problem. On Solaris, -lsocket
and -lnsl are put in X_EXTRA_LIBS (by AC_PATH_XTRA), and then we check
them again and put them in LIBS, so they get doubled up on the link line.
-- David
diff -u -r --exclude-from exclude_auto fc-adv/acinclude.m4
freeciv-mod/acinclude.m4
--- fc-adv/acinclude.m4 Sat Nov 21 17:56:52 1998
+++ freeciv-mod/acinclude.m4 Sat Nov 21 18:29:57 1998
@@ -4,22 +4,21 @@
dnl
dnl This macro is intended to search for X11-related libraries. It takes the
dnl following variables for input:
-dnl LIBS -- prefixed to all linker lines
-dnl X_LIBS -- prefixed to all linker lines (after LIBS)
-dnl X_EXTRA_LIBS -- suffixed to all linker lines
-dnl Thus, the trial linker line will be "$LIBS $X_LIBS -l$1 $X_EXTRA_LIBS".
+dnl X_PRE_LIBS, X_LIBS, X_EXTRA_LIBS, LIBS
+dnl These will apear on linker lines in the above order;
+dnl thus the trial linker line will be:
+dnl "$X_PRE_LIBS $X_LIBS -l$1 $X_EXTRA_LIBS $LIBS".
dnl
dnl The following variables are output:
dnl X_EXTRA_LIBS -- contains "-l$1 $X_EXTRA_LIBS" if the link succeeds
dnl
dnl Thus, the intended usage of this macro is something like this:
dnl AC_PATH_XTRA
-dnl X_LIBS="$X_LIBS $X_PRE_LIBS"
-dnl dnl Is it just me or is AC_PATH_XTRA broken?
+dnl dnl Is it just me or is AC_PATH_XTRA broken?
dnl FC_CHECK_X_LIB(X11, XOpenDisplay, , AC_MSG_ERROR("Need X11"))
dnl FC_CHECK_X_LIB(Xext, XShapeCombineMask)
dnl [etc.]
-dnl LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS"
+dnl LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $LIBS"
dnl
AC_DEFUN(FC_CHECK_X_LIB,
[AC_MSG_CHECKING([for $2 in X library -l$1])
@@ -30,7 +29,7 @@
ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
[ac_save_LIBS="$LIBS"
-LIBS="$LIBS $X_LIBS -l$1 $X_EXTRA_LIBS"
+LIBS="$X_PRE_LIBS $X_LIBS -l$1 $X_EXTRA_LIBS $LIBS"
AC_TRY_LINK(dnl
ifelse([$2], [main], , dnl Avoid conflicting decl of main.
[/* Override any gcc2 internal prototype to avoid an error. */
diff -u -r --exclude-from exclude_auto fc-adv/configure.in
freeciv-mod/configure.in
--- fc-adv/configure.in Sat Nov 21 18:27:03 1998
+++ freeciv-mod/configure.in Sat Nov 21 18:30:38 1998
@@ -86,8 +86,6 @@
if test x$client = xtrue; then
dnl Checks for X:
AC_PATH_XTRA
- dnl CFLAGS="$CFLAGS $X_CFLAGS"
- X_LIBS="$X_LIBS $X_PRE_LIBS"
dnl Checks for X libs:
FC_CHECK_X_LIB(X11, XOpenDisplay, , AC_MSG_ERROR("Need X11"))
@@ -100,7 +98,6 @@
else
FC_CHECK_X_LIB(Xaw3d, main)
fi
- dnl LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS"
fi
dnl Checks for non-X libraries:
- [Freeciv-Dev] Silliness in FC_CHECK_X_LIB, Sverker Wiberg, 1998/11/19
- Re: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB, Greg Wooledge, 1998/11/19
- Re: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB,
David Pfitzner <=
- Re: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB, David Pfitzner, 1998/11/21
- Re: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB, Greg Wooledge, 1998/11/21
- Re: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB, David Pfitzner, 1998/11/21
- Re: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB, Greg Wooledge, 1998/11/22
- Re: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB, David Pfitzner, 1998/11/22
[Freeciv-Dev] ./configure does work on Solaris (was: Silliness in FC_CHECK_X_LIB), Reinier Post, 1998/11/21
|
|