Complete.Org: Mailing Lists: Archives: freeciv-dev: November 1998:
Re: [Freeciv-Dev] Xpm headers, again
Home

Re: [Freeciv-Dev] Xpm headers, again

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] Xpm headers, again
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sat, 21 Nov 1998 19:39:16 +1100

I wrote:
> Andrew E. Schulman wrote:
> > 
> > About a month ago, someone posted a patch to this list, intended to correct
> > the problem that configure wasn't finding Xpm file headers.  The patch
> > worked but now it seems to have been misplaced.  Would whoever posted it
> > please do so again?  Thanks.  Andrew.
> 
> I think I found it:
> http://www.complete.org/mailinglists/archives/x-OLD-freeciv-dev-9809/msg00551.html

However I think changes to freeciv configure since that patch was made
(regarding LIBS etc) mean that it no longer works properly.  
I suggest instead the attached patch, though its pretty crude, and could 
probably be improved by anyone who know much at all about this stuff.
Works for me though (on Linux and Solaris).

-- David
diff -u -r --exclude-from exclude_auto fc-adv/acinclude.m4 
freeciv-mod/acinclude.m4
--- fc-adv/acinclude.m4 Sat Nov 21 18:32:34 1998
+++ freeciv-mod/acinclude.m4    Sat Nov 21 18:33:10 1998
@@ -78,4 +78,26 @@
             test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
             eval echo \""[$]$1"\"
         )`
-])
\ No newline at end of file
+])
+
+
+dnl FC_CHECK_X_HEADER(HEADER)
+dnl Takes a header file as input; tries to link a program with that
+dnl header file, using X_CFLAGS and X libs (as FC_CHECK_X_LIB).
+dnl Raises an error if it doesn't work.
+dnl This doesn't define or cache anything, though it probably should.
+dnl
+AC_DEFUN(FC_CHECK_X_HEADER,
+[AC_MSG_CHECKING([for $1])
+ac_save_CFLAGS="$CFLAGS"
+ac_save_LIBS="$LIBS"
+CFLAGS="$CFLAGS $X_CFLAGS"
+LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $LIBS"
+AC_TRY_LINK([#include <$1>],[main()],
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+       AC_MSG_RESULT(yes),
+       AC_MSG_RESULT(no)
+       AC_MSG_ERROR([$1 is needed]))dnl
+])
+
diff -u -r --exclude-from exclude_auto fc-adv/configure.in 
freeciv-mod/configure.in
--- fc-adv/configure.in Sat Nov 21 18:32:34 1998
+++ freeciv-mod/configure.in    Sat Nov 21 18:33:10 1998
@@ -109,7 +109,7 @@
 AC_HEADER_STDC
 AC_CHECK_HEADERS(sys/ioctl.h sys/time.h unistd.h)
 if test x$client = xtrue; then
-    AC_CHECK_HEADERS(X11/xpm.h)
+    FC_CHECK_X_HEADER(X11/xpm.h)
 fi
 
 dnl Checks for typedefs, structures, and compiler characteristics.

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