--- freeciv/configure.in Fri Jun 15 17:36:18 2001 +++ confciv/configure.in Fri Jun 15 22:42:55 2001 @@ -276,28 +276,39 @@ dnl Checks for X libs: fc_save_X_LIBS="$X_LIBS" X_LIBS="$X_LIBS $X_PRE_LIBS" - FC_CHECK_X_LIB(X11, XOpenDisplay, , haveX11=no) + AC_CHECK_LIB(X11, XOpenDisplay, X_EXTRA_LIBS="-lX11 $X_EXTRA_LIBS", + haveX11=no, $X_LIBS $LIBS) if test "x$haveX11" != "xno"; then - FC_CHECK_X_LIB(Xext, XShapeCombineMask) + AC_CHECK_LIB(Xext, XShapeCombineMask, X_EXTRA_LIBS="-lXext $X_EXTRA_LIBS" + , ,$X_LIBS $X_EXTRA_LIBS $LIBS) dnl Insert X_PRE_LIBS (eg -lSM -lICE) into X_EXTRA_LIBS here: X_EXTRA_LIBS="$X_PRE_LIBS $X_EXTRA_LIBS" X_LIBS="$fc_save_X_LIBS" - FC_CHECK_X_LIB(Xt, main) - FC_CHECK_X_LIB(Xmu, main) - FC_CHECK_X_LIB(Xpm, XpmReadFileToPixmap, , haveXpm=no) + AC_CHECK_LIB(Xt, main, X_EXTRA_LIBS="-lXt $X_EXTRA_LIBS" + , ,$X_LIBS $X_EXTRA_LIBS $LIBS) + AC_CHECK_LIB(Xmu, main, X_EXTRA_LIBS="-lXmu $X_EXTRA_LIBS" + , ,$X_LIBS $X_EXTRA_LIBS $LIBS) + AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, X_EXTRA_LIBS="-lXpm $X_EXTRA_LIBS" + , haveXpm=no, $X_LIBS $X_EXTRA_LIBS $LIBS) if test "x$haveXpm" != "xno"; then dnl Xaw or Xaw3d: if test -n "$WITH_XAW3D"; then - FC_CHECK_X_LIB(Xaw3d, main, , AC_MSG_ERROR(did not find Xaw3d library)) + AC_CHECK_LIB(Xaw3d, main, X_EXTRA_LIBS="-lXaw4d $X_EXTRA_LIBS", + AC_MSG_ERROR(did not find Xaw3d library), + $X_LIBS $X_EXTRA_LIBS $LIBS) elif test "$client" = "xaw"; then - FC_CHECK_X_LIB(Xaw, main, , AC_MSG_ERROR(did not find Xaw library)) + AC_CHECK_LIB(Xaw, main, X_EXTRA_LIBS="-lXaw $X_EXTRA_LIBS", + AC_MSG_ERROR(did not find Xaw library), + $X_LIBS $X_EXTRA_LIBS $LIBS) else - FC_CHECK_X_LIB(Xaw3d, main, , noXaw3d=1) + AC_CHECK_LIB(Xaw3d, main, X_EXTRA_LIBS="-lXaw3d $X_EXTRA_LIBS", + noXaw3d=1, $X_LIBS $X_EXTRA_LIBS $LIBS) if test -n "$noXaw3d"; then - FC_CHECK_X_LIB(Xaw, main, , - AC_MSG_ERROR(did not find either Xaw or Xaw3d library)) + AC_CHECK_LIB(Xaw, main, X_EXTRA_LIBS="-lXaw $X_EXTRA_LIBS", + AC_MSG_ERROR(did not find either Xaw or Xaw3d library), + $X_LIBS $X_EXTRA_LIBS $LIBS) fi fi --- freeciv/acinclude.m4 Fri Jun 15 17:36:13 2001 +++ confciv/acinclude.m4 Fri Jun 15 22:52:52 2001 @@ -1,70 +1,3 @@ - -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 X_LIBS -- prefixed to all linker lines -dnl X_EXTRA_LIBS -- suffixed to all linker lines -dnl LIBS -- suffixed to all linker lines (after X_EXTRA_LIBS) -dnl Thus, the trial linker line will be "$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 FC_CHECK_X_LIB(X11, XOpenDisplay, , AC_MSG_ERROR("Need X11")) -dnl FC_CHECK_X_LIB(Xext, XShapeCombineMask) -dnl [etc.] -dnl LIBS="$X_LIBS $X_EXTRA_LIBS $LIBS" -dnl -AC_DEFUN(FC_CHECK_X_LIB, -[AC_MSG_CHECKING([for $2 in X library -l$1]) -dnl Use a cache variable name containing both the library and function name, -dnl because the test really is for library $1 defining function $2, not -dnl just for library $1. Separate tests with the same $1 and different $2s -dnl may have different results. -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. */ -]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus -extern "C" -#endif -])dnl -[/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $2(); -]), - [$2()], - eval "ac_cv_lib_$ac_lib_var=yes", - eval "ac_cv_lib_$ac_lib_var=no") -LIBS="$ac_save_LIBS" -])dnl -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - AC_MSG_RESULT(yes) - ifelse([$3], , -[changequote(, )dnl - ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` -changequote([, ])dnl - AC_DEFINE_UNQUOTED($ac_tr_lib) - X_EXTRA_LIBS="-l$1 $X_EXTRA_LIBS" -], [$3]) -else - AC_MSG_RESULT(no) -ifelse([$4], , , [$4 -])dnl -fi -]) - - dnl FC_EXPAND_DIR(VARNAME, DIR) dnl expands occurrences of ${prefix} and ${exec_prefix} in the given DIR, dnl and assigns the resulting string to VARNAME