Commit e04534e4 authored by Lynn Garren's avatar Lynn Garren

improve build of shared libraries

parent 039b1338
......@@ -176,8 +176,11 @@ g++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -198,30 +201,42 @@ g++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
g++4)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
c++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -242,8 +257,11 @@ c++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
icc)
......@@ -325,6 +343,13 @@ AC_SUBST(SHEXT)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
# ----------------------------------------------------------------------
# Check for supported link flags
# ----------------------------------------------------------------------
AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"])
AC_SUBST(MY_SHEXTRA)
# ----------------------------------------------------------------------
# Set system-dependent options:
# ----------------------------------------------------------------------
......
......@@ -20,7 +20,7 @@ else
lib_shared = libCLHEP-Cast-@VERSION@.$(SHEXT)
endif
SHFLAGS = @MY_SHFLAGS@
SHLINK = @MY_SHLINK@
SHLINK = @MY_SHLINK@ @MY_SHEXTRA@
SHNAME = @MY_SHNAME@
endif
if BUILD_STATIC
......
2009-06-30 Lynn Garren <garren@fnal.gov>
* configure.in, */configure.in, */src/Makefile.am: Make sure that
the shared library build picks up package dependencies.
==============================
18.11.08 Release CLHEP-2.0.4.2
==============================
......
......@@ -178,8 +178,11 @@ g++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -200,30 +203,42 @@ g++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
g++4)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
c++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -244,8 +259,11 @@ c++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
icc)
......@@ -327,6 +345,13 @@ AC_SUBST(SHEXT)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
# ----------------------------------------------------------------------
# Check for supported link flags
# ----------------------------------------------------------------------
AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"])
AC_SUBST(MY_SHEXTRA)
# ----------------------------------------------------------------------
# Set system-dependent options:
# ----------------------------------------------------------------------
......
......@@ -22,7 +22,7 @@ else
lib_shared = libCLHEP-Evaluator-@VERSION@.$(SHEXT)
endif
SHFLAGS = @MY_SHFLAGS@
SHLINK = @MY_SHLINK@
SHLINK = @MY_SHLINK@ @MY_SHEXTRA@
SHNAME = @MY_SHNAME@
endif
if BUILD_STATIC
......
......@@ -186,8 +186,11 @@ g++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -208,30 +211,42 @@ g++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
g++4)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
c++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -252,8 +267,11 @@ c++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
icc)
......@@ -337,6 +355,13 @@ AC_SUBST(SHEXT)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
# ----------------------------------------------------------------------
# Check for supported link flags
# ----------------------------------------------------------------------
AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"])
AC_SUBST(MY_SHEXTRA)
# ----------------------------------------------------------------------
# Set system-dependent options:
# ----------------------------------------------------------------------
......
......@@ -22,11 +22,15 @@ if BUILD_SHARED
shareddir = shared
if BUILD_VISUAL
lib_shared = CLHEP-Exceptions-@VERSION@.$(SHEXT)
LDADD = ${top_builddir}/../Cast/src/CLHEP-Cast-@VERSION@.$(SHEXT) \
${top_builddir}/../RefCount/src/CLHEP-RefCount-@VERSION@.$(SHEXT)
else
lib_shared = libCLHEP-Exceptions-@VERSION@.$(SHEXT)
LDADD = ${top_builddir}/../Cast/src/libCLHEP-Cast-@VERSION@.$(SHEXT) \
${top_builddir}/../RefCount/src/libCLHEP-RefCount-@VERSION@.$(SHEXT)
endif
SHFLAGS = @MY_SHFLAGS@
SHLINK = @MY_SHLINK@
SHLINK = @MY_SHLINK@ @MY_SHEXTRA@
SHNAME = @MY_SHNAME@
endif
if BUILD_STATIC
......@@ -42,13 +46,13 @@ $(shareddir):
if BUILD_VISUAL
$(lib_shared): $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS)
$(SHLINK) $(SHNAME)$@ $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS)
$(SHLINK) $(SHNAME)$@ $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS) $(LDADD)
$(shareddir)/%.$(OBJEXT): %.cc
$(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $<
else
$(lib_shared): $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS)
$(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS) -o $@
$(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Exceptions_@VERSION@_so_OBJECTS) $(LDADD) -o $@
$(shareddir)/%.$(OBJEXT): %.cc
$(CXXCOMPILE) $(SHFLAGS) -c -o $@ $<
......
......@@ -178,8 +178,11 @@ g++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -200,30 +203,42 @@ g++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
g++4)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
c++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -244,8 +259,11 @@ c++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
icc)
......@@ -327,6 +345,13 @@ AC_SUBST(SHEXT)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
# ----------------------------------------------------------------------
# Check for supported link flags
# ----------------------------------------------------------------------
AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"])
AC_SUBST(MY_SHEXTRA)
# ----------------------------------------------------------------------
# Set system-dependent options:
# ----------------------------------------------------------------------
......
......@@ -90,7 +90,7 @@ else
lib_shared = libCLHEP-GenericFunctions-@VERSION@.$(SHEXT)
endif
SHFLAGS = @MY_SHFLAGS@
SHLINK = @MY_SHLINK@
SHLINK = @MY_SHLINK@ @MY_SHEXTRA@
SHNAME = @MY_SHNAME@
endif
if BUILD_STATIC
......
......@@ -179,8 +179,11 @@ g++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -201,30 +204,42 @@ g++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
g++4)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
c++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -245,8 +260,11 @@ c++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
icc)
......@@ -328,6 +346,13 @@ AC_SUBST(SHEXT)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
# ----------------------------------------------------------------------
# Check for supported link flags
# ----------------------------------------------------------------------
AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"])
AC_SUBST(MY_SHEXTRA)
# ----------------------------------------------------------------------
# Set system-dependent options:
# ----------------------------------------------------------------------
......
......@@ -21,11 +21,13 @@ if BUILD_SHARED
shareddir = shared
if BUILD_VISUAL
lib_shared = CLHEP-Geometry-@VERSION@.$(SHEXT)
LDADD = ${top_builddir}/../Vector/src/CLHEP-Vector-@VERSION@.$(SHEXT)
else
lib_shared = libCLHEP-Geometry-@VERSION@.$(SHEXT)
LDADD = ${top_builddir}/../Vector/src/libCLHEP-Vector-@VERSION@.$(SHEXT)
endif
SHFLAGS = @MY_SHFLAGS@
SHLINK = @MY_SHLINK@
SHLINK = @MY_SHLINK@ @MY_SHEXTRA@
SHNAME = @MY_SHNAME@
endif
if BUILD_STATIC
......@@ -41,13 +43,13 @@ $(shareddir):
if BUILD_VISUAL
$(lib_shared): $(libCLHEP_Geometry_@VERSION@_so_OBJECTS)
$(SHLINK) $(SHNAME)$@ $(libCLHEP_Geometry_@VERSION@_so_OBJECTS)
$(SHLINK) $(SHNAME)$@ $(libCLHEP_Geometry_@VERSION@_so_OBJECTS) $(LDADD)
$(shareddir)/%.$(OBJEXT): %.cc
$(CXXCOMPILE) $(SHFLAGS) /c /Fo$@ $<
else
$(lib_shared): $(libCLHEP_Geometry_@VERSION@_so_OBJECTS)
$(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Geometry_@VERSION@_so_OBJECTS) -o $@
$(CXXLINK) $(SHLINK) $(SHNAME)$@ $(libCLHEP_Geometry_@VERSION@_so_OBJECTS) $(LDADD) -o $@
$(shareddir)/%.$(OBJEXT): %.cc
$(CXXCOMPILE) $(SHFLAGS) -c -o $@ $<
......
......@@ -186,8 +186,11 @@ g++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -208,30 +211,42 @@ g++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
g++4)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
c++)
case "$target" in
*-*-linux*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
;;
*-*-darwin*)
......@@ -252,8 +267,11 @@ c++)
;;
*)
AM_CXXFLAGS="-O -ansi -pedantic -Wall"
MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
MY_SHFLAGS="-fPIC -DPIC"
MY_SHLINK="-shared -Wl,--no-undefined"
MY_SHNAME="-Wl,-soname,"
MY_LD="-Wl,--rpath -Wl,"
SHEXT=so
AR="ar"; ARFLAGS="cru"
esac;;
icc)
......@@ -335,6 +353,14 @@ AC_SUBST(SHEXT)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
# ----------------------------------------------------------------------
# Check for supported link flags
# ----------------------------------------------------------------------
AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"])
AC_SUBST(MY_SHEXTRA)
# ----------------------------------------------------------------------