diff options
author | Bruno Haible <bruno@clisp.org> | 2003-02-14 16:04:49 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:09:58 +0200 |
commit | d2e5774561e847b895d3d17890ccb1b273fa2be4 (patch) | |
tree | c02cef91596948d9ea3248a8702e5a33615bef37 /autoconf-lib-link | |
parent | 000676e07c3fc3f8cc3891e5c468aa22524efb10 (diff) | |
download | external_gettext-d2e5774561e847b895d3d17890ccb1b273fa2be4.zip external_gettext-d2e5774561e847b895d3d17890ccb1b273fa2be4.tar.gz external_gettext-d2e5774561e847b895d3d17890ccb1b273fa2be4.tar.bz2 |
Move tests/rpathcfg.sh to autoconf-lib-link/tests/rpathcfg.sh.
Diffstat (limited to 'autoconf-lib-link')
-rwxr-xr-x | autoconf-lib-link/tests/rpathcfg.sh | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/autoconf-lib-link/tests/rpathcfg.sh b/autoconf-lib-link/tests/rpathcfg.sh new file mode 100755 index 0000000..11f241e --- /dev/null +++ b/autoconf-lib-link/tests/rpathcfg.sh @@ -0,0 +1,223 @@ +#!/bin/sh +# Prints information for maintaining config.rpath. + +# The caller should set the environment variables +# top_srcdir, CONFIG_SHELL, CC, GCC, LDFLAGS, LD, with_gnu_ld, host. + +echo "=============== rpathcfg for $host ===============" +echo +echo "--------------- config.rpath output ---------------" +${CONFIG_SHELL-/bin/sh} $top_srcdir/config.rpath "$host" | sed -e 's/^acl_cv_//' +echo "--------------- experimentally determined ---------------" +abs_top_srcdir=`cd $top_srcdir && pwd` +builddir=`pwd` +global_top_srcdir=`cd "$top_srcdir" && pwd` +export global_top_srcdir +rm -rf tstprefix tstbuild tstlib + +eval `${CONFIG_SHELL-/bin/sh} $top_srcdir/config.rpath "$host" | grep '^acl_cv_wl='` +wl="$acl_cv_wl" + +# Static library suffix (normally "a"). +mkdir tstprefix +mkdir tstbuild +(cd $top_srcdir/tests/rpathx && tar cf - *) | (cd tstbuild && tar xf -) +(cd tstbuild + ${CONFIG_SHELL-/bin/sh} ./configure --disable-shared --prefix=$builddir/tstprefix > configure.log 2>&1 + make > make.log 2>&1 + make install > install.log 2>&1 +) +rm -rf tstbuild +libext= +cd tstprefix/lib +for f in *; do + case $f in + *.la) ;; + *[0-9]) ;; + *) libext=`echo $f | sed -e 's/^.*\.//'`;; + esac + if test -n "$libext"; then + break + fi +done +cd ../.. +rm -rf tstprefix + +# Shared library suffix (normally "so"). +mkdir tstprefix +mkdir tstbuild +(cd $top_srcdir/tests/rpathx && tar cf - *) | (cd tstbuild && tar xf -) +(cd tstbuild + ${CONFIG_SHELL-/bin/sh} ./configure --disable-static --prefix=$builddir/tstprefix > configure.log 2>&1 + make > make.log 2>&1 + make install > install.log 2>&1 +) +rm -rf tstbuild +shlibext= +cd tstprefix/lib || exit 1 +for f in *; do + case $f in + *.la) ;; + *[0-9]) ;; + *) shlibext=`echo $f | sed -e 's/^.*\.//'`;; + esac + if test -n "$shlibext"; then + break + fi +done +cd ../.. +rm -rf tstprefix + +# Prepare hardcoding tests. +mkdir tstprefix +mkdir tstbuild +(cd $top_srcdir/tests/rpathx && tar cf - *) | (cd tstbuild && tar xf -) +(cd tstbuild + ${CONFIG_SHELL-/bin/sh} ./configure --disable-static --prefix=$builddir/tstprefix > configure.log 2>&1 + make > make.log 2>&1 + make install > install.log 2>&1 +) +rm -rf tstbuild + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec= +for spec in \ + '-L$libdir' \ + '-R$libdir' \ + '-rpath $libdir' '${wl}-rpath ${wl}$libdir' \ + '${wl}+b ${wl}$libdir' \ + '${wl}-R $libdir:/usr/lib:/lib' \ + '${wl}-blibpath:$libdir:/usr/lib:/lib' \ + '${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' \ + ; do + mv tstprefix/lib tstlib + libdir=`pwd`/tstprefix/lib + eval flag=\"$spec\" + echo 1>&2 + echo "$CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c tstlib/librpathx.$shlibext $flag -o a.out" 1>&2 + $CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c tstlib/librpathx.$shlibext $flag -o a.out + if test $? = 0; then + mv tstlib tstprefix/lib + echo "ok, running created a.out." 1>&2 + if ./a.out; then + hardcode_libdir_flag_spec="$hardcode_libdir_flag_spec$spec +" + fi + else + mv tstlib tstprefix/lib + fi + rm -f a.out +done + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator= +if test -n "$hardcode_libdir_flag_spec"; then + spec=`echo "$hardcode_libdir_flag_spec" | sed -e '2,$d'` + # Try with multiple -rpath flags. + mv tstprefix/lib tstlib + libdir=`pwd`/tstprefix/lib + eval flag1=\"$spec\" + libdir=/tmp + eval flag2=\"$spec\" + echo 1>&2 + echo "$CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c tstlib/librpathx.$shlibext $flag1 $flag2 -o a.out" 1>&2 + $CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c tstlib/librpathx.$shlibext $flag1 $flag2 -o a.out + if test $? = 0; then + mv tstlib tstprefix/lib + echo "ok, running created a.out." 1>&2 + if ./a.out; then + hardcode_libdir_separator=NONE + fi + else + mv tstlib tstprefix/lib + fi + rm -f a.out + if test -z "$hardcode_libdir_separator"; then + # Try with a single -rpath flag. + mv tstprefix/lib tstlib + libdir=`pwd`/tstprefix/lib:/tmp + eval flag=\"$spec\" + echo 1>&2 + echo "$CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c tstlib/librpathx.$shlibext $flag -o a.out" 1>&2 + $CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c tstlib/librpathx.$shlibext $flag -o a.out + if test $? = 0; then + mv tstlib tstprefix/lib + echo "ok, running created a.out." 1>&2 + if ./a.out; then + hardcode_libdir_separator=: + fi + else + mv tstlib tstprefix/lib + fi + rm -f a.out + fi + if test -z "$hardcode_libdir_separator"; then + echo "hardcode_libdir_separator test failed!" 1>&2 + else + if test "$hardcode_libdir_separator" = NONE; then + hardcode_libdir_separator= + fi + fi +fi + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no +echo 1>&2 +echo "$CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c tstprefix/lib/librpathx.$shlibext -o a.out" 1>&2 +$CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c tstprefix/lib/librpathx.$shlibext -o a.out +if test $? = 0; then + echo "ok, running created a.out." 1>&2 + if ./a.out; then + hardcode_direct=yes + fi +fi +rm -f a.out + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no +echo 1>&2 +echo "$CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c -Ltstprefix/lib -lrpathx -o a.out" 1>&2 +$CC $LDFLAGS $top_srcdir/tests/rpathlx/usex.c -Ltstprefix/lib -lrpathx -o a.out +if test $? = 0; then + echo "ok, running created a.out." 1>&2 + if ./a.out; then + hardcode_minus_L=yes + fi +fi +rm -f a.out + +# Clean up. +rm -rf tstprefix + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +cat <<EOF + +# Static library suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally "so"). +shlibext="$shlibext" + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="$hardcode_libdir_separator" + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct="$hardcode_direct" + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L="$hardcode_minus_L" + +EOF |