Add a --enable-rpath option which is off by default. When specified
this adds the correct rpath flag for the X11 libraries.
This commit is contained in:
parent
0790dafd76
commit
1979bd2f15
55
configure.in
55
configure.in
|
|
@ -287,6 +287,61 @@ AC_PATH_X
|
|||
AC_PATH_XTRA
|
||||
|
||||
|
||||
dnl Check if the user wants to use the appropriate rpath commands to compile in
|
||||
dnl the shared library path for the X libraries. This is off by default since
|
||||
dnl that is how it has been historically. Using --enable-rpath will turn this on
|
||||
|
||||
_use_rpath=no
|
||||
AC_MSG_CHECKING([if hardcoding of the X11 runtime library path is desired])
|
||||
AC_ARG_ENABLE([rpath],
|
||||
[ --enable-rpath Enable hardcoding the X11 runtime library path [default=disabled]],
|
||||
[
|
||||
if test "X$enable_rpath" = "Xno" ; then
|
||||
AC_MSG_RESULT([no])
|
||||
_use_rpath=no
|
||||
else
|
||||
AC_MSG_RESULT([yes])
|
||||
_use_rpath=yes
|
||||
fi
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
_use_rpath=no
|
||||
]
|
||||
)
|
||||
|
||||
if test "X$_use_rpath" = "Xyes" ; then
|
||||
# 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
|
||||
|
||||
dnl Checks for X libraries - if X11 wasn't found then don't make following
|
||||
dnl tests and compile without X11 support - otherwise, check if the following
|
||||
dnl libraries are present (error if they are not)
|
||||
|
|
|
|||
Loading…
Reference in New Issue