Complete.Org: Mailing Lists: Archives: freeciv-dev: November 1998:
[Freeciv-Dev] Silliness in FC_CHECK_X_LIB
Home

[Freeciv-Dev] Silliness in FC_CHECK_X_LIB

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Silliness in FC_CHECK_X_LIB
From: Sverker Wiberg <sverkerw@xxxxxxxxxxxx>
Date: Thu, 19 Nov 1998 15:22:46 +0100

Zeke, the machine I build and run FreeCiv on, is a Vax running a
modified Ultrix 4.4 environment. For instance, the old resolver
routines was ripped out from libc so I have to explicitly link with a
new (and better) resolver. These resolver libraries *must* be lined
after anything that might need them, so they should be linked last.

According to autoconf's infopages (node Preset Output Variables) and
the local installation-FAQ, this should be done by setting the
environment variable LIBS to a suitable value. This sort of things
would also be useful to mention in a `config.site' file. 

The file `acinclude.m4', on the other hand, says: 

dnl FC_CHECK_X_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
dnl   ACTION-IF-NOT-FOUND]])
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".

This means that listing the resolver in LIBS will link the X libraries
*after* and *without* the resolver, causing spurious link failures. Of
course, I can configure it by listing the resolver in X_EXTRA_LIBS
instead, but I don't see why FreeCiv should be the only package to
require that. In short, I believe that LIBS should be appended to
linker lines instead of prepended (LDFLAGS is prepended, btw).

A simple fix is in the diff below, but I think it can be done even
better.

/Sverker



Index: acinclude.m4
===================================================================
RCS file: /home/freeciv/CVS/freeciv/acinclude.m4,v
retrieving revision 1.2
diff -c -r1.2 acinclude.m4
*** acinclude.m4        1998/11/18 12:10:28     1.2
--- acinclude.m4        1998/11/19 14:14:34
***************
*** 30,36 ****
  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"
  AC_TRY_LINK(dnl
  ifelse([$2], [main], , dnl Avoid conflicting decl of main.
  [/* Override any gcc2 internal prototype to avoid an error.  */
--- 30,36 ----
  ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
  AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,
  [ac_save_LIBS="$LIBS"
! 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.  */



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