Skip to content

Commit

Permalink
Adding new configure flag --enable-all-static.
Browse files Browse the repository at this point in the history
This passes -all-static to the --mode=link invocations
of libtool and is required on the BG/Q system Mira to
force static linking.

Updating all Makefiles to set AM_LDFLAGS = $(libmesh_LDFLAGS).
  • Loading branch information
jwpeterson committed Sep 9, 2013
1 parent 2ffb39d commit cd4ae6d
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SUBDIRS = include #src
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(libmesh_CFLAGS)
AM_LDFLAGS = $(libmesh_LDFLAGS)

# AM_CPPFLAGS are method-independent cppflags that
# we use when compiling libmesh proper, or its utility
Expand Down
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ LIBMESH_SET_METHODS
#-----------------------------------------------------
LT_INIT([disable-static])


#-----------------------------------------------------
# See if the user requested --enable-all-static
#-----------------------------------------------------
AX_ALL_STATIC

# --------------------------------------------------------------
# Release versioning - after we find the C++ compiler
Expand Down
1 change: 1 addition & 0 deletions contrib/Make.common
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AUTOMAKE_OPTIONS = subdir-objects
AM_CPPFLAGS = $(pkg_cppflags) # any defined package-specific include paths
AM_CFLAGS =
AM_CXXFLAGS =
AM_LDFLAGS = $(libmesh_LDFLAGS)

######################################################################
#
Expand Down
4 changes: 4 additions & 0 deletions contrib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ devel_libs =
prof_libs =
oprof_libs =

# Doesn't seem to be used directly in this Makefile; add
# it in case someone includes this Makefile?
AM_LDFLAGS = $(libmesh_LDFLAGS)

if LIBMESH_INSTALL_INTERNAL_BOOST
SUBDIRS += boost/include
endif
Expand Down
1 change: 1 addition & 0 deletions examples/Make.common
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ AUTOMAKE_OPTIONS = subdir-objects
AM_CPPFLAGS = $(libmesh_optional_INCLUDES) -I$(top_builddir)/include
AM_CFLAGS = $(libmesh_CFLAGS)
AM_CXXFLAGS = $(libmesh_CXXFLAGS)
AM_LDFLAGS = $(libmesh_LDFLAGS)
LIBS = $(libmesh_optional_LIBS)

examples_source_path = $(top_srcdir)/examples
Expand Down
1 change: 1 addition & 0 deletions examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ AM_CPPFLAGS = $(libmesh_CPPFLAGS)
AM_CFLAGS = $(libmesh_CFLAGS)
AM_CXXFLAGS = $(libmesh_CXXFLAGS)
AM_CPPFLAGS += $(libmesh_optional_INCLUDES) -I$(top_builddir)/include
AM_LDFLAGS = $(libmesh_LDFLAGS)
LIBS = $(libmesh_optional_LIBS)

examples_source_path = $(top_srcdir)/examples
Expand Down
25 changes: 25 additions & 0 deletions m4/all_static.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Configure option to pass -all-static to libtool's link mode. So
# far, this was only required on the BG/Q machine Mira to get static
# linking to work. Off by default. Other than LDFLAGS, AM_LDFLAGS
# seems to be the only flag that makes it into the Makefile.in files
# after the --mode=link arguments to libtool.
AC_DEFUN([AX_ALL_STATIC],
[
AC_ARG_ENABLE(all-static,
[AC_HELP_STRING([--enable-all-static],[Pass -all-static to libtool's link mode])],
enableallstatic=$enableval,
enableallstatic=no)
if (test $enableallstatic = yes); then
if (test "x$libmesh_LDFLAGS" != x) ; then
# Append to whatever the user has for libmesh_LDFLAGS in their environment
libmesh_LDFLAGS="$libmesh_LDFLAGS -all-static"
else
# Set libmesh_LDFLAGS to -all-static
libmesh_LDFLAGS=-all-static
fi
# Substitute into Makefiles where relevant.
AC_SUBST(libmesh_LDFLAGS)
fi
])
1 change: 1 addition & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ AM_CFLAGS = $(libmesh_CFLAGS)
AM_CPPFLAGS = $(libmesh_optional_INCLUDES) -I$(top_builddir)/include \
$(libmesh_contrib_INCLUDES) $(CPPUNIT_CFLAGS) \
-DLIBMESH_IS_UNIT_TESTING
AM_LDFLAGS = $(libmesh_LDFLAGS)
LIBS = $(libmesh_optional_LIBS) $(CPPUNIT_LIBS)

unit_tests_sources = \
Expand Down

0 comments on commit cd4ae6d

Please sign in to comment.