Search /usr/local/lib for shared libraries.

Estimated hours taken: 1
Branches: main, release

Search /usr/local/lib for shared libraries. This fixes
problems linking debugging executables on mundroo.

configure.in:
aclocal.m4:
	Check for /usr/local/lib.

scripts/ml.in:
	Document why we don't default to static linking for
	all libraries on Solaris/x86.
This commit is contained in:
Simon Taylor
2002-11-19 08:16:07 +00:00
parent 877da11fa6
commit 5158b782e1
3 changed files with 47 additions and 11 deletions

22
aclocal.m4 vendored
View File

@@ -72,15 +72,33 @@ if test "$GCC" = yes; then
else
# It's some other compiler. We don't know if it searches
# /usr/local/include by default, so add it.
if test -d /usr/local/include; then
if test -d /usr/local/include/.; then
AC_MSG_RESULT(yes)
ALL_LOCAL_C_INCL_DIRS="-I/usr/local/include "
else
AC_MSG_RESULT(nos)
AC_MSG_RESULT(no)
fi
fi
AC_SUBST(ALL_LOCAL_C_INCL_DIRS)
])
#-----------------------------------------------------------------------------#
#
# Set ALL_LOCAL_C_LIB_DIRS to any extra directories we need to add to the
# search path for libraries.
#
AC_DEFUN(MERCURY_CHECK_LOCAL_C_LIB_DIRS,
[
AC_MSG_CHECKING(whether to pass -L/usr/local/lib to the linker)
if test -d /usr/local/lib/.; then
AC_MSG_RESULT(yes)
ALL_LOCAL_C_LIB_DIRS=/usr/local/lib
else
AC_MSG_RESULT(no)
ALL_LOCAL_C_LIB_DIRS=
fi
AC_SUBST(ALL_LOCAL_C_LIB_DIRS)
])
#-----------------------------------------------------------------------------#
#
# Check for readline and related header files and libraries

View File

@@ -406,9 +406,13 @@ CPPFLAGS="-Iruntime -Iruntime/machdeps $CPPFLAGS"
# doesn't search either of those by default.
MERCURY_CHECK_LOCAL_C_INCL_DIRS
CPPFLAGS="$ALL_LOCAL_C_INCL_DIRS $CPPFLAGS"
if test -d /usr/local/lib/.; then
LIBS="-L/usr/local/lib $LIBS"
fi
MERCURY_CHECK_LOCAL_C_LIB_DIRS
for dir in $ALL_LOCAL_C_LIB_DIRS kludge_for_broken_shells
do
if test "$dir" != "kludge_for_broken_shells"; then
LIBS="-L$dir $LIBS"
fi
done
AC_PROG_CPP
#-----------------------------------------------------------------------------#

View File

@@ -24,7 +24,8 @@ DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
# include the file `parse_ml_options.sh-subr'
@PARSE_ML_OPTIONS@
# add /usr/local/lib to the default search path, if needed
ALL_LOCAL_C_LIB_DIRS=${MERCURY_ALL_LOCAL_C_LIB_DIRS=@ALL_LOCAL_C_LIB_DIRS@}
NONSHARED_LIB_DIR=${MERCURY_NONSHARED_LIB_DIR=@NONSHARED_LIB_DIR@}
DEMANGLER=${MERCURY_DEMANGLER=mdemangle}
CC=${MERCURY_C_COMPILER="@CC@"}
@@ -127,7 +128,12 @@ case $all_libs in default)
case $FULLARCH in i*86-*-linux*|i*86-*-freebsd*|i*86-*-cygwin*)
# shared libraries are not the default on Linux
# -- see README.Linux
# Likewise for FreeBSD
# Likewise for FreeBSD and Cygwin
#
# We don't do this for Solaris/x86 because -ldl is
# only available for dynamically linked executables
# XXX With these defaults linking with Mercury libraries
# other than the standard library will fail.
case $make_shared_lib in false)
all_libs=static
;;
@@ -351,9 +357,12 @@ merc_libdir_opts="\
@LIB_LIBPATH@$LIBDIR/$GRADE/$FULLARCH
@LIB_LIBPATH@$LIBDIR/$FULLARCH
"
system_libdir_opts="\
@LIB_LIBPATH@/usr/local/lib
"
system_libdir_opts=
for dir in $ALL_LOCAL_C_LIB_DIRS kludge_for_broken_shells; do
if [ "$dir" != "kludge_for_broken_shells" ]; then
system_libdir_opts="@LIB_LIBPATH@$dir $system_libdir_opts"
fi
done
LIBDIR_OPTS="$user_libdir_opts $merc_libdir_opts $system_libdir_opts"
case $mercury_libs in
@@ -379,12 +388,17 @@ case $mercury_libs in
;;
esac
case $all_libs in
shared) system_shlib_dirs=$ALL_LOCAL_C_LIB_DIRS ;;
static) system_shlib_dirs="" ;;
esac
RPATH_OPT_LIST=
# only set RPATH_OPT_LIST if the system supports shared libraries
case $EXT_FOR_SHARED_LIB in so)
prev=""
for dir in $user_shlib_dirs $merc_shlib_dirs 'kludge for broken shells'
for dir in $user_shlib_dirs $merc_shlib_dirs \
$system_shlib_dirs 'kludge for broken shells'
do
case "$dir" in
'kludge for broken shells')