Newer
Older
Fons Rademakers
committed
#!/bin/bash
# A (not so) simple configure script.
# Authors: Christian Holm Christensen and Fons Rademakers.
#
# To help with debugging the script, some comments are preprended with
# 3 '#' echo and 3 '%' - replace that pattern with echo and 3 '%' to
# get printouts. When done replace the pattern echo and 3 '%' with the
# original pattern of 3 '#' echo and 3 '%'. Emacs command M-C-% does
# this easily.
#
######################################################################
Pere Mato Vila
committed
echo "****************************************************************************************************************"
echo "* The classic configure/make method of building ROOT is now DEPRECATED in favor of the CMake one. *"
echo "* Refer to README/INSTALL file for updated instructions or visit the page https://root.cern.ch/building-root *"
echo "****************************************************************************************************************"
#
### echo %%% Some global variables
#
found_lib=no
found_dir=no
found_hdr=no
show_pkglist=no
noact="no"
Fons Rademakers
committed
altcc=
altcxx=
altf77=
altld=
gcctoolchain=
Fons Rademakers
committed
host=
enable_editline \
Fons Rademakers
committed
enable_alloc \
Fons Rademakers
committed
enable_astiff \
enable_bonjour \
enable_builtin_lzma \
enable_builtin_llvm \
enable_cxxmodules \
enable_castor \
enable_cocoa \
enable_davix \
enable_dcache \
enable_explicitlink \
Fons Rademakers
committed
enable_genvector \
enable_http \
enable_mathmore \
Fons Rademakers
committed
enable_minuit2 \
enable_opengl \
enable_oracle \
enable_pgsql \
enable_pythia6 \
enable_roofit \
Lorenzo Moneta
committed
enable_r \
enable_ruby \
enable_rfio \
enable_rpath \
Philippe Canal
committed
enable_search_usrlocal \
enable_sapdb \
enable_shadowpw \
enable_shared \
enable_soversion \
enable_sqlite \
enable_srp \
enable_ssl \
enable_table \
enable_tbb \
Lorenzo Moneta
committed
enable_vc \
enable_x11 \
"
Fons Rademakers
committed
ENABLEALL="no"
DEFAULTENABLE="yes"
for flag in "$@"; do
case $flag in
Fons Rademakers
committed
--all)
ENABLEALL="yes"
break ;;
MINIMALENABLE="enable_x11"
break ;;
--minimal)
DEFAULTENABLE="no"
MINIMALENABLE=""
break ;;
esac
done
# This sets all options to "yes" unless --minimal is specified.
# We turn off those we don't want on per default explictly afterwards.
for c in $options $deprecated_options; do
case ${c} in
${MINIMALENABLE}) eval ${c}="yes" ;;
enable_shared) eval ${c}="yes" ;;
*) eval ${c}="${DEFAULTENABLE}" ;;
esac
done
enable_cxx14=no
enable_cxxmodules=no
Fons Rademakers
committed
enable_cocoa=
enable_afs=no
Fons Rademakers
committed
enable_alloc=no
enable_explicitlink=no
enable_http=no
enable_qt=no
enable_roofit=no
enable_rpath=no
enable_ruby=no
enable_shadowpw=
enable_soversion=no
enable_tbb=no
enable_thread=yes # cannot be disabled (not in above options list)
Lorenzo Moneta
committed
enable_vc=no
Fons Rademakers
committed
enable_builtin_freetype=no
enable_builtin_ftgl=no
Fons Rademakers
committed
enable_builtin_pcre=no
Fons Rademakers
committed
enable_builtin_zlib=no
enable_builtin_lzma=no
enable_builtin_llvm=yes
Philippe Canal
committed
enable_search_usrlocal=yes
Fons Rademakers
committed
if test "x$ENABLEALL" = "xyes"; then
enable_gdml=yes
enable_http=yes
Fons Rademakers
committed
enable_qt=yes
enable_qtgsi=yes
enable_roofit=yes
enable_minuit2=yes
Fons Rademakers
committed
enable_table=yes
enable_unuran=yes
Fons Rademakers
committed
fi
#
# ./configure arguments and defaults set via supported env vars
#
envvars="
THREAD \
ZLIB \
LIBTIFF \
LIBJPEG \
LIBPNG \
LZMA \
OPENGL \
MYSQL \
PGSQL \
QTDIR \
SAPDB \
RFIO \
CASTOR \
PYTHIA6 \
DCACHE \
CHIRP \
ALIEN \
ASIMAGE \
LDAP \
GLOBUS_LOCATION \
SRP \
AFS \
ROOFIT \
TABLE \
Lorenzo Moneta
committed
VC \
DAVIX \
"
configenvvars=
if test ! "x$cc" = "x" ; then
if test ! "x$configenvvars" = "x" ; then
configenvvars="$configenvvars $c=$cc"
else
configenvvars="$c=$cc"
fi
fi
done
configargs="$*"
configargs=`echo $configargs | sed 's, *--nohowto,,g'`
configoptions=
if test ! "x$configenvvars" = "x" ; then
configoptions=$configenvvars
fi
if test ! "x$configargs" = "x" ; then
if test ! "x$configoptions" = "x" ; then
configoptions="$configoptions $configargs"
else
configoptions=$configargs
fi
fi
configoptions=`echo $configoptions | sed 's,\\\,\\\\\\\,g'`
######################################################################
#
### echo %%% Some common functions
#
#_____________________________________________________________________
message() {
# Write a simple message to std out
if test $# -lt 1 ; then
echo "message: Too few arguments"
return 1
fi
echo $ac_n "$* ... $ac_c"
logmsg "$*"
}
#_____________________________________________________________________
logmsg() {
# Write a simple message to std out
if test $# -lt 1 ; then
echo "logmsg: Too few arguments"
return 1
fi
if test "x$1" = "x-n"; then
shift
echo -n "$*" >> $logfile
else
echo "$*" >> $logfile
fi
}
#_____________________________________________________________________
result() {
echo "$*"
logmsg "Result: $*"
}
#_____________________________________________________________________
checking_msg() {
# Write a simple "checking" message to std out.
if test $# -lt 1 ; then
echo "checking_msg: Too few arguments"
return 1
fi
echo $ac_n "Checking for$ac_c"
logmsg $ac_n "Checking for$ac_c"
while test $# -gt 1 ; do
echo $ac_n " $1,$ac_c"
logmsg $ac_n " $1,$ac_c"
shift
if test $# -eq 1 ; then
echo $ac_n " or$ac_c"
logmsg $ac_n " or$ac_c"
fi
done
echo $ac_n " $1 ... $ac_c"
Fons Rademakers
committed
#_____________________________________________________________________
check_libpic() {
# This function will try to find out if an archive library [$1]
# contains relocatable code. Currently works only for linux.
# The result of the check is stored in is_libpic, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
is_libpic=1
Fons Rademakers
committed
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "check_libpic: not 1 argument"
return 1
fi
case $platform in
linux) ;;
*) return 0;
Fons Rademakers
committed
;;
esac
# Save arguments in logical names
chklibpic=$1
if [ "x`basename $chklibpic .a`" != "x`basename $chklibpic`" ]; then
# we have an archive .a file
logmsg "Checking if $chklibpic contains relocatable code"
logmsg " objdump -r $chklibpic | grep -v ' .debug_' | grep 'R_X86_64_32'"
objdump -r $chklibpic | grep -v ' .debug_' | grep 'R_X86_64_32' > /dev/null 2>& 1
Fons Rademakers
committed
ret=$?
logmsg " result: $ret"
if test $ret -eq 0 ; then
is_libpic=0
logmsg " is not a relocatable library"
Fons Rademakers
committed
fi
fi
}
Fons Rademakers
committed
#_____________________________________________________________________
check_libcompat() {
# This function will try to find out if a library [$1] contains
Fons Rademakers
committed
# compatible 64 bit or 32 bit code matching the selected architecture.
# Currently only MacOS X supports universal libs.
# The result of the check is stored in is_libcompat, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
is_libcompat=0
is_libnotcompat=0
Fons Rademakers
committed
ret=0
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "check_libcompat: not 1 argument"
return 1
fi
# Save arguments in logical names
chklibcompat=$1
logmsg "Checking if $chklibcompat contains compatible code"
case $arch in
macosx)
case $chklibcompat in
*.tbd)
Fons Rademakers
committed
ret=1
;;
*)
logmsg " lipo $chklibcompat -verify_arch i386"
if lipo $chklibcompat -verify_arch i386 ; then
ret=1
fi
;;
esac
Fons Rademakers
committed
;;
macosx64|macosxicc)
case $chklibcompat in
*.tbd)
Fons Rademakers
committed
ret=1
;;
*)
logmsg " lipo $chklibcompat -verify_arch x86_64"
if lipo $chklibcompat -verify_arch x86_64 ; then
ret=1
fi
;;
esac
Fons Rademakers
committed
;;
esac
logmsg " result: $ret"
if test $ret -eq 1 ; then
is_libcompat=1
logmsg " is a compatible library"
else
is_libnotcompat=1
logmsg " is a not-compatible library"
Fons Rademakers
committed
fi
}
#_____________________________________________________________________
check_libcxxcompat() {
# This function will try to find out if a library [$1] is linked
# against a compatible C++ run-time library (either libstdc++ or libc++).
# Currently only MacOS X and Linux support libc++ and libstdc++.
# The result of the check is stored in is_libcxxcompat, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
Fons Rademakers
committed
# To skip this check, in case std types are not used in the public
# API of the library, set skipchecklibcxxcompat="yes".
is_libcxxcompat=1
ret=0
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "check_libcxxcompat: not 1 argument"
return 1
fi
Fons Rademakers
committed
# Can we skip the check in case library has no std C++ in public API
if test "x$skipchecklibcxxcompat" = "xyes"; then
skipchecklibcxxcompat=""
logmsg "check_libcxxcompat: skipping check for $1"
return
fi
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
# Save arguments in logical names
chklibcxxcompat=$1
logmsg "Checking if $chklibcxxcompat is linked against compatible C++ run-time"
if test "x$enable_libcxx" = "xyes"; then
case $arch in
macosx*)
logmsg " otool -L $chklibcxxcompat | grep libstdc++"
if otool -L $chklibcxxcompat | grep 'libstdc++' > /dev/null 2>& 1 ; then
ret=1
fi
;;
linux*)
logmsg " ldd $chklibcxxcompat | grep libstdc++"
if ldd $chklibcxxcompat | grep 'libstdc++' > /dev/null 2>& 1 ; then
ret=1
fi
;;
esac
else
case $arch in
macosx*)
logmsg " otool -L $chklibcxxcompat | grep libc++"
if otool -L $chklibcxxcompat | grep 'libc++' > /dev/null 2>& 1 ; then
ret=1
fi
;;
linux*)
logmsg " ldd $chklibcxxcompat | grep libc++"
if ldd $chklibcxxcompat | grep 'libc++' > /dev/null 2>& 1 ; then
ret=1
fi
;;
esac
fi
logmsg " result: $ret"
if test $ret -eq 1 ; then
is_libcxxcompat=0
logmsg " is linked against not-compatible C++ run-time library"
else
logmsg " is linked against compatible C++ run-time library"
fi
}
Fons Rademakers
committed
#_____________________________________________________________________
check_lib64() {
# This function will try to find out if a library [$1] contains 64 bit
# or 32 bit code. Currently works only for linux and solaris.
Fons Rademakers
committed
# The result of the check is stored in is_lib64, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
is_lib64=0
ret=0
Fons Rademakers
committed
# Assert that we got enough arguments
if test $# -ne 1 ; then
echo "check_lib64: not 1 argument"
return 1
Fons Rademakers
committed
fi
filearg=
case $platform in
linux) filearg="-L" ;;
solaris) ;;
*) return 1;;
esac
Fons Rademakers
committed
# Save arguments in logical names
chklib64=$1
logmsg "Checking if $chklib64 is a 64-bit library"
Fons Rademakers
committed
if [ "x`basename $chklib64 .a`" != "x`basename $chklib64`" ]; then
# we have an archive .a file
if [ "x$platform" = "xlinux" ]; then
logmsg " objdump -a $chklib64 | grep 'x86-64'"
if objdump -a $chklib64 | grep 'x86-64' > /dev/null 2>& 1 ; then
ret=1
fi
fi
if [ "x$platform" = "xsolaris" ]; then
chklib64file=`ar t $chklib64 | awk '{if (NR == 2) print $1}'`
logmsg " ar x $chklib64 $chklib64file"
ar x $chklib64 $chklib64file
logmsg " file $filearg $chklib64file | grep '64-bit'"
if file $filearg $chklib64file | grep '64-bit' > /dev/null 2>& 1 ; then
ret=1
fi
rm -f $chklib64file
fi
Fons Rademakers
committed
else
if file $filearg $chklib64 | grep 'ASCII' > /dev/null 2>& 1 ; then
check_link $chklib64
ret=$link_result
else
logmsg " file $filearg $chklib64 | grep '64-bit'"
if file $filearg $chklib64 | grep '64-bit' > /dev/null 2>& 1 ; then
ret=1
fi
fi
Fons Rademakers
committed
fi
if test $ret -eq 1 ; then
Fons Rademakers
committed
is_lib64=1
logmsg " is a 64bit library"
Fons Rademakers
committed
fi
}
#_____________________________________________________________________
check_library() {
# This function will try to locate a library [$1] in the specific
# directory [$3] or in a default path [$*]. If the second argument
# [$2] is not "no" or "staticonly", then shared libraries are favoured.
# The result of the search is stored in found_lib and found_dir,
# which should be immediately copied, since the variables value will
# be overwritten at next invocation of this function.
# Assert that we got enough arguments
if test $# -lt 4 ; then
echo "check_library: Too few arguments"
return 1
fi
# Save arguments in local names
lib=$1 ; shift
shared=$1 ; shift
libdirl=$1 ; shift
libdirs="$*"
Fons Rademakers
committed
if test ! "x$iossdk" = "x" ; then
sdklibs=""
for i in $libdirs; do
#if test $i = "/usr/lib"; then
sdklibs="$sdklibs ${iossdk}${i}"
#else
# sdklibs="$sdklibs $i"
#fi
done
libdirs="$sdklibs"
Fons Rademakers
committed
fi
Philippe Canal
committed
if test "x$enable_search_usrlocal" = "xno" ; then
no_usrlocal=""
Philippe Canal
committed
if [[ $i != /usr/local/* ]] ; then
no_usrlocal="$no_usrlocal $i"
fi
done
libdirs="$no_usrlocal"
fi
# Write a message
checking_msg $lib
# check if we got a specific argument as to where the library
# is to be found
if test ! "x$libdirl" = "x" ; then
libdirs=$libdirl
fi
found_lib=no
found_dir=no
# Make list of libraries to search for. The .lib extension is for
# Windoze - note $shared is always "no" on windoze, since we need
# the .lib export library to link.
libs=""
for i in $lib ; do
for ext in .a .lib "" ; do # lib without extension for MacOS X
libs="$libs $i$ext"
done
slibs=""
for i in $lib ; do
for ext in .so .sl .tbd .dylib .dll.a ; do # .dll.a for cygwin gcc
slibs="$slibs $i$ext"
done
done
libs="$libs $slibs"
elif test "x$shared" = "xstaticonly" ; then
libs="$libs"
else
libs="$slibs $libs"
fi
# Loop over the list of possible directories, and see if we can
# find any of the library files as determind above.
for i in $libdirs ; do
# look first in the lib32 directories
if test "x$checklib32" = "xyes" ; then
i32=`echo $i | sed -e 's|lib$|lib32|' -e 's|lib/|lib32/|'`
Pere Mato Vila
committed
i="$i32 $i"
#i="$i32"
fi
# look first in the lib64 directories
if test "x$checklinux64" = "xyes" ; then
i64=`echo $i | sed -e 's|lib$|lib64|' -e 's|lib/|lib64/|'`
Fons Rademakers
committed
i="$i64 $i"
fi
Fons Rademakers
committed
# look first in the DEB_HOST_MULTIARCH directories
if test "x$debmultiarch" != "x" ; then
i64=`echo $i | sed "s|\(lib\)$|\1/$debmultiarch|"`
i="$i64 $i"
fi
Fons Rademakers
committed
# look only in the lib64 directories
if test "x$checkonlylib64" = "xyes" ; then
i64=`echo $i | sed -e 's|lib$|lib64|' -e 's|lib/|lib64/|'`
i="$i64"
fi
Fons Rademakers
committed
# look only in the hpux64 directories
i="$i64"
# look first in the amd64 directories
if test "x$checksolaris64" = "xyes" ; then
i64=`echo $i | sed 's|\(lib\)|\1/amd64|'`
fi
logmsg " Checking in directories $i for $libs"
for l in $i ; do
continue
for j in ${libs} ; do
logmsg " Checking for library $j in directory $l"
# if we found the file (it's readable by user), we set the
# logical variables and are on our way, otherwise we continue
liblist=`echo $l/$j` # expands wildcard in $l/$j
for n in ${liblist} ; do
logmsg " Checking $n"
if test -f $n ; then
logmsg " Found file $n"
Fons Rademakers
committed
if test "x$checklib64" = "xyes" ; then
check_lib64 $n
if test $is_lib64 -eq 1 ; then
found_dir=$l
found_lib=$j
break 4
fi
else
Fons Rademakers
committed
if test "x$checklibcompat" = "xyes" ; then
check_libcompat $n
if test $is_libcompat -eq 0 ; then
break 4
fi
fi
if test "x$checklibcxxcompat" = "xyes" ; then
check_libcxxcompat $n
if test $is_libcxxcompat -eq 0 ; then
break 4
fi
fi
Fons Rademakers
committed
found_dir=$l
found_lib=$j
check_lib64 $n
else
is_lib64=0
fi
Fons Rademakers
committed
if test $is_lib64 -eq 1 ; then
found_dir=no
found_lib=no
Fons Rademakers
committed
# skip cygwin libraries when in pure Win32 mode
if test "x$platform" = "xwin32"; then
case $found_dir in
/lib|/lib/*|/usr/*) found_dir=no ;;
*) break 4;;
esac
else
break 4
fi
Fons Rademakers
committed
fi
else
done
done
done
echo $found_dir
unset libs
unset libdirs
if test "x$found_dir" = "xno" || test "x$found_lib" = "xno" ; then
found_dir=""
found_lib=""
found_raw_lib=""
logmsg " library not found"
found_ext=`echo $found_lib | sed 's|^lib\(.*\)\.\(.*\)|\2|'`
flib=""
maclib=""
for i in $lib ; do
for ext in .a .lib "" ; do # lib without extension for MacOS X
if test "x$found_lib" = "x$i$ext" ; then
flib=$i$ext
if test "x$ext" = "x" ; then
maclib="yes"
fi
break 2
fi
done
done
if (test "x$found_lib" = "x$flib" && test "x$shared" = "xno") || \
test "x$maclib" = "xyes" ; then
found_lib=${found_dir}/${found_lib}
found_raw_dir=${found_dir}
found_dir=""
else
found_raw_lib=${found_lib}
found_lib=`echo $found_lib | sed 's|^lib\(.*\)\..*|-l\1|'`
found_raw_dir=${found_dir}
found_dir=-L${found_dir}
Fons Rademakers
committed
# Avoid inclusion of /usr/lib, which is always included anyway
if test "x$found_dir" = "x-L/usr/lib" || \
test "x$found_dir" = "x-L/usr/lib32" || \
test "x$found_dir" = "x-L/usr/lib64" ; then
found_dir=""
fi
if test "x$debmultiarch" != "x" ; then
if test "x$found_dir" = "x-L/usr/lib/$debmultiarch" ; then
found_dir=""
fi
fi
if test "x$checksolaris64" = "xyes" ; then
if test "x$found_dir" = "x-L/usr/lib/amd64" || \
test "x$found_dir" = "x-L/usr/lib/64" ; then
found_dir=""
fi
fi
if test "x$checkhpux64" = "xyes" ; then
if test "x$found_dir" = "x-L/usr/lib/hpux64" ; then
found_dir=""
fi
fi
# Correct path for win32
if test "x$platform" = "xwin32"; then
if test ! "x$found_lib" = "x" ; then
found_lib=`cygpath -m $found_lib`
fi
if test ! "x$found_dir" = "x" ; then
found_dir=`cygpath -m $found_dir`
fi
fi
fi
unset shared
unset slibs
unset lib
unset flib
unset maclib
unset libdirl
#_____________________________________________________________________
check_header() {
# This function will try to locate a header [$1] in the specific
# directory [$2] or in a default path [$*].
# The result of the search is stored in found_hdr and found_dir,
# which should be immediately copied, since the variables value will
# be overwritten at next invocation of this function.
# Assert that we got enough arguments
if test $# -lt 3 ; then
echo "check_header: Too few arguments"
return 1
fi
# Save arguments in logical names
hdrs=$1 ; shift
hdrdir=$1 ; shift
hdrdirs="$*"
Fons Rademakers
committed
if test ! "x$iossdk" = "x" ; then
sdkhdrs=""
for i in $hdrdirs; do
#if test $i = "/usr/include"; then
sdkhdrs="$sdkhdrs ${iossdk}${i}"
#else
# sdkhdrs="$sdkhdrs $i"
#fi
done
hdrdirs="$sdkhdrs"
Fons Rademakers
committed
fi
Philippe Canal
committed
if test "x$enable_search_usrlocal" = "xno" ; then
no_usrlocal=""
for i in $hdrdirs; do
if [[ $i != /usr/local/* ]] ; then
no_usrlocal="$no_usrlocal $i"
fi
done
hdrdirs="$no_usrlocal"
fi
Fons Rademakers
committed
# Write a message
checking_msg $hdrs
# Check if we got a specific argument as to where the library
# is to be found
if test ! "x$hdrdir" = "x" ; then
hdrdirs=$hdrdir
fi
found_hdr=no
found_dir=no
# Loop over the list of possible directories, and see if we can
# find any of the library files as determind above.
Fons Rademakers
committed
for i in $hdrdirs; do
logmsg " Checking in directory $i"
for j in ${hdrs} ; do
logmsg " Checking for $j in directory $i"
# if we found the file (it's readable by user), we set the
# logical variables and are on our way, otherwise we continue
if test -r $i/$j ; then
logmsg " $i/$j is read-able"
found_dir=$i
found_hdr=$j
# skip cygwin headers when in pure Win32 mode
if test "x$platform" = "xwin32"; then
case $found_dir in
/usr/*) found_dir="no" ;;
*) break 2;;
esac
else
break 2
fi
fi
done
done
echo $found_dir
if test "x$found_hdr" = "xno" || test "x$found_dir" = "xno" ; then
found_hdr=""
found_dir=""
fi
# Avoid inclusion of /usr/include, which is always included anyway
#if test "x$found_dir" = "x/usr/include" ; then
# found_dir="include"
# Correct path for win32
Fons Rademakers
committed
if test "x$platform" = "xwin32"; then
if test ! "x$found_hdr" = "x" ; then
found_hdr=`cygpath -m $found_hdr`
fi
if test ! "x$found_dir" = "x" ; then
found_dir=`cygpath -m $found_dir`
fi
fi
unset hdrs
unset hdrdirs
unset hdrdir
}
#_____________________________________________________________________
check_code() {
# This function compiles a source file containing code from $1
# with extra CXXFLAGS $2 (can be empty), e.g. to pass -I.
# The result of the check is stored in include_result, 1 if true,
# 0 otherwise, which should be immediately copied, since the variable
# will be overwritten at next invocation of this function.
# Assert that we got enough arguments
if test $# -lt 1 ; then
echo "check_include: Too few arguments"
return 1
fi
cat <<EOF > conftest.mk
include ${ac_srcdir}/config/Makefile.${arch}
CXX = ${altcxx}
conftest.o: conftest.cxx
\$(CXX) $2 -c \$^ -o \$@
EOF
$gnumake -f conftest.mk >> $logfile 2>&1
if test $? -eq 0 ; then
logmsg " supported"
include_result=1
else
logmsg " not supported"
include_result=0
fi
rm -f conftest.mk conftest.o conftest.cxx conftest.d
}
#_____________________________________________________________________
check_link() {
# This function will try to link a specific library [$1] in an
# optional directory [$2] and test, optionally, for a specified
# symbol [$3].
# The result of the check is stored in link_result, 1 if true,