1
1
openmpi/config/c_get_alignment.m4

74 lines
3.5 KiB
Plaintext
Raw Normal View History

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.
2015-06-24 06:59:57 +03:00
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) 2009 Sun Microsystems, Inc. All rights reserved.
2015-06-24 18:42:02 +03:00
dnl Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
2015-06-24 06:59:57 +03:00
dnl
dnl Additional copyrights may follow
2015-06-24 06:59:57 +03:00
dnl
dnl $HEADER$
dnl
# OPAL_C_GET_ALIGN(type, config_var)
* Rewrite ompi_mca.m4 to use m4_defined lists of projects (ompi, orte, etc.), frameworks, and components without configure scripts instead of hard-coded shell variables (for projects and frameworks) and shell variable building (for components). * Add 3rd category of component configuration (in addition to configure scripts and no-configured components): configure.m4 components. These components can only be built as part of OMPI (like no-configure), but can provide an m4 file that is run as part of the main configure script. These macros can set whether the component should be built, along with just about any other configuration wanted. More care must be taken compared to configure components, as doing things like setting variables or calling AC_MSG_ERROR now affects the top-level configure script (so calling AC_MSG_ERROR if your component can't configure probably isn't what you want) * Added support to autogen.sh for the configure.m4-style components, as well as building up the m4_define lists ompi_mca.m4 now expects * Updated a number of macros to be more config.cache friendly (both so that config.cache can be used and so the test can be quickly run multiple times in the same configrue script): - ompi_config_asm - c_weak_symbols - c_get_alignment * Added new macros to be shared when configuring components: - ompi_objc.m4 (this actually provides AC_PROG_OBJC - don't ask...) - ompi_check_xgrid - ompi_check_tm - ompi_check_bproc * Updated a number of components to use configure.m4 instead of configure.stub - btl portals - io romio - tm ras and pls - bjs, lsf_bproc ras and bproc_seed pls - xgrid ras and pls - null iof (used by tm) This commit was SVN r6412.
2005-07-09 22:52:53 +04:00
# ----------------------------------
2015-06-24 06:59:57 +03:00
# Determine datatype alignment.
# First arg is type, 2nd arg is config var to define.
2015-06-24 18:42:02 +03:00
# Now that we require C99 compilers, we include stdbool.h
# in the alignment test so that we can find the definition
# of "bool" when we test for its alignment. We might be able
# to avoid this if we test for alignemtn of _Bool, but
# since we use "bool" in the code, let's be safe and check
# what we use. Yes, they should be the same - but "should" and
# "are" frequently differ
AC_DEFUN([OPAL_C_GET_ALIGNMENT],[
* Rewrite ompi_mca.m4 to use m4_defined lists of projects (ompi, orte, etc.), frameworks, and components without configure scripts instead of hard-coded shell variables (for projects and frameworks) and shell variable building (for components). * Add 3rd category of component configuration (in addition to configure scripts and no-configured components): configure.m4 components. These components can only be built as part of OMPI (like no-configure), but can provide an m4 file that is run as part of the main configure script. These macros can set whether the component should be built, along with just about any other configuration wanted. More care must be taken compared to configure components, as doing things like setting variables or calling AC_MSG_ERROR now affects the top-level configure script (so calling AC_MSG_ERROR if your component can't configure probably isn't what you want) * Added support to autogen.sh for the configure.m4-style components, as well as building up the m4_define lists ompi_mca.m4 now expects * Updated a number of macros to be more config.cache friendly (both so that config.cache can be used and so the test can be quickly run multiple times in the same configrue script): - ompi_config_asm - c_weak_symbols - c_get_alignment * Added new macros to be shared when configuring components: - ompi_objc.m4 (this actually provides AC_PROG_OBJC - don't ask...) - ompi_check_xgrid - ompi_check_tm - ompi_check_bproc * Updated a number of components to use configure.m4 instead of configure.stub - btl portals - io romio - tm ras and pls - bjs, lsf_bproc ras and bproc_seed pls - xgrid ras and pls - null iof (used by tm) This commit was SVN r6412.
2005-07-09 22:52:53 +04:00
AC_CACHE_CHECK([alignment of $1],
[AS_TR_SH([opal_cv_c_align_$1])],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
#include <stdbool.h> ],
[[
struct foo { char c; $1 x; };
struct foo *p = (struct foo *) malloc(sizeof(struct foo));
int diff;
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
diff = ((char *)&p->x) - ((char *)&p->c);
free(p);
fprintf(f, "%d\n", (diff >= 0) ? diff : -diff);
]])], [AS_TR_SH([opal_cv_c_align_$1])=`cat conftestval`],
* Rewrite ompi_mca.m4 to use m4_defined lists of projects (ompi, orte, etc.), frameworks, and components without configure scripts instead of hard-coded shell variables (for projects and frameworks) and shell variable building (for components). * Add 3rd category of component configuration (in addition to configure scripts and no-configured components): configure.m4 components. These components can only be built as part of OMPI (like no-configure), but can provide an m4 file that is run as part of the main configure script. These macros can set whether the component should be built, along with just about any other configuration wanted. More care must be taken compared to configure components, as doing things like setting variables or calling AC_MSG_ERROR now affects the top-level configure script (so calling AC_MSG_ERROR if your component can't configure probably isn't what you want) * Added support to autogen.sh for the configure.m4-style components, as well as building up the m4_define lists ompi_mca.m4 now expects * Updated a number of macros to be more config.cache friendly (both so that config.cache can be used and so the test can be quickly run multiple times in the same configrue script): - ompi_config_asm - c_weak_symbols - c_get_alignment * Added new macros to be shared when configuring components: - ompi_objc.m4 (this actually provides AC_PROG_OBJC - don't ask...) - ompi_check_xgrid - ompi_check_tm - ompi_check_bproc * Updated a number of components to use configure.m4 instead of configure.stub - btl portals - io romio - tm ras and pls - bjs, lsf_bproc ras and bproc_seed pls - xgrid ras and pls - null iof (used by tm) This commit was SVN r6412.
2005-07-09 22:52:53 +04:00
[AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])],
2015-06-24 06:59:57 +03:00
[ # cross compile - do a non-executable test. Trick
# taken from the Autoconf 2.59c. Switch to using
# AC_CHECK_ALIGNOF when we can require Autoconf 2.60.
_AC_COMPUTE_INT([(long int) offsetof (opal__type_alignof_, y)],
[AS_TR_SH([opal_cv_c_align_$1])],
[AC_INCLUDES_DEFAULT
#include <stdbool.h>
#ifndef offsetof
# define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
* Rewrite ompi_mca.m4 to use m4_defined lists of projects (ompi, orte, etc.), frameworks, and components without configure scripts instead of hard-coded shell variables (for projects and frameworks) and shell variable building (for components). * Add 3rd category of component configuration (in addition to configure scripts and no-configured components): configure.m4 components. These components can only be built as part of OMPI (like no-configure), but can provide an m4 file that is run as part of the main configure script. These macros can set whether the component should be built, along with just about any other configuration wanted. More care must be taken compared to configure components, as doing things like setting variables or calling AC_MSG_ERROR now affects the top-level configure script (so calling AC_MSG_ERROR if your component can't configure probably isn't what you want) * Added support to autogen.sh for the configure.m4-style components, as well as building up the m4_define lists ompi_mca.m4 now expects * Updated a number of macros to be more config.cache friendly (both so that config.cache can be used and so the test can be quickly run multiple times in the same configrue script): - ompi_config_asm - c_weak_symbols - c_get_alignment * Added new macros to be shared when configuring components: - ompi_objc.m4 (this actually provides AC_PROG_OBJC - don't ask...) - ompi_check_xgrid - ompi_check_tm - ompi_check_bproc * Updated a number of components to use configure.m4 instead of configure.stub - btl portals - io romio - tm ras and pls - bjs, lsf_bproc ras and bproc_seed pls - xgrid ras and pls - null iof (used by tm) This commit was SVN r6412.
2005-07-09 22:52:53 +04:00
#endif
typedef struct { char x; $1 y; } opal__type_alignof_;
* Rewrite ompi_mca.m4 to use m4_defined lists of projects (ompi, orte, etc.), frameworks, and components without configure scripts instead of hard-coded shell variables (for projects and frameworks) and shell variable building (for components). * Add 3rd category of component configuration (in addition to configure scripts and no-configured components): configure.m4 components. These components can only be built as part of OMPI (like no-configure), but can provide an m4 file that is run as part of the main configure script. These macros can set whether the component should be built, along with just about any other configuration wanted. More care must be taken compared to configure components, as doing things like setting variables or calling AC_MSG_ERROR now affects the top-level configure script (so calling AC_MSG_ERROR if your component can't configure probably isn't what you want) * Added support to autogen.sh for the configure.m4-style components, as well as building up the m4_define lists ompi_mca.m4 now expects * Updated a number of macros to be more config.cache friendly (both so that config.cache can be used and so the test can be quickly run multiple times in the same configrue script): - ompi_config_asm - c_weak_symbols - c_get_alignment * Added new macros to be shared when configuring components: - ompi_objc.m4 (this actually provides AC_PROG_OBJC - don't ask...) - ompi_check_xgrid - ompi_check_tm - ompi_check_bproc * Updated a number of components to use configure.m4 instead of configure.stub - btl portals - io romio - tm ras and pls - bjs, lsf_bproc ras and bproc_seed pls - xgrid ras and pls - null iof (used by tm) This commit was SVN r6412.
2005-07-09 22:52:53 +04:00
],
[AC_MSG_WARN([*** Problem running configure test!])
AC_MSG_WARN([*** See config.log for details.])
AC_MSG_ERROR([*** Cannot continue.])])])])
AC_DEFINE_UNQUOTED([$2], [$AS_TR_SH([opal_cv_c_align_$1])], [Alignment of type $1])
eval "$2=$AS_TR_SH([opal_cv_c_align_$1])"
rm -rf conftest* ]) dnl