BUG: SHLIB_LINK was being used when linking static executables. Missing comma

in RUNTIME_FLAG for IRIX.
ENH: User supplied SHLIB_CFLAGS (-fPIC, etc) will override configure detected
flags
This commit is contained in:
Amitha Perera 2001-06-12 14:15:22 -04:00
parent 583ac25e8f
commit 918c8c4f3a
3 changed files with 50 additions and 32 deletions

View File

@ -405,6 +405,8 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
if(outputRuntime && runtimeDirs.size()>0)
{
// For the runtime search directories, do a "-Wl,-rpath,a:b:c" or
// a "-R a -R b -R c" type link line
fout << runtimeFlag;
std::vector<std::string>::iterator itr = runtimeDirs.begin();
fout << *itr;
@ -427,6 +429,8 @@ void cmUnixMakefileGenerator::OutputLinkLibraries(std::ostream& fout,
void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
{
bool dll = cmCacheManager::GetInstance()->IsOn("BUILD_SHARED_LIBS");
// for each target
const cmTargets &tgts = m_Makefile->GetTargets();
for(cmTargets::const_iterator l = tgts.begin();
@ -459,8 +463,12 @@ void cmUnixMakefileGenerator::OutputTargets(std::ostream& fout)
{
fout << l->first << ": ${" <<
l->first << "_SRC_OBJS} ${CMAKE_DEPEND_LIBS}\n";
fout << "\t${CMAKE_CXX_COMPILER} ${CMAKE_SHLIB_LINK_FLAGS} ${CMAKE_CXXFLAGS} ${" <<
l->first << "_SRC_OBJS} ";
fout << "\t${CMAKE_CXX_COMPILER} ";
if (dll)
{
fout << "${CMAKE_SHLIB_LINK_FLAGS} ";
}
fout << "${CMAKE_CXXFLAGS} ${" << l->first << "_SRC_OBJS} ";
this->OutputLinkLibraries(fout, NULL,l->second);
fout << " -o " << l->first << "\n\n";
}

57
Templates/configure vendored
View File

@ -2312,7 +2312,7 @@ fi
CMAKE_SHLIB_SUFFIX=".so"
CMAKE_DL_LIBS=""
CMAKE_SHLIB_BUILD_FLAGS="-shared -rdata_shared"
CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath"
CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
CMAKE_SHLIB_RUNTIME_SEP=":"
;;
Linux*)
@ -2394,11 +2394,12 @@ fi
NetBSD-*|FreeBSD-*)
# Not available on all versions: check for include file.
if test -f /usr/include/dlfcn.h; then
CMAKE_SHLIB_CFLAGS="-fpic"
CMAKE_SHLIB_CFLAGS="-fPIC"
CMAKE_SHLIB_LD_LIBS=""
CMAKE_SHLIB_SUFFIX=".so"
CMAKE_DL_LIBS=""
CMAKE_SHLIB_LINK_FLAGS="-shared"
CMAKE_SHLIB_BUILD_FLAGS="-shared"
CMAKE_SHLIB_LINK_FLAGS=""
CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
CMAKE_SHLIB_RUNTIME_SEP=":"
else
@ -2542,7 +2543,11 @@ case $system in
;;
esac
CMAKE_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
# If the user has supplied C flags for compiling shared objects, use
# those instead
if test "${SHLIB_CFLAGS}" != ""; then
CMAKE_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
fi
CMAKE_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
@ -2591,17 +2596,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:2595: checking for $ac_hdr" >&5
echo "configure:2600: 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 2600 "configure"
#line 2605 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2610: \"$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*
@ -2646,17 +2651,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:2650: checking for $ac_hdr" >&5
echo "configure:2655: 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 2655 "configure"
#line 2660 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2665: \"$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*
@ -2685,7 +2690,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:2689: checking for pthread_create in -lpthreads" >&5
echo "configure:2694: 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
@ -2693,7 +2698,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthreads $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2697 "configure"
#line 2702 "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
@ -2704,7 +2709,7 @@ int main() {
pthread_create()
; return 0; }
EOF
if { (eval echo configure:2708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2713: \"$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
@ -2725,7 +2730,7 @@ else
fi
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:2729: checking for pthread_create in -lpthread" >&5
echo "configure:2734: 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
@ -2733,7 +2738,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2737 "configure"
#line 2742 "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
@ -2744,7 +2749,7 @@ int main() {
pthread_create()
; return 0; }
EOF
if { (eval echo configure:2748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2753: \"$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
@ -2767,7 +2772,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:2771: checking for thr_create in -lthread" >&5
echo "configure:2776: 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
@ -2775,7 +2780,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lthread $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2779 "configure"
#line 2784 "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
@ -2786,7 +2791,7 @@ int main() {
thr_create()
; return 0; }
EOF
if { (eval echo configure:2790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2795: \"$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
@ -2809,7 +2814,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:2813: checking for thr_create in -lthread" >&5
echo "configure:2818: 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
@ -2817,7 +2822,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lthread $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2821 "configure"
#line 2826 "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
@ -2828,7 +2833,7 @@ int main() {
thr_create()
; return 0; }
EOF
if { (eval echo configure:2832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2837: \"$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
@ -2930,7 +2935,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:2934: checking ansi standard C++ stream headers " >&5
echo "configure:2939: checking ansi standard C++ stream headers " >&5
echo "******"
rm -rf conftest.*
cat > conftest.cc <<!
@ -2951,7 +2956,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:2955: checking ansi standard namespace support " >&5
echo "configure:2960: checking ansi standard namespace support " >&5
rm -rf conftest.*
cat > conftest.cc <<!
#include <list>
@ -2979,7 +2984,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:2983: checking for $ac_word" >&5
echo "configure:2988: 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
@ -3019,7 +3024,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:3023: checking for $ac_word" >&5
echo "configure:3028: 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

View File

@ -158,7 +158,7 @@ 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_FLAG="-Wl,-rpath,"
CMAKE_SHLIB_RUNTIME_SEP=":"
;;
Linux*)
@ -208,11 +208,12 @@ case $system in
NetBSD-*|FreeBSD-*)
# Not available on all versions: check for include file.
if test -f /usr/include/dlfcn.h; then
CMAKE_SHLIB_CFLAGS="-fpic"
CMAKE_SHLIB_CFLAGS="-fPIC"
CMAKE_SHLIB_LD_LIBS=""
CMAKE_SHLIB_SUFFIX=".so"
CMAKE_DL_LIBS=""
CMAKE_SHLIB_LINK_FLAGS="-shared"
CMAKE_SHLIB_BUILD_FLAGS="-shared"
CMAKE_SHLIB_LINK_FLAGS=""
CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath,"
CMAKE_SHLIB_RUNTIME_SEP=":"
else
@ -356,7 +357,11 @@ case $system in
;;
esac
CMAKE_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
# If the user has supplied C flags for compiling shared objects, use
# those instead
if test "${SHLIB_CFLAGS}" != ""; then
CMAKE_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
fi
CMAKE_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"