1# -*- shell-script -*-
2#
3# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
4#                         University Research and Technology
5#                         Corporation.  All rights reserved.
6# Copyright (c) 2004-2018 The University of Tennessee and The University
7#                         of Tennessee Research Foundation.  All rights
8#                         reserved.
9# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
10#                         University of Stuttgart.  All rights reserved.
11# Copyright (c) 2004-2005 The Regents of the University of California.
12#                         All rights reserved.
13# Copyright (c) 2006-2019 Cisco Systems, Inc.  All rights reserved
14# Copyright (c) 2006-2008 Sun Microsystems, Inc.  All rights reserved.
15# Copyright (c) 2006-2017 Los Alamos National Security, LLC.  All rights
16#                         reserved.
17# Copyright (c) 2009      Oak Ridge National Labs.  All rights reserved.
18# Copyright (c) 2011-2013 NVIDIA Corporation.  All rights reserved.
19# Copyright (c) 2012      Oracle and/or its affiliates.  All rights reserved.
20# Copyright (c) 2013      Mellanox Technologies, Inc.
21#                         All rights reserved.
22# Copyright (c) 2013-2019 Intel, Inc.  All rights reserved.
23# Copyright (c) 2014-2017 Research Organization for Information Science
24#                         and Technology (RIST). All rights reserved.
25# Copyright (c) 2016-2017 IBM Corporation.  All rights reserved.
26# Copyright (c) 2018      Amazon.com, Inc. or its affiliates.
27#                         All Rights reserved.
28# $COPYRIGHT$
29#
30# Additional copyrights may follow
31#
32# $HEADER$
33#
34
35
36############################################################################
37# Initialization, version number, and other random setup/init stuff
38############################################################################
39
40# Load in everything found by autogen.pl
41m4_include([config/autogen_found_items.m4])
42# Load the version number code
43m4_include([config/opal_get_version.m4])
44AC_LANG([C])
45
46# Init autoconf
47
48# We don't have the version number to put in here yet, and we can't
49# call OPAL_GET_VERSION (etc.) before AC_INIT.  So use the shell
50# version.  project_name_* comes from config/project_list.m4, which
51# was set during autogen.pl.
52
53AC_INIT([project_name_long],
54        [m4_normalize(esyscmd([config/opal_get_version.sh VERSION --tarball]))],
55        [http://www.open-mpi.org/community/help/], [project_name_short])
56AC_PREREQ(2.60)
57AC_CONFIG_AUX_DIR(config)
58AC_CONFIG_MACRO_DIR(config)
59
60OPAL_CAPTURE_CONFIGURE_CLI([OPAL_CONFIGURE_CLI])
61
62# Get our platform support file.  This has to be done very, very early
63# because it twiddles random bits of autoconf
64OPAL_LOAD_PLATFORM
65
66#
67# Start it up
68#
69
70AC_CHECK_PROG([PERL],[perl],[perl],[no])
71AS_IF([test "X$PERL" = "Xno"],
72      [AC_MSG_ERROR(["Open MPI requires perl. Aborting"])])
73
74OPAL_CONFIGURE_SETUP
75opal_show_title "Configuring project_name_long"
76
77#
78# Setup some things that must be done before AM-INIT-AUTOMAKE
79#
80
81opal_show_subtitle "Startup tests"
82AC_CANONICAL_HOST
83AC_CANONICAL_TARGET
84AC_DEFINE_UNQUOTED(OPAL_ARCH, "$target", [OMPI architecture string])
85AS_IF([test "$host" != "$target"],
86      [AC_MSG_WARN([Cross-compile detected])
87       AC_MSG_WARN([Cross-compiling is only partially supported])
88       AC_MSG_WARN([Proceed at your own risk!])])
89
90# AC_USE_SYSTEM_EXTENSIONS alters CFLAGS (e.g., adds -g -O2)
91OPAL_VAR_SCOPE_PUSH([CFLAGS_save])
92CFLAGS_save=$CFLAGS
93AC_USE_SYSTEM_EXTENSIONS
94# AC_USE_SYSTEM_EXTENSIONS will modify CFLAGS if nothing was in there
95# beforehand.  We don't want that.  So if there was nothing in
96# CFLAGS, put nothing back in there.
97AS_IF([test -z "$CFLAGS_save"], [CFLAGS=])
98OPAL_VAR_SCOPE_POP
99
100#
101# Init automake
102#
103AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects no-define 1.12.2 tar-ustar])
104
105# SILENT_RULES is new in AM 1.11, but we require 1.11 or higher via
106# autogen.  Limited testing shows that calling SILENT_RULES directly
107# works in more cases than adding "silent-rules" to INIT_AUTOMAKE
108# (even though they're supposed to be identical).  Shrug.
109AM_SILENT_RULES([yes])
110
111# Make configure depend on the VERSION file, since it's used in AC_INIT
112AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
113
114# Sanity checks
115AC_DEFUN([OMPI_CHECK_DIR_FOR_SPACES],[
116    dir="$1"
117    article="$2"
118    label="$3"
119
120    AC_MSG_CHECKING([directory of $label])
121    AC_MSG_RESULT([$dir])
122    AS_IF([test -n "`echo $dir | grep ' '`"],
123          [AC_MSG_WARN([This version of Open MPI does not support $article $label])
124           AC_MSG_WARN([with a path that contains spaces])
125           AC_MSG_ERROR([Cannot continue.])])
126])
127
128AC_DEFUN([OMPI_CANONICALIZE_PATH],[
129    case $host_os in
130    darwin*)
131        # MacOS does not have "readlink -f" or realpath (at least as
132        # of MacOS Cataline / 10.15).  Instead, use Python, because we
133        # know MacOS comes with a /usr/bin/python that has
134        # os.path.realpath.
135        $2=`/usr/bin/python -c 'import os; print os.path.realpath("'$1'")'`
136        ;;
137    *)
138        $2=`readlink -f $1`
139        ;;
140    esac
141])
142
143OMPI_CHECK_DIR_FOR_SPACES([$srcdir], [a], [source tree])
144OMPI_CANONICALIZE_PATH([$srcdir], [ompi_dir])
145OMPI_CHECK_DIR_FOR_SPACES([$ompi_dir], [an], [absolute source tree])
146OMPI_CANONICALIZE_PATH([.], [ompi_dir])
147OMPI_CHECK_DIR_FOR_SPACES([$ompi_dir], [a], [build tree])
148OMPI_CHECK_DIR_FOR_SPACES([$prefix], [a], [prefix])
149OMPI_CANONICALIZE_PATH([$prefix], [ompi_dir])
150OMPI_CHECK_DIR_FOR_SPACES([$ompi_dir], [an], [absolute prefix])
151
152opal_show_subtitle "Checking versions"
153
154# Get the version of OMPI that we are installing
155
156m4_ifdef([project_ompi],
157         [OPAL_SAVE_VERSION([OMPI], [Open MPI], [$srcdir/VERSION],
158                            [ompi/include/ompi/version.h])])
159
160m4_ifdef([project_orte],
161         [OPAL_SAVE_VERSION([ORTE], [Open MPI Run-Time Environment],
162                            [$srcdir/VERSION],
163                            [orte/include/orte/version.h])])
164
165m4_ifdef([project_oshmem],
166         [OPAL_SAVE_VERSION([OSHMEM], [Open SHMEM],
167                            [$srcdir/VERSION],
168                            [oshmem/include/oshmem/version.h])])
169
170OPAL_SAVE_VERSION([OPAL], [Open Portable Access Layer], [$srcdir/VERSION],
171                  [opal/include/opal/version.h])
172
173# Get shared library version numbers
174
175. $srcdir/VERSION
176m4_ifdef([project_ompi],
177         [AC_SUBST(libmpi_so_version)
178          AC_SUBST(libmpi_cxx_so_version)
179          AC_SUBST(libmpi_mpifh_so_version)
180          AC_SUBST(libmpi_usempi_tkr_so_version)
181          AC_SUBST(libmpi_usempi_ignore_tkr_so_version)
182          AC_SUBST(libmpi_usempif08_so_version)
183          AC_SUBST(libmpi_java_so_version)
184          AC_SUBST(libompitrace_so_version)])
185m4_ifdef([project_orte],
186         [AC_SUBST(libopen_rte_so_version)])
187m4_ifdef([project_oshmem],
188         [AC_SUBST(liboshmem_so_version)])
189AC_SUBST(libopen_pal_so_version)
190# It's icky that we have to hard-code the names of the
191# common components here.  :-( This could probably be done
192# transparently by adding some intelligence in autogen.pl
193# and/or opal_mca.m4, but I don't have the cycles to do this
194# right now.
195AC_SUBST(libmca_opal_common_ofi_so_version)
196AC_SUBST(libmca_opal_common_cuda_so_version)
197AC_SUBST(libmca_opal_common_sm_so_version)
198AC_SUBST(libmca_opal_common_ugni_so_version)
199AC_SUBST(libmca_opal_common_verbs_so_version)
200AC_SUBST(libmca_orte_common_alps_so_version)
201AC_SUBST(libmca_ompi_common_ompio_so_version)
202AC_SUBST(libmca_ompi_common_monitoring_so_version)
203AC_SUBST(libmca_opal_common_ucx_so_version)
204
205#
206# Get the versions of the autotools that were used to bootstrap us
207# (helpful for debugging reports)
208#
209AC_MSG_CHECKING([for bootstrap Autoconf version])
210acversion=`grep "Generated by GNU Autoconf" $0 | head -n 1 | awk '{ print $6 }'`
211AC_MSG_RESULT([$acversion])
212AC_MSG_CHECKING([for bootstrap Automake version])
213AC_MSG_RESULT([$am__api_version])
214AC_MSG_CHECKING([for boostrap Libtool version])
215ltversion=`grep VERSION= $srcdir/config/ltmain.sh | head -n 1 | cut -d= -f2`
216AC_MSG_RESULT([$ltversion])
217
218# List header files to generate
219
220AC_CONFIG_HEADERS([opal/include/opal_config.h])
221m4_ifdef([project_ompi],
222         [AC_CONFIG_HEADERS([ompi/include/mpi.h])])
223m4_ifdef([project_oshmem],
224         [AC_CONFIG_HEADER([oshmem/include/shmem.h])])
225
226opal_show_subtitle "Initialization, setup"
227
228OMPI_TOP_BUILDDIR="`pwd`"
229AC_SUBST(OMPI_TOP_BUILDDIR)
230cd "$srcdir"
231OMPI_TOP_SRCDIR="`pwd`"
232AC_SUBST(OMPI_TOP_SRCDIR)
233cd "$OMPI_TOP_BUILDDIR"
234
235AC_MSG_NOTICE([builddir: $OMPI_TOP_BUILDDIR])
236AC_MSG_NOTICE([srcdir: $OMPI_TOP_SRCDIR])
237if test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"; then
238    AC_MSG_NOTICE([Detected VPATH build])
239fi
240
241# Setup the top of the opal/include/opal_config.h file
242
243AH_TOP([/* -*- c -*-
244 *
245 * Copyright (c) 2004-2005 The Trustees of Indiana University.
246 *                         All rights reserved.
247 * Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
248 *                         All rights reserved.
249 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
250 *                         University of Stuttgart.  All rights reserved.
251 * Copyright (c) 2004-2005 The Regents of the University of California.
252 *                         All rights reserved.
253 * Copyright (c) 2014      Intel, Inc. All rights reserved.
254 * $COPYRIGHT$
255 *
256 * Additional copyrights may follow
257 *
258 * $HEADER$
259 *
260 * Function: - OS, CPU and compiler dependent configuration
261 */
262
263#ifndef OPAL_CONFIG_H
264#define OPAL_CONFIG_H
265
266#include "opal_config_top.h"
267
268])
269AH_BOTTOM([
270#include "opal_config_bottom.h"
271#endif /* OPAL_CONFIG_H */
272])
273
274# Other basic setup stuff (shared with components)
275
276OPAL_BASIC_SETUP
277
278OPAL_TOP_SRCDIR="$OMPI_TOP_SRCDIR"
279OPAL_TOP_BUILDDIR="$OMPI_TOP_BUILDDIR"
280AC_SUBST(OPAL_TOP_SRCDIR)
281AC_SUBST(OPAL_TOP_BUILDDIR)
282
283m4_ifdef([project_orte],
284         [ORTE_TOP_SRCDIR="$OMPI_TOP_SRCDIR"
285          ORTE_TOP_BUILDDIR="$OMPI_TOP_BUILDDIR"
286          AC_SUBST(ORTE_TOP_SRCDIR)
287          AC_SUBST(ORTE_TOP_BUILDDIR)])
288
289m4_ifdef([project_oshmem],
290         [OSHMEM_TOP_SRCDIR="$OMPI_TOP_SRCDIR"
291          OSHMEM_TOP_BUILDDIR="$OMPI_TOP_BUILDDIR"
292          AC_SUBST(OSHMEM_TOP_SRCDIR)
293          AC_SUBST(OSHMEM_TOP_BUILDDIR)])
294
295############################################################################
296# Configuration options
297############################################################################
298
299OPAL_CONFIGURE_OPTIONS
300OPAL_CHECK_OS_FLAVORS
301OPAL_CHECK_CUDA
302OPAL_CHECK_PMI
303OPAL_CHECK_PMIX
304m4_ifdef([project_orte], [ORTE_CONFIGURE_OPTIONS])
305m4_ifdef([project_ompi], [OMPI_CONFIGURE_OPTIONS])
306m4_ifdef([project_oshmem], [OSHMEM_CONFIGURE_OPTIONS])
307
308# Set up project specific AM_CONDITIONALs
309AS_IF([test "$enable_ompi" != "no"], [project_ompi_amc=true], [project_ompi_amc=false])
310m4_ifndef([project_ompi], [project_ompi_amc=false])
311
312AS_IF([test "$enable_orte" != "no"], [project_orte_amc=true], [project_orte_amc=false])
313m4_ifndef([project_orte], [project_orte_amc=false])
314
315AS_IF([test "$enable_oshmem" != "no"], [project_oshmem_amc=true], [project_oshmem_amc="no (disabled)"])
316m4_ifndef([project_oshmem], [project_oshmem_amc="no (not available)"])
317
318# Enable/Disable Software-Based Performance Counters Capability
319AC_ARG_ENABLE(spc,
320    AC_HELP_STRING([--enable-spc],
321                   [Enable software-based performance counters capability (default: disabled)]))
322if test "$enable_spc" = "yes"; then
323    AC_MSG_RESULT([yes])
324    SPC_ENABLE=1
325else
326    AC_MSG_RESULT([no])
327    SPC_ENABLE=0
328fi
329AC_DEFINE_UNQUOTED([SPC_ENABLE],
330                   [$SPC_ENABLE],
331                   [If the software-based performance counters capability should be enabled.])
332AM_CONDITIONAL(SPC_ENABLE, test "$SPC_ENABLE" = "1")
333
334AS_IF([test "$enable_spc" != "no"], [project_spc_amc=true], [project_spc_amc=false])
335
336if test "$enable_binaries" = "no" && test "$enable_dist" = "yes"; then
337    AC_MSG_WARN([--disable-binaries is incompatible with --enable dist])
338    AC_MSG_ERROR([Cannot continue])
339fi
340
341# The library prefixes must be set before we call OPAL MCA.  Here is
342# as good a place as any.
343OPAL_SET_LIB_PREFIX([])
344m4_ifdef([project_orte],
345          [ORTE_SET_LIB_PREFIX([])])
346m4_ifdef([project_ompi],
347          [OMPI_SET_LIB_NAME([])])
348
349############################################################################
350# Libtool: part one
351# (before C compiler setup)
352############################################################################
353
354#
355# Part one of libtool magic.  Default to: enable shared, disable static.
356#
357
358AM_ENABLE_SHARED
359AM_DISABLE_STATIC
360
361OPAL_SETUP_WRAPPER_INIT
362
363##################################
364# Check for known incompatibility
365##################################
366
367# Do *not* print a message that we're checking the OS because this
368# test is *not* meant to be an all-inclusive "if it passes this test,
369# then configure must succeed" test.  This test is *only* mean to
370# screen out the versions of OS X where we know OMPI will cause kernel
371# panics because of bad implementations of pty's.  See
372# https://svn.open-mpi.org/trac/ompi/ticket/1637 for details.
373
374#   OS X name         OS X Version    $host_os value
375# OS X Tiger             10.4.x           darwin8.x
376# OS X Leopard           10.5.x           darwin9.x
377# OS X Snow Leopard      10.6.x           darwin10.x
378# OS X Lion              10.7.x           darwin11.x
379
380# We do not support OS X before version 10.5 (Leopard)
381case $host_os in
382# Corresponds to OS X 10.0 - 10.4 (additional [] quoting for m4)
383darwin[[45678]]*)
384    AC_MSG_WARN([Open MPI does not support OS X prior to version 10.5 (Leopard)])
385    AC_MSG_ERROR([Cannot continue])
386esac
387
388############################################################################
389# Check for compilers and preprocessors
390############################################################################
391opal_show_title "Compiler and preprocessor tests"
392
393##################################
394# C compiler characteristics
395##################################
396
397OPAL_SETUP_CC
398
399# If we build on a windows environment with the windows compiler and linker
400# then we need some translation functions from the opal/win32 directory.
401AM_CONDITIONAL(OMPI_NEED_WINDOWS_REPLACEMENTS,
402               test "$opal_cv_c_compiler_vendor" = "microsoft" )
403
404# Do all Interix detections if necessary
405OMPI_INTERIX
406
407# Does the compiler support "ident"-like constructs?
408
409OPAL_CHECK_IDENT([CC], [CFLAGS], [c], [C])
410
411#
412# Check for some types
413#
414
415AC_CHECK_TYPES(int8_t)
416AC_CHECK_TYPES(uint8_t)
417AC_CHECK_TYPES(int16_t)
418AC_CHECK_TYPES(uint16_t)
419AC_CHECK_TYPES(int32_t)
420AC_CHECK_TYPES(uint32_t)
421AC_CHECK_TYPES(int64_t)
422AC_CHECK_TYPES(uint64_t)
423AC_CHECK_TYPES(int128_t)
424AC_CHECK_TYPES(__int128)
425AC_CHECK_TYPES(uint128_t)
426AC_CHECK_TYPES(long long)
427
428AC_CHECK_TYPES(__float128)
429AC_CHECK_TYPES(long double)
430# We only need these types if we're building the OMPI project, but
431# OPAL currently doesn't protect for their lack of presence well.
432AC_CHECK_HEADERS(complex.h)
433AC_CHECK_TYPES(float _Complex)
434AC_CHECK_TYPES(double _Complex)
435AC_CHECK_TYPES(long double _Complex)
436
437AC_CHECK_TYPES(intptr_t)
438AC_CHECK_TYPES(uintptr_t)
439AC_CHECK_TYPES(mode_t)
440AC_CHECK_TYPES(ssize_t)
441AC_CHECK_TYPES(ptrdiff_t)
442
443#
444# Check for type sizes
445#
446
447AC_CHECK_SIZEOF(_Bool)
448AC_CHECK_SIZEOF(char)
449AC_CHECK_SIZEOF(short)
450AC_CHECK_SIZEOF(int)
451AC_CHECK_SIZEOF(long)
452if test "$ac_cv_type_long_long" = yes; then
453    AC_CHECK_SIZEOF(long long)
454fi
455AC_CHECK_SIZEOF(float)
456AC_CHECK_SIZEOF(double)
457if test "$ac_cv_type_long_double" = yes; then
458    AC_CHECK_SIZEOF(long double)
459fi
460if test "$ac_cv_type___float128" = yes; then
461    AC_CHECK_SIZEOF(__float128)
462fi
463# We only need these types if we're building the OMPI project, but
464# OPAL currently doesn't protect for their lack of presence well.
465if test "$ac_cv_type_float__Complex" = yes; then
466    AC_CHECK_SIZEOF(float _Complex)
467fi
468if test "$ac_cv_type_double__Complex" = yes; then
469    AC_CHECK_SIZEOF(double _Complex)
470fi
471if test "$ac_cv_type_long_double__Complex" = yes; then
472    AC_CHECK_SIZEOF(long double _Complex)
473fi
474
475AC_CHECK_SIZEOF(void *)
476AC_CHECK_SIZEOF(size_t)
477if test "$ac_cv_type_ssize_t" = yes ; then
478    AC_CHECK_SIZEOF(ssize_t)
479fi
480if test "$ac_cv_type_ptrdiff_t" = yes; then
481    AC_CHECK_SIZEOF(ptrdiff_t)
482else
483    AC_MSG_ERROR([ptrdiff_t type is not available, this is required by C99 standard.  Cannot continue])
484fi
485AC_CHECK_SIZEOF(wchar_t)
486
487AC_CHECK_SIZEOF(pid_t)
488
489# Check sizes of atomic types so we can define fixed-width types in OPAL
490AC_CHECK_SIZEOF(atomic_short, [],[[#include <stdatomic.h>]])
491AC_CHECK_SIZEOF(atomic_int,[],[[#include <stdatomic.h>]])
492AC_CHECK_SIZEOF(atomic_long,[],[[#include <stdatomic.h>]])
493AC_CHECK_SIZEOF(atomic_llong,[],[[#include <stdatomic.h>]])
494
495#
496# Check for type alignments
497#
498
499OPAL_C_GET_ALIGNMENT(bool, OPAL_ALIGNMENT_BOOL)
500OPAL_C_GET_ALIGNMENT(int8_t, OPAL_ALIGNMENT_INT8)
501OPAL_C_GET_ALIGNMENT(int16_t, OPAL_ALIGNMENT_INT16)
502OPAL_C_GET_ALIGNMENT(int32_t, OPAL_ALIGNMENT_INT32)
503OPAL_C_GET_ALIGNMENT(int64_t, OPAL_ALIGNMENT_INT64)
504if test "$ac_cv_type_int128_t" = yes ; then
505  OPAL_C_GET_ALIGNMENT(int128_t, OPAL_ALIGNMENT_INT128)
506fi
507OPAL_C_GET_ALIGNMENT(char, OPAL_ALIGNMENT_CHAR)
508OPAL_C_GET_ALIGNMENT(short, OPAL_ALIGNMENT_SHORT)
509OPAL_C_GET_ALIGNMENT(wchar_t, OPAL_ALIGNMENT_WCHAR)
510OPAL_C_GET_ALIGNMENT(int, OPAL_ALIGNMENT_INT)
511OPAL_C_GET_ALIGNMENT(long, OPAL_ALIGNMENT_LONG)
512if test "$ac_cv_type_long_long" = yes; then
513    OPAL_C_GET_ALIGNMENT(long long, OPAL_ALIGNMENT_LONG_LONG)
514fi
515OPAL_C_GET_ALIGNMENT(float, OPAL_ALIGNMENT_FLOAT)
516OPAL_C_GET_ALIGNMENT(double, OPAL_ALIGNMENT_DOUBLE)
517if test "$ac_cv_type_long_double" = yes; then
518    OPAL_C_GET_ALIGNMENT(long double, OPAL_ALIGNMENT_LONG_DOUBLE)
519fi
520if test "$ac_cv_type___float128" = yes; then
521    OPAL_C_GET_ALIGNMENT(__float128, OPAL_ALIGNMENT___FLOAT128)
522fi
523
524
525# We only need these types if we're building the OMPI project, but
526# OPAL currently doesn't protect for their lack of presence well.
527if test "$ac_cv_type_float__Complex" = yes; then
528    OPAL_C_GET_ALIGNMENT(float _Complex, OPAL_ALIGNMENT_FLOAT_COMPLEX)
529fi
530if test "$ac_cv_type_double__Complex" = yes; then
531    OPAL_C_GET_ALIGNMENT(double _Complex, OPAL_ALIGNMENT_DOUBLE_COMPLEX)
532fi
533if test "$ac_cv_type_long_double__Complex" = yes; then
534    OPAL_C_GET_ALIGNMENT(long double _Complex, OPAL_ALIGNMENT_LONG_DOUBLE_COMPLEX)
535fi
536
537OPAL_C_GET_ALIGNMENT(void *, OPAL_ALIGNMENT_VOID_P)
538OPAL_C_GET_ALIGNMENT(size_t, OPAL_ALIGNMENT_SIZE_T)
539
540#
541# Check for other compiler characteristics
542#
543
544OPAL_C_WEAK_SYMBOLS
545OPAL_C_MACRO_WEAK_SYMBOLS
546
547if test "x$CC" = "xicc"; then
548    OPAL_CHECK_ICC_VARARGS
549fi
550
551# If we want the profiling layer:
552# - If the C compiler has weak symbols, use those.
553# - If not, then set to compile the code again with #define's in a
554#   separate directory.
555
556if test "$WANT_WEAK_SYMBOLS" = "0"; then
557    OPAL_C_HAVE_WEAK_SYMBOLS=0
558fi
559if test "$OPAL_C_HAVE_WEAK_SYMBOLS" = "1"; then
560    OMPI_PROFILING_COMPILE_SEPARATELY=0
561else
562    OMPI_PROFILING_COMPILE_SEPARATELY=1
563fi
564
565# Check if we support the offsetof compiler directive
566
567OPAL_CHECK_OFFSETOF
568
569
570##################################
571# C++ compiler characteristics
572##################################
573
574# We don't need C++ unless we're building Open MPI; ORTE and OPAL do
575# not use C++ at all.  The OPAL macro name appears to be a bit of a
576# misnomer; I'm not sure why it was split into a second macro and put
577# into OPAL...?  All it does is setup the C++ compiler (the OMPI macro
578# sets up the C++ MPI bindings, etc.).  Perhaps it was moved to OPAL
579# just on the rationale that all compiler setup should be done in
580# OPAL...?  Shrug.
581m4_ifdef([project_ompi], [OPAL_SETUP_CXX
582                          OMPI_SETUP_CXX])
583# Used in Makefile.ompi-rules
584AM_CONDITIONAL(MAN_PAGE_BUILD_MPI_CXX_BINDINGS,
585               [test "$WANT_MPI_CXX_SUPPORT" = 1])
586
587##################################
588# Only after setting up both
589# C and C++ check compiler attributes.
590##################################
591
592opal_show_subtitle "Compiler characteristics"
593
594OPAL_CHECK_ATTRIBUTES
595OPAL_CHECK_COMPILER_VERSION_ID
596
597
598##################################
599# Java MPI Binding request
600##################################
601# Only needed for OMPI
602m4_ifdef([project_ompi], [OMPI_SETUP_JAVA_BINDINGS])
603
604
605##################################
606# MPI / OpenSHMEM API profiling layer
607##################################
608
609# Setup profiling bindings (if we're building the relevant projects).
610m4_ifdef([project_ompi], [OMPI_SETUP_MPI_PROFILING])
611m4_ifdef([project_oshmem], [OSHMEM_SETUP_PROFILING])
612
613
614##################################
615# Assembler Configuration
616##################################
617
618opal_show_subtitle "Assembler"
619
620AM_PROG_AS
621OPAL_CONFIG_ASM
622
623
624##################################
625# Fortran
626##################################
627
628OMPI_BUILD_FORTRAN_BINDINGS=0
629
630m4_ifdef([project_ompi], [OMPI_SETUP_MPI_FORTRAN], [ompi_fortran_happy=0])
631
632# Used in Makefile.ompi-rules
633AM_CONDITIONAL(MAN_PAGE_BUILD_MPIFH_BINDINGS,
634              [test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS])
635AM_CONDITIONAL(MAN_PAGE_BUILD_USEMPIF08_BINDINGS,
636              [test $OMPI_BUILD_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS])
637
638AM_CONDITIONAL(OSHMEM_BUILD_FORTRAN_BINDINGS,
639    [test "$enable_oshmem" = "yes" && \
640     test "$ompi_fortran_happy" = "1" && \
641     test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS" && \
642     test "$enable_oshmem_fortran" != "no"])
643
644# checkpoint results
645AC_CACHE_SAVE
646
647
648##################################
649# Header files
650##################################
651
652opal_show_title "Header file tests"
653
654AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h \
655    dlfcn.h endian.h execinfo.h err.h fcntl.h grp.h libgen.h \
656    libutil.h memory.h netdb.h netinet/in.h netinet/tcp.h \
657    poll.h pthread.h pty.h pwd.h sched.h \
658    strings.h stropts.h linux/ethtool.h linux/sockios.h \
659    sys/fcntl.h sys/ipc.h sys/shm.h \
660    sys/ioctl.h sys/mman.h sys/param.h sys/queue.h \
661    sys/resource.h sys/select.h sys/socket.h sys/sockio.h \
662    sys/stat.h sys/statfs.h sys/statvfs.h sys/time.h sys/tree.h \
663    sys/types.h sys/uio.h sys/un.h net/uio.h sys/utsname.h sys/vfs.h sys/wait.h syslog.h \
664    termios.h ulimit.h unistd.h util.h utmp.h malloc.h \
665    ifaddrs.h crt_externs.h regex.h mntent.h paths.h \
666    ioLib.h sockLib.h hostLib.h shlwapi.h sys/synch.h db.h ndbm.h zlib.h ieee754.h])
667
668AC_CHECK_HEADERS([sys/mount.h], [], [],
669[AC_INCLUDES_DEFAULT
670#if HAVE_SYS_PARAM_H
671#include <sys/param.h>
672#endif
673])
674
675AC_CHECK_HEADERS([sys/sysctl.h], [], [],
676[AC_INCLUDES_DEFAULT
677#if HAVE_SYS_PARAM_H
678#include <sys/param.h>
679#endif
680])
681
682# Needed to work around Darwin requiring sys/socket.h for
683# net/if.h
684AC_CHECK_HEADERS([net/if.h], [], [],
685    [#include <stdio.h>
686#if STDC_HEADERS
687# include <stdlib.h>
688# include <stddef.h>
689#else
690# if HAVE_STDLIB_H
691#  include <stdlib.h>
692# endif
693#endif
694#if HAVE_SYS_SOCKET_H
695# include <sys/socket.h>
696#endif
697])
698
699# checkpoint results
700AC_CACHE_SAVE
701
702
703##################################
704# Types
705##################################
706
707opal_show_title "Type tests"
708
709AC_CHECK_TYPES([socklen_t, struct sockaddr_in, struct sockaddr_in6,
710                struct sockaddr_storage, struct ifreq, struct ethtool_cmd],
711               [], [], [AC_INCLUDES_DEFAULT
712#if HAVE_SYS_SOCKET_H
713#include <sys/socket.h>
714#endif
715#ifdef HAVE_NETINET_IN_H
716#include <netinet/in.h>
717#endif
718#ifdef HAVE_LINUX_ETHTOOL_H
719#include <linux/ethtool.h>
720#endif
721#ifdef HAVE_NET_IF_H
722#include <net/if.h>
723#endif])
724
725AC_CHECK_DECLS([ethtool_cmd_speed, SIOCETHTOOL],
726               [], [], [AC_INCLUDES_DEFAULT
727#ifdef HAVE_LINUX_ETHTOOL_H
728#include <linux/ethtool.h>
729#endif
730#ifdef HAVE_LINUX_SOCKIOS_H
731#include <linux/sockios.h>
732#endif])
733
734AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],
735               [], [], [AC_INCLUDES_DEFAULT
736#ifdef HAVE_LINUX_ETHTOOL_H
737#include <linux/ethtool.h>
738#endif
739#ifdef HAVE_LINUX_SOCKIOS_H
740#include <linux/sockios.h>
741#endif])
742
743AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],
744               [], [], [AC_INCLUDES_DEFAULT
745#ifdef HAVE_LINUX_ETHTOOL_H
746#include <linux/ethtool.h>
747#endif
748#ifdef HAVE_LINUX_SOCKIOS_H
749#include <linux/sockios.h>
750#endif])
751
752AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],
753               [], [], [AC_INCLUDES_DEFAULT
754#ifdef HAVE_LINUX_ETHTOOL_H
755#include <linux/ethtool.h>
756#endif
757#ifdef HAVE_LINUX_SOCKIOS_H
758#include <linux/sockios.h>
759#endif])
760
761AC_CHECK_MEMBERS([struct ethtool_cmd.speed_hi],
762               [], [], [AC_INCLUDES_DEFAULT
763#ifdef HAVE_LINUX_ETHTOOL_H
764#include <linux/ethtool.h>
765#endif
766#ifdef HAVE_LINUX_SOCKIOS_H
767#include <linux/sockios.h>
768#endif])
769
770AC_CHECK_DECLS([AF_UNSPEC, PF_UNSPEC, AF_INET6, PF_INET6],
771               [], [], [AC_INCLUDES_DEFAULT
772#if HAVE_SYS_SOCKET_H
773#include <sys/socket.h>
774#endif
775#ifdef HAVE_NETINET_IN_H
776#include <netinet/in.h>
777#endif])
778
779# SA_RESTART in signal.h
780OPAL_VAR_SCOPE_PUSH([MSG])
781AC_MSG_CHECKING([if SA_RESTART defined in signal.h])
782AC_EGREP_CPP(yes, [
783#include <signal.h>
784#ifdef SA_RESTART
785    yes
786#endif ], [MSG=yes VALUE=1], [MSG=no VALUE=0])
787AC_DEFINE_UNQUOTED(OPAL_HAVE_SA_RESTART, $VALUE,
788    [Whether we have SA_RESTART in <signal.h> or not])
789AC_MSG_RESULT([$MSG])
790OPAL_VAR_SCOPE_POP
791
792AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [], [
793#include <sys/types.h>
794#if HAVE_SYS_SOCKET_H
795#include <sys/socket.h>
796#endif])
797
798AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [
799#include <sys/types.h>
800#include <dirent.h>])
801
802AC_CHECK_MEMBERS([siginfo_t.si_fd],,,[#include <signal.h>])
803AC_CHECK_MEMBERS([siginfo_t.si_band],,,[#include <signal.h>])
804
805#
806# Checks for struct member names in struct statfs
807#
808AC_CHECK_MEMBERS([struct statfs.f_type], [], [], [
809AC_INCLUDES_DEFAULT
810#ifdef HAVE_SYS_VFS_H
811#include <sys/vfs.h>
812#endif
813#ifdef HAVE_SYS_STATFS_H
814#include <sys/statfs.h>
815#endif
816])
817
818AC_CHECK_MEMBERS([struct statfs.f_fstypename], [], [], [
819AC_INCLUDES_DEFAULT
820#ifdef HAVE_SYS_PARAM_H
821#include <sys/param.h>
822#endif
823#ifdef HAVE_SYS_MOUNT_H
824#include <sys/mount.h>
825#endif
826#ifdef HAVE_SYS_VFS_H
827#include <sys/vfs.h>
828#endif
829#ifdef HAVE_SYS_STATFS_H
830#include <sys/statfs.h>
831#endif
832])
833
834#
835# Checks for struct member names in struct statvfs
836#
837AC_CHECK_MEMBERS([struct statvfs.f_basetype], [], [], [
838AC_INCLUDES_DEFAULT
839#ifdef HAVE_SYS_STATVFS_H
840#include <sys/statvfs.h>
841#endif
842])
843
844AC_CHECK_MEMBERS([struct statvfs.f_fstypename], [], [], [
845AC_INCLUDES_DEFAULT
846#ifdef HAVE_SYS_STATVFS_H
847#include <sys/statvfs.h>
848#endif
849])
850
851#
852# Find corresponding types for MPI_Aint, MPI_Count, and MPI_Offset.
853# And if relevant, find the corresponding MPI_ADDRESS_KIND,
854# MPI_COUNT_KIND, and MPI_OFFSET_KIND.
855#
856m4_ifdef([project_ompi], [OMPI_FIND_MPI_AINT_COUNT_OFFSET])
857
858# checkpoint results
859AC_CACHE_SAVE
860
861##################################
862# Linker characteristics
863##################################
864
865AC_MSG_CHECKING([the linker for support for the -fini option])
866OPAL_VAR_SCOPE_PUSH([LDFLAGS_save])
867LDFLAGS_save=$LDFLAGS
868LDFLAGS="$LDFLAGS_save -Wl,-fini -Wl,finalize"
869AC_TRY_LINK([void finalize (void) {}], [], [AC_MSG_RESULT([yes])
870        opal_ld_have_fini=1], [AC_MSG_RESULT([no])
871        opal_ld_have_fini=0])
872LDFLAGS=$LDFLAGS_save
873OPAL_VAR_SCOPE_POP
874
875##################################
876# Libraries
877##################################
878
879opal_show_title "Library and Function tests"
880
881# Darwin doesn't need -lutil, as it's something other than this -lutil.
882OPAL_SEARCH_LIBS_CORE([openpty], [util])
883
884OPAL_SEARCH_LIBS_CORE([gethostbyname], [nsl])
885
886OPAL_SEARCH_LIBS_CORE([socket], [socket])
887
888# Solaris has sched_yield in -lrt, usually in libc
889OPAL_SEARCH_LIBS_CORE([sched_yield], [rt])
890
891# IRIX and CentOS have dirname in -lgen, usually in libc
892OPAL_SEARCH_LIBS_CORE([dirname], [gen])
893
894# Darwin doesn't need -lm, as it's a symlink to libSystem.dylib
895OPAL_SEARCH_LIBS_CORE([ceil], [m])
896
897# -lrt might be needed for clock_gettime
898OPAL_SEARCH_LIBS_CORE([clock_gettime], [rt])
899
900AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv __malloc_initialize_hook __clear_cache])
901
902# Sanity check: ensure that we got at least one of statfs or statvfs.
903if test $ac_cv_func_statfs = no && test $ac_cv_func_statvfs = no; then
904    AC_MSG_WARN([neither statfs() and statvfs() were found])
905    AC_MSG_ERROR([Cannot continue])
906fi
907
908# On some hosts, htonl is a define, so the AC_CHECK_FUNC will get
909# confused.  On others, it's in the standard library, but stubbed with
910# the magic glibc foo as not implemented.  and on other systems, it's
911# just not there.  This covers all cases.
912AC_CACHE_CHECK([for htonl define],
913  [ompi_cv_htonl_define],
914  [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
915#ifdef HAVE_SYS_TYPES_H
916#include <sys/types.h>
917#endif
918#ifdef HAVE_NETINET_IN_H
919#include <netinet/in.h>
920#endif
921#ifdef HAVE_ARPA_INET_H
922#include <arpa/inet.h>
923#endif],[
924#ifndef ntohl
925#error "ntohl not defined"
926#endif
927])], [ompi_cv_htonl_define=yes], [ompi_cv_htonl_define=no])])
928AC_CHECK_FUNC([htonl], [ompi_have_htonl=yes], [ompi_have_htonl=no])
929AS_IF([test "$ompi_cv_htonl_define" = "yes" || test "$ompi_have_htonl" = "yes"],
930    [AC_DEFINE_UNQUOTED([HAVE_UNIX_BYTESWAP], [1],
931        [whether unix byteswap routines -- htonl, htons, nothl, ntohs -- are available])])
932
933#
934# Make sure we can copy va_lists (need check declared, not linkable)
935#
936
937AC_CHECK_DECL(va_copy, OPAL_HAVE_VA_COPY=1, OPAL_HAVE_VA_COPY=0,
938    [#include <stdarg.h>])
939AC_DEFINE_UNQUOTED(OPAL_HAVE_VA_COPY, $OPAL_HAVE_VA_COPY,
940    [Whether we have va_copy or not])
941
942AC_CHECK_DECL(__va_copy, OPAL_HAVE_UNDERSCORE_VA_COPY=1,
943    OPAL_HAVE_UNDERSCORE_VA_COPY=0, [#include <stdarg.h>])
944AC_DEFINE_UNQUOTED(OPAL_HAVE_UNDERSCORE_VA_COPY, $OPAL_HAVE_UNDERSCORE_VA_COPY,
945    [Whether we have __va_copy or not])
946
947AC_CHECK_DECLS(__func__)
948
949# checkpoint results
950AC_CACHE_SAVE
951
952
953##################################
954# System-specific tests
955##################################
956
957opal_show_title "System-specific tests"
958
959# Do we have _SC_NPROCESSORS_ONLN? (only going to pass if we also have
960# <unistd.h> and sysconf(), which is ok) OS X 10.4 has <unistd.h> and
961# sysconf(), but does not have _SC_NPROCESSORS_ONLN.  Doh!
962
963AC_CACHE_CHECK([for _SC_NPROCESSORS_ONLN],
964  [ompi_cv_have__SC_NPROCESSORS_ONLN],
965  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
966AC_INCLUDES_DEFAULT
967#include <unistd.h>
968],
969     [int i = _SC_NPROCESSORS_ONLN;])],
970     [ompi_cv_have__SC_NPROCESSORS_ONLN="yes"],
971     [ompi_cv_have__SC_NPROCESSORS_ONLN="no"])])
972AS_IF([test "$ompi_cv_have__SC_NPROCESSORS_ONLN" = "yes"],
973      [result=1], [result=0])
974AC_DEFINE_UNQUOTED([OPAL_HAVE__SC_NPROCESSORS_ONLN], [$result],
975  [Define to 1 ifyou have the declaration of _SC_NPROCESSORS_ONLN, and to 0 otherwise])
976
977# all: endian
978
979AC_C_BIGENDIAN
980
981OPAL_CHECK_BROKEN_QSORT
982
983# all: SYSV semaphores
984# all: SYSV shared memory
985# all: size of FD_SET
986# all: sizeof struct stat members
987# all: type of getsockopt optlen
988# all: type of recvfrom optlen
989
990#
991# Check out what thread support we have
992#
993OPAL_CONFIG_THREADS
994
995CFLAGS="$CFLAGS $THREAD_CFLAGS"
996CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"
997CXXFLAGS="$CXXFLAGS $THREAD_CXXFLAGS"
998CXXCPPFLAGS="$CXXCPPFLAGS $THREAD_CXXCPPFLAGS"
999LDFLAGS="$LDFLAGS $THREAD_LDFLAGS"
1000LIBS="$LIBS $THREAD_LIBS"
1001
1002OPAL_WRAPPER_FLAGS_ADD([CFLAGS], [$THREAD_CFLAGS])
1003OPAL_WRAPPER_FLAGS_ADD([CXXFLAGS], [$THREAD_CXXFLAGS])
1004OPAL_WRAPPER_FLAGS_ADD([FCFLAGS], [$THREAD_FCFLAGS])
1005OPAL_WRAPPER_FLAGS_ADD([LDFLAGS], [$THREAD_LDFLAGS])
1006# no need to update WRAPPER_EXTRA_LIBS - we'll get it from LT later
1007
1008#
1009# What is the local equivalent of "ln -s"
1010#
1011
1012AC_PROG_LN_S
1013
1014AC_PROG_GREP
1015AC_PROG_EGREP
1016
1017#
1018# We need as and lex
1019#
1020AM_PROG_AS
1021AM_PROG_LEX
1022
1023# If we don't have Flex and we don't have a generated .c file
1024# (distribution tarballs will have the .c file included, but git
1025# clones will not), then error.  Must have Flex -- other versions of
1026# Lex are not workable (all things being equal, since this is *only*
1027# required for developers, we decided that it really was not worth it
1028# to be portable between different versions of lex ;-).
1029
1030if test -z "$LEX" || \
1031   test -n "`echo $LEX | $GREP missing`" || \
1032   test "`basename $LEX`" != "flex"; then
1033    if test ! -f "$srcdir/opal/util/show_help_lex.c"; then
1034        AC_MSG_WARN([*** Could not find Flex on your system.])
1035        AC_MSG_WARN([*** Flex is required for developer builds of Open MPI.])
1036        AC_MSG_WARN([*** Other versions of Lex are not supported.])
1037        AC_MSG_WARN([*** YOU DO NOT NEED FLEX WHEN BUILDING DISTRIBUTION TARBALLS!])
1038        AC_MSG_ERROR([Cannot continue])
1039    fi
1040fi
1041
1042#
1043# Look for ps command and arguments for orte-clean
1044#
1045m4_ifdef([project_orte], [OPAL_PS_FLAVOR_CHECK])
1046
1047#
1048# File system case sensitivity
1049#
1050
1051OPAL_CASE_SENSITIVE_FS_SETUP
1052
1053# AIX: FIONBIO in sys/ioctl.h
1054# glibc: memcpy
1055
1056#
1057# Do we have RLIMIT_NPROC in <sys/resources.h>? (e.g., Solaris does not)
1058#
1059
1060AC_CHECK_DECLS([RLIMIT_NPROC], [], [], [
1061AC_INCLUDES_DEFAULT
1062#if HAVE_SYS_RESOURCE_H
1063#include <sys/resource.h>
1064#endif])
1065
1066#
1067# Do we have RLIMIT_MEMLOCK in <sys/resources.h>? (e.g., Solaris does not)
1068#
1069
1070AC_CHECK_DECLS([RLIMIT_MEMLOCK], [], [], [
1071AC_INCLUDES_DEFAULT
1072#if HAVE_SYS_RESOURCE_H
1073#include <sys/resource.h>
1074#endif])
1075
1076#
1077# Do we have RLIMIT_NOFILE in <sys/resources.h>? (e.g., Solaris does not)
1078#
1079
1080AC_CHECK_DECLS([RLIMIT_NOFILE], [], [], [
1081AC_INCLUDES_DEFAULT
1082#if HAVE_SYS_RESOURCE_H
1083#include <sys/resource.h>
1084#endif])
1085
1086#
1087# Do we have RLIMIT_MEMLOCK in <sys/resources.h>? (e.g., Solaris does not)
1088#
1089
1090AC_CHECK_DECLS([RLIMIT_FSIZE], [], [], [
1091AC_INCLUDES_DEFAULT
1092#if HAVE_SYS_RESOURCE_H
1093#include <sys/resource.h>
1094#endif])
1095
1096#
1097# Do we have RLIMIT_CORE in <sys/resources.h>? (e.g., Solaris does not)
1098#
1099
1100AC_CHECK_DECLS([RLIMIT_CORE], [], [], [
1101AC_INCLUDES_DEFAULT
1102#if HAVE_SYS_RESOURCE_H
1103#include <sys/resource.h>
1104#endif])
1105
1106#
1107# Do we have RLIMIT_STACK in <sys/resources.h>? (e.g., Solaris does not)
1108#
1109
1110AC_CHECK_DECLS([RLIMIT_STACK], [], [], [
1111AC_INCLUDES_DEFAULT
1112#if HAVE_SYS_RESOURCE_H
1113#include <sys/resource.h>
1114#endif])
1115
1116#
1117# Do we have RLIMIT_AS in <sys/resources.h>? (e.g., Solaris does not)
1118#
1119
1120AC_CHECK_DECLS([RLIMIT_AS], [], [], [
1121AC_INCLUDES_DEFAULT
1122#if HAVE_SYS_RESOURCE_H
1123#include <sys/resource.h>
1124#endif])
1125
1126# checkpoint results
1127AC_CACHE_SAVE
1128
1129###########################################################
1130#        Fault Tolerance
1131#
1132# The FT code in the OMPI trunk is currently broken. We don't
1133# have an active maintainer for it at this time, and it isn't
1134# clear if/when we will return to it. We have therefore removed
1135# the configure options supporting it until such time as it
1136# can be fixed.
1137#
1138# However, we recognize that there are researchers who use this
1139# option on their independent branches. In such cases, simply
1140# uncomment the line below to render the FT configure options
1141# visible again
1142#
1143###########################################################
1144dnl OPAL_SETUP_FT_OPTIONS
1145###########################################################
1146# The following line is always required as it contains the
1147# AC_DEFINE and AM_CONDITIONAL calls that set variables used
1148# throughout the build system. If the above line is commented
1149# out, then those variables will be set to "off". Otherwise,
1150# they are controlled by the options
1151OPAL_SETUP_FT
1152
1153##################################
1154# MCA
1155##################################
1156
1157opal_show_title "Modular Component Architecture (MCA) setup"
1158
1159AC_MSG_CHECKING([for subdir args])
1160OPAL_CONFIG_SUBDIR_ARGS([opal_subdir_args])
1161AC_MSG_RESULT([$opal_subdir_args])
1162
1163OPAL_MCA
1164
1165m4_ifdef([project_ompi], [OMPI_REQUIRE_ENDPOINT_TAG_FINI])
1166
1167# Last minute disable of OpenSHMEM if we didn't find any oshmem SPMLs
1168if test "$project_oshmem_amc" = "true" && test $OSHMEM_FOUND_WORKING_SPML -eq 0 ; then
1169    # We don't have an spml that will work, so oshmem wouldn't be able
1170    # to run an application.  Therefore, don't build the oshmem layer.
1171    if test "$enable_oshmem" != "no" && test -n "$enable_oshmem"; then
1172	AC_MSG_WARN([No spml found, so OpenSHMEM layer will be non functional.])
1173	AC_MSG_ERROR([Aborting because OpenSHMEM requested, but can not build.])
1174    else
1175	AC_MSG_WARN([No spml found.  Will not build OpenSHMEM layer.])
1176	project_oshmem_amc="false (no spml)"
1177	# now for the hard part, remove project from list that will
1178	# run.  This is a hack, but it works as long as the project
1179	# remains named "oshmem".
1180	MCA_PROJECT_SUBDIRS=`echo "$MCA_PROJECT_SUBDIRS" | sed -e 's/oshmem//'`
1181    fi
1182fi
1183
1184# checkpoint results
1185AC_CACHE_SAVE
1186
1187##################################
1188# CUDA: part two
1189##################################
1190
1191# This is somewhat gross to have a configure check for a common MCA
1192# component outside of the normal MCA checks, but this check must come
1193# after the opal DL MCA checks have done.  Someday this could perhaps
1194# be done better by having some kind of "run this check at the end of
1195# all other MCA checks" hook...?
1196
1197OPAL_CHECK_CUDA_AFTER_OPAL_DL
1198
1199##################################
1200# MPI Extended Interfaces
1201##################################
1202
1203m4_ifdef([project_ompi], [OMPI_SETUP_MPI_EXT])
1204
1205# checkpoint results
1206AC_CACHE_SAVE
1207
1208##################################
1209# Contributed software
1210##################################
1211
1212m4_ifdef([project_ompi], [OMPI_SETUP_CONTRIB])
1213
1214# checkpoint results
1215AC_CACHE_SAVE
1216
1217##################################
1218# Visibility
1219##################################
1220
1221# Check the visibility declspec at the end to avoid problem with
1222# the previous tests that are not necessarily prepared for
1223# the visibility feature.
1224opal_show_title "Symbol visibility feature"
1225
1226OPAL_CHECK_VISIBILITY
1227
1228
1229
1230############################################################################
1231# Final top-level OMPI configuration
1232############################################################################
1233
1234opal_show_title "Final top-level OMPI configuration"
1235
1236############################################################################
1237# Libtool: part two
1238# (after C compiler setup = no compiler/linker tests after this)
1239############################################################################
1240
1241opal_show_subtitle "Libtool configuration"
1242
1243# Use the undocumented solaris_use_stlport4 libtool variable to turn off any
1244# Cstd/stlport4 linkage. This allows Open MPI to be C++ STL agnostic.
1245if test "x$opal_cv_c_compiler_vendor" = "xsun"; then
1246    solaris_use_stlport4="yes"
1247fi
1248
1249# Due to this thread:
1250# http://www.open-mpi.org/community/lists/users/2013/02/21356.php and
1251# a helpful tip from Dave Goodell, set the precious variables for
1252# compilers to "no" that we don't want.  Libtool's m4 configry will
1253# interpret this as "I won't be using this language; don't bother
1254# setting it up."  Note that we do this only for Fortran; we *don't*
1255# do this for C++, because even if we're not building the MPI C++
1256# bindings, we *do* still want to setup the mpicxx wrapper if we have
1257# a C++ compiler.
1258AS_IF([test "$OMPI_TRY_FORTRAN_BINDINGS" = "$OMPI_FORTRAN_NO_BINDINGS"],[F77=no FC=no])
1259
1260LT_INIT([dlopen win32-dll])
1261
1262# What's the suffix of shared libraries?  Inspired by generated
1263# Libtool code (even though we don't support several of these
1264# platforms, there didn't seem to be any harm in leaving in some of
1265# them, alhtough I did remove some that we have never/will never
1266# support, like OS/2).
1267OPAL_DYN_LIB_PREFIX=lib
1268case $host_os in
1269cygwin*)
1270    OPAL_DYN_LIB_PREFIX=cyg
1271    OPAL_DYN_LIB_SUFFIX=dll
1272    ;;
1273mingw* | pw32* | cegcc*)
1274    OPAL_DYN_LIB_SUFFIX=dll
1275    ;;
1276darwin* | rhapsody*)
1277    OPAL_DYN_LIB_SUFFIX=dylib
1278    ;;
1279hpux9* | hpux10* | hpux11*)
1280    case $host_cpu in
1281        ia64*)
1282        OPAL_DYN_LIB_SUFFIX=so
1283        ;;
1284    *)
1285        OPAL_DYN_LIB_SUFFIX=sl
1286        ;;
1287    esac
1288    ;;
1289*)
1290   OPAL_DYN_LIB_SUFFIX=so
1291   ;;
1292esac
1293AC_SUBST(OPAL_DYN_LIB_PREFIX)
1294AC_SUBST(OPAL_DYN_LIB_SUFFIX)
1295
1296# Need the libtool binary before the rpathify stuff
1297LT_OUTPUT
1298
1299############################################################################
1300# final compiler config
1301############################################################################
1302
1303m4_ifdef([project_ompi], [opal_show_subtitle "Compiler flags"],
1304         [m4_ifdef([project_orte], [opal_show_subtitle "Compiler flags"])])
1305
1306#
1307# This is needed for VPATH builds, so that it will -I the appropriate
1308# include directory.  We delayed doing it until now just so that
1309# '-I$(top_srcdir)' doesn't show up in any of the configure output --
1310# purely aesthetic.
1311#
1312# Because opal_config.h and mpi.h are created by AC_CONFIG_HEADERS, we
1313# don't need to -I the builddir for <opal,ompi>/include. However, we do
1314# need to add it for orte as it doesn't have an AC_CONFIG_HEADERS that
1315# will install it for us. If we VPATH building, we do need to include the
1316# source directories, however.
1317#
1318if test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"; then
1319    # Note the embedded m4 directives here -- we must embed them
1320    # rather than have successive assignments to these shell
1321    # variables, lest the $(foo) names try to get evaluated here.
1322    # Yuck!
1323    CPPFLAGS='-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/opal/include m4_ifdef([project_orte], [-I$(top_srcdir)/orte/include -I$(top_builddir)/orte/include]) m4_ifdef([project_ompi], [-I$(top_srcdir)/ompi/include]) m4_ifdef([project_oshmem], [-I$(top_srcdir)/oshmem/include])'" $CPPFLAGS"
1324    # C++ is only relevant if we're building OMPI
1325    m4_ifdef([project_ompi], [CXXCPPFLAGS='-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/opal/include -I$(top_srcdir)/orte/include -I$(top_srcdir)/ompi/include'" $CXXCPPFLAGS"])
1326else
1327    CPPFLAGS='-I$(top_srcdir) m4_ifdef([project_orte], [-I$(top_srcdir)/orte/include])'" $CPPFLAGS"
1328    # C++ is only relevant if we're building OMPI
1329    m4_ifdef([project_ompi], [CXXCPPFLAGS='-I$(top_srcdir)'" $CXXCPPFLAGS"])
1330fi
1331
1332# OMPI/ORTE wants some additional processing of the flags (e.g., get
1333# versions without optimization for debugger modules).
1334
1335m4_ifdef([project_orte], [ORTE_SETUP_DEBUGGER_FLAGS],
1336         [m4_ifdef([project_ompi], [ORTE_SETUP_DEBUGGER_FLAGS])])
1337
1338#
1339# Delayed the substitution of CFLAGS and CXXFLAGS until now because
1340# they may have been modified throughout the course of this script.
1341#
1342
1343AC_SUBST(CFLAGS)
1344AC_SUBST(CPPFLAGS)
1345AC_SUBST(CXXFLAGS)
1346AC_SUBST(CXXCPPFLAGS)
1347m4_ifdef([project_ompi], [AC_SUBST(FFLAGS)
1348                          AC_SUBST(FCFLAGS)
1349
1350                          AC_SUBST(OMPI_LIBMPI_EXTRA_LIBS)
1351                          AC_SUBST(OMPI_LIBMPI_EXTRA_LDFLAGS)])
1352
1353#
1354# Aggregate MCA parameters directory
1355#
1356AC_SUBST([AMCA_PARAM_SETS_DIR], ['$(opaldatadir)/amca-param-sets'])
1357
1358############################################################################
1359# final wrapper compiler config
1360############################################################################
1361
1362opal_show_subtitle "Wrapper compiler final setup"
1363# The ORTE and OMPI wrapper scripts (i.e., not the C-compiled
1364# executables) need perl.
1365AC_PATH_PROG(PERL, perl, perl)
1366
1367OPAL_SETUP_WRAPPER_FINAL
1368
1369# Recreate some defines prefixed with OMPI_ so that there are no bare
1370# autoconf macro defines in mpi.h.  Since AC sometimes changes whether
1371# things are defined as null tokens or an integer result, two projects
1372# with different versions of AC can cause problems.
1373
1374# According to the autoconf 2.67 documentation the AC_HEADER_STDC macro,
1375# and therefore the ac_cv_header_stdc cache variable, is obsolescent, as
1376# current systems have conforming header files. Instead of removing the
1377# protection completely, let's just make sure it is always on.
1378AC_DEFINE(OPAL_STDC_HEADERS, 1,
1379          [Do not use outside of mpi.h.  Define to 1 if you have the ANSI C header files.])
1380if test $ac_cv_header_sys_time_h = yes ; then
1381    AC_DEFINE(OPAL_HAVE_SYS_TIME_H, 1,
1382              [Do not use outside of mpi.h.  Define to 1 if you have the <sys/time.h> header file.])
1383fi
1384if test $ac_cv_type_long_long = yes ; then
1385    AC_DEFINE(OPAL_HAVE_LONG_LONG, 1,
1386              [Do not use outside of mpi.h.  Define to 1 if the system has the type `long long'.]) dnl `
1387fi
1388if test $ac_cv_header_sys_synch_h = yes ; then
1389    AC_DEFINE(OPAL_HAVE_SYS_SYNCH_H, 1,
1390              [Do not use outside of mpi.h.  Define to 1 if you have the <sys/synch.h> header file.])
1391fi
1392
1393# If there is a local hook for each project, call it.  This allows 3rd
1394# parties to add configuration steps to OPAL, ORTE, and/or OMPI simply
1395# by placing a file in [opal|orte|ompi]/config/whatever.m4 that
1396# AC_DEFUN's the appropriate macro name -- no patching is necessary.
1397# If that macro is defined, we'll run it here.
1398#
1399# Unfortunately, aclocal is not smart enough to parse something like
1400# the following in opal_mca.m4 (when we're already m4 looping over the
1401# project list):
1402#
1403# m4_foreach(mca_project, [mca_project_list],
1404#           [m4_ifdef(mca_project[_CONFIG_LOCAL], mca_project[_CONFIG_LOCAL])])
1405#
1406# Meaning that aclocal doesn't see that, for example,
1407# "ompi_CONFIG_LOCAL" is actually invoked at the bottom and therefore
1408# go look for an .m4 file that contains it.  Instead, we have to
1409# manually list the macros here.  *Then* aclocal is smart enough to go
1410# look for an .m4 file containing each macro, and if found,
1411# automatically m4_include the corresponding in aclocal.m4.  Bummer.
1412# :-\
1413
1414m4_ifdef([opal_CONFIG_LOCAL], [opal_CONFIG_LOCAL])
1415m4_ifdef([project_orte],
1416         [m4_ifdef([orte_CONFIG_LOCAL], [orte_CONFIG_LOCAL])])
1417m4_ifdef([project_ompi],
1418         [m4_ifdef([ompi_CONFIG_LOCAL], [ompi_CONFIG_LOCAL])])
1419
1420############################################################################
1421# Party on
1422############################################################################
1423
1424# set projects good/no good AM_CONDITIONALS.  This is at the end so
1425# that the OSHMEM/OMPI projects can be disabled, if needed, based on
1426# MCA tests.  If a project is to be disabled, also remove it from
1427# MCA_PROJECT_SUBDIRS to actually disable building.
1428AM_CONDITIONAL([PROJECT_OMPI], [test "$project_ompi_amc" = "true"])
1429AM_CONDITIONAL([PROJECT_ORTE], [test "$project_orte_amc" = "true"])
1430AM_CONDITIONAL([PROJECT_OSHMEM], [test "$project_oshmem_amc" = "true"])
1431
1432AC_MSG_CHECKING([if libtool needs -no-undefined flag to build shared libraries])
1433case "`uname`" in
1434  CYGWIN*|MINGW*|AIX*)
1435    ## Add in the -no-undefined flag to LDFLAGS for libtool.
1436    AC_MSG_RESULT([yes])
1437    LDFLAGS="$LDFLAGS -no-undefined"
1438    ;;
1439  *)
1440    ## Don't add in anything.
1441    AC_MSG_RESULT([no])
1442    ;;
1443esac
1444
1445# opaldatadir, opallibdir, and opalinclude are essentially the same as
1446# pkg*dir, but will always be */openmpi.  This is to make it a bit
1447# easier to deal with the problem of opal, orte, and ompi built from
1448# their own tarballs, with their own PACKAGE variables.
1449opaldatadir='${datadir}/openmpi'
1450opallibdir='${libdir}/openmpi'
1451opalincludedir='${includedir}/openmpi'
1452AC_SUBST(opaldatadir)
1453AC_SUBST(opallibdir)
1454AC_SUBST(opalincludedir)
1455
1456OPAL_SET_MCA_PREFIX([OMPI_MCA_])
1457OPAL_SET_MCA_CMD_LINE_ID([mca])
1458m4_ifdef([project_orte],
1459         [ortedatadir="$opaldatadir"
1460          AC_SUBST(ortedatadir)
1461          ortelibdir="$opallibdir"
1462          AC_SUBST(ortelibdir)
1463          orteincludedir="$opalincludedir"
1464          AC_SUBST(orteincludedir)])
1465m4_ifdef([project_ompi],
1466         [ompidatadir="$opaldatadir"
1467          AC_SUBST(ompidatadir)
1468          ompilibdir="$opallibdir"
1469          AC_SUBST(ompilibdir)
1470          ompiincludedir="$opalincludedir"
1471          AC_SUBST(ompiincludedir)])
1472m4_ifdef([project_oshmem],
1473         [oshmemdatadir="$opaldatadir"
1474          AC_SUBST(oshmemdatadir)
1475          oshmemlibdir="$opallibdir"
1476          AC_SUBST(oshmemlibdir)
1477          oshmemincludedir="$opalincludedir"
1478          AC_SUBST(oshmemincludedir)])
1479
1480opal_show_subtitle "Final output"
1481
1482AC_CONFIG_FILES([
1483    Makefile
1484
1485    config/Makefile
1486
1487    contrib/Makefile
1488
1489    contrib/dist/mofed/debian/changelog
1490    contrib/dist/mofed/debian/control
1491    contrib/dist/mofed/debian/copyright:LICENSE
1492
1493    test/Makefile
1494    test/event/Makefile
1495    test/asm/Makefile
1496    test/datatype/Makefile
1497    test/dss/Makefile
1498    test/class/Makefile
1499    test/mpool/Makefile
1500    test/support/Makefile
1501    test/threads/Makefile
1502    test/util/Makefile
1503])
1504
1505m4_ifdef([project_ompi], [AC_CONFIG_FILES([test/monitoring/Makefile test/spc/Makefile])])
1506
1507AC_CONFIG_FILES([contrib/dist/mofed/debian/rules],
1508                [chmod +x contrib/dist/mofed/debian/rules])
1509AC_CONFIG_FILES([contrib/dist/mofed/compile_debian_mlnx_example],
1510                [chmod +x contrib/dist/mofed/compile_debian_mlnx_example])
1511
1512OPAL_CONFIG_FILES
1513m4_ifdef([project_orte], [ORTE_CONFIG_FILES])
1514m4_ifdef([project_ompi], [OMPI_CONFIG_FILES])
1515m4_ifdef([project_oshmem], [OSHMEM_CONFIG_FILES])
1516
1517OPAL_CHECK_LIBNL_SUMMARY
1518
1519AC_OUTPUT
1520
1521OPAL_SUMMARY_PRINT
1522