1
1
openmpi/config/opal_check_ident.m4
Jeff Squyres b29b852281 Consolidate all the opal/orte/ompi .m4 files back to the top-level
config/ directory.  We split them apart a while ago in the hopes that
it would simplify things, but it didn't really (e.g., because there
were still some ompi/opal .m4 files in the top-level config/
directory, resulting in developer confusion where any given m4 macro
was defined).

So this commit consolidates them back into the top-level directory for
simplicity.  

There's still (at least) two changes that would be nice to make:

 1. Split any generated .m4 file (e.g., autogen-generated .m4 files)
    into a separate directory somewhere so that a top-level -Iconfig/
    will only get our explicitly defined macros, not the autogen stuff
    (e.g., with libevent2019 needing to get the visibility macro, but
    NOT all the autogen-generated inclusion of component configure.m4
    files).
 1. Change configure to be of the form:
{{{
# ...a small amount of preamble/setup...
OPAL_SETUP
m4_ifdef([project_orte], [ORTE_SETUP])
m4_ifdef([project_ompi], [OMPI_SETUP])
# ...a small amount of finishing stuff...
}}}

I doubt we'll ever get anything as clean as that, but that would be
the goal to shoot for.

This commit was SVN r27704.
2012-12-19 00:00:36 +00:00

98 строки
3.7 KiB
Bash

dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
dnl defines:
dnl OPAL_$1_USE_PRAGMA_IDENT
dnl OPAL_$1_USE_IDENT
dnl OPAL_$1_USE_CONST_CHAR_IDENT
dnl
# OMPI_CHECK_IDENT(compiler-env, compiler-flags,
# file-suffix, lang) Try to compile a source file containing
# a #pragma ident, and determine whether the ident was
# inserted into the resulting object file
# -----------------------------------------------------------
AC_DEFUN([OMPI_CHECK_IDENT], [
AC_MSG_CHECKING([for $4 ident string support])
opal_pragma_ident_happy=0
opal_ident_happy=0
opal_static_const_char_happy=0
_OMPI_CHECK_IDENT(
[$1], [$2], [$3],
[[#]pragma ident], [],
[opal_pragma_ident_happy=1
ompi_message="[#]pragma ident"],
_OMPI_CHECK_IDENT(
[$1], [$2], [$3],
[[#]ident], [],
[opal_ident_happy=1
ompi_message="[#]ident"],
_OMPI_CHECK_IDENT(
[$1], [$2], [$3],
[[#]pragma comment(exestr, ], [)],
[opal_pragma_comment_happy=1
ompi_message="[#]pragma comment"],
[opal_static_const_char_happy=1
ompi_message="static const char[[]]"])))
AC_DEFINE_UNQUOTED([OPAL_$1_USE_PRAGMA_IDENT],
[$opal_pragma_ident_happy], [Use #pragma ident strings for $4 files])
AC_DEFINE_UNQUOTED([OPAL_$1_USE_IDENT],
[$opal_ident_happy], [Use #ident strings for $4 files])
AC_DEFINE_UNQUOTED([OPAL_$1_USE_PRAGMA_COMMENT],
[$opal_pragma_comment_happy], [Use #pragma comment for $4 files])
AC_DEFINE_UNQUOTED([OPAL_$1_USE_CONST_CHAR_IDENT],
[$opal_static_const_char_happy], [Use static const char[] strings for $4 files])
AC_MSG_RESULT([$ompi_message])
unset opal_pragma_ident_happy opal_ident_happy opal_static_const_char_happy ompi_message
])
# _OMPI_CHECK_IDENT(compiler-env, compiler-flags,
# file-suffix, header_prefix, header_suffix, action-if-success, action-if-fail)
# Try to compile a source file containing a #-style ident,
# and determine whether the ident was inserted into the
# resulting object file
# -----------------------------------------------------------
AC_DEFUN([_OMPI_CHECK_IDENT], [
eval ompi_compiler="\$$1"
eval ompi_flags="\$$2"
ompi_ident="string_not_coincidentally_inserted_by_the_compiler"
cat > conftest.$3 <<EOF
$4 "$ompi_ident" $5
int main(int argc, char** argv);
int main(int argc, char** argv) { return 0; }
EOF
# "strings" won't always return the ident string. objdump isn't
# universal (e.g., OS X doesn't have it), and ...other
# complications. So just try to "grep" for the string in the
# resulting object file. If the ident is found in "strings" or
# the grep succeeds, rule that we have this flavor of ident.
OPAL_LOG_COMMAND([$ompi_compiler $ompi_flags -c conftest.$3 -o conftest.${OBJEXT}],
[AS_IF([test -f conftest.${OBJEXT}],
[ompi_output="`strings -a conftest.${OBJEXT} | grep $ompi_ident`"
grep $ompi_ident conftest.${OBJEXT} 2>&1 1>/dev/null
ompi_status=$?
AS_IF([test "$ompi_output" != "" -o "$ompi_status" = "0"],
[$6],
[$7])],
[OPAL_LOG_MSG([the failed program was:])
OPAL_LOG_FILE([conftest.$3])
$7]
[$7])])
unset ompi_compiler ompi_flags ompi_output ompi_status
rm -rf conftest.* conftest${EXEEXT}
])dnl