diff options
-rw-r--r-- | Source/cmUnixMakefileGenerator.cxx | 52 | ||||
-rw-r--r-- | Templates/CMakeSystemConfig.cmake.in | 4 | ||||
-rwxr-xr-x | Templates/configure | 136 | ||||
-rw-r--r-- | Templates/configure.in | 74 |
4 files changed, 221 insertions, 45 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx index 7909873..a47eb6c 100644 --- a/Source/cmUnixMakefileGenerator.cxx +++ b/Source/cmUnixMakefileGenerator.cxx @@ -254,8 +254,30 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout, // Try to emit each search path once std::set<std::string> emitted; + // Embed runtime search paths if possible and if required. + bool outputRuntime = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS"); + std::string runtimeFlag; + std::string runtimeSep; + std::vector<std::string> runtimeDirs; + + if(m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_FLAG")) + { + runtimeFlag = m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_FLAG"); + } + if(m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_SEP")) + { + runtimeSep = m_Makefile->GetDefinition("CMAKE_SHLIB_RUNTIME_SEP"); + } + + // concatenate all paths or no? + bool runtimeConcatenate = ( runtimeSep!="" ); + if(runtimeFlag == "") + { + outputRuntime = false; + } + // collect all the flags needed for linking libraries - std::string linkLibs; + std::string linkLibs; std::vector<std::string>& libdirs = m_Makefile->GetLinkDirectories(); for(std::vector<std::string>::iterator libDir = libdirs.begin(); libDir != libdirs.end(); ++libDir) @@ -270,6 +292,10 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout, && libDir->find("${") == std::string::npos) { linkLibs += "-L"; + if(outputRuntime) + { + runtimeDirs.push_back( libpath ); + } } linkLibs += libpath; linkLibs += " "; @@ -306,6 +332,10 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout, linkLibs += "-L"; linkLibs += libpath; linkLibs += " "; + if(outputRuntime) + { + runtimeDirs.push_back( libpath ); + } } } cmRegularExpression libname("lib(.*)\\.(.*)"); @@ -337,6 +367,26 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout, linkLibs += librariesLinked; } fout << linkLibs; + + if(outputRuntime && runtimeDirs.size()>0) + { + fout << runtimeFlag; + std::vector<std::string>::iterator itr = runtimeDirs.begin(); + fout << *itr; + ++itr; + for( ; itr != runtimeDirs.end(); ++itr ) + { + if(runtimeConcatenate) + { + fout << runtimeSep << *itr; + } + else + { + fout << " " << runtimeFlag << *itr; + } + } + fout << " "; + } } diff --git a/Templates/CMakeSystemConfig.cmake.in b/Templates/CMakeSystemConfig.cmake.in index 15c2895..27ece9a 100644 --- a/Templates/CMakeSystemConfig.cmake.in +++ b/Templates/CMakeSystemConfig.cmake.in @@ -38,6 +38,10 @@ SET (CMAKE_SHLIB_LINK_FLAGS "@CMAKE_SHLIB_LINK_FLAGS@" CACHE STRING "Flags used to link a shared library.") SET (CMAKE_SHLIB_LD_LIBS "@CMAKE_SHLIB_LD_LIBS@" CACHE STRING "Libraries used by LD for shared libraries") +SET (CMAKE_SHLIB_RUNTIME_FLAG "@CMAKE_SHLIB_RUNTIME_FLAG@" CACHE STRING + "Flag used to specify run-time search paths") +SET (CMAKE_SHLIB_RUNTIME_SEP "@CMAKE_SHLIB_RUNTIME_SEP@" CACHE STRING + "If null, each runtime path is a separate option. Otherwise, they are all joined, separated by this.") # support for X11 SET (CMAKE_X_LIBS "@X_PRE_LIBS@ @X_LIBS@ -lX11 -lXext @X_EXTRA_LIBS@" CACHE STRING "Libraries and options used in X11 programs") SET (CMAKE_X_CFLAGS "@X_CFLAGS@" CACHE STRING "X11 extra flags") diff --git a/Templates/configure b/Templates/configure index e40c17a..e07ccf9 100755 --- a/Templates/configure +++ b/Templates/configure @@ -2167,6 +2167,16 @@ CMAKE_shared_ok="yes" # Flags to pass to the compiler when linking object # files into an executable application binary such # as tclsh. +# CMAKE_SHLIB_RUNTIME_FLAG - +# Flag used to specify the runtime directories (e.g. "-R" or +# "-Wl,-rpath,"). If null, no attempt is make to specify the +# runtime paths. +# CMAKE_SHLIB_RUNTIME_SEP - +# If null, then each path is a separate argument. If not null, +# then all the directories are joined together, separated by +# $(CMAKE_SHLIB_RUNTIME_SEP) and appended to +# $(CMAKE_SHLIB_RUNTIME_FLAG). When not null, this is +# typically a colon ":". #-------------------------------------------------------------------- @@ -2174,7 +2184,7 @@ CMAKE_shared_ok="yes" # Linux can use either -ldl or -ldld for dynamic loading. echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:2178: checking for dlopen in -ldl" >&5 +echo "configure:2188: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2182,7 +2192,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 2186 "configure" +#line 2196 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2193,7 +2203,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2228,7 +2238,7 @@ case $system in CMAKE_SHLIB_SUFFIX="..o" CMAKE_DL_LIBS="" echo $ac_n "checking for printf in -lld""... $ac_c" 1>&6 -echo "configure:2232: checking for printf in -lld" >&5 +echo "configure:2242: checking for printf in -lld" >&5 ac_lib_var=`echo ld'_'printf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2236,7 +2246,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lld $LIBS" cat > conftest.$ac_ext <<EOF -#line 2240 "configure" +#line 2250 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2247,7 +2257,7 @@ int main() { printf() ; return 0; } EOF -if { (eval echo configure:2251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2268,6 +2278,8 @@ else fi CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) CMAKE_SHLIB_CFLAGS="+z" @@ -2275,10 +2287,14 @@ fi CMAKE_SHLIB_SUFFIX=".sl" CMAKE_DL_LIBS="-ldld" CMAKE_SHLIB_BUILD_FLAGS='+Z -Wl,-E -Wl,-b' - CMAKE_SHLIB_LINK_FLAGS='-Wl,+s -Wl,+b,${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='-Wl,+s' + CMAKE_SHLIB_RUNTIME_FLAG='-Wl,+b,' + CMAKE_SHLIB_RUNTIME_SEP=':' if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-E -Wl,-b' - CMAKE_SHLIB_LINK_FLAGS='-Wl,+s -Wl,+b,${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='-Wl,+s' + CMAKE_SHLIB_RUNTIME_FLAG='-Wl,+b,' + CMAKE_SHLIB_RUNTIME_SEP=':' fi ;; IRIX-5.*) @@ -2287,6 +2303,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=":" ;; IRIX-6* | IRIX64-6* | IRIX-64-6*) CMAKE_SHLIB_CFLAGS="" @@ -2294,6 +2312,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath" + CMAKE_SHLIB_RUNTIME_SEP=":" ;; Linux*) CMAKE_SHLIB_CFLAGS="-fPIC" @@ -2303,20 +2323,22 @@ fi if test "$have_dl" = yes; then CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="-rdynamic" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=":" else ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dld.h""... $ac_c" 1>&6 -echo "configure:2310: checking for dld.h" >&5 +echo "configure:2332: checking for dld.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2315 "configure" +#line 2337 "configure" #include "confdefs.h" #include <dld.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2320: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2342: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2335,6 +2357,8 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then CMAKE_DL_LIBS="-ldld" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP="" else echo "$ac_t""no" 1>&6 fi @@ -2346,6 +2370,8 @@ fi CMAKE_DL_LIBS="-lgdi32" CMAKE_SHLIB_SUFFIX=".dll" CMAKE_SHLIB_LINK_FLAGS="-shared" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; MP-RAS-02*) CMAKE_SHLIB_CFLAGS="-K PIC" @@ -2353,6 +2379,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; MP-RAS-*) CMAKE_SHLIB_CFLAGS="-K PIC" @@ -2360,6 +2388,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; NetBSD-*|FreeBSD-*) # Not available on all versions: check for include file. @@ -2369,12 +2399,16 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="-shared" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=":" else CMAKE_SHLIB_CFLAGS="" CMAKE_SHLIB_LD_LIBS="" CMAKE_SHLIB_SUFFIX="..o" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" fi ;; NEXTSTEP-*) @@ -2383,6 +2417,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; OSF1-1.012) # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 @@ -2392,6 +2428,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 @@ -2400,6 +2438,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; OSF1-V*) # Digital OSF/1 @@ -2408,7 +2448,9 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,"*"' - CMAKE_SHLIB_LINK_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='' + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=":" ;; RISCos-*) CMAKE_SHLIB_CFLAGS="-G 0" @@ -2416,6 +2458,8 @@ fi CMAKE_SHLIB_SUFFIX="..o" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, @@ -2426,6 +2470,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="-belf -Wl,-Bexport" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; SINIX*5.4*) CMAKE_SHLIB_CFLAGS="-K PIC" @@ -2433,6 +2479,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; SunOS-4*) CMAKE_SHLIB_CFLAGS="-PIC" @@ -2440,7 +2488,9 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-r -nostdlib' - CMAKE_SHLIB_LINK_FLAGS='-Wl,-L${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='' + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-R," + CMAKE_SHLIB_RUNTIME_SEP=":" ;; SunOS-5*) CMAKE_SHLIB_CFLAGS="-KPIC" @@ -2448,10 +2498,14 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_BUILD_FLAGS='-G' - CMAKE_SHLIB_LINK_FLAGS='-R ${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='' + CMAKE_SHLIB_RUNTIME_FLAG="-R " + CMAKE_SHLIB_RUNTIME_SEP=":" if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then CMAKE_SHLIB_BUILD_FLAGS='-Wl,-G' - CMAKE_SHLIB_LINK_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='' + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-R," + CMAKE_SHLIB_RUNTIME_SEP=":" fi ;; ULTRIX-4.*) @@ -2460,6 +2514,8 @@ fi CMAKE_SHLIB_LD_LIBS="" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; UNIX_SV*) CMAKE_SHLIB_CFLAGS="-K PIC" @@ -2467,6 +2523,8 @@ fi CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; esac export CMAKE_SHLIB_SUFFIX @@ -2497,6 +2555,8 @@ CMAKE_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}" + + ########################## ## ## ## Check thread support ## @@ -2531,17 +2591,17 @@ for ac_hdr in sys/prctl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2535: checking for $ac_hdr" >&5 +echo "configure:2595: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2540 "configure" +#line 2600 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2545: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2586,17 +2646,17 @@ for ac_hdr in pthread.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2590: checking for $ac_hdr" >&5 +echo "configure:2650: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2595 "configure" +#line 2655 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2625,7 +2685,7 @@ done if test "$use_pthreads" = "yes"; then if test "$use_sproc" = "no"; then echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:2629: checking for pthread_create in -lpthreads" >&5 +echo "configure:2689: checking for pthread_create in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2633,7 +2693,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <<EOF -#line 2637 "configure" +#line 2697 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2644,7 +2704,7 @@ int main() { pthread_create() ; return 0; } EOF -if { (eval echo configure:2648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2665,7 +2725,7 @@ else fi echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:2669: checking for pthread_create in -lpthread" >&5 +echo "configure:2729: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2673,7 +2733,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <<EOF -#line 2677 "configure" +#line 2737 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2684,7 +2744,7 @@ int main() { pthread_create() ; return 0; } EOF -if { (eval echo configure:2688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2707,7 +2767,7 @@ fi # Work around Solaris 5.6 and 5.7 bug: if test "`uname -s -r`" = "SunOS 5.6"; then echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6 -echo "configure:2711: checking for thr_create in -lthread" >&5 +echo "configure:2771: checking for thr_create in -lthread" >&5 ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2715,7 +2775,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lthread $LIBS" cat > conftest.$ac_ext <<EOF -#line 2719 "configure" +#line 2779 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2726,7 +2786,7 @@ int main() { thr_create() ; return 0; } EOF -if { (eval echo configure:2730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2749,7 +2809,7 @@ fi fi if test "`uname -s -r`" = "SunOS 5.7"; then echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6 -echo "configure:2753: checking for thr_create in -lthread" >&5 +echo "configure:2813: checking for thr_create in -lthread" >&5 ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2757,7 +2817,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lthread $LIBS" cat > conftest.$ac_ext <<EOF -#line 2761 "configure" +#line 2821 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2768,7 +2828,7 @@ int main() { thr_create() ; return 0; } EOF -if { (eval echo configure:2772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2870,7 +2930,7 @@ fi # ansi stream files (without the .h) if test $ac_cv_prog_gxx = no; then echo $ac_n "checking ansi standard C++ stream headers ""... $ac_c" 1>&6 -echo "configure:2874: checking ansi standard C++ stream headers " >&5 +echo "configure:2934: checking ansi standard C++ stream headers " >&5 echo "******" rm -rf conftest.* cat > conftest.cc <<! @@ -2891,7 +2951,7 @@ fi if test $ac_cv_prog_gxx = no; then echo "******" echo $ac_n "checking ansi standard namespace support ""... $ac_c" 1>&6 -echo "configure:2895: checking ansi standard namespace support " >&5 +echo "configure:2955: checking ansi standard namespace support " >&5 rm -rf conftest.* cat > conftest.cc <<! #include <list> @@ -2919,7 +2979,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2923: checking for $ac_word" >&5 +echo "configure:2983: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RUNMAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2959,7 +3019,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2963: checking for $ac_word" >&5 +echo "configure:3023: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_CMAKE_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3168,6 +3228,8 @@ s%@CMAKE_LIB_EXT@%$CMAKE_LIB_EXT%g s%@CMAKE_DL_LIBS@%$CMAKE_DL_LIBS%g s%@CMAKE_SHLIB_LD_LIBS@%$CMAKE_SHLIB_LD_LIBS%g s%@CMAKE_SHLIB_SUFFIX@%$CMAKE_SHLIB_SUFFIX%g +s%@CMAKE_SHLIB_RUNTIME_FLAG@%$CMAKE_SHLIB_RUNTIME_FLAG%g +s%@CMAKE_SHLIB_RUNTIME_SEP@%$CMAKE_SHLIB_RUNTIME_SEP%g s%@CMAKE_USE_SPROC@%$CMAKE_USE_SPROC%g s%@CMAKE_USE_PTHREADS@%$CMAKE_USE_PTHREADS%g s%@CMAKE_HP_PTHREADS@%$CMAKE_HP_PTHREADS%g diff --git a/Templates/configure.in b/Templates/configure.in index b4c0419..c11d571 100644 --- a/Templates/configure.in +++ b/Templates/configure.in @@ -92,6 +92,16 @@ CMAKE_shared_ok="yes" # Flags to pass to the compiler when linking object # files into an executable application binary such # as tclsh. +# CMAKE_SHLIB_RUNTIME_FLAG - +# Flag used to specify the runtime directories (e.g. "-R" or +# "-Wl,-rpath,"). If null, no attempt is make to specify the +# runtime paths. +# CMAKE_SHLIB_RUNTIME_SEP - +# If null, then each path is a separate argument. If not null, +# then all the directories are joined together, separated by +# $(CMAKE_SHLIB_RUNTIME_SEP) and appended to +# $(CMAKE_SHLIB_RUNTIME_FLAG). When not null, this is +# typically a colon ":". #-------------------------------------------------------------------- @@ -114,6 +124,8 @@ case $system in CMAKE_DL_LIBS="" AC_CHECK_LIB(ld,printf, CMAKE_DL_LIBS="-lld") CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) CMAKE_SHLIB_CFLAGS="+z" @@ -121,10 +133,14 @@ case $system in CMAKE_SHLIB_SUFFIX=".sl" CMAKE_DL_LIBS="-ldld" CMAKE_SHLIB_BUILD_FLAGS='+Z -Wl,-E -Wl,-b' - CMAKE_SHLIB_LINK_FLAGS='-Wl,+s -Wl,+b,${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='-Wl,+s' + CMAKE_SHLIB_RUNTIME_FLAG='-Wl,+b,' + CMAKE_SHLIB_RUNTIME_SEP=':' if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-E -Wl,-b' - CMAKE_SHLIB_LINK_FLAGS='-Wl,+s -Wl,+b,${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='-Wl,+s' + CMAKE_SHLIB_RUNTIME_FLAG='-Wl,+b,' + CMAKE_SHLIB_RUNTIME_SEP=':' fi ;; IRIX-5.*) @@ -133,6 +149,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=":" ;; IRIX-6* | IRIX64-6* | IRIX-64-6*) CMAKE_SHLIB_CFLAGS="" @@ -140,6 +158,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath" + CMAKE_SHLIB_RUNTIME_SEP=":" ;; Linux*) CMAKE_SHLIB_CFLAGS="-fPIC" @@ -149,10 +169,14 @@ case $system in if test "$have_dl" = yes; then CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="-rdynamic" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=":" else AC_CHECK_HEADER(dld.h, [ CMAKE_DL_LIBS="-ldld" - CMAKE_SHLIB_LINK_FLAGS=""]) + CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=""]) fi ;; CYGWIN_NT*) @@ -160,6 +184,8 @@ case $system in CMAKE_DL_LIBS="-lgdi32" CMAKE_SHLIB_SUFFIX=".dll" CMAKE_SHLIB_LINK_FLAGS="-shared" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; MP-RAS-02*) CMAKE_SHLIB_CFLAGS="-K PIC" @@ -167,6 +193,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; MP-RAS-*) CMAKE_SHLIB_CFLAGS="-K PIC" @@ -174,6 +202,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; NetBSD-*|FreeBSD-*) # Not available on all versions: check for include file. @@ -183,12 +213,16 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="-shared" + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=":" else CMAKE_SHLIB_CFLAGS="" CMAKE_SHLIB_LD_LIBS="" CMAKE_SHLIB_SUFFIX="..o" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" fi ;; NEXTSTEP-*) @@ -197,6 +231,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; OSF1-1.[012]) # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1 @@ -206,6 +242,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 @@ -214,6 +252,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; OSF1-V*) # Digital OSF/1 @@ -222,7 +262,9 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,"*"' - CMAKE_SHLIB_LINK_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='' + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," + CMAKE_SHLIB_RUNTIME_SEP=":" ;; RISCos-*) CMAKE_SHLIB_CFLAGS="-G 0" @@ -230,6 +272,8 @@ case $system in CMAKE_SHLIB_SUFFIX="..o" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, @@ -240,6 +284,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="-belf -Wl,-Bexport" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; SINIX*5.4*) CMAKE_SHLIB_CFLAGS="-K PIC" @@ -247,6 +293,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; SunOS-4*) CMAKE_SHLIB_CFLAGS="-PIC" @@ -254,7 +302,9 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-r -nostdlib' - CMAKE_SHLIB_LINK_FLAGS='-Wl,-L${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='' + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-R," + CMAKE_SHLIB_RUNTIME_SEP=":" ;; SunOS-5*) CMAKE_SHLIB_CFLAGS="-KPIC" @@ -262,10 +312,14 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_BUILD_FLAGS='-G' - CMAKE_SHLIB_LINK_FLAGS='-R ${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='' + CMAKE_SHLIB_RUNTIME_FLAG="-R " + CMAKE_SHLIB_RUNTIME_SEP=":" if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then CMAKE_SHLIB_BUILD_FLAGS='-Wl,-G' - CMAKE_SHLIB_LINK_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + CMAKE_SHLIB_LINK_FLAGS='' + CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-R," + CMAKE_SHLIB_RUNTIME_SEP=":" fi ;; ULTRIX-4.*) @@ -274,6 +328,8 @@ case $system in CMAKE_SHLIB_LD_LIBS="" CMAKE_DL_LIBS="" CMAKE_SHLIB_LINK_FLAGS="-Wl,-D,08000000" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; UNIX_SV*) CMAKE_SHLIB_CFLAGS="-K PIC" @@ -281,6 +337,8 @@ case $system in CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="-ldl" CMAKE_SHLIB_LINK_FLAGS="-Wl,-Bexport" + CMAKE_SHLIB_RUNTIME_FLAG="" + CMAKE_SHLIB_RUNTIME_SEP="" ;; esac export CMAKE_SHLIB_SUFFIX @@ -309,6 +367,8 @@ AC_SUBST(CMAKE_LIB_EXT) AC_SUBST(CMAKE_DL_LIBS) AC_SUBST(CMAKE_SHLIB_LD_LIBS) AC_SUBST(CMAKE_SHLIB_SUFFIX) +AC_SUBST(CMAKE_SHLIB_RUNTIME_FLAG) +AC_SUBST(CMAKE_SHLIB_RUNTIME_SEP) ########################## |