1
1

This commit combines 3 somewhat-unrelated things, which unfortunately

got linked together (work on one caused work in the other):

 * Clean up a bunch of VAR_SCOPE issues in configure.  This includes:
   * Using VAR_SCOPE_PUSH and VAR_SCOPE_POP in more places
   * Cleaning up the use of some shell variables (e.g., name them better)
 * Add support for external libevent via
   --with-libevent=<dir-to-libevent-install-tree>, as specifically
   asked for by downstream packagers.
 * Revamp how wrapper compiler RPATH (and RUNPATH) support is done.
   The external libevent work exposed weakenesses in how the original
   RPATH/RUNPATH work was done, so we had to re-do it to be a bit more
   robust.

This work has not yet been tested on Solaris.

Refs trac:3694

This commit was SVN r29899.

The following Trac tickets were found above:
  Ticket 3694 --> https://svn.open-mpi.org/trac/ompi/ticket/3694
Этот коммит содержится в:
Jeff Squyres 2013-12-13 21:24:45 +00:00
родитель f4afa4fd1f
Коммит 1bc8f41edb
14 изменённых файлов: 591 добавлений и 310 удалений

Просмотреть файл

@ -3,7 +3,7 @@ dnl
dnl Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2011-2012 Oak Ridge National Labs. All rights reserved.
dnl $COPYRIGHT$
dnl
@ -637,12 +637,12 @@ EOF
# m4_configure components)
m4_foreach(flags, [LDFLAGS, LIBS],
[AS_IF([test "$mpiext_$1_WRAPPER_EXTRA_]flags[" = ""],
[OPAL_APPEND_UNIQ([ompi_mca_wrapper_extra_]m4_tolower(flags), [$mpiext_$1_]flags)],
[OPAL_APPEND_UNIQ([ompi_mca_wrapper_extra_]m4_tolower(flags), [$mpiext_$1_WRAPPER_EXTRA_]flags)])
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_]m4_tolower(flags), [$mpiext_$1_]flags)],
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_]m4_tolower(flags), [$mpiext_$1_WRAPPER_EXTRA_]flags)])
])
AS_IF([test "$mpiext_$1_WRAPPER_EXTRA_CPPFLAGS" != ""],
[OPAL_APPEND_UNIQ([ompi_mca_wrapper_extra_cppflags], [$mpiext_$1_WRAPPER_EXTRA_CPPFLAGS])])
[OPAL_FLAGS_APPEND_UNIQ([ompi_mca_wrapper_extra_cppflags], [$mpiext_$1_WRAPPER_EXTRA_CPPFLAGS])])
])

Просмотреть файл

@ -1,182 +0,0 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
AC_DEFUN([OMPI_CHECK_LINKER_FLAGS],[
#
# libtool has been created by this point
# Try to see if it will add any additional flags for dependant libraries
#
AC_MSG_CHECKING([for libtool-supplied linker flags])
libtool="$1"
extra_flags="$2"
# Get the directory where libtool lives
start="`pwd`"
d="`dirname $libtool`"
cd "$d"
libtool="`pwd`/libtool"
cd "$start"
unset d start
# Make a playground to work in
mkdir conftest.$$
cd conftest.$$
cat > foo.c <<EOF
int foo(void) { return 0; }
EOF
ompi_check_linker_flags_work() {
OPAL_LOG_MSG([$cmd], [yes])
eval $cmd >&5 2>&5
if test -n "[$]1"; then
output=`eval $cmd 2>/dev/null | head -n 1 | sed -e 's,^libtool: *,,' -e 's,^link: *,,'`
fi
status="$?"
OPAL_LOG_MSG([\$? = $status], [yes])
if test "$status" != "0"; then
AC_MSG_RESULT([libtool error!])
AC_MSG_ERROR([Cannot continue])
fi
}
#
# First make a sample library with the current LDFLAGS and LIBS
#
cmd="$libtool --mode=compile --tag=CC $CC $CFLAGS -c -o foo.o foo.c"
ompi_check_linker_flags_work
cmd="$libtool --mode=link --tag=CC $CC $CFLAGS foo.lo $LDFLAGS $LIBS -o libfoo.la"
ompi_check_linker_flags_work
#
# Now fake linking to it and capture the output from libtool
#
cmd="$libtool --dry-run --mode=link --tag=CC $CC bar.lo libfoo.la -o bar $extra_flags"
ompi_check_linker_flags_work yes
# eat any extra whitespace in CC, as libtool will do the same
tmpCC=`echo $CC | sed -e 's/\//\\\\\//g'`
output=`echo $output | sed -e "s/^$tmpCC//"`
extra_ldflags=
for arg in $output ; do
case "$arg" in
*.libs/bar*) ;;
bar*) ;;
-I*) ;;
-L*) ;;
-R*) ;;
-lfoo) ;;
*.libs/libfoo.*) ;;
-o) ;;
*.so) ;;
*.a) ;;
*)
extra_ldflags="$extra_ldflags $arg"
;;
esac
shift
done
if test -n "$extra_ldflags"; then
AC_MSG_RESULT([$extra_ldflags])
else
AC_MSG_RESULT([no extra flags])
fi
#
# Now do something similar in order to capture the rpath flags: re-run
# the link, but give the libtool --rpath argument. Then capture the
# difference between this output and the previous output. Do this
# separately from the above tests to ensure that we don't accidentally
# remove -R if it's needed for rpath.
#
WRAPPER_RPATH_SUPPORT=disabled
AS_IF([test "x$enable_wrapper_rpath" = "xyes"],
[AC_MSG_CHECKING([for libtool-supplied rpath arguments])
no_rpath_output=$output
cmd="$libtool --dry-run --mode=link --tag=CC $CC -rpath /ompi-bogus-test-dir bar.lo libfoo.la -o bar $extra_flags"
ompi_check_linker_flags_work yes
# eat any extra whitespace in CC, as libtool will do the same
tmpCC=`echo $CC | sed -e 's/\//\\\\\//g'`
output=`echo $output | sed -e "s/^$tmpCC//"`
rpath_args=
for rp in $output ; do
found=0
for nrp in $no_rpath_output ; do
AS_IF([test "$rp" = "$nrp"], [found=1])
done
# If we didn't find it, then it must be an rpath argument.
# Ensure to replace /ompi-bogus-test-dir with ${libdir} so
# that the wrapper can do proper replacement, later.
AS_IF([test "$found" = "0"],
[rpath_args="$rpath_args `echo $rp | sed -e 's@/ompi-bogus-test-dir@\@{libdir}@'`"])
done
# If there were no flags necessary, then we really aren't doing
# anything to enable rpath, so let's not claim that we are.
AS_IF([test "`echo $rpath_args`" = ""],
[rpath_args=
enable_wrapper_rpath=no
WRAPPER_RPATH_SUPPORT=unnecessary
msg="no extra flags"],
[wrapper_extra_ldflags="$wrapper_extra_ldflags $rpath_args"
WRAPPER_RPATH_SUPPORT=rpath
msg=$rpath_args])
AC_MSG_RESULT([$msg])
])
# We don't need to be in the subdir any more
cd ..
rm -rf conftest.$$
AS_IF([test "x$enable_wrapper_rpath" = "xyes"],
[
# Now that we have the rpath flags, check to see if the linker
# supports the DT_RUNPATH flags via --enable-new-dtags (a GNU
# ld-specific option). These flags are more social than
# DT_RPATH -- they can be overridden by LD_LIBRARY_PATH (where
# a regular DT_RPATH cannot).
OPAL_VAR_SCOPE_PUSH([LDFLAGS_save])
AC_MSG_CHECKING([if linker supports RUNPATH (vs. RPATH)])
LDFLAGS_save=$LDFLAGS
LDFLAGS="$LDFLAGS $rpath_args -Wl,--enable-new-dtags"
AC_LANG_PUSH([C])
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 7;])],
[msg=yes
WRAPPER_RPATH_SUPPORT=runpath
wrapper_extra_ldflags="$wrapper_extra_ldflags -Wl,--enable-new-dtags"],
[msg=no])
AC_LANG_POP([C])
LDFLAGS=$LDFLAGS_save
AC_MSG_RESULT([$msg])
OPAL_VAR_SCOPE_POP
])
])dnl

Просмотреть файл

@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
@ -788,13 +788,13 @@ AC_MSG_ERROR([*** $2 component $3 was supposed to be direct-called, but
AS_LITERAL_IF([$3],
[m4_foreach(flags, [LDFLAGS, LIBS],
[AS_IF([test "$$2_$3_WRAPPER_EXTRA_]flags[" = ""],
[OPAL_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$2_$3_]flags)],
[OPAL_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$2_$3_WRAPPER_EXTRA_]flags)])
[OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$2_$3_]flags)],
[OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$2_$3_WRAPPER_EXTRA_]flags)])
])],
[m4_foreach(flags, [LDFLAGS, LIBS],
[[str="line=\$$2_$3_WRAPPER_EXTRA_]flags["]
eval "$str"
OPAL_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$line])])])
OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$line])])])
fi
# if needed, copy over WRAPPER_EXTRA_CPPFLAGS. Since a configure script
@ -805,7 +805,7 @@ AC_MSG_ERROR([*** $2 component $3 was supposed to be direct-called, but
[m4_if(OMPI_EVAL_ARG([MCA_$1_$2_CONFIGURE_MODE]), [STOP_AT_FIRST], [stop_at_first=1], [stop_at_first=0])
AS_IF([test "$8" = "static" -a "$stop_at_first" = "1"],
[AS_IF([test "$with_devel_headers" = "yes"],
[OPAL_APPEND_UNIQ([mca_wrapper_extra_cppflags], [$$2_$3_WRAPPER_EXTRA_CPPFLAGS])])],
[OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_cppflags], [$$2_$3_WRAPPER_EXTRA_CPPFLAGS])])],
[AC_MSG_WARN([ignoring $2_$3_WRAPPER_EXTRA_CPPFLAGS ($$2_$3_WRAPPER_EXTRA_CPPFLAGS): component conditions not met])])])])
])

Просмотреть файл

@ -13,7 +13,7 @@ dnl All rights reserved.
dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
@ -160,7 +160,7 @@ AC_DEFUN([_OMPI_SETUP_CXX_COMPILER_BACKEND],[
# Do we want debugging?
if test "$WANT_DEBUG" = "1" -a "$enable_debug_symbols" != "no" ; then
CXXFLAGS="$CXXFLAGS -g"
OPAL_UNIQ(CXXFLAGS)
OPAL_FLAGS_UNIQ(CXXFLAGS)
AC_MSG_WARN([-g has been added to CXXFLAGS (--enable-debug)])
fi
@ -202,7 +202,7 @@ AC_DEFUN([_OMPI_SETUP_CXX_COMPILER_BACKEND],[
fi
CXXFLAGS="$CXXFLAGS $add"
OPAL_UNIQ(CXXFLAGS)
OPAL_FLAGS_UNIQ(CXXFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CXXFLAGS (--enable-picky)])
fi
@ -223,7 +223,7 @@ AC_DEFUN([_OMPI_SETUP_CXX_COMPILER_BACKEND],[
add=" -finline-functions"
fi
CXXFLAGS="$CXXFLAGS_orig$add"
OPAL_UNIQ(CXXFLAGS)
OPAL_FLAGS_UNIQ(CXXFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CXXFLAGS])
fi

Просмотреть файл

@ -66,7 +66,7 @@ AC_DEFUN([OMPI_SETUP_FC],[
AS_IF([test $ompi_fc_happy -eq 1 -a "$WANT_DEBUG" = "1" -a "$enable_debug_symbols" != "no"],
[FCFLAGS="$FCFLAGS -g"
OPAL_UNIQ(FCFLAGS)
OPAL_FLAGS_UNIQ(FCFLAGS)
AC_MSG_WARN([-g has been added to FCFLAGS (--enable-debug)])
])

Просмотреть файл

@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
dnl
dnl $COPYRIGHT$
dnl
@ -275,17 +275,6 @@ for val in ${$1}; do
ompi_i="`expr $ompi_i + 1`"
done
# Check for special cases where we do want to allow repeated
# arguments (per
# http://www.open-mpi.org/community/lists/devel/2012/08/11362.php).
case $val in
-Xclang)
ompi_found=0
ompi_i=`expr $ompi_count + 1`
;;
esac
# If we didn't find the token, add it to the "array"
if test "$ompi_found" = "0"; then
@ -358,6 +347,122 @@ dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
# Remove all duplicate -I, -L, and -l flags from the variable named $1
AC_DEFUN([OPAL_FLAGS_UNIQ],[
# 1 is the variable name to be uniq-ized
ompi_name=$1
# Go through each item in the variable and only keep the unique ones
ompi_count=0
for val in ${$1}; do
ompi_done=0
ompi_i=1
ompi_found=0
# Loop over every token we've seen so far
ompi_done="`expr $ompi_i \> $ompi_count`"
while test "$ompi_found" = "0" -a "$ompi_done" = "0"; do
# Have we seen this token already? Prefix the comparison
# with "x" so that "-Lfoo" values won't be cause an error.
ompi_eval="expr x$val = x\$ompi_array_$ompi_i"
ompi_found=`eval $ompi_eval`
# Check the ending condition
ompi_done="`expr $ompi_i \>= $ompi_count`"
# Increment the counter
ompi_i="`expr $ompi_i + 1`"
done
# Check for special cases where we do want to allow repeated
# arguments (per
# http://www.open-mpi.org/community/lists/devel/2012/08/11362.php).
case $val in
-Xclang)
ompi_found=0
ompi_i=`expr $ompi_count + 1`
;;
esac
# If we didn't find the token, add it to the "array"
if test "$ompi_found" = "0"; then
ompi_eval="ompi_array_$ompi_i=$val"
eval $ompi_eval
ompi_count="`expr $ompi_count + 1`"
else
ompi_i="`expr $ompi_i - 1`"
fi
done
# Take all the items in the "array" and assemble them back into a
# single variable
ompi_i=1
ompi_done="`expr $ompi_i \> $ompi_count`"
ompi_newval=
while test "$ompi_done" = "0"; do
ompi_eval="ompi_newval=\"$ompi_newval \$ompi_array_$ompi_i\""
eval $ompi_eval
ompi_eval="unset ompi_array_$ompi_i"
eval $ompi_eval
ompi_done="`expr $ompi_i \>= $ompi_count`"
ompi_i="`expr $ompi_i + 1`"
done
# Done; do the assignment
ompi_newval="`echo $ompi_newval`"
ompi_eval="$ompi_name=\"$ompi_newval\""
eval $ompi_eval
# Clean up
unset ompi_name ompi_i ompi_done ompi_newval ompi_eval ompi_count
])dnl
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
# OPAL_FLAGS_APPEND_UNIQ(variable, new_argument)
# ----------------------------------------------
# Append new_argument to variable if:
#
# - the argument does not begin with -I, -L, or -l, or
# - the argument begins with -I, -L, or -l, and it's not already in variable
#
# This macro assumes a space seperated list.
AC_DEFUN([OPAL_FLAGS_APPEND_UNIQ], [
OPAL_VAR_SCOPE_PUSH([opal_tmp opal_append])
for arg in $2; do
opal_tmp=`echo $arg | cut -c1-2`
opal_append=1
AS_IF([test "$opal_tmp" = "-I" -o "$opal_tmp" = "-L" -o "$opal_tmp" = "-l"],
[for val in ${$1}; do
AS_IF([test "x$val" = "x$arg"], [opal_append=0])
done])
AS_IF([test "$opal_append" = "1"],
[AS_IF([test -z "$$1"], [$1=$arg], [$1="$$1 $arg"])])
done
OPAL_VAR_SCOPE_POP
])
dnl #######################################################################
dnl #######################################################################
dnl #######################################################################
# Macro that serves as an alternative to using `which <prog>`. It is
# preferable to simply using `which <prog>` because backticks (`) (aka
# backquotes) invoke a sub-shell which may source a "noisy"

Просмотреть файл

@ -103,8 +103,8 @@ AC_DEFUN([OPAL_SETUP_CC],[
OPAL_WRAPPER_FLAGS_ADD([CFLAGS], [$OMPI_COVERAGE_FLAGS])
OPAL_WRAPPER_FLAGS_ADD([LDFLAGS], [$OMPI_COVERAGE_FLAGS])
OPAL_UNIQ(CFLAGS)
OPAL_UNIQ(LDFLAGS)
OPAL_FLAGS_UNIQ(CFLAGS)
OPAL_FLAGS_UNIQ(LDFLAGS)
AC_MSG_WARN([$OMPI_COVERAGE_FLAGS has been added to CFLAGS (--enable-coverage)])
WANT_DEBUG=1
@ -122,7 +122,7 @@ AC_DEFUN([OPAL_SETUP_CC],[
CFLAGS="$CFLAGS -g"
fi
OPAL_UNIQ(CFLAGS)
OPAL_FLAGS_UNIQ(CFLAGS)
AC_MSG_WARN([-g has been added to CFLAGS (--enable-debug)])
fi
@ -177,7 +177,7 @@ AC_DEFUN([OPAL_SETUP_CC],[
add="$add -Werror-implicit-function-declaration "
CFLAGS="$CFLAGS $add"
OPAL_UNIQ(CFLAGS)
OPAL_FLAGS_UNIQ(CFLAGS)
AC_MSG_WARN([$add has been added to CFLAGS (--enable-picky)])
unset add
fi
@ -212,7 +212,7 @@ AC_DEFUN([OPAL_SETUP_CC],[
fi
CFLAGS="$CFLAGS_orig$add"
OPAL_UNIQ(CFLAGS)
OPAL_FLAGS_UNIQ(CFLAGS)
AC_MSG_WARN([$add has been added to CFLAGS])
unset add
fi
@ -241,7 +241,7 @@ AC_DEFUN([OPAL_SETUP_CC],[
fi
CFLAGS="${CFLAGS_orig}${add}"
OPAL_UNIQ([CFLAGS])
OPAL_FLAGS_UNIQ([CFLAGS])
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CFLAGS])
fi

Просмотреть файл

@ -13,7 +13,7 @@ dnl All rights reserved.
dnl Copyright (c) 2006 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
@ -94,7 +94,7 @@ AC_DEFUN([_OPAL_SETUP_CXX_COMPILER_BACKEND],[
# Do we want debugging?
if test "$WANT_DEBUG" = "1" -a "$enable_debug_symbols" != "no" ; then
CXXFLAGS="$CXXFLAGS -g"
OPAL_UNIQ(CXXFLAGS)
OPAL_FLAGS_UNIQ(CXXFLAGS)
AC_MSG_WARN([-g has been added to CXXFLAGS (--enable-debug)])
fi
@ -140,7 +140,7 @@ AC_DEFUN([_OPAL_SETUP_CXX_COMPILER_BACKEND],[
fi
CXXFLAGS="$CXXFLAGS $add"
OPAL_UNIQ(CXXFLAGS)
OPAL_FLAGS_UNIQ(CXXFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CXXFLAGS (--enable-picky)])
fi
@ -161,7 +161,7 @@ AC_DEFUN([_OPAL_SETUP_CXX_COMPILER_BACKEND],[
add=" -finline-functions"
fi
CXXFLAGS="$CXXFLAGS_orig$add"
OPAL_UNIQ(CXXFLAGS)
OPAL_FLAGS_UNIQ(CXXFLAGS)
if test "$add" != "" ; then
AC_MSG_WARN([$add has been added to CXXFLAGS])
fi

Просмотреть файл

@ -177,14 +177,8 @@ AC_DEFUN([_OPAL_SETUP_LIBLTDL_INTERNAL],[
[OPAL_HAVE_LTDL_ADVISE=1])
CPPFLAGS="$CPPFLAGS_save"
# Arrgh. This is gross. But I can't think of any other way
# to do it. :-( These files are in the build tree; don't list
# $srcdir here.
flags=`$EGREP ^LIBADD_DL opal/libltdl/Makefile | cut -d= -f2-`
OMPI_CHECK_LINKER_FLAGS([opal/libltdl/libtool],
[-export-dynamic $flags])
OPAL_WRAPPER_FLAGS_ADD([LIBS], [$extra_ldflags])
# --export-dynamic allows exported symbols to be resolved via
# --dlsym and friends.
LDFLAGS="-export-dynamic $LDFLAGS"
else
AC_MSG_WARN([Failed to build GNU libltdl. This usually means that something])

Просмотреть файл

@ -11,7 +11,7 @@ dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
@ -21,8 +21,8 @@ dnl
# OPAL_WRAPPER_FLAGS_ADD(variable, new_argument)
# ----------------------------------------------
# Add new_argument to the list of arguments for variable in the wrapper compilers,
# if it's not already there. For example:
# Add new_argument to the list of arguments for variable in the
# wrapper compilers, if it's not already there. For example:
# OPAL_WRAPPER_FLAGS_ADD(CFLAGS, "-pthread")
# will add -pthread to the list of CFLAGS the wrappers use when invoked.
#
@ -31,12 +31,12 @@ dnl
AC_DEFUN([OPAL_WRAPPER_FLAGS_ADD], [
m4_ifdef([mca_component_configure_active],
[m4_fatal([OPAL_WRAPPER_FLAGS_ADD can not be called from a component configure])])
m4_if([$1], [CPPFLAGS], [OPAL_APPEND_UNIQ([wrapper_extra_cppflags], [$2])],
[$1], [CFLAGS], [OPAL_APPEND_UNIQ([wrapper_extra_cflags], [$2])],
[$1], [CXXFLAGS], [OPAL_APPEND_UNIQ([wrapper_extra_cxxflags], [$2])],
[$1], [FCFLAGS], [OPAL_APPEND_UNIQ([wrapper_extra_fcflags], [$2])],
[$1], [LDFLAGS], [OPAL_APPEND_UNIQ([wrapper_extra_ldflags], [$2])],
[$1], [LIBS], [OPAL_APPEND_UNIQ([wrapper_extra_libs], [$2])],
m4_if([$1], [CPPFLAGS], [OPAL_FLAGS_APPEND_UNIQ([wrapper_extra_cppflags], [$2])],
[$1], [CFLAGS], [OPAL_FLAGS_APPEND_UNIQ([wrapper_extra_cflags], [$2])],
[$1], [CXXFLAGS], [OPAL_FLAGS_APPEND_UNIQ([wrapper_extra_cxxflags], [$2])],
[$1], [FCFLAGS], [OPAL_FLAGS_APPEND_UNIQ([wrapper_extra_fcflags], [$2])],
[$1], [LDFLAGS], [OPAL_FLAGS_APPEND_UNIQ([wrapper_extra_ldflags], [$2])],
[$1], [LIBS], [OPAL_FLAGS_APPEND_UNIQ([wrapper_extra_libs], [$2])],
[m4_fatal([Unknown wrapper flag type $1])])
])
@ -129,10 +129,125 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[
AC_MSG_RESULT([$enable_wrapper_rpath])
])
# Check to see whether the linker supports DT_RPATH. We'll need to
# use config.rpath to find the flags that it needs, if it does (see
# comments in config.rpath for an explanation of where it came from).
AC_DEFUN([OPAL_SETUP_RPATH],[
OPAL_VAR_SCOPE_PUSH([rpath_libdir_save rpath_script rpath_outfile])
AC_MSG_CHECKING([if linker supports RPATH])
# Output goes into globally-visible $rpath_args. Run this in a
# sub-process so that we don't pollute the current process
# environment.
rpath_script=conftest.$$.sh
rpath_outfile=conftest.$$.out
rm -f $rpath_script $rpath_outfile
cat > $rpath_file <<EOF
#!/bin/sh
# Slurp in the libtool config into my environment
# Apparently, "libtoool --config" calls "exit", so we can't source it
# (because if script A sources script B, and B calls "exit", then both
# B and A will exit). Instead, we have to send the output to a file
# and then source that.
$OMPI_TOP_BUILDDIR/opal/libltdl/libtool --config > $rpath_outfile
chmod +x $rpath_outfile
. ./$rpath_outfile
rm -f $rpath_outfile
# Evaluate \$hardcode_libdir_flag_spec, and substitute in LIBDIR for \$libdir
libdir=LIBDIR
flags="\`eval echo \$hardcode_libdir_flag_spec\`"
echo \$flags
# Done
exit 0
EOF
chmod +x $rpath_script
rpath_args=`./$rpath_script`
rm -f $rpath_script
AS_IF([test -n "$rpath_args"],
[WRAPPER_RPATH_SUPPORT=rpath
AC_MSG_RESULT([yes ($rpath_args)])],
[WRAPPER_RPATH_SUPPORT=unnecessary
AC_MSG_RESULT([yes (no extra flags needed)])])
OPAL_VAR_SCOPE_POP
# If we found RPATH support, check for RUNPATH support, too
AS_IF([test "$WRAPPER_RPATH_SUPPORT" = "rpath"],
[OPAL_SETUP_RUNPATH])
])
# Check to see if the linker supports the DT_RUNPATH flags via
# --enable-new-dtags (a GNU ld-specific option). These flags are more
# social than DT_RPATH -- they can be overridden by LD_LIBRARY_PATH
# (where a regular DT_RPATH cannot).
#
# If DT_RUNPATH is supported, then we'll use *both* the RPATH and
# RUNPATH flags in the LDFLAGS.
AC_DEFUN([OPAL_SETUP_RUNPATH],[
OPAL_VAR_SCOPE_PUSH([LDFLAGS_save])
AC_MSG_CHECKING([if linker supports RUNPATH])
# Set the output in $runpath_args
runpath_args=
LDFLAGS_save=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
AC_LANG_PUSH([C])
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 7;])],
[WRAPPER_RPATH_SUPPORT=runpath
runpath_args="-Wl,--enable-new-dtags"
AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])],
[AC_MSG_RESULT([no])])
AC_LANG_POP([C])
LDFLAGS=$LDFLAGS_save
OPAL_VAR_SCOPE_POP
])
# Called to find all -L arguments in the LDFLAGS and add in RPATH args
# for each of them. Then also add in an RPATH for @{libdir} (which
# will be replaced by the wrapper compile to the installdir libdir at
# runtime), and the RUNPATH args, if we have them.
AC_DEFUN([RPATHIFY_LDFLAGS],[
OPAL_VAR_SCOPE_PUSH([rpath_out rpath_dir rpath_tmp])
AS_IF([test "$enable_wrapper_rpath" = "no" -o "$WRAPPER_RPATH_SUPPORT" = "disabled"],
[:],
[rpath_out=
for val in ${$1}; do
case $val in
-L*)
rpath_dir=`echo $val | cut -c3-`
rpath_tmp=`echo $rpath_args | sed -e s@LIBDIR@$rpath_dir@`
rpath_out="$rpath_out $rpath_tmp"
;;
esac
done
# Now add in the RPATH args for @{libdir}, and the RUNPATH args
rpath_tmp=`echo $rpath_args | sed -e s/LIBDIR/@{libdir}/`
$1="$rpath_out $rpath_tmp $runpath_args"
])
OPAL_VAR_SCOPE_POP
])
# OPAL_SETUP_WRAPPER_FINAL()
# ---------------------------
AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
# Setup RPATH support, if desired
WRAPPER_RPATH_SUPPORT=disabled
AS_IF([test "$enable_wrapper_rpath" = "yes"],
[OPAL_SETUP_RPATH])
AS_IF([test "$enable_wrapper_rpath" = "yes" -a "$WRAPPER_RPATH_SUPPORT" = "disabled"],
[AC_MSG_WARN([RPATH support requested but not available])
AC_MSG_ERROR([Cannot continue])])
# We now have all relevant flags. Substitute them in everywhere.
m4_ifdef([project_opal], [
AC_MSG_CHECKING([for OPAL CPPFLAGS])
if test "$WANT_INSTALL_HEADERS" = "1" ; then
@ -164,6 +279,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
AC_MSG_CHECKING([for OPAL LDFLAGS])
OPAL_WRAPPER_EXTRA_LDFLAGS="$opal_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
RPATHIFY_LDFLAGS([OPAL_WRAPPER_EXTRA_LDFLAGS])
AC_SUBST([OPAL_WRAPPER_EXTRA_LDFLAGS])
AC_MSG_RESULT([$OPAL_WRAPPER_EXTRA_LDFLAGS])
@ -174,7 +290,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
# asked for, as they know better than us.
AC_MSG_CHECKING([for OPAL LIBS])
OPAL_WRAPPER_EXTRA_LIBS="$opal_mca_wrapper_extra_libs"
OPAL_APPEND_UNIQ([OPAL_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
OPAL_FLAGS_APPEND_UNIQ([OPAL_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
OPAL_WRAPPER_EXTRA_LIBS="$OPAL_WRAPPER_EXTRA_LIBS $with_wrapper_libs"
AC_SUBST([OPAL_WRAPPER_EXTRA_LIBS])
AC_MSG_RESULT([$OPAL_WRAPPER_EXTRA_LIBS])
@ -211,12 +327,13 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
AC_MSG_CHECKING([for ORTE LDFLAGS])
ORTE_WRAPPER_EXTRA_LDFLAGS="$orte_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
RPATHIFY_LDFLAGS([ORTE_WRAPPER_EXTRA_LDFLAGS])
AC_SUBST([ORTE_WRAPPER_EXTRA_LDFLAGS])
AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_LDFLAGS])
AC_MSG_CHECKING([for ORTE LIBS])
ORTE_WRAPPER_EXTRA_LIBS="$orte_mca_wrapper_extra_libs"
OPAL_APPEND_UNIQ([ORTE_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
OPAL_FLAGS_APPEND_UNIQ([ORTE_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
ORTE_WRAPPER_EXTRA_LIBS="$ORTE_WRAPPER_EXTRA_LIBS $with_wrapper_libs"
AC_SUBST([ORTE_WRAPPER_EXTRA_LIBS])
AC_MSG_RESULT([$ORTE_WRAPPER_EXTRA_LIBS])
@ -282,12 +399,13 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
AC_MSG_CHECKING([for OMPI LDFLAGS])
OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
RPATHIFY_LDFLAGS([OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_MSG_CHECKING([for OMPI LIBS])
OMPI_WRAPPER_EXTRA_LIBS="$ompi_mca_wrapper_extra_libs"
OPAL_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
OMPI_WRAPPER_EXTRA_LIBS="$OMPI_WRAPPER_EXTRA_LIBS $with_wrapper_libs"
AC_SUBST([OMPI_WRAPPER_EXTRA_LIBS])
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LIBS])

207
config/orte_setup_java.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,207 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2006 The University of Tennessee and The University
dnl of Tennessee Research Foundation. All rights
dnl reserved.
dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2012 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007-2012 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
# This macro is necessary to get the title to be displayed first. :-)
AC_DEFUN([ORTE_SETUP_JAVA_BANNER],[
ompi_show_subtitle "Java compiler"
])
# ORTE_SETUP_JAVA()
# ----------------
# Do everything required to setup the Java compiler. Safe to AC_REQUIRE
# this macro.
AC_DEFUN([ORTE_SETUP_JAVA],[
OPAL_VAR_SCOPE_PUSH([orte_java_happy bad found dir jnih PATH_save CPPFLAGS_save])
AC_REQUIRE([ORTE_SETUP_JAVA_BANNER])
AC_ARG_ENABLE(java,
AC_HELP_STRING([--enable-java],
[Enable Java-based support in the system - use this option to disable all Java-based compiler tests (default: enabled)]))
AC_ARG_WITH(jdk-dir,
AC_HELP_STRING([--with-jdk-dir(=DIR)],
[Location of the JDK header directory. If you use this option, do not specify --with-jdk-bindir or --with-jdk-headers.]))
AC_ARG_WITH(jdk-bindir,
AC_HELP_STRING([--with-jdk-bindir(=DIR)],
[Location of the JDK bin directory. If you use this option, you must also use --with-jdk-headers (and you must NOT use --with-jdk-dir)]))
AC_ARG_WITH(jdk-headers,
AC_HELP_STRING([--with-jdk-headers(=DIR)],
[Location of the JDK header directory. If you use this option, you must also use --with-jdk-bindir (and you must NOT use --with-jdk-dir)]))
if test "$enable_java" = "no"; then
HAVE_JAVA_SUPPORT=0
orte_java_happy=no
else
# Check for bozo case: ensure a directory was specified
AS_IF([test "$with_jdk_dir" = "yes" -o "$with_jdk_dir" = "no"],
[AC_MSG_WARN([Must specify a directory name for --with-jdk-dir])
AC_MSG_ERROR([Cannot continue])])
AS_IF([test "$with_jdk_bindir" = "yes" -o "$with_jdk_bindir" = "no"],
[AC_MSG_WARN([Must specify a directory name for --with-jdk-bindir])
AC_MSG_ERROR([Cannot continue])])
AS_IF([test "$with_jdk_headers" = "yes" -o "$with_jdk_headers" = "no"],
[AC_MSG_WARN([Must specify a directory name for --with-jdk-headers])
AC_MSG_ERROR([Cannot continue])])
# Check for bozo case: either specify --with-jdk-dir or
# (--with-jdk-bindir, --with-jdk-headers) -- not both.
bad=0
AS_IF([test -n "$with_jdk_dir" -a -n "$with_jdk_bindir" -o \
-n "$with_jdk_dir" -a -n "$with_jdk_headers"],[bad=1])
AS_IF([test -z "$with_jdk_bindir" -a -n "$with_jdk_headers" -o \
-n "$with_jdk_bindir" -a -z "$with_jdk_headers"],[bad=1])
AS_IF([test "$bad" = "1"],
[AC_MSG_WARN([Either specify --with-jdk-dir or both of (--with-jdk_bindir, --with-jdk-headers) -- not both.])
AC_MSG_ERROR([Cannot continue])])
AS_IF([test -n "$with_jdk_dir"],
[with_jdk_bindir=$with_jdk_dir/bin
with_jdk_headers=$with_jdk_dir/include])
##################################################################
# with_jdk_dir can now be ignored; with_jdk_bindir and
# with_jdk_headers will be either empty or have valid values.
##################################################################
# Some java installations are in obscure places. So let's
# hard-code a few of the common ones so that users don't have to
# specify --with-java-<foo>=LONG_ANNOYING_DIRECTORY.
AS_IF([test -z "$with_jdk_bindir"],
[ # OS X Snow Leopard and Lion (10.6 and 10.7 -- did not
# check prior versions)
found=0
dir=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
AC_MSG_CHECKING([OSX locations])
AS_IF([test -d $dir],
[AC_MSG_RESULT([found])
found=1
with_jdk_headers=$dir
with_jdk_bindir=/usr/bin],
[AC_MSG_RESULT([not found])])
if test "$found" = "0"; then
# Various Linux
if test -z "$JAVA_HOME"; then
dir='/usr/lib/jvm/java-*-openjdk-*/include/'
else
dir=$JAVA_HOME/include
fi
jnih=`ls $dir/jni.h 2>/dev/null | head -n 1`
AC_MSG_CHECKING([Linux locations])
AS_IF([test -r "$jnih"],
[with_jdk_headers=`dirname $jnih`
OPAL_WHICH([javac], [with_jdk_bindir])
AS_IF([test -n "$with_jdk_bindir"],
[AC_MSG_RESULT([found])
found=1
with_jdk_bindir=`dirname $with_jdk_bindir`],
[with_jdk_headers=])],
[dir='/usr/lib/jvm/default-java/include/'
jnih=`ls $dir/jni.h 2>/dev/null | head -n 1`
AS_IF([test -r "$jnih"],
[with_jdk_headers=`dirname $jnih`
OPAL_WHICH([javac], [with_jdk_bindir])
AS_IF([test -n "$with_jdk_bindir"],
[AC_MSG_RESULT([found])
found=1
with_jdk_bindir=`dirname $with_jdk_bindir`],
[with_jdk_headers=])],
[AC_MSG_RESULT([not found])])])
fi
if test "$found" = "0"; then
# Solaris
dir=/usr/java
AC_MSG_CHECKING([Solaris locations])
AS_IF([test -d $dir -a -r "$dir/include/jni.h"],
[AC_MSG_RESULT([found])
with_jdk_headers=$dir/include
with_jdk_bindir=$dir/bin
found=1],
[AC_MSG_RESULT([not found])])
fi
],
[found=1])
if test "$found" = "1"; then
OMPI_CHECK_WITHDIR([jdk-bindir], [$with_jdk_bindir], [javac])
OMPI_CHECK_WITHDIR([jdk-headers], [$with_jdk_headers], [jni.h])
# Look for various Java-related programs
orte_java_happy=no
PATH_save=$PATH
AS_IF([test -n "$with_jdk_bindir" -a "$with_jdk_bindir" != "yes" -a "$with_jdk_bindir" != "no"],
[PATH="$with_jdk_bindir:$PATH"])
AC_PATH_PROG(JAVAC, javac)
AC_PATH_PROG(JAVAH, javah)
AC_PATH_PROG(JAR, jar)
PATH=$PATH_save
# Check to see if we have all 3 programs.
AS_IF([test -z "$JAVAC" -o -z "$JAVAH" -o -z "$JAR"],
[orte_java_happy=no
HAVE_JAVA_SUPPORT=0],
[orte_java_happy=yes
HAVE_JAVA_SUPPORT=1])
# Look for jni.h
AS_IF([test "$orte_java_happy" = "yes"],
[CPPFLAGS_save=$CPPFLAGS
# silence a stupid Mac warning
CPPFLAGS="$CPPFLAGS -DTARGET_RT_MAC_CFM=0"
AS_IF([test -n "$with_jdk_headers" -a "$with_jdk_headers" != "yes" -a "$with_jdk_headers" != "no"],
[ORTE_JDK_CPPFLAGS="-I$with_jdk_headers"
# Some flavors of JDK also require -I<blah>/linux.
# See if that's there, and if so, add a -I for that,
# too. Ugh.
AS_IF([test -d "$with_jdk_headers/linux"],
[ORTE_JDK_CPPFLAGS="$ORTE_JDK_CPPFLAGS -I$with_jdk_headers/linux"])
# Solaris JDK also require -I<blah>/solaris.
# See if that's there, and if so, add a -I for that,
# too. Ugh.
AS_IF([test -d "$with_jdk_headers/solaris"],
[ORTE_JDK_CPPFLAGS="$ORTE_JDK_CPPFLAGS -I$with_jdk_headers/solaris"])
CPPFLAGS="$CPPFLAGS $ORTE_JDK_CPPFLAGS"])
AC_CHECK_HEADER([jni.h], [],
[orte_java_happy=no])
CPPFLAGS=$CPPFLAGS_save
])
else
orte_java_happy=no;
HAVE_JAVA_SUPPORT=no;
fi
AC_SUBST(ORTE_JDK_CPPFLAGS)
fi
# Are we happy?
AC_MSG_CHECKING([Java support available])
AS_IF([test "$orte_java_happy" = "no"],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])])
AC_DEFINE_UNQUOTED([ORTE_HAVE_JAVA_SUPPOR]T, [$HAVE_JAVA_SUPPORT], [do we have Java support])
AM_CONDITIONAL(ORTE_HAVE_JAVA_SUPPORT, test "$orte_java_happy" = "yes")
OPAL_VAR_SCOPE_POP
])

123
opal/mca/event/external/configure.m4 поставляемый
Просмотреть файл

@ -44,16 +44,6 @@ AC_DEFUN([MCA_opal_event_external_POST_CONFIG],[
CPPFLAGS="$CPPFLAGS $opal_event_external_CPPFLAGS"
LDFLAGS="$LDFLAGS $opal_event_external_LDFLAGS"
LIBS="$LIBS $opal_event_external_LIBS"
# These flags need to get passed to the wrapper compilers
# (this is unnecessary for the internal/embedded event)
# Finally, add some flags to the wrapper compiler if we're
# building with developer headers so that our headers can
# be found.
event_external_WRAPPER_EXTRA_CPPFLAGS="$opal_event_external_CPPFLAGS"
event_external_WRAPPER_EXTRA_LDFLAGS="$opal_event_external_LDFLAGS"
event_external_WRAPPER_EXTRA_LIBS="$opal_event_external_LIBS"
])
])dnl
@ -65,24 +55,50 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[
OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save])
AC_ARG_WITH([external-libevent],
[AC_HELP_STRING([--with-external-libevent=DIR],
[Search for event libraries in DIR. Should only be used if an external copy of libevent is being used.])])
AC_ARG_WITH([libevent],
[AC_HELP_STRING([--with-libevent=DIR],
[Search for libevent headers and libraries in DIR. Should only be used if an external copy of libevent is being used.])])
# Do we want this external component?
# Bozo check
AS_IF([test "$with_libevent" = "no"],
[AC_MSG_WARN([It is not possible to configure Open MPI --without-libevent])
AC_MSG_ERROR([Cannot continue])])
AC_ARG_WITH([libevent-libdir],
[AC_HELP_STRING([--with-libevent-libdir=DIR],
[Search for libevent libraries in DIR. Should only be used if an external copy of libevent is being used.])])
# Make sure the user didn't specify --with-libevent=internal and
# --with-libevent-libdir=whatever (because you can only specify
# --with-libevent-libdir when external libevent is being used).
AS_IF([test "$with_libevent" = "internal" -a "$with_libevent_libdir" != ""],
[AC_MSG_WARN([Both --with-libevent=internal and --with-libevent-libdir=DIR])
AC_MSG_WARN([were specified, which does not make sense.])
AC_MSG_ERROR([Cannot continue])])
# Do we want this external component? (slightly redundant logic,
# but hopefully slightly more clear...)
opal_event_external_want=no
AS_IF([test "$with_external_libevent" != ""], [opal_event_external_want=yes])
# If we still want external support, try it
AS_IF([test "$with_libevent" = "external"], [opal_event_external_want=yes])
AS_IF([test "$with_libevent_libdir" != ""], [opal_event_external_want=yes])
AS_IF([test "$with_libevent" != "" -a "$with_libevent" != "no" -a "$with_libevent" != "internal"], [opal_event_external_want=yes])
# If we want external support, try it
AS_IF([test "$opal_event_external_want" = "yes"],
[OMPI_CHECK_WITHDIR([external-libevent], [$with_event_libdir],
[ # Error out if the specified dir does not exist
OMPI_CHECK_WITHDIR([libevent-libdir], [$with_libevent_libdir],
[libevent.*])
AC_MSG_CHECKING([looking for external event in...])
AS_IF([test ! -z "$with_external_libevent" -a "$with_external_libevent" != "yes"],
[opal_event_libdir="$with_external_libevent"
AC_MSG_RESULT([$opal_event_libdir])],
[AC_MSG_RESULT([default search paths])])
AC_MSG_CHECKING([for external libevent in])
AS_IF([test "$with_libevent" != "external" -a "$with_libevent" != "yes"],
[opal_event_dir=$with_libevent
AC_MSG_RESULT([$opal_event_dir])
OMPI_CHECK_WITHDIR([libevent], [$with_libdir],
[include/event.h])
],
[AC_MSG_RESULT([(default search paths)])])
AS_IF([test ! -z "$with_libevent_libdir" -a "$with_libevent_libdir" != "yes"],
[opal_event_libdir="$with_libevent_libdir"])
opal_event_external_CPPFLAGS_save=$CPPFLAGS
opal_event_external_CFLAGS_save=$CFLAGS
@ -93,41 +109,60 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[
[event.h],
[event],
[event_config_new],
[],
[$opal_event_libdir],
[-levent_pthreads],
[$opal_event_dir],
[$opal_event_libdir],
[opal_event_external_support=yes],
[opal_event_external_support=no])
# Ensure that this libevent has the symbol
# "evthread_set_lock_callbacks", which will only exist if
# libevent was configured with thread support.
LIBS="$opal_event_external_LDFLAGS $LIBS"
AC_CHECK_LIB([event], [evthread_set_lock_callbacks],
[],
[AC_MSG_WARN([External libevent does not have thread support])
AC_MSG_WARN([Open MPI requires libevent to be compiled with])
AC_MSG_WARN([thread support enabled])
AC_MSG_ERROR([Cannot continue])])
AC_CHECK_LIB([event_pthreads], [evthread_use_pthreads],
[],
[AC_MSG_WARN([External libevent does not have thread support])
AC_MSG_WARN([Open MPI requires libevent to be compiled with])
AC_MSG_WARN([thread support enabled])
AC_MSG_ERROR([Cannot continue])])
CPPFLAGS=$opal_event_external_CPPFLAGS_save
CFLAGS=$opal_event_external_CFLAGS_save
LDFLAGS=$opal_event_external_LDFLAGS_save
LIBS=$opal_event_external_LIBS_save
# check for pthread support - must do this after
# restoring LIBS as otherwise the results of
# this macro will be overwritten
OMPI_CHECK_FUNC_LIB([evthread_use_pthreads],
[event_pthreads],
[opal_event_external_has_threads=1],
[opal_event_external_has_threads=0])
AC_SUBST(opal_event_external_CPPFLAGS)
AC_SUBST(opal_event_external_LDFLAGS)
AC_SUBST(opal_event_external_LIBS)
])
# These flags need to get passed to the wrapper compilers
# (this is unnecessary for the internal/embedded event)
event_external_WRAPPER_EXTRA_CPPFLAGS=$opal_event_external_CPPFLAGS
# Finally, add some flags to the wrapper compiler if we're
# building with developer headers so that our headers can
# be found.
event_external_WRAPPER_EXTRA_LDFLAGS=$opal_event_external_LDFLAGS
event_external_WRAPPER_EXTRA_LIBS=$opal_event_external_LIBS
])
# Done!
AS_IF([test "$opal_event_external_support" = "yes"],
[AC_DEFINE_UNQUOTED([EVENT_EXTERNAL_EVENT_VERSION],
[external],
[Version of event])
AC_DEFINE_UNQUOTED([OPAL_HAVE_EXTERNAL_EVENT_THREAD_SUPPORT],
[$opal_event_external_has_threads],
[Whether the external libevent has thread support])
[ # If we configured successfully, set
# OPAL_HAVE_WORKING_EVENTOPS to 1 (it's a calculated value
# in the embedded Open MPI libevent, so we can only assume
# what it is in the installed libevent :-\ ).
file=$opal_event_dir/include/libevent/config.h
OPAL_HAVE_WORKING_EVENTOPS=1
$1],
[$2])
AC_SUBST(opal_event_external_CPPFLAGS)
AC_SUBST(opal_event_external_LDFLAGS)
AC_SUBST(opal_event_external_LIBS)
[OPAL_HAVE_WORKING_EVENTOPS=0
$2])
OPAL_VAR_SCOPE_POP
])dnl

6
opal/mca/event/external/external.h поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
*
* $COPYRIGHT$
@ -60,11 +60,7 @@ OPAL_DECLSPEC int opal_event_init(void);
#define opal_event_set_priority(x, n) event_priority_set((x), (n))
/* thread support APIs */
#if OPAL_HAVE_EXTERNAL_EVENT_THREAD_SUPPORT
#define opal_event_use_threads() evthread_use_pthreads()
#else
#define opal_event_use_threads()
#endif
/* Basic event APIs */
#define opal_event_enable_debug_mode() event_enable_debug_mode()

Просмотреть файл

@ -21,6 +21,7 @@ AC_DEFUN([MCA_opal_event_libevent2021_COMPILE_MODE], [
])
AC_DEFUN([MCA_opal_event_libevent2021_POST_CONFIG], [
AM_CONDITIONAL(OPAL_EVENT_HAVE_THREAD_SUPPORT, test "$enable_event_thread_support" = "yes")
AS_IF([test "$1" = "1"],
[ # Build libevent/include/event2/event-config.h. If we
# don't do it here, then libevent's Makefile.am will build
@ -30,10 +31,10 @@ AC_DEFUN([MCA_opal_event_libevent2021_POST_CONFIG], [
# copied from libevent's Makefile.am.
AC_CONFIG_COMMANDS([opal/mca/event/libevent2021/libevent/include/event2/event-config.h],
[basedir="opal/mca/event/libevent2021"
file="$basedir/libevent/include/event2/event-config.h"
rm -f "$file.new"
cat > "$file.new" <<EOF
[libevent_basedir="opal/mca/event/libevent2021"
libevent_file="$libevent_basedir/libevent/include/event2/event-config.h"
rm -f "$libevent_file.new"
cat > "$libevent_file.new" <<EOF
/* event2/event-config.h
*
* This file was generated by autoconf when libevent was built, and
@ -51,18 +52,18 @@ EOF
sed -e 's/#define /#define _EVENT_/' \
-e 's/#undef /#undef _EVENT_/' \
-e 's/#ifndef /#ifndef _EVENT_/' < "$basedir/libevent/config.h" >> "$file.new"
echo "#endif" >> "$file.new"
-e 's/#ifndef /#ifndef _EVENT_/' < "$libevent_basedir/libevent/config.h" >> "$libevent_file.new"
echo "#endif" >> "$libevent_file.new"
# Only make a new .h file if the
# Only make a new .h libevent_file if the
# contents haven't changed
diff -q $file "$file.new" > /dev/null 2> /dev/null
diff -q $libevent_file "$libevent_file.new" > /dev/null 2> /dev/null
if test "$?" = "0"; then
echo $file is unchanged
echo $libevent_file is unchanged
else
cp "$file.new" $file
cp "$libevent_file.new" $libevent_file
fi
rm -f "$file.new"])
rm -f "$libevent_file.new"])
# Must set this variable so that the framework m4 knows
# what file to include in opal/mca/event/event.h
@ -70,11 +71,11 @@ EOF
# Add some stuff to CPPFLAGS so that the rest of the source
# tree can be built
file=$basedir/libevent
CPPFLAGS="$CPPFLAGS -I$OMPI_TOP_SRCDIR/$file -I$OMPI_TOP_SRCDIR/$file/include"
libevent_file=$libevent_basedir/libevent
CPPFLAGS="$CPPFLAGS -I$OMPI_TOP_SRCDIR/$libevent_file -I$OMPI_TOP_SRCDIR/$libevent_file/include"
AS_IF([test "$OMPI_TOP_BUILDDIR" != "$OMPI_TOP_SRCDIR"],
[CPPFLAGS="$CPPFLAGS -I$OMPI_TOP_BUILDDIR/$file/include"])
unset file
[CPPFLAGS="$CPPFLAGS -I$OMPI_TOP_BUILDDIR/$libevent_file/include"])
unset libevent_file
])
])
@ -82,11 +83,20 @@ EOF
# [action-if-cant-compile])
# ------------------------------------------------
AC_DEFUN([MCA_opal_event_libevent2021_CONFIG],[
OPAL_VAR_SCOPE_PUSH([CFLAGS_save CPPFLAGS_save file event_args libevent_happy])
OPAL_VAR_SCOPE_PUSH([CFLAGS_save CPPFLAGS_save libevent_file event_args libevent_happy])
AC_CONFIG_FILES([opal/mca/event/libevent2021/Makefile])
basedir="opal/mca/event/libevent2021"
libevent_basedir="opal/mca/event/libevent2021"
# If we're not building externally, configure this component
AS_IF([test "$with_libevent" = "internal" -o "$with_libevent" = "" -o "$with_libevent" = "yes"],
[MCA_opal_event_libevent2021_DO_THE_CONFIG],
[AC_MSG_WARN([using an external libevent; disqualifiying this component])
$2])
OPAL_VAR_SCOPE_POP
])
AC_DEFUN([MCA_opal_event_libevent2021_DO_THE_CONFIG], [
CFLAGS_save="$CFLAGS"
CFLAGS="$OMPI_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"
CPPFLAGS_save="$CPPFLAGS"
@ -154,7 +164,7 @@ AC_DEFUN([MCA_opal_event_libevent2021_CONFIG],[
AC_MSG_RESULT([$event_args])
OMPI_CONFIG_SUBDIR([$basedir/libevent],
OMPI_CONFIG_SUBDIR([$libevent_basedir/libevent],
[$event_args $ompi_subdir_args],
[libevent_happy="yes"], [libevent_happy="no"])
if test "$libevent_happy" = "no"; then
@ -174,12 +184,10 @@ AC_DEFUN([MCA_opal_event_libevent2021_CONFIG],[
# the value in the generated libevent/config.h (NOT
# libevent/include/event2/event-config.h!). Otherwise, set it to
# 0.
file=$basedir/libevent/config.h
AS_IF([test "$libevent_happy" = "yes" -a -r $file],
[OPAL_HAVE_WORKING_EVENTOPS=`grep HAVE_WORKING_EVENTOPS $file | awk '{print [$]3 }'`
libevent_file=$libevent_basedir/libevent/config.h
AS_IF([test "$libevent_happy" = "yes" -a -r $libevent_file],
[OPAL_HAVE_WORKING_EVENTOPS=`grep HAVE_WORKING_EVENTOPS $libevent_file | awk '{print [$]3 }'`
$1],
[$2
OPAL_HAVE_WORKING_EVENTOPS=0])
OPAL_VAR_SCOPE_POP
])