1
1

Ensure that other packages defining PACKAGE_ macros don't hurt us, and protect others from our PACKAGE_ macros.

This commit was SVN r24571.
Этот коммит содержится в:
Jeff Squyres 2011-03-24 22:39:56 +00:00
родитель d7e029cb40
Коммит 5ae1b15b6e
3 изменённых файлов: 62 добавлений и 2 удалений

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

@ -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-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2011 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
# reserved.
@ -208,6 +208,9 @@ AH_TOP([/* -*- c -*-
#ifndef OPAL_CONFIG_H
#define OPAL_CONFIG_H
#include "opal_config_top.h"
])
AH_BOTTOM([
#include "opal_config_bottom.h"

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

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -618,4 +618,23 @@ static inline uint16_t ntohs(uint16_t netvar) { return netvar; }
#define restrict
#endif
#else
/* For a similar reason to what is listed in opal_config_top.h, we
want to protect others from the autoconf/automake-generated
PACKAGE_<foo> macros in opal_config.h. We can't put these undef's
directly in opal_config.h because they'll be turned into #defines'
via autoconf.
So put them here in case any only else includes OMPI/ORTE/OPAL's
config.h files. */
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef PACKAGE_URL
#undef HAVE_CONFIG_H
#endif /* OMPI_BUILDING */

38
opal/include/opal_config_top.h Обычный файл
Просмотреть файл

@ -0,0 +1,38 @@
/*
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is included at the top of opal_config.h, and is
* therefore a) before all the #define's that were output from
* configure, and b) included in most/all files in Open MPI.
*
* Since this file is *only* ever included by opal_config.h, and
* opal_config.h already has #ifndef/#endif protection, there is no
* need to #ifndef/#endif protection here.
*/
#ifndef OPAL_CONFIG_H
#error "opal_config_top.h should only be included from opal_config.h"
#endif
/* The only purpose of this file is to undef the PACKAGE_<foo> macros
that are put in by autoconf/automake projects. Specifically, if
you include a .h file from another project that defines these
macros (e.g., gmp.h) and then include OMPI/ORTE/OPAL's config.h,
you'll get a preprocessor conflict. So put these undef's here to
protect us from other package's PACKAGE_<foo> macros.
Note that we can't put them directly in opal_config.h (e.g., via
AH_TOP) because they will be turned into #define's by autoconf. */
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef PACKAGE_URL
#undef HAVE_CONFIG_H