Commit d1413272 authored by Pavan Balaji's avatar Pavan Balaji
Browse files

Added support for static compilation.



If the user passes the -static flag, we disable interlibrary
dependencies, since the linker would pick the static versions of the
libraries in that case.

We are still making an assumption that the default mode of the linker
is shared, and the user can specify static library builds with
-static.  However, this is not always true.  On BG/Q, for example, the
default is static.

Fixes #2190.
Signed-off-by: Kenneth Raffenetti's avatarKen Raffenetti <raffenet@mcs.anl.gov>
parent 90100837
......@@ -86,6 +86,7 @@ fi
linking=yes
allargs=("$@")
argno=0
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
......@@ -99,6 +100,9 @@ for arg in "$@" ; do
# ----------------------------------------------------------------
# Options that control how we use mpicc (e.g., -show,
# -cc=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
......@@ -208,7 +212,7 @@ final_cflags="@MPICH_MPICC_CFLAGS@ @WRAPPER_CFLAGS@"
final_cppflags="@MPICH_MPICC_CPPFLAGS@ @WRAPPER_CPPFLAGS@"
final_ldflags="@MPICH_MPICC_LDFLAGS@"
final_libs="@MPICH_MPICC_LIBS@"
if test "@INTERLIB_DEPS@" = "no" ; then
if test "@INTERLIB_DEPS@" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="$ldflags @LDFLAGS@ @WRAPPER_LDFLAGS@"
final_libs="$libs @LIBS@ @WRAPPER_LIBS@"
fi
......
......@@ -85,6 +85,7 @@ fi
linking=yes
allargs=""
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
......@@ -99,6 +100,9 @@ for arg in "$@" ; do
# ----------------------------------------------------------------
# Options that control how we use mpicc (e.g., -show,
# -cc=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
......@@ -217,7 +221,7 @@ final_cflags="@MPICH_MPICC_CFLAGS@ @WRAPPER_CFLAGS@"
final_cppflags="@MPICH_MPICC_CPPFLAGS@ @WRAPPER_CPPFLAGS@"
final_ldflags="@MPICH_MPICC_LDFLAGS@"
final_libs="@MPICH_MPICC_LIBS@"
if test "@INTERLIB_DEPS@" = "no" ; then
if test "@INTERLIB_DEPS@" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="$ldflags @LDFLAGS@ @WRAPPER_LDFLAGS@"
final_libs="$libs @LIBS@ @WRAPPER_LIBS@"
fi
......
......@@ -83,6 +83,7 @@ fi
linking=yes
allargs=("$@")
argno=0
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
......@@ -96,6 +97,9 @@ for arg in "$@" ; do
# ----------------------------------------------------------------
# Options that control how we use mpicxx (e.g., -show,
# -cxx=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
......@@ -214,7 +218,7 @@ final_cxxflags="@MPICH_MPICXX_CXXFLAGS@ @WRAPPER_CXXFLAGS@"
final_cppflags="@MPICH_MPICXX_CPPFLAGS@ @WRAPPER_CPPFLAGS@"
final_ldflags="@MPICH_MPICXX_LDFLAGS@"
final_libs="@MPICH_MPICXX_LIBS@"
if test "@INTERLIB_DEPS@" = "no" ; then
if test "@INTERLIB_DEPS@" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="$ldflags @LDFLAGS@ @WRAPPER_LDFLAGS@"
final_libs="$libs @LIBS@ @WRAPPER_LIBS@"
fi
......
......@@ -82,6 +82,7 @@ fi
linking=yes
allargs=""
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
......@@ -96,6 +97,9 @@ for arg in "$@" ; do
# ----------------------------------------------------------------
# Options that control how we use mpicxx (e.g., -show,
# -cxx=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
......@@ -223,7 +227,7 @@ final_cxxflags="@MPICH_MPICXX_CXXFLAGS@ @WRAPPER_CXXFLAGS@"
final_cppflags="@MPICH_MPICXX_CPPFLAGS@ @WRAPPER_CPPFLAGS@"
final_ldflags="@MPICH_MPICXX_LDFLAGS@"
final_libs="@MPICH_MPICXX_LIBS@"
if test "@INTERLIB_DEPS@" = "no" ; then
if test "@INTERLIB_DEPS@" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="$ldflags @LDFLAGS@ @WRAPPER_LDFLAGS@"
final_libs="$libs @LIBS@ @WRAPPER_LIBS@"
fi
......
......@@ -90,6 +90,7 @@ linking=yes
allargs=("$@")
argno=0
cppflags=()
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
......@@ -103,6 +104,9 @@ for arg in "$@" ; do
# ----------------------------------------------------------------
# Options that control how we use mpif77 (e.g., -show,
# -f77=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
......@@ -265,7 +269,7 @@ fi
final_fflags="@MPICH_MPIF77_FFLAGS@ @WRAPPER_FFLAGS@"
final_ldflags="@MPICH_MPIF77_LDFLAGS@"
final_libs="@MPICH_MPIF77_LIBS@"
if test "@INTERLIB_DEPS@" = "no" ; then
if test "@INTERLIB_DEPS@" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="$ldflags @LDFLAGS@ @WRAPPER_LDFLAGS@"
final_libs="$libs @LIBS@ @WRAPPER_LIBS@"
fi
......
......@@ -88,6 +88,7 @@ fi
linking=yes
allargs=""
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
......@@ -102,6 +103,9 @@ for arg in "$@" ; do
# ----------------------------------------------------------------
# Options that control how we use mpif77 (e.g., -show,
# -f77=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
......@@ -287,7 +291,7 @@ fi
final_fflags="@MPICH_MPIF77_FFLAGS@ @WRAPPER_FFLAGS@"
final_ldflags="@MPICH_MPIF77_LDFLAGS@"
final_libs="@MPICH_MPIF77_LIBS@"
if test "@INTERLIB_DEPS@" = "no" ; then
if test "@INTERLIB_DEPS@" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="$ldflags @LDFLAGS@ @WRAPPER_LDFLAGS@"
final_libs="$libs @LIBS@ @WRAPPER_LIBS@"
fi
......
......@@ -103,6 +103,7 @@ linking=yes
allargs=("$@")
argno=0
cppflags=()
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
......@@ -116,6 +117,9 @@ for arg in "$@" ; do
# ----------------------------------------------------------------
# Options that control how we use mpifort (e.g., -show,
# -fc=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
......@@ -306,7 +310,7 @@ fi
final_fcflags="@MPICH_MPIFORT_FCFLAGS@ @WRAPPER_FCFLAGS@"
final_ldflags="@MPICH_MPIFORT_LDFLAGS@"
final_libs="@MPICH_MPIFORT_LIBS@"
if test "@INTERLIB_DEPS@" = "no" ; then
if test "@INTERLIB_DEPS@" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="$ldflags @LDFLAGS@ @WRAPPER_LDFLAGS@"
final_libs="$libs @LIBS@ @WRAPPER_LIBS@"
fi
......
......@@ -101,6 +101,7 @@ fi
#
linking=yes
allargs=""
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
......@@ -115,6 +116,9 @@ for arg in "$@" ; do
# ----------------------------------------------------------------
# Options that control how we use mpifort (e.g., -show,
# -fc=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
......@@ -323,7 +327,7 @@ fi
final_fcflags="@MPICH_MPIFORT_FCFLAGS@ @WRAPPER_FCFLAGS@"
final_ldflags="@MPICH_MPIFORT_LDFLAGS@"
final_libs="@MPICH_MPIFORT_LIBS@"
if test "@INTERLIB_DEPS@" = "no" ; then
if test "@INTERLIB_DEPS@" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="$ldflags @LDFLAGS@ @WRAPPER_LDFLAGS@"
final_libs="$libs @LIBS@ @WRAPPER_LIBS@"
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment