1# --------------------------------------------------------------
2# configure.ac file for libmesh.  Used by Automake to generate
3# aclocal.m4 and Makefile.in. See also: http://tinyurl.com/hatuyfn
4# --------------------------------------------------------------
5AC_INIT([libmesh], [1.6.2], [libmesh-users@lists.sourceforge.net], [libmesh], [http://libmesh.github.io])
6AC_PREREQ([2.69])
7
8# by default CFLAGS and CXXFLAGS are set to '-g -O2' on systems that support them.
9# this causes a problem if we then declare a different optimization level. So
10# default them to empty, regardless of what the system supports.
11: ${CFLAGS=""}
12: ${CXXFLAGS=""}
13
14# Infer the source directory as the path to the ./configure script
15srcdir=`dirname $0`
16top_srcdir=`dirname $0`
17
18
19AC_MSG_RESULT(---------------------------------------------)
20AC_MSG_RESULT(----------- Configuring libMesh -------------)
21AC_MSG_RESULT(---------------------------------------------)
22
23AC_CONFIG_AUX_DIR([build-aux])
24AC_CONFIG_MACRO_DIR([m4])
25
26# --------------------------------------------------------------
27# Compute the canonical target system type variable "target", and its
28# three individual parts: "target_cpu", "target_vendor", and "target_os"
29# --------------------------------------------------------------
30AC_CANONICAL_TARGET
31
32AC_CONFIG_FILES([Makefile
33                 include/Makefile
34                 include/libmesh/Makefile
35                 contrib/Makefile
36                 contrib/utils/Makefile
37                 contrib/utils/Make.common
38                 tests/Makefile
39                 contrib/utils/libmesh-opt.pc
40                 contrib/utils/libmesh-dbg.pc
41                 contrib/utils/libmesh-devel.pc
42                 contrib/utils/libmesh-prof.pc
43                 contrib/utils/libmesh-oprof.pc
44                 doc/Doxyfile
45                 doc/Makefile
46                 doc/html/Makefile
47                 ])
48
49AC_CONFIG_FILES(contrib/bin/libmesh-config,          [chmod +x contrib/bin/libmesh-config])
50#AC_CONFIG_FILES(contrib/bin/strip_dup_libs.pl,       [chmod +x contrib/bin/strip_dup_libs.pl])
51#AC_CONFIG_FILES(contrib/bin/strip_dup_incl_paths.pl, [chmod +x contrib/bin/strip_dup_incl_paths.pl])
52AC_CONFIG_FILES(contrib/bin/create_libmesh_release,  [chmod +x contrib/bin/create_libmesh_release])
53AC_CONFIG_FILES(doc/dot,                             [chmod +x doc/dot])
54AC_CONFIG_FILES(tests/run_unit_tests.sh,             [chmod +x tests/run_unit_tests.sh])
55
56# Create a temporary file with e.g. HAVE_MPI
57AC_CONFIG_HEADER(include/libmesh_config.h.tmp:include/libmesh_config.h.in)
58# Prefixes everything in the temporary file with LIBMESH_, e.g. LIBMESH_HAVE_MPI
59AX_PREFIX_CONFIG_H(include/libmesh_config.h,LIBMESH,include/libmesh_config.h.tmp)
60
61# Print configuration info to the header file
62AC_DEFINE_UNQUOTED(CONFIGURE_INFO, ["$0 $ac_configure_args"], [Configuration information.])
63
64# require automake 1.11 - color tests
65AM_INIT_AUTOMAKE([dist-xz dist-bzip2 tar-ustar color-tests serial-tests 1.12])
66
67# use silent rules - automake 1.11
68AM_SILENT_RULES(yes)
69
70# We originally passed [enable] to AM_MAINTAINER_MODE, but this caused
71# ordinary users to have to configure with --disable-maintainer-mode,
72# which is easy to forget unless you are closely following the
73# instructions, or are aware of the issue and have run the provided
74# ./bootstrap script.
75#
76# We've now switched this to simply AM_MAINTAINER_MODE with no
77# arguments, which is equivalent to AM_MAINTAINER_MODE([disable]).  In
78# this configuration, developers who modify Makefile.am files (or
79# other build system files) *must* configure with
80# --enable-maintainer-mode in order for dependent files (Makefile.in,
81# etc) to be properly rebuilt whenever changes to the build system are
82# made.
83#
84# Note that this approach is not without its drawbacks and detractors:
85# https://blogs.gnome.org/desrt/2011/09/08/am_maintainer_mode-is-not-cool
86# https://www.gnu.org/software/automake/manual/html_node/maintainer_002dmode.html
87# but the benefit is that casual and first-time users are not
88# surprised by the default behavior of simply running ./configure.
89#
90# Note that we also do things a bit differently than most other
91# projects regarding the number of auto-generated build files
92# (Makefile.in) that are checked in, and it seems like the new
93# approach makes more sense for the way our project works --
94# rebuilding the build files are not part of a normal build for most
95# users.
96AM_MAINTAINER_MODE
97
98
99# --------------------------------------------------------------
100# Determine if we are doing a local or VPATH build. In the case
101# of the latter we will need to go through some extra effort to
102# create links for the example source files.
103# --------------------------------------------------------------
104AC_CHECK_FILE(src/base/libmesh.C, [libmesh_vpath_build=no], [libmesh_vpath_build=yes])
105AS_IF([test $libmesh_vpath_build = yes],
106      [AC_MSG_RESULT(<<< Configuring build directory for VPATH build >>>)])
107AM_CONDITIONAL(LIBMESH_VPATH_BUILD, test x$libmesh_vpath_build = xyes)
108
109# --------------------------------------------------------------
110# Do compilation tests using the compiler, preprocessor, and file extensions
111# of C++.  This uses the .C extension for test programs.
112# --------------------------------------------------------------
113AC_LANG([C++])
114
115# -------------------------------------------------------------
116# Perl - look for perl.  Perl is used to generate dependencies.  We
117# also use it to (optionally) parse compiler version strings, so $PERL
118# needs to be set before LIBMESH_SET_COMPILERS is called.
119# -------------------------------------------------------------
120AC_PATH_PROG(PERL, perl)
121AC_SUBST(PERL)
122
123#--------------------------------------------------------------------
124# Check for whether to enable MPI and PETSc which will influence our
125# choice of compiler
126#--------------------------------------------------------------------
127ACSM_COMPILER_CONTROL_ARGS
128
129#-----------------------------------------------------------------------
130# Scrape PETSc configure information for their CXX, MPI_INCLUDE, MPI_LIB,
131# PETSCLINKLIBS, PETSCINCLUDEDIRS, and other variables
132#-----------------------------------------------------------------------
133ACSM_SCRAPE_PETSC_CONFIGURE
134
135# --------------------------------------------------------------
136# Set our preferred compilers
137# --------------------------------------------------------------
138LIBMESH_SET_COMPILERS
139
140# By default we do not set any -march flag, but this can be turned on
141# by configuring with --enable-march
142AC_ARG_ENABLE(march,
143              AC_HELP_STRING([--enable-march],
144                             [Determine the correct -march flag for this system]),
145              [AS_CASE("${enableval}",
146                       [yes], [enablemarch=yes],
147                       [no],  [enablemarch=no],
148                       [AC_MSG_ERROR(bad value ${enableval} for --enable-march)])],
149              [enablemarch=no])
150
151# Set the value of the cache variable $ax_cv_gcc_archflag based
152# on the current architecture. For the first argument:
153# [yes] = generate portable code (-mtune)
154# [no]  = generate architecture-specific code (-march)
155# This script is specifc to GCC; the flags it determines might not
156# work for other compilers. There is also an optional third
157# argument which controls what happens when determining an arch flag
158# fails, we don't do anything in that case.
159AS_IF([test "x$enablemarch" != "xno"],
160      [
161        AX_GCC_ARCHFLAG([no],
162                        [
163                          dnl Action if success - append $ax_cv_gcc_archflag to CXXFLAGS flags for
164                          dnl all but debugging METHODS. I don't think it is needed with -O0 when
165                          dnl debugging.
166                          CXXFLAGS_OPT="$CXXFLAGS_OPT $ax_cv_gcc_archflag"
167                          CXXFLAGS_DEVEL="$CXXFLAGS_DEVEL $ax_cv_gcc_archflag"
168                          CXXFLAGS_PROF="$CXXFLAGS_PROF $ax_cv_gcc_archflag"
169                          CXXFLAGS_OPROF="$CXXFLAGS_OPROF $ax_cv_gcc_archflag"
170                        ])
171      ])
172
173# --------------------------------------------------------------
174# Allow the user to explicitly turn off C++11 support by saying
175# --disable-cxx11?  This is no longer supported.
176#
177# We'll leave the "option" in place for a release, though, just in
178# case anyone is specifying --enable-cxx11 in their build scripts
179# --------------------------------------------------------------
180AC_ARG_ENABLE(cxx11,
181              AC_HELP_STRING([--disable-cxx11],
182                             [build without C++11 support (no longer supported!)]),
183              [AS_CASE("${enableval}",
184                       [yes], [enablecxx11=yes],
185                       [no],  [AC_MSG_ERROR(libMesh now requires C++11)],
186                       [AC_MSG_ERROR(bad value ${enableval} for --disable-cxx11)])],
187              [enablecxx11=irrelevant])
188
189AS_IF([test $enablecxx11 != irrelevant],
190      [AC_MSG_WARN([--enable/disable-cxx11 are now deprecated])])
191enablecxx11=yes
192
193# --------------------------------------------------------------
194# Setting --enable-cxx11-required causes an error to be emitted during
195# configure if the compiler does not support a specific subset of
196# C++11 features.  This is useful for app codes which require C++11,
197# since it prevents situations where libmesh is built without C++11
198# support (which may take a very long time), and then the app fails to
199# compile, requiring you to redo everything.
200# --------------------------------------------------------------
201AC_ARG_ENABLE(cxx11-required,
202              AC_HELP_STRING([--enable-cxx11-required],
203                             [Error if compiler does not support C++11]),
204              [AS_CASE("${enableval}",
205                       [yes], [cxx11required=yes],
206                       [no],  [cxx11required=no],
207                       [AC_MSG_ERROR(bad value ${enableval} for --enable-cxx11-required)])],
208              [cxx11required=irrelevant])
209
210AS_IF([test $cxx11required != irrelevant],
211      [AC_MSG_WARN([C++11 is now always required for libMesh])])
212
213# --------------------------------------------------------------
214# Standard autoconf macro for determining the proper -std=c++11
215# flag for the current compiler.  Adds the result to CXXFLAGS if
216# one is found.  See ax_cxx_compile_stdcxx_11.m4 for details.
217# --------------------------------------------------------------
218AX_CXX_COMPILE_STDCXX_11([],[mandatory])
219
220# --------------------------------------------------------------
221# See compiler.m4 for the definition of this function.  It uses the
222# output of DETERMINE_CXX_BRAND to set special flags for idiosyncratic
223# compilers.  For example, newer versions of GCC have additional C++ debugging
224# flags like _GLIBCXX_DEBUG_PEDANTIC which were not present in older versions.
225# --------------------------------------------------------------
226LIBMESH_SET_CXX_FLAGS
227
228#------------------------------------------------------
229# Checks for code coverage
230# this must be done after we look for our own compilers
231#------------------------------------------------------
232ACSM_CODE_COVERAGE
233libmesh_CFLAGS="$GCOV_FLAGS $libmesh_CFLAGS"
234libmesh_CXXFLAGS="$GCOV_FLAGS $libmesh_CXXFLAGS"
235
236#-----------------------------------------------------
237# Set compiler flags for devel, opt, etc. methods
238#-----------------------------------------------------
239LIBMESH_SET_METHODS
240
241AC_CONFIG_FILES([contrib/utils/libmesh.pc:$LIBMESH_PC_IN])
242
243# By default we merely enable some warnings, but we can turn those
244# into errors (for library code only, not contrib or external code)
245# by configuring with --enable-werror
246AC_ARG_ENABLE(werror,
247              AC_HELP_STRING([--enable-werror],
248                             [Turn compilation warnings into errors]),
249              [AS_CASE("${enableval}",
250                       [yes], [enablewerror=yes],
251                       [no],  [enablewerror=no],
252                       [AC_MSG_ERROR(bad value ${enableval} for --enable-werror)])],
253              [enablewerror=no])
254
255ANY_WERROR_FLAG=$WERROR_FLAGS
256AS_IF([test "x$enablewerror" != "xyes"],
257        [ANY_WERROR_FLAG=''
258         AC_MSG_RESULT(<<< Compiler warnings are just warnings >>>)],
259        [AX_CHECK_COMPILE_FLAG($WERROR_FLAGS,
260          [AC_MSG_RESULT(<<< Compiler warnings are now errors >>>)],
261          [ANY_WERROR_FLAG=''
262           AC_MSG_RESULT(<<< Compiler does not support $WERROR_FLAGS >>>)
263           AC_MSG_RESULT(<<< Compiler warnings are just warnings >>>)])])
264AC_SUBST(ANY_WERROR_FLAG)
265
266# By default we merely enable some of the most common compiler
267# warnings, but we can turn on as many warnings as we avoid triggering
268# (for library code only, not contrib or external code) by configuring
269# with --enable-paranoid-warnings
270AC_ARG_ENABLE(paranoid-warnings,
271              AC_HELP_STRING([--enable-paranoid-warnings],
272                             [Turn on paranoid compiler warnings]),
273              [AS_CASE("${enableval}",
274                       [yes], [enableparanoid=yes],
275                       [no],  [enableparanoid=no],
276                       [AC_MSG_ERROR(bad value ${enableval} for --enable-paranoid-warnings)])],
277              [enableparanoid=no])
278
279dnl Test paranoid warning flags with -Werror on so we can detect if
280dnl some are unrecognized
281ANY_PARANOID_FLAGS=$PARANOID_FLAGS
282AS_IF([test "x$enableparanoid" != "xyes"],
283        [ANY_PARANOID_FLAGS=''
284         AC_MSG_RESULT(<<< Disabling extra paranoid compiler warnings >>>)],
285        [old_CXXFLAGS="$CXXFLAGS"
286         CXXFLAGS="$CXXFLAGS $WERROR_FLAGS $PARANOID_FLAGS"
287         AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
288          [AC_MSG_RESULT(<<< Enabled extra paranoid compiler warnings >>>)],
289          [ANY_PARANOID_FLAGS=''
290           AC_MSG_RESULT(<<< Compiler may not support all of $PARANOID_FLAGS >>>)
291           AC_MSG_RESULT(<<< Disabling extra paranoid compiler warnings >>>)])
292         CXXFLAGS="$old_CXXFLAGS"])
293AC_SUBST(ANY_PARANOID_FLAGS)
294
295# --------------------------------------------------------------
296# Test for mandatory C++11 features, those which libMesh now requires
297# for internal use.
298# --------------------------------------------------------------
299LIBMESH_TEST_CXX11_AUTO
300AS_IF([test "x$have_cxx11_auto" != "xyes"],
301      [AC_MSG_ERROR([libMesh requires C++11 auto variable support])])
302
303LIBMESH_TEST_CXX11_RANGEFOR
304AS_IF([test "x$have_cxx11_rangefor" != "xyes"],
305      [AC_MSG_ERROR([libMesh requires C++11 ranged-for loop support])])
306
307# Technically we require uniform initialization, but this is the
308# closest test we have
309LIBMESH_TEST_CXX11_INITIALIZER_LIST
310AS_IF([test "x$have_cxx11_initializer_list" != "xyes"],
311      [AC_MSG_ERROR([libMesh requires C++11 initializer list support])])
312
313LIBMESH_TEST_CXX11_UNIQUE_PTR
314AS_IF([test "x$have_cxx11_unique_ptr" != "xyes"],
315      [AC_MSG_ERROR([libMesh requires C++11 std::unique_ptr support])])
316
317LIBMESH_TEST_CXX11_MAKE_UNIQUE_WORKAROUND
318AS_IF([test "x$have_cxx11_make_unique_workaround" != "xyes"],
319      [AC_MSG_ERROR([libMesh requires C++11 variadic template support])])
320
321LIBMESH_TEST_CXX11_TUPLE
322AS_IF([test "x$have_cxx11_tuple" != "xyes"],
323      [AC_MSG_ERROR([libMesh requires C++11 std::tuple support])])
324
325LIBMESH_TEST_CXX11_LAMBDA
326AS_IF([test "x$have_cxx11_lambda" != "xyes"],
327      [AC_MSG_ERROR([libMesh requires C++11 lambda support])])
328
329LIBMESH_TEST_CXX11_FIXED_TYPE_ENUM
330AS_IF([test "x$have_cxx11_fixed_type_enum" != "xyes"],
331      [AC_MSG_ERROR([libMesh requires C++11 fixed type enumeration support])])
332
333LIBMESH_TEST_CXX11_FIXED_TYPE_ENUM_FWD
334AS_IF([test "x$have_cxx11_fixed_type_enum_fwd" != "xyes"],
335      [AC_MSG_ERROR([libMesh requires C++11 fixed type enumeration forward declaration support])])
336
337LIBMESH_TEST_CXX11_OVERRIDE
338AS_IF([test "x$have_cxx11_override" != "xyes"],
339      [AC_MSG_ERROR([libMesh requires C++11 compiler support the override keyword])])
340
341LIBMESH_TEST_CXX11_MOVE_CONSTRUCTORS
342AS_IF([test "x$have_cxx11_move_constructors" != "xyes"],
343      [AC_MSG_ERROR([libMesh requires C++11 move constructor support])])
344
345LIBMESH_TEST_CXX11_DELETED_FUNCTIONS
346AS_IF([test "x$have_cxx11_deleted_functions" != "xyes"],
347      [AC_MSG_ERROR([libMesh requires C++11 deleted function support])])
348
349LIBMESH_TEST_CXX11_DEFAULTED_FUNCTIONS
350AS_IF([test "x$have_cxx11_defaulted_functions" != "xyes"],
351      [AC_MSG_ERROR([libMesh requires C++11 defaulted function support])])
352
353LIBMESH_TEST_CXX11_NULLPTR
354AS_IF([test "x$have_cxx11_nullptr" != "xyes"],
355      [AC_MSG_ERROR([libMesh requires the C++11 nullptr keyword])])
356
357LIBMESH_TEST_CXX11_FINAL
358AS_IF([test "x$have_cxx11_final" != "xyes"],
359      [AC_MSG_ERROR([libMesh requires the C++11 final keyword])])
360
361LIBMESH_TEST_CXX11_DECLTYPE
362AS_IF([test "x$have_cxx11_decltype" != "xyes"],
363      [AC_MSG_ERROR([libMesh requires the C++11 decltype keyword])])
364
365LIBMESH_TEST_CXX11_BEGIN_END
366AS_IF([test "x$have_cxx11_begin_end" != "xyes"],
367      [AC_MSG_ERROR([libMesh requires C++11 std::begin/end support])])
368
369LIBMESH_TEST_CXX11_CONTAINER_ERASE
370AS_IF([test "x$have_cxx11_container_erase" != "xyes"],
371      [AC_MSG_ERROR([libMesh requires C++11 support for std container erase() functions returning iterators])])
372
373LIBMESH_TEST_CXX11_CONTAINER_EMPLACE
374AS_IF([test "x$have_cxx11_container_emplace" != "xyes"],
375      [AC_MSG_ERROR([libMesh requires C++11 support for std container emplace() functions])])
376
377LIBMESH_TEST_CXX11_IOTA
378AS_IF([test "x$have_cxx11_iota" != "xyes"],
379      [AC_MSG_ERROR([libMesh requires C++11 support for std::iota])])
380
381LIBMESH_TEST_CXX11_VECTOR_DATA
382AS_IF([test "x$have_cxx11_vector_data" != "xyes"],
383      [AC_MSG_ERROR([libMesh requires C++11 support for std::vector::data()])])
384
385LIBMESH_TEST_CXX11_SHARED_PTR
386AS_IF([test "x$have_cxx11_shared_ptr" != "xyes"],
387      [AC_MSG_ERROR([libMesh requires C++11 support for std::shared_ptr])])
388
389LIBMESH_TEST_CXX11_RVALUE_REFERENCES
390AS_IF([test "x$have_cxx11_rvalue_references" != "xyes"],
391      [AC_MSG_ERROR([libMesh requires C++11 support for rvalue references])])
392
393LIBMESH_TEST_CXX11_TO_STRING
394AS_IF([test "x$have_cxx11_to_string" != "xyes"],
395      [AC_MSG_ERROR([libMesh requires C++11 support for std::to_string()])])
396
397LIBMESH_TEST_CXX11_CONSTEXPR
398AS_IF([test "x$have_cxx11_constexpr" != "xyes"],
399      [AC_MSG_ERROR([libMesh requires C++11 support for constexpr])])
400
401LIBMESH_TEST_CXX11_VARIADIC_TEMPLATES
402AS_IF([test "x$have_cxx11_variadic_templates" != "xyes"],
403      [AC_MSG_ERROR([libMesh requires C++11 support for variadic templates])])
404
405LIBMESH_TEST_CXX11_ALIAS_DECLARATIONS
406AS_IF([test "x$have_cxx11_alias_declarations" != "xyes"],
407      [AC_MSG_ERROR([libMesh requires C++11 support for alias declarations])])
408
409LIBMESH_TEST_CXX11_ARRAY
410AS_IF([test "x$have_cxx11_array" != "xyes"],
411      [AC_MSG_ERROR([libMesh requires C++11 support for std::array])])
412
413LIBMESH_TEST_CXX11_ISNAN_ISINF
414AS_IF([test "x$have_cxx11_isnan" != "xyes"],
415      [AC_MSG_ERROR([libMesh requires C++11 support for std::isnan])])
416AS_IF([test "x$have_cxx11_isinf" != "xyes"],
417      [AC_MSG_ERROR([libMesh requires C++11 support for std::isinf])])
418
419# --------------------------------------------------------------
420# Test for optional modern C++ features, which libMesh offers shims
421# for and/or which libMesh applications may want to selectively use.
422# --------------------------------------------------------------
423LIBMESH_TEST_CXX14_MAKE_UNIQUE
424LIBMESH_TEST_CXX11_REGEX
425LIBMESH_TEST_CXX11_THREAD
426LIBMESH_TEST_CXX11_CONDITION_VARIABLE
427LIBMESH_TEST_CXX11_TYPE_TRAITS
428LIBMESH_TEST_CXX11_MATH_FUNCS
429LIBMESH_TEST_CXX17_FALLTHROUGH_ATTRIBUTE
430
431#-----------------------------------------------------
432# Initialize libtool.  By default, we will build
433# only shared libraries on platforms that support them
434#-----------------------------------------------------
435LT_INIT([disable-static])
436
437#-----------------------------------------------------
438# See if the user requested --enable-all-static
439#-----------------------------------------------------
440AX_ALL_STATIC
441
442# --------------------------------------------------------------
443# Release versioning - after we find the C++ compiler
444# --------------------------------------------------------------
445AX_SPLIT_VERSION
446
447# Strip any '-pre' suffix from version; our code expects a number
448LIBMESH_NUMERIC_POINT_VERSION=`echo "$AX_POINT_VERSION" | $SED 's/-.*//'`
449
450AC_DEFINE_UNQUOTED(MAJOR_VERSION,            [$AX_MAJOR_VERSION],  [libMesh major version number])
451AC_DEFINE_UNQUOTED(MINOR_VERSION,            [$AX_MINOR_VERSION],  [libMesh minor version number])
452AC_DEFINE_UNQUOTED(MICRO_VERSION,            [$LIBMESH_NUMERIC_POINT_VERSION],  [libMesh micro version number])
453AC_DEFINE_UNQUOTED(LIB_VERSION,              ["$VERSION"],         [libMesh version number])
454AC_DEFINE_UNQUOTED(LIB_RELEASE,              ["$BUILD_DEVSTATUS"], [libMesh source code version])
455AC_DEFINE_UNQUOTED(CXX,                      ["$CXX"],             [C++ compiler])
456AC_DEFINE_UNQUOTED(IO_COMPATIBILITY_VERSION, ["0.7.4"],            [libMesh I/O file format compatibility string])
457
458
459
460# --------------------------------------------------------------
461# Portable symbolic links
462# --------------------------------------------------------------
463AC_PROG_LN_S
464# -------------------------------------------------------------
465
466# ---------------------------------------------------------------
467# this seems to get done automatically for C++, but not C?
468# Required for QHull rules as implemented
469# --------------------------------------------------------------
470AM_PROG_CC_C_O
471# --------------------------------------------------------------
472
473# --------------------------------------------------------------
474# parent directories -- portably and without race conditions
475# --------------------------------------------------------------
476AC_PROG_MKDIR_P
477# -------------------------------------------------------------
478
479# --------------------------------------------------------------
480# nice sed that doesn't truncate output
481# --------------------------------------------------------------
482AC_PROG_SED
483AC_SUBST(SED)
484# --------------------------------------------------------------
485
486
487# -------------------------------------------------------------
488# pkg-config - used to configure installed packages.  We can
489# use it to query our installed targets, if it exists.
490# Otherwise we can fall back to libmesh-config.
491#
492# Not required to build libmesh, but we can install a config
493# file so that users can use 'pkg-config libmesh ...'
494# -------------------------------------------------------------
495AS_IF([test -z "$PKG_CONFIG"],
496      [AC_PATH_PROG(PKG_CONFIG, pkg-config, no)])
497# -------------------------------------------------------------
498
499
500
501LIBMESH_COMPILER_FEATURES
502
503
504
505# --------------------------------------------------------------
506# The AC_SUBST(foo) command creates an output variable from a shell
507# variable.  This command also causes AC_OUTPUT to replace all
508# instances of @VAR@ with the value of the shell variable VAR in the
509# output files (e.g. one or more Makefiles).
510# --------------------------------------------------------------
511AC_SUBST(host)
512AC_SUBST(GXX_VERSION)
513AC_SUBST(CXXFLAGS_OPT)
514AC_SUBST(CXXFLAGS_DBG)
515AC_SUBST(CXXFLAGS_DVL)
516AC_SUBST(CFLAGS_OPT)
517AC_SUBST(CFLAGS_DBG)
518AC_SUBST(CFLAGS_DVL)
519AC_SUBST(LDFLAGS)
520AC_SUBST(NODEPRECATEDFLAG)
521AC_SUBST(CXXSHAREDFLAG)
522AC_SUBST(RPATHFLAG)
523AC_SUBST(PROFILING_FLAGS)
524AC_SUBST(OPROFILE_FLAGS)
525AC_SUBST(FLIBS)
526AC_SUBST(METHOD)
527
528
529
530# --------------------------------------------------------------
531# This is a special test for the mpCC (IBM) compiler.
532# mpCC fails the AC_LANG tests. Set the compiler to
533# mpCC if it is there instead of xlC, but only do this
534# _after_ configure is finished using CXX!
535# --------------------------------------------------------------
536AS_IF([test "$CXX" = xlC_r],
537      [
538        AC_CHECK_PROG(MPCXX,mpCC_r,mpCC_r,$CXX,$PATH)
539        CXX=$MPCXX
540        AS_IF([test "$CXX" = mpCC_r],
541              [AC_MSG_RESULT(<<< Using $CXX instead of xlC_r to compile C++ >>>)])
542      ])
543
544AS_IF([test "$CXX" = xlC],
545      [
546        AC_CHECK_PROG(MPCXX,mpCC,mpCC,$CXX,$PATH)
547        CXX=$MPCXX
548        AS_IF([test "$CXX" = mpCC],
549              [AC_MSG_RESULT(<<< Using $CXX instead of xlC to compile C++ >>>)])
550      ])
551# --------------------------------------------------------------
552
553
554# --------------------------------------------------------------
555# Get the source tree directory
556# --------------------------------------------------------------
557PWD=`pwd`
558AC_SUBST(PWD)
559
560
561
562# --------------------------------------------------------------
563# configure parts of the libmesh core
564# --------------------------------------------------------------
565LIBMESH_CORE_FEATURES
566
567
568
569# --------------------------------------------------------------
570# configure optional, external packages and libraries
571# --------------------------------------------------------------
572LIBMESH_CONFIGURE_OPTIONAL_PACKAGES
573
574
575# Query configuration environment
576ACSM_SUMMARIZE_ENV
577
578# Each example gets a makefile
579AS_IF([test "x$enableexamples" = "xyes"],
580      [
581        AC_CONFIG_FILES([examples/introduction/introduction_ex1/Makefile
582                         examples/introduction/introduction_ex2/Makefile
583                         examples/introduction/introduction_ex3/Makefile
584                         examples/introduction/introduction_ex4/Makefile
585                         examples/introduction/introduction_ex5/Makefile
586                         examples/adaptivity/adaptivity_ex1/Makefile
587                         examples/adaptivity/adaptivity_ex2/Makefile
588                         examples/adaptivity/adaptivity_ex3/Makefile
589                         examples/adaptivity/adaptivity_ex4/Makefile
590                         examples/adaptivity/adaptivity_ex5/Makefile
591                         examples/adjoints/adjoints_ex1/Makefile
592                         examples/adjoints/adjoints_ex2/Makefile
593                         examples/adjoints/adjoints_ex3/Makefile
594                         examples/adjoints/adjoints_ex4/Makefile
595                         examples/adjoints/adjoints_ex5/Makefile
596                         examples/adjoints/adjoints_ex6/Makefile
597                         examples/eigenproblems/eigenproblems_ex1/Makefile
598                         examples/eigenproblems/eigenproblems_ex2/Makefile
599                         examples/eigenproblems/eigenproblems_ex3/Makefile
600                         examples/fem_system/fem_system_ex1/Makefile
601                         examples/fem_system/fem_system_ex2/Makefile
602                         examples/fem_system/fem_system_ex3/Makefile
603                         examples/fem_system/fem_system_ex4/Makefile
604                         examples/fem_system/fem_system_ex5/Makefile
605                         examples/solution_transfer/solution_transfer_ex1/Makefile
606                         examples/miscellaneous/miscellaneous_ex1/Makefile
607                         examples/miscellaneous/miscellaneous_ex2/Makefile
608                         examples/miscellaneous/miscellaneous_ex3/Makefile
609                         examples/miscellaneous/miscellaneous_ex4/Makefile
610                         examples/miscellaneous/miscellaneous_ex5/Makefile
611                         examples/miscellaneous/miscellaneous_ex6/Makefile
612                         examples/miscellaneous/miscellaneous_ex7/Makefile
613                         examples/miscellaneous/miscellaneous_ex8/Makefile
614                         examples/miscellaneous/miscellaneous_ex9/Makefile
615                         examples/miscellaneous/miscellaneous_ex10/Makefile
616                         examples/miscellaneous/miscellaneous_ex11/Makefile
617                         examples/miscellaneous/miscellaneous_ex12/Makefile
618                         examples/miscellaneous/miscellaneous_ex13/Makefile
619                         examples/miscellaneous/miscellaneous_ex14/Makefile
620                         examples/optimization/optimization_ex1/Makefile
621                         examples/optimization/optimization_ex2/Makefile
622                         examples/subdomains/subdomains_ex1/Makefile
623                         examples/subdomains/subdomains_ex2/Makefile
624                         examples/subdomains/subdomains_ex3/Makefile
625                         examples/systems_of_equations/systems_of_equations_ex1/Makefile
626                         examples/systems_of_equations/systems_of_equations_ex2/Makefile
627                         examples/systems_of_equations/systems_of_equations_ex3/Makefile
628                         examples/systems_of_equations/systems_of_equations_ex4/Makefile
629                         examples/systems_of_equations/systems_of_equations_ex5/Makefile
630                         examples/systems_of_equations/systems_of_equations_ex6/Makefile
631                         examples/systems_of_equations/systems_of_equations_ex7/Makefile
632                         examples/systems_of_equations/systems_of_equations_ex8/Makefile
633                         examples/systems_of_equations/systems_of_equations_ex9/Makefile
634                         examples/reduced_basis/reduced_basis_ex1/Makefile
635                         examples/reduced_basis/reduced_basis_ex2/Makefile
636                         examples/reduced_basis/reduced_basis_ex3/Makefile
637                         examples/reduced_basis/reduced_basis_ex4/Makefile
638                         examples/reduced_basis/reduced_basis_ex5/Makefile
639                         examples/reduced_basis/reduced_basis_ex6/Makefile
640                         examples/reduced_basis/reduced_basis_ex7/Makefile
641                         examples/transient/transient_ex1/Makefile
642                         examples/transient/transient_ex2/Makefile
643                         examples/vector_fe/vector_fe_ex1/Makefile
644                         examples/vector_fe/vector_fe_ex2/Makefile
645                         examples/vector_fe/vector_fe_ex3/Makefile
646                         examples/vector_fe/vector_fe_ex4/Makefile
647                         examples/vector_fe/vector_fe_ex5/Makefile
648                         examples/Makefile])
649     ])
650
651
652
653# hackery.  If we are supporting nested autoconf packages and we want to specify
654# additional arguments to be passed to those packages, do that here.
655# Specifically, we append libmesh_subpackage_arguments to ac_configure_args
656# before AC_OUTPUT recurses into our subpackages
657AS_IF([test "x$enablenested" = "xyes"],
658      [
659        ac_configure_args_SAVE="$ac_configure_args"
660        ac_configure_args="$ac_configure_args $libmesh_subpackage_arguments CXX='$CXX' CC='$CC' F77='$F77' FC='$FC' CPPFLAGS='$HDF5_CPPFLAGS $CPPFLAGS' LIBS='$HDF5_LIBS $LIBS'"
661      ])
662
663AC_CONFIG_SUBDIRS([contrib/timpi])
664
665# Create output files. Also configures any subpackages
666AC_OUTPUT
667
668# end hackery
669AS_IF([test "x$enablenested" = "xyes"],
670      [ac_configure_args="$ac_configure_args_SAVE"])
671
672# Final summary
673AX_SUMMARIZE_CONFIG
674
675
676
677AC_MSG_RESULT(---------------------------------------------)
678AC_MSG_RESULT(--------- Done Configuring libMesh ----------)
679AC_MSG_RESULT(---------------------------------------------)
680# rm -f -r conftest* config.cache include/libmesh/libmesh_config.h.tmp
681