Author: emallove
Date: 2007-11-02 22:40:22 EDT (Fri, 02 Nov 2007)
New Revision: 16644
URL: https://svn.open-mpi.org/trac/ompi/changeset/16644
Log:
* Embed ident strings into the Open MPI libraries using one of the
following
methods (in order of precedence):
1. #pragma ident <ident string> (e.g., Intel and Sun)
1. #ident <ident string> (e.g., GCC)
1. static const char ident[] = <ident string> (all others)
By default, the ident string used is the standard Open MPI version
string. Only
the following libraries will get the embedded version strings
(e.g., DSOs will
not):
* libmpi.so
* libmpi_cxx.so
* libmpi_f77.so
* libopen-pal.so
* libopen-rte.so
* Added two new configure options:
* `--with-package-name="STRING"` (defaults to "Open MPI
username@hostname
Distribution"). `STRING` is displayed by `ompi_info` next to the
"Package"
heading.
* `--with-ident-string="STRING"` (defaults to the standard Open
MPI version
string - e.g., X.Y.Zr######). `%VERSION%` will expand to the
Open MPI
version string if it is supplied to this configure option.
Added:
trunk/config/ompi_check_ident.m4
Text files modified:
trunk/acinclude.m4 | 3 ++-
trunk/config/ompi_configure_options.m4 | 33 +++++++++++++++++++
+++++++++++++-
trunk/configure.ac | 13 ++++++++++---
trunk/ompi/include/ompi_config.h.in | 3 +++
trunk/ompi/mpi/c/init.c | 10 ++++++++++
trunk/ompi/mpi/cxx/mpicxx.cc | 12 ++++++++++--
trunk/ompi/mpi/f77/init_f.c | 10 ++++++++++
trunk/ompi/tools/ompi_info/version.cc | 3 +++
trunk/opal/runtime/opal_init.c | 8 ++++++++
trunk/orte/include/orte_config.h.in | 4 ++++
trunk/orte/runtime/orte_init.c | 9 +++++++++
11 files changed, 101 insertions(+), 7 deletions(-)
Modified: trunk/acinclude.m4
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/acinclude.m4 (original)
+++ trunk/acinclude.m4 2007-11-02 22:40:22 EDT (Fri, 02 Nov 2007)
@@ -10,7 +10,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 Cisco Systems, Inc.
+dnl Copyright (c) 2006-2007 Cisco Systems, Inc.
dnl Copyright (c) 2006 Los Alamos National Security, LLC. All
rights
dnl reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
@@ -58,6 +58,7 @@
m4_include(config/ompi_case_sensitive_fs_setup.m4)
m4_include(config/ompi_check_broken_qsort.m4)
m4_include(config/ompi_check_compiler_works.m4)
+m4_include(config/ompi_check_ident.m4)
m4_include(config/ompi_check_func_lib.m4)
m4_include(config/ompi_check_optflags.m4)
m4_include(config/ompi_check_attributes.m4)
Added: trunk/config/ompi_check_ident.m4
=
=
=
=
=
=
=
=
=
=====================================================================
--- (empty file)
+++ trunk/config/ompi_check_ident.m4 2007-11-02 22:40:22 EDT (Fri,
02 Nov 2007)
@@ -0,0 +1,88 @@
+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 OMPI_$1_USE_PRAGMA_IDENT
+dnl OMPI_$1_USE_IDENT
+dnl OMPI_$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])
+
+ ompi_pragma_ident_happy=0
+ ompi_ident_happy=0
+ ompi_static_const_char_happy=0
+ _OMPI_CHECK_IDENT(
+ [$1], [$2], [$3],
+ [[#]pragma ident],
+ [ompi_pragma_ident_happy=1
+ ompi_message="[#]pragma ident"],
+ _OMPI_CHECK_IDENT(
+ [$1], [$2], [$3],
+ [[#]ident],
+ [ompi_ident_happy=1
+ ompi_message="[#]ident"],
+ [ompi_static_const_char_happy=1
+ ompi_message="static const char[[]]"]))
+
+ AC_DEFINE_UNQUOTED([OMPI_$1_USE_PRAGMA_IDENT],
+ [$ompi_pragma_ident_happy], [Use #pragma ident strings for
$4 files])
+ AC_DEFINE_UNQUOTED([OMPI_$1_USE_IDENT],
+ [$ompi_ident_happy], [Use #ident strings for $4 files])
+ AC_DEFINE_UNQUOTED([OMPI_$1_USE_CONST_CHAR_IDENT],
+ [$ompi_static_const_char_happy], [Use static const char[]
strings for $4 files])
+
+ AC_MSG_RESULT([$ompi_message])
+
+ unset ompi_pragma_ident_happy ompi_ident_happy
ompi_static_const_char_happy ompi_message
+])
+
+# _OMPI_CHECK_IDENT(compiler-env, compiler-flags,
+# file-suffix, header, 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"
+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.
+
+ OMPI_LOG_COMMAND([$ompi_compiler $ompi_flags -c conftest.$3 -o
conftest],
+ [ompi_output="`strings -a conftest | grep
$ompi_ident`"
+ grep $ompi_ident conftest 2>&1 1>/dev/null
+ ompi_status=$?
+ AS_IF([test "$ompi_output" != "" -o
"$ompi_status" = "0"],
+ [$5],
+ [$6])],
+ [OMPI_LOG_MSG([the failed program was:])
+ OMPI_LOG_FILE([conftest.$3])
+ $6])
+
+ unset ompi_compiler ompi_flags ompi_output ompi_status
+ /bin/rm -f conftest.* conftest
+])dnl
Modified: trunk/config/ompi_configure_options.m4
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/config/ompi_configure_options.m4 (original)
+++ trunk/config/ompi_configure_options.m4 2007-11-02 22:40:22 EDT
(Fri, 02 Nov 2007)
@@ -10,7 +10,8 @@
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 Cisco Systems, Inc. All rights
reserved.
+dnl Copyright (c) 2006-2007 Cisco Systems, Inc. All rights
reserved.
+dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
@@ -704,4 +705,34 @@
AC_DEFINE_UNQUOTED([ORTE_WANT_ORTERUN_PREFIX_BY_DEFAULT],
[$orte_want_orterun_prefix_by_default],
[Whether we want orterun to effect "--prefix
$prefix" by default])
+
+#
+# Package/brand string
+#
+AC_MSG_CHECKING([for package/brand string])
+AC_ARG_WITH([package-string],
+ [AC_HELP_STRING([--with-package-string=STRING],
+ [Use a branding string throughout Open MPI])])
+if test "$with_package_string" = "" -o "$with_package_string" =
"no"; then
+ with_package_string="Open MPI $OMPI_CONFIGURE_USER@
$OMPI_CONFIGURE_HOST Distribution"
+fi
+AC_DEFINE_UNQUOTED([OPAL_PACKAGE_STRING], ["$with_package_string"],
+ [package/branding string for Open MPI])
+AC_MSG_RESULT([$with_package_string])
+
+#
+# Ident string
+#
+AC_MSG_CHECKING([for ident string])
+AC_ARG_WITH([ident-string],
+ [AC_HELP_STRING([--with-ident-string=STRING],
+ [Embed an ident string into Open MPI object
files])])
+if test "$with_ident_string" = "" -o "$with_ident_string" = "no";
then
+ with_ident_string="%VERSION%"
+fi
+with_ident_string="`echo $with_ident_string | sed -e 's/%VERSION
%/'$OMPI_VERSION/`"
+AC_DEFINE_UNQUOTED([OPAL_IDENT_STRING], ["$with_ident_string"],
+ [ident string for Open MPI])
+AC_MSG_RESULT([$with_ident_string])
+
])
Modified: trunk/configure.ac
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac 2007-11-02 22:40:22 EDT (Fri, 02 Nov 2007)
@@ -10,7 +10,7 @@
# University of Stuttgart. All rights
reserved.
# Copyright (c) 2004-2005 The Regents of the University of
California.
# All rights reserved.
-# Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
+# Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Sun Microsystems, Inc. All rights
reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All
rights
# reserved.
@@ -187,6 +187,10 @@
AM_CONDITIONAL(OMPI_NEED_WINDOWS_REPLACEMENTS,
test "$ompi_cv_c_compiler_vendor" = "microsoft" )
+# Does the compiler support "ident"-like constructs?
+
+OMPI_CHECK_IDENT([CC], [CFLAGS], [c], [C])
+
#
# Check for some types
#
@@ -359,6 +363,10 @@
OMPI_SETUP_CXX
+# Does the compiler support "ident"-like constructs?
+
+OMPI_CHECK_IDENT([CXX], [CXXFLAGS], [cc], [C++])
+
# check for type sizes
AC_LANG_PUSH(C++)
@@ -369,7 +377,7 @@
OMPI_C_GET_ALIGNMENT(bool, OMPI_ALIGNMENT_CXX_BOOL)
AC_LANG_POP(C++)
-# check if we want C++ support
+# check if we want C++ support
AM_CONDITIONAL(WANT_MPI_CXX_BINDINGS,
test "$WANT_MPI_CXX_SUPPORT" = 1)
@@ -377,7 +385,6 @@
[Whether we want MPI cxx support or not])
-
##################################
# Only after setting up both
# C and C++ check compiler attributes.
Modified: trunk/ompi/include/ompi_config.h.in
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/ompi/include/ompi_config.h.in (original)
+++ trunk/ompi/include/ompi_config.h.in 2007-11-02 22:40:22 EDT
(Fri, 02 Nov 2007)
@@ -10,6 +10,8 @@
* University of Stuttgart. All rights
reserved.
* Copyright (c) 2004-2005 The Regents of the University of
California.
* All rights reserved.
+ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@@ -24,6 +26,7 @@
#include "opal_config.h"
+#define OMPI_IDENT_STRING OPAL_IDENT_STRING
/
***********************************************************************
*
Modified: trunk/ompi/mpi/c/init.c
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/ompi/mpi/c/init.c (original)
+++ trunk/ompi/mpi/c/init.c 2007-11-02 22:40:22 EDT (Fri, 02 Nov
2007)
@@ -9,6 +9,8 @@
* University of Stuttgart. All rights
reserved.
* Copyright (c) 2004-2005 The Regents of the University of
California.
* All rights reserved.
+ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@@ -24,6 +26,14 @@
#include "ompi/mpi/c/bindings.h"
#include "ompi/constants.h"
+#if OMPI_CC_USE_PRAGMA_IDENT
+#pragma ident OMPI_IDENT_STRING
+#elif OMPI_CC_USE_IDENT
+#ident OMPI_IDENT_STRING
+#else
+static const char ident[] = OMPI_IDENT_STRING;
+#endif
+
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
#pragma weak MPI_Init = PMPI_Init
#endif
Modified: trunk/ompi/mpi/cxx/mpicxx.cc
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/ompi/mpi/cxx/mpicxx.cc (original)
+++ trunk/ompi/mpi/cxx/mpicxx.cc 2007-11-02 22:40:22 EDT (Fri, 02
Nov 2007)
@@ -10,14 +10,14 @@
// University of Stuttgart. All rights
reserved.
// Copyright (c) 2004-2005 The Regents of the University of
California.
// All rights reserved.
+// Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
+// Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
//
// $HEADER$
-//
-
#include <stdio.h>
static const int ompi_stdio_seek_set = SEEK_SET;
static const int ompi_stdio_seek_cur = SEEK_CUR;
@@ -28,6 +28,14 @@
/* Need to include ompi_config.h after mpicxx.h... */
#include "ompi_config.h"
+#if OMPI_CXX_USE_PRAGMA_IDENT
+#pragma ident OMPI_IDENT_STRING
+#elif OMPI_CXX_USE_IDENT
+#ident OMPI_IDENT_STRING
+#else
+static const char ident[] = OMPI_IDENT_STRING;
+#endif
+
#include "ompi/errhandler/errhandler.h"
#if OMPI_PROVIDE_MPI_FILE_INTERFACE && OMPI_WANT_MPI_CXX_SEEK
Modified: trunk/ompi/mpi/f77/init_f.c
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/ompi/mpi/f77/init_f.c (original)
+++ trunk/ompi/mpi/f77/init_f.c 2007-11-02 22:40:22 EDT (Fri, 02
Nov 2007)
@@ -9,6 +9,8 @@
* University of Stuttgart. All rights
reserved.
* Copyright (c) 2004-2005 The Regents of the University of
California.
* All rights reserved.
+ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@@ -18,6 +20,14 @@
#include "ompi_config.h"
+#if OMPI_CC_USE_PRAGMA_IDENT
+#pragma ident OMPI_IDENT_STRING
+#elif OMPI_CC_USE_IDENT
+#ident OMPI_IDENT_STRING
+#else
+static const char ident[] = OMPI_IDENT_STRING;
+#endif
+
#include "ompi/mpi/f77/bindings.h"
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILE_LAYER
Modified: trunk/ompi/tools/ompi_info/version.cc
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/ompi/tools/ompi_info/version.cc (original)
+++ trunk/ompi/tools/ompi_info/version.cc 2007-11-02 22:40:22 EDT
(Fri, 02 Nov 2007)
@@ -9,6 +9,7 @@
// University of Stuttgart. All rights
reserved.
// Copyright (c) 2004-2005 The Regents of the University of
California.
// All rights reserved.
+// Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
@@ -125,6 +126,7 @@
//
void ompi_info::show_ompi_version(const string& scope)
{
+ out("Package", "package", OPAL_PACKAGE_STRING);
out("Open MPI", type_ompi + ":version:full",
make_version_str(scope,
OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
@@ -151,6 +153,7 @@
OPAL_WANT_SVN, OPAL_SVN_R));
out("OPAL SVN revision", type_opal + ":version:svn",
OPAL_SVN_R);
+ out("Ident string", "ident", OPAL_IDENT_STRING);
}
Modified: trunk/opal/runtime/opal_init.c
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/opal/runtime/opal_init.c (original)
+++ trunk/opal/runtime/opal_init.c 2007-11-02 22:40:22 EDT (Fri, 02
Nov 2007)
@@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of
California.
* All rights reserved.
* Copyright (c) 2007 Cisco, Inc. All rights reserved.
+ * Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@@ -48,6 +49,13 @@
#include "opal/util/keyval_parse.h"
#include "opal/util/sys_limits.h"
+#if OMPI_CC_USE_PRAGMA_IDENT
+#pragma ident OPAL_IDENT_STRING
+#elif OMPI_CC_USE_IDENT
+#ident OPAL_IDENT_STRING
+#else
+static const char ident[] = OPAL_IDENT_STRING;
+#endif
int opal_initialized = 0;
int opal_util_initialized = 0;
Modified: trunk/orte/include/orte_config.h.in
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/orte/include/orte_config.h.in (original)
+++ trunk/orte/include/orte_config.h.in 2007-11-02 22:40:22 EDT
(Fri, 02 Nov 2007)
@@ -10,6 +10,8 @@
* University of Stuttgart. All rights
reserved.
* Copyright (c) 2004-2005 The Regents of the University of
California.
* All rights reserved.
+ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@@ -24,6 +26,8 @@
#include "opal_config.h"
+#define ORTE_IDENT_STRING OPAL_IDENT_STRING
+
#if defined(__WINDOWS__)
# if defined(_USRDLL) /* building shared libraries (.DLL) */
Modified: trunk/orte/runtime/orte_init.c
=
=
=
=
=
=
=
=
=
=====================================================================
--- trunk/orte/runtime/orte_init.c (original)
+++ trunk/orte/runtime/orte_init.c 2007-11-02 22:40:22 EDT (Fri, 02
Nov 2007)
@@ -12,6 +12,7 @@
* Copyright (c) 2006 Los Alamos National Security, LLC. All
rights
* reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2007 Sun Microsystems, Inc. All rights
reserved.
*
* $COPYRIGHT$
*
@@ -85,6 +86,14 @@
#include "orte/runtime/orte_cr.h"
+#if OMPI_CC_USE_PRAGMA_IDENT
+#pragma ident ORTE_IDENT_STRING
+#elif OMPI_CC_USE_IDENT
+#ident ORTE_IDENT_STRING
+#else
+static const char ident[] = ORTE_IDENT_STRING;
+#endif
+
int orte_init(bool infrastructure)
{
int ret;
_______________________________________________
svn mailing list
s...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/svn