Complete.Org: Mailing Lists: Archives: freeciv-dev: December 1998:
Re: [Freeciv-Dev] ./configure --with-xpm=path
Home

Re: [Freeciv-Dev] ./configure --with-xpm=path

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] ./configure --with-xpm=path
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Tue, 1 Dec 1998 21:14:26 +1100

I wrote:

> This patch should make specifying the Xpm paths to configure easier.
> I can now configure on Solaris with Solaris cc with the simple:
>   ./configure --with-xpm=/usr/local

Following a suggestion from Mitch, if the user does not specify
any Xpm paths, and there are likely-looking files in /usr/local/lib
and/or /usr/local/include, then use those paths, since they are 
common locations for Xpm.  Also, with a few other checks, this 
was getting rather long so I moved it to acinclude.m4

This modified patch means I can now configure on Solaris with 
Solaris cc with just  "./configure" !

-- David
diff -u -r --exclude-from exclude_auto freeciv-cvs/acinclude.m4 
freeciv-mod/acinclude.m4
--- freeciv-cvs/acinclude.m4    Fri Nov 27 22:16:59 1998
+++ freeciv-mod/acinclude.m4    Tue Dec  1 21:07:52 1998
@@ -80,3 +80,70 @@
             eval echo \""[$]$1"\"
         )`
 ])
+
+
+dnl FC_XPM_PATHS
+dnl Allow user to specify extra include/lib paths for Xpm, with
+dnl --with-xpm=prefix  --with-xpm-lib=dir  --with-xpm-include=dir
+dnl Sets variables xpm_libdir and xpm_incdir
+dnl If either is not specified it is set to "no"
+dnl If either is "no", and a likely file exists in /usr/local/lib or
+dnl /usr/local/include (respectively), set to those.
+dnl Doesn't do any cache stuff.
+dnl
+AC_DEFUN(FC_XPM_PATHS,
+[AC_MSG_CHECKING(extra paths for Xpm)
+dnl General Xpm prefix:
+dnl "no" means no prefix is required
+AC_ARG_WITH(xpm,
+       [  --with-xpm=PREFIX       Xpm files are in PREFIX/lib and 
PREFIX/include],
+       xpm_prefix="$withval", 
+       xpm_prefix="no"
+)
+if test "$xpm_prefix" = "yes"; then
+    AC_MSG_ERROR(please provide a path for --with-xpm)
+fi
+if test "$xpm_prefix" = "no"; then
+    xpm_libdir="no"
+    xpm_incdir="no"
+else
+    xpm_libdir="$xpm_prefix/lib"
+    xpm_incdir="$xpm_prefix/include"
+fi
+dnl May override general Xpm prefix with explicit individual paths:
+AC_ARG_WITH(xpm-lib,
+       [  --with-xpm-lib=DIR      Xpm library is in DIR],
+       xpm_libdir="$withval" 
+)
+if test "$xpm_libdir" = "yes"; then
+    AC_MSG_ERROR(please provide a path for --with-xpm-lib)
+fi
+AC_ARG_WITH(xpm-include,
+       [  --with-xpm-include=DIR  Xpm header file X11/xpm.h is in DIR],
+       xpm_incdir="$withval" 
+)
+if test "$xpm_incdir" = "yes"; then
+    AC_MSG_ERROR(please provide a path for --with-xpm-include)
+fi
+dnl If xpm-lib path was not specified, try /usr/local/lib if that 
+dnl looks likely; a real link test will happen later.
+fc_xpm_default=/usr/local
+if test "$xpm_libdir" = "no"; then
+    fc_xpm_default_lib="$fc_xpm_default/lib"
+    for fc_extension in a so sl; do
+        if test -r $fc_xpm_default_lib/libXpm.$fc_extension; then
+            xpm_libdir=$fc_xpm_default_lib
+            break
+        fi
+    done
+fi
+dnl Likewise for xpm-include with /usr/local/include;
+dnl A real include/cpp test will happen later.
+if test "$xpm_incdir" = "no"; then
+    fc_xpm_default_inc="$fc_xpm_default/include"
+    if test -r $fc_xpm_default_inc/X11/xpm.h; then
+        xpm_incdir=$fc_xpm_default_inc
+    fi
+fi
+AC_MSG_RESULT([library $xpm_libdir, include $xpm_incdir])
+])
diff -u -r --exclude-from exclude_auto freeciv-cvs/configure.in 
freeciv-mod/configure.in
--- freeciv-cvs/configure.in    Tue Dec  1 20:33:28 1998
+++ freeciv-mod/configure.in    Tue Dec  1 20:52:37 1998
@@ -70,6 +70,10 @@
 esac], [server=true])
 AM_CONDITIONAL(SERVER, test x$server = xtrue)
 
+if test x$client = xtrue; then
+    dnl Try to get additional Xpm paths:
+    FC_XPM_PATHS
+fi
 
 dnl Checks for programs.
 AC_PROG_AWK
@@ -86,7 +90,19 @@
 if test x$client = xtrue; then
     dnl Checks for X:
     AC_PATH_XTRA
-    dnl CFLAGS="$CFLAGS $X_CFLAGS"
+
+    if test "$xpm_incdir" != "no"; then
+        X_CFLAGS="$X_CFLAGS -I$xpm_incdir"
+    fi
+    if test "$xpm_libdir" != "no"; then
+        X_LIBS="$X_LIBS -L$xpm_libdir"
+       dnl Try using R values set in AC_PATH_XTRA:
+        if test "$ac_R_nospace" = "yes"; then
+            X_LIBS="$X_LIBS -R$xpm_libdir"
+        elif test "$ac_R_space" = "yes"; then
+            X_LIBS="$X_LIBS -R $xpm_libdir"
+        fi
+    fi
     X_LIBS="$X_LIBS $X_PRE_LIBS"
 
     dnl Checks for X libs:

[Prev in Thread] Current Thread [Next in Thread]
  • Re: [Freeciv-Dev] ./configure --with-xpm=path, David Pfitzner <=