2004-01-12 00:35:37 +03:00
# -*- shell-script -*-
#
# $HEADER$
#
############################################################################
# Initialization, version number, and other random setup/init stuff
############################################################################
# Init autoconf
AC_INIT(@PARAM_INIT_FILE@)
AC_PREREQ(2.57)
AC_CONFIG_AUX_DIR(@PARAM_CONFIG_AUX_DIR@)
2004-08-02 04:24:22 +04:00
# Get the version of @MCA_TYPE@ @MCA_COMPONENT_NAME@ that we are installing.
2004-01-12 00:35:37 +03:00
2004-01-14 23:57:03 +03:00
if test -n "@PARAM_VERSION_FILE@" -a -f "@PARAM_VERSION_FILE@"; then
2004-07-07 16:45:36 +04:00
OMPI_GET_VERSION(@PARAM_VERSION_FILE@, @PARAM_VAR_PREFIX@)
2004-01-14 23:57:03 +03:00
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_MAJOR_VERSION,
$@PARAM_VAR_PREFIX@_MAJOR_VERSION,
2004-08-02 04:24:22 +04:00
[Major OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
2004-01-14 23:57:03 +03:00
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_MINOR_VERSION,
$@PARAM_VAR_PREFIX@_MINOR_VERSION,
2004-08-02 04:24:22 +04:00
[Minor OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
2004-01-14 23:57:03 +03:00
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_RELEASE_VERSION,
$@PARAM_VAR_PREFIX@_RELEASE_VERSION,
2004-08-02 04:24:22 +04:00
[Release OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
2004-01-14 23:57:03 +03:00
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_ALPHA_VERSION,
$@PARAM_VAR_PREFIX@_ALPHA_VERSION,
2004-08-02 04:24:22 +04:00
[Alpha OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
2004-01-14 23:57:03 +03:00
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_BETA_VERSION,
$@PARAM_VAR_PREFIX@_BETA_VERSION,
2004-08-02 04:24:22 +04:00
[Beta OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
2004-01-14 23:57:03 +03:00
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_CVS_VERSION,
$@PARAM_VAR_PREFIX@_CVS_VERSION,
2004-08-02 04:24:22 +04:00
[CVS OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version])
2004-01-14 23:57:03 +03:00
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_VERSION,
"$@PARAM_VAR_PREFIX@_VERSION",
2004-08-02 04:24:22 +04:00
[Overall OMPI MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ version number])
2004-01-14 23:57:03 +03:00
version_string="version $@PARAM_VAR_PREFIX@_VERSION"
else
version_string=""
fi
2004-01-12 00:35:37 +03:00
#
# Start it up
#
2004-06-07 19:33:53 +04:00
OMPI_CONFIGURE_SETUP
2004-08-02 04:24:22 +04:00
ompi_show_title "Configuring MCA @MCA_TYPE@ @MCA_COMPONENT_NAME@ component $version_string"
2004-06-07 19:33:53 +04:00
ompi_show_subtitle "Initialization, setup"
2004-01-12 00:35:37 +03:00
#
# Init automake
# The third argument to AM_INIT_AUTOMAKE surpresses the PACKAGE and
# VERSION macors
#
AM_INIT_AUTOMAKE(@PARAM_AM_NAME@, $@PARAM_VAR_PREFIX@_VERSION, 'no')
2004-08-02 04:24:22 +04:00
# Setup the top-level MCA component config.h file
2004-01-12 00:35:37 +03:00
AH_TOP([/* -*- c -*-
*
* $HEADER$
*
2004-07-07 16:45:36 +04:00
* Open MPI configuation header file.
2004-08-02 04:24:22 +04:00
* MCA @MCA_TYPE@: @MCA_COMPONENT_NAME@ component
2004-01-12 00:35:37 +03:00
*/
#ifndef @PARAM_VAR_PREFIX@_CONFIG_H
#define @PARAM_VAR_PREFIX@_CONFIG_H
])
AH_BOTTOM([#endif /* _@PARAM_VAR_PREFIX@_CONFIG_H */])
#
# Do the normal basics of setup:
# - set CLEANFILES
# - figure out the host type
# - set the default prefix
#
2004-06-07 19:33:53 +04:00
OMPI_BASIC_SETUP
2004-01-12 00:35:37 +03:00
#
# Check to see if the user wants this @MCA_TYPE@ to be the default
#
2004-08-02 04:24:22 +04:00
AC_MSG_CHECKING([if want the @MCA_COMPONENT_NAME@ @MCA_TYPE@ to be the default])
2004-01-12 00:35:37 +03:00
want_default=0
result=no
AC_ARG_WITH(@PROCESSED_MCA_TYPE@,
AC_HELP_STRING([--with-@PROCESSED_MCA_TYPE@=name],
2004-08-02 04:24:22 +04:00
[if name is "@MCA_COMPONENT_NAME@", the @MCA_COMPONENT_NAME@ @MCA_TYPE@ will be the default]))
if test "$with_@PROCESSED_MCA_TYPE@" = "@MCA_COMPONENT_NAME@"; then
2004-01-12 00:35:37 +03:00
want_default=1
result=yes
fi
AC_DEFINE_UNQUOTED(@PARAM_VAR_PREFIX@_DEFAULT, $want_default,
2004-08-02 04:24:22 +04:00
[Whether the @MCA_COMPONENT_NAME@ @MCA_TYPE@ is the default @PROCESSED_MCA_TYPE@ or not])
2004-01-12 00:35:37 +03:00
AC_MSG_RESULT([$result])
#
2004-07-07 16:45:36 +04:00
# Part one of libtool magic
2004-01-12 00:35:37 +03:00
#
2004-07-07 16:45:36 +04:00
AM_ENABLE_SHARED
AM_DISABLE_STATIC
#
2004-08-02 04:24:22 +04:00
# Find which components should be built as run-time loadable components
2004-07-07 16:45:36 +04:00
# Acceptable combinations:
#
# [default -- no option given]
# --enable-mca-dso
# --enable-mca-dso=[.+,]*COMPONENT_TYPE[.+,]*
# --enable-mca-dso=[.+,]*COMPONENT_TYPE-COMPONENT_NAME[.+,]*
# --disable-mca-dso
2004-01-12 00:35:37 +03:00
#
2004-07-07 16:45:36 +04:00
AC_MSG_CHECKING([if want component to be a DSO])
AC_ARG_ENABLE(mca-dso,
AC_HELP_STRING([--enable-mca-dso=LIST],
2004-08-02 04:24:22 +04:00
[comma-separated list of types and/or type-component pairs that will be built as run-time loadable components (as opposed to statically linked in), if supported on this platform. The default is to build all components as DSOs; the --disable-mca-dso[=LIST] form can be used to disable building all or some types/components as DSOs]. If LIST is "@MCA_TYPE@-@MCA_COMPONENT_NAME@" or "@MCA_COMPONENTNAME@", then @MCA_COMPONENT_NAME@ will be compiled as a DSO (if supported on this platform).))
2004-01-12 00:35:37 +03:00
# Manual conversion of $kind to its generic name (e.g., crmpi->cr,
2004-06-07 19:33:53 +04:00
# crompi->cr).
2004-01-12 00:35:37 +03:00
case "@MCA_TYPE@" in
crmpi)
generic_type="cr"
;;
2004-06-07 19:33:53 +04:00
crompi)
2004-01-12 00:35:37 +03:00
generic_type="cr"
;;
*)
generic_type="@MCA_TYPE@"
;;
esac
2004-08-02 04:24:22 +04:00
BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO=0
2004-01-12 00:35:37 +03:00
msg=no
2004-07-07 16:45:36 +04:00
if test "$enable_shared" = "no"; then
msg=no
elif test -z "$enable_mca_dso" -o "$enable_mca_dso" = "yes" -o \
"$enable_mca_dso" = "@MCA_TYPE@" -o "$enable_mca_dso" = "$generic_type"; then
2004-08-02 04:24:22 +04:00
BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO=1
2004-01-12 00:35:37 +03:00
msg=yes
2004-07-07 16:45:36 +04:00
else
2004-01-12 00:35:37 +03:00
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
2004-07-07 16:45:36 +04:00
for item in $enable_mca_dso; do
2004-08-02 04:24:22 +04:00
if test "$item" = "@MCA_TYPE@-@MCA_COMPONENT_NAME@" -o \
2004-07-07 16:45:36 +04:00
"$item" = "@MCA_TYPE@" -o "$item" = "$generic_type"; then
2004-08-02 04:24:22 +04:00
BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO=1
2004-01-12 00:35:37 +03:00
msg=yes
fi
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
###########################################################################
# Check for compilers and preprocessors
############################################################################
##################################
# Compiler characteristics
##################################
@C_COMPILER_SETUP@
@CXX_COMPILER_SETUP@
2004-07-07 16:45:36 +04:00
##################################
# Find Open MPI header files
##################################
# Are we building as part of the Open MPI source tree, or outside of it?
AC_ARG_WITH(openmpi,
AC_HELP_STRING([--with-openmpi=DIR],
[specify the location of the Open MPI header files and library. The default is to build within a source tree or be able to find the headers/library without additional CPPFLAGS/LDFLAGS. This option is generally only necessary when components are being configured/built outside of an Open MPI source tree]))
# Establish the top-level OMPI directory. If --with-openmpi was not
# specified, then see if we're building a) within an Open MPI source
# tree, or b) can find the Open MPI headers and library file without
# any additional CPPFLAGS/LDFLAGS.
top_ompi_srcdir=
top_ompi_builddir=
found_ompi_headers=
# Split this into multiple tests because we may have multiple
# possibilities here:
#
# - build in the Open MPI source tree
# - build outside of the Open MPI source tree, and have valid
# --with-openmpi
# - build outside of the Open MPI source tree, and not have a valid
# --with-openmpi
AC_MSG_CHECKING([for Open MPI header files])
# First case: we do not have --with-openmpi, so check and see if we're
# building inside the Open MPI source tree
if test -z "$with_openmpi"; then
# Are we within an Open MPI source tree?
if test -f "$srcdir/../../../../config/mca_configure.ac"; then
# This is needed for VPATH builds, so that it will -I the
# appropriate include directory (don't know why automake
# doesn't do this # automatically).
top_ompi_srcdir='$(top_srcdir)/../../../..'
top_ompi_builddir='$(top_builddir)/../../../..'
INCFLAGS='-I$(top_ompi_srcdir)/src -I$(top_ompi_srcdir)/include -I$(top_ompi_builddir)/src'
found_ompi_headers=1
AC_MSG_RESULT([already in Open MPI source tree])
fi
fi
# If we haven't found the headers yet, then we know that we're *not*
# building within the Open MPI source tree.
if test -z "$found_ompi_headers"; then
top_ompi_srcdir="unused -- building outside of Open MPI source tree"
top_ompi_builddir="$top_ompi_srcdir"
fi
# Now see if a) we haven't found the headers yet, and b) we have
# --with-openmpi
if test -z "$found_ompi_headers"; then
# We're outside the Open MPI build tree, and we have been provided
# a top-level directory where the header files live.
if test -n "$with_openmpi"; then
if -d "$with_opemnpi"; then
if test -d "$with_openmpi/openmpi" -a \
-f "$with_openmpi/openmpi/include/ompi.h"; then
INCFLAGS="-I$with_openmpi/openmpi"
found_ompi_headers=1
AC_MSG_RESULT([$with_openmpi/openmpi])
elif test -f "$with_openmpi/include/ompi.h"; then
INCFLAGS="-I$with_openmpi"
found_ompi_headers=1
AC_MSG_RESULT([$with_openmpi])
else
AC_MSG_RESULT([got bogus --with-openmpi value])
AC_MSG_WARN([*** Directory $with_openmpi exists])
AC_MSG_WARN([*** But cannot seem to find Open MPI headers in it])
AC_MSG_WARN([*** Looking elsewhere...])
fi
else
AC_MSG_RESULT([got bogus --with-openmpi value])
AC_MSG_WARN([*** Directory $with_openmpi does not seem to exist])
AC_MSG_WARN([*** Trying to find Open MPI headers without it...])
fi
fi
# If we've gotten this far and haven't found the Open MPI headers
# yet, then just try compiling a C program with some of the Open
# MPI headers and see if they're found (i.e., if they're in the
# preprocessor's default search path)
if test -z "$found_ompi_headers"; then
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include "include/ompi.h"]],
[[]]),
[found_ompi_headers=1])
if test -n "$found_ompi_headers"; then
AC_MSG_RESULT([default preprocessor path])
fi
fi
fi
# If we got this far and haven't found the Open MPI headers, stick a
# fork in us, 'cause we're done.
if test -z "$found_ompi_headers"; then
AC_MSG_WARN([*** Could not find the Open MPI headers])
AC_MSG_ERROR([*** Cannot continue])
fi
AC_SUBST(top_ompi_srcdir)
AC_SUBST(top_ompi_builddir)
2004-01-12 00:35:37 +03:00
##################################
2004-08-02 04:24:22 +04:00
# @MCA_TYPE@ @MCA_COMPONENT_NAME@ component specific setup
2004-01-12 00:35:37 +03:00
##################################
2004-07-08 17:08:44 +04:00
#
# Unset all *_EXTRA_* flags
#
unset ABORT
for scope in LIBMPI WRAPPER; do
for flags in CFLAGS CXXFLAGS FFLAGS LDFLAGS LIBS; do
str="unset ${scope}_EXTRA_${flags}"
eval $str
done
done
#
# Invoke configure.stub code stubs, if they exist. Have at least one
# statement (well, m4 macro) in each "if" block so that some older sh
# flavors don't complain.
#
2004-07-07 16:45:36 +04:00
2004-06-07 19:33:53 +04:00
if test "$OMPI_WANT_DIST" = "no"; then
2004-07-07 16:45:36 +04:00
OMPI_LOG_MSG([Running configure stub macro])
2004-01-12 00:35:37 +03:00
@CONFIGURE_STUB_MACRO@
else
2004-07-07 16:45:36 +04:00
OMPI_LOG_MSG([Running configure dist stub macro])
2004-01-12 00:35:37 +03:00
@CONFIGURE_DIST_STUB_MACRO@
fi
2004-07-08 17:08:44 +04:00
#
# If any *_EXTRA_* flags were set, save them in $srcdir/post_configure.sh.
# This will be examined by the top-level configure script.
#
create_post_configure_file() {
if test ! -f post_configure.sh; then
cat > post_configure.sh <<EOF
# This file is automatically generated by configure.
# Manual changes will be lost!
# Generated by: `whoami`
# On machine: `hostname`
# On: `date`
EOF
fi
}
rm -f post_configure.sh
if test -n "$ABORT"; then
create_post_configure_file
echo "ABORT=\"$ABORT\"" >> post_configure.sh
AC_MSG_ERROR([*** ABORT flag is set; aborting])
fi
for scope in LIBMPI WRAPPER; do
for flags in CFLAGS CXXFLAGS FFLAGS LDFLAGS LIBS; do
str="found=\$${scope}_EXTRA_${flags}"
eval $str
if test -n "$found"; then
create_post_configure_file
echo "${scope}_EXTRA_${flags}=\"$found\"" >> post_configure.sh
fi
done
done
2004-01-12 00:35:37 +03:00
#
2004-07-07 16:45:36 +04:00
# We delayed doing it until now just so that long include paths don't
# show up in any of the configure output -- purely aesthetic.
2004-01-12 00:35:37 +03:00
#
2004-07-07 16:45:36 +04:00
CPPFLAGS="$CPPFLAGS $INCFLAGS"
CXXCPPFLAGS="$CXXCPPFLAGS $INCFLAGS"
2004-06-15 05:23:05 +04:00
2004-01-12 00:35:37 +03:00
#
# Delayed the substitution of these until now because they may have
# been modified throughout the course of this script.
#
AC_SUBST(CPPFLAGS)
2004-07-07 16:45:36 +04:00
AC_SUBST(CXXCPPFLAGS)
2004-01-12 00:35:37 +03:00
############################################################################
# libtool magic
############################################################################
2004-06-07 19:33:53 +04:00
ompi_show_subtitle "GNU libtool setup"
2004-01-12 00:35:37 +03:00
AM_PROG_LIBTOOL
2004-08-02 04:24:22 +04:00
AM_CONDITIONAL(OMPI_BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO,
test "$BUILD_@MCA_TYPE@_@MCA_COMPONENT_NAME@_DSO" = "1")
2004-01-12 00:35:37 +03:00
############################################################################
# Party on
############################################################################
2004-06-07 19:33:53 +04:00
ompi_show_subtitle "Final output"
2004-01-12 00:35:37 +03:00
AM_CONFIG_HEADER([@PARAM_CONFIG_HEADER_FILE@])
AC_CONFIG_FILES([@PARAM_CONFIG_FILES@])
AC_OUTPUT