|
| 1 | +# -*- shell-script -*- |
| 2 | +# |
| 3 | +# Copyright (c) 2012-2020 Cisco Systems, Inc. All rights reserved. |
| 4 | +# Copyright (c) 2025 UT-Battelle, LLC. All rights reserved. |
| 5 | +# |
| 6 | +# $COPYRIGHT$ |
| 7 | +# |
| 8 | + |
| 9 | +dnl |
| 10 | +dnl Init autoconf |
| 11 | +dnl |
| 12 | + |
| 13 | +AC_PREREQ([2.67]) |
| 14 | +AC_INIT([mpi-environmgmt-test], [1.0], [http://www.open-mpi.org]) |
| 15 | +AC_CONFIG_AUX_DIR([config]) |
| 16 | +AC_CONFIG_MACRO_DIR([config]) |
| 17 | +AC_CONFIG_SRCDIR([.]) |
| 18 | + |
| 19 | +echo "Configuring Environmental Management test" |
| 20 | + |
| 21 | +AM_INIT_AUTOMAKE([1.11 foreign -Wall -Werror]) |
| 22 | + |
| 23 | +# If Automake supports silent rules, enable them. |
| 24 | +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
| 25 | + |
| 26 | +AH_TOP([/* -*- c -*- |
| 27 | + * |
| 28 | + * Environmental Management test suite configuation header file. |
| 29 | + * See the top-level LICENSE file for license and copyright |
| 30 | + * information. |
| 31 | + */ |
| 32 | + |
| 33 | +#ifndef MPI_ENVIRONMGMT_TEST_CONFIG_H |
| 34 | +#define MPI_ENVIRONMGMT_TEST_CONFIG_H |
| 35 | +]) |
| 36 | +AH_BOTTOM([#endif /* MPI_ENVIRONMGMT_TEST_CONFIG_H */]) |
| 37 | + |
| 38 | +dnl |
| 39 | +dnl Make automake clean emacs ~ files for "make clean" |
| 40 | +dnl |
| 41 | + |
| 42 | +CLEANFILES="*~" |
| 43 | +AC_SUBST(CLEANFILES) |
| 44 | + |
| 45 | +dnl |
| 46 | +dnl Get various programs |
| 47 | +dnl Bias towards mpicc/mpic++/mpif77 |
| 48 | +dnl C compiler |
| 49 | +dnl |
| 50 | + |
| 51 | +if test "$CC" != ""; then |
| 52 | + BASE="`basename $CC`" |
| 53 | +else |
| 54 | + BASE= |
| 55 | +fi |
| 56 | +if test "$BASE" = "" -o "$BASE" = "." -o "$BASE" = "cc" -o \ |
| 57 | + "$BASE" = "gcc" -o "$BASE" = "xlc" -o "$BASE" = "pgcc" -o \ |
| 58 | + "$BASE" = "icc"; then |
| 59 | + AC_CHECK_PROG(HAVE_MPICC, mpicc, yes, no) |
| 60 | + if test "$HAVE_MPICC" = "yes"; then |
| 61 | + CC=mpicc |
| 62 | + export CC |
| 63 | + fi |
| 64 | +fi |
| 65 | + |
| 66 | +CFLAGS_save=$CFLAGS |
| 67 | +AC_PROG_CC |
| 68 | +CFLAGS=$CFLAGS_save |
| 69 | + |
| 70 | +dnl |
| 71 | +dnl Fortran compiler - prefer mpifort if available |
| 72 | +dnl |
| 73 | + |
| 74 | +if test "$FC" = ""; then |
| 75 | + AC_CHECK_PROG(HAVE_MPIFORT, mpifort, yes, no) |
| 76 | + if test "$HAVE_MPIFORT" = "yes"; then |
| 77 | + FC=mpifort |
| 78 | + export FC |
| 79 | + fi |
| 80 | +fi |
| 81 | + |
| 82 | +FFLAGS_save=$FFLAGS |
| 83 | +AC_PROG_FC |
| 84 | +FFLAGS=$FFLAGS_save |
| 85 | + |
| 86 | + |
| 87 | +dnl |
| 88 | +dnl Because these are meant to be used for debugging, after all |
| 89 | +dnl |
| 90 | + |
| 91 | +if test -z "$CFLAGS"; then |
| 92 | + CFLAGS="-g" |
| 93 | +fi |
| 94 | + |
| 95 | +dnl |
| 96 | +dnl Ensure that we can compile and link a C MPI program |
| 97 | +dnl |
| 98 | + |
| 99 | +AC_LANG_PUSH([C]) |
| 100 | +AC_CHECK_HEADERS(mpi.h) |
| 101 | + |
| 102 | +AC_MSG_CHECKING([if linking MPI program works]) |
| 103 | +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h> |
| 104 | +]], |
| 105 | + [[MPI_Comm a = MPI_COMM_WORLD]])], |
| 106 | + [AC_MSG_RESULT([yes])], |
| 107 | + [AC_MSG_RESULT([no]) |
| 108 | + AC_MSG_WARN([Simple MPI program fails to link]) |
| 109 | + AC_MSG_ERROR([Cannot continue]) |
| 110 | + ]) |
| 111 | + |
| 112 | +AC_CHECK_LIB([mpi], [MPI_Add_error_code], |
| 113 | + [AC_DEFINE([HAVE_MPI_ADD_ERROR_CODE], [1], [Define if have MPI_Add_error_code])], |
| 114 | + [AC_MSG_WARN([MPI_Add_error_code not found; disable related features])]) |
| 115 | + |
| 116 | + |
| 117 | +AC_CHECK_LIB([mpi], [MPI_Remove_error_code], |
| 118 | + [AC_DEFINE([HAVE_MPI_REMOVE_ERROR_CODE], [1], [Define if have MPI_Remove_error_code])], |
| 119 | + [AC_MSG_WARN([MPI_Remove_error_code not found; disable related features])]) |
| 120 | + |
| 121 | +AC_CHECK_LIB([mpi], [MPI_Remove_error_class], |
| 122 | + [AC_DEFINE([HAVE_MPI_REMOVE_ERROR_CLASS], [1], [Define if have MPI_Remove_error_class])], |
| 123 | + [AC_MSG_WARN([MPI_Remove_error_class not found; disable related features])]) |
| 124 | + |
| 125 | +AC_CHECK_LIB([mpi], [MPI_Remove_error_string], |
| 126 | + [AC_DEFINE([HAVE_MPI_REMOVE_ERROR_STRING], [1], [Define if have MPI_Remove_error_string])], |
| 127 | + [AC_MSG_WARN([MPI_Remove_error_string not found; disable related features])]) |
| 128 | + |
| 129 | +AC_SUBST([MPI_LIBS]) |
| 130 | + |
| 131 | +dnl |
| 132 | +dnl Check for pthreads support |
| 133 | +dnl |
| 134 | + |
| 135 | +AC_SEARCH_LIBS([pthread_create], [pthread], [have_pthread=yes], [have_pthread=no]) |
| 136 | +if test "$have_pthread" = "yes"; then |
| 137 | + AC_DEFINE([HAVE_PTHREAD], [1], [Define if have pthreads]) |
| 138 | +fi |
| 139 | + |
| 140 | +AC_LANG_POP([C]) |
| 141 | + |
| 142 | +dnl |
| 143 | +dnl Party on |
| 144 | +dnl |
| 145 | + |
| 146 | +AC_CONFIG_HEADERS([config.h]) |
| 147 | +AC_CONFIG_FILES([ |
| 148 | + Makefile |
| 149 | + src/Makefile |
| 150 | +]) |
| 151 | +AC_OUTPUT |
0 commit comments