I noticed that gschem's configure script won't set the required
-Rpath or -Wl,--rpath, or whatever flags needed to set the runtime
path to the X11 libraries. The attached patch adds that check
and it seems to work fine. Without this, you have to
manually set LDFLAGS in your configure environmnet or set LD_LIBRARY_PATH
on solaris and other os's.
Anyone see any problems with this?
Thanks
-Dan
--
Index: gschem/configure.ac
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/configure.ac,v
retrieving revision 1.14
diff -u -2 -r1.14 configure.ac
--- gschem/configure.ac 28 Dec 2004 06:57:55 -0000 1.14
+++ gschem/configure.ac 17 Jan 2005 16:25:08 -0000
@@ -119,4 +119,35 @@
X_EXTRA_LIBS="$X_EXTRA_LIBS"
X_LDFLAGS="$X_LDFLAGS $X_LIBS $X_EXTRA_LIBS $X_PRE_LIBS -lX11 -lm"
+
+ # Try to figure out if we need -Rpath for finding X11 libs
+ # at runtime. Why autoconf doesn't already do this, I don't
+ # know...
+ xlib_path=""
+ for p in $X_LDFLAGS ; do
+ case $p in
+ -L*)
+ xlib_path="$xlib_path $p"
+ ;;
+ esac
+ done
+
+ _save_LIBS=$LIBS
+ LIBS="$LIBS $X_LDFLAGS"
+ rpath=""
+ for fl in "-Wl,-rpath " "-Wl,--rpath " "-rpath " "--rpath " "-Wl,-R" "-R"
"-R " ; do
+ xlib_rpath=`echo $xlib_path | sed "s/-L/$fl/g"`
+ LIBS="$_save_LIBS $X_LIBS $xlib_rpath"
+ AC_MSG_CHECKING([if the compiler accepts ${fl}path for runtime
libraries])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+ AC_MSG_RESULT([yes])
+ rpath=$fl,
+ AC_MSG_RESULT([no]))
+ test -n "$rpath" && break
+ done
+ if test -n "$rpath"; then
+ X_LDFLAGS="$X_LDFLAGS $xlib_rpath"
+ fi
+ LIBS=$_save_LIBS
+
fi