File: c_get_alignment.m4

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (59 lines) | stat: -rw-r--r-- 2,404 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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) 2009      Sun Microsystems, Inc.  All rights reserved.
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 (c) 2021      Cisco Systems, Inc.  All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl

# OPAL_C_GET_ALIGNMENT(c_type, c_macro_name)
# ----------------------------------
# Determine datatype alignment.
# First arg is type, 2nd arg is macro name to define.
# 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],[
    OPAL_VAR_SCOPE_PUSH([opal_align_value])
    AC_LANG_PUSH([C])

    AC_CHECK_ALIGNOF([$1], [AC_INCLUDES_DEFAULT
                            #include <stdbool.h>
                           ])

    # Put the value determined from AC CHECK_ALIGNOF into an
    # easy-to-access shell variable.
    AS_VAR_COPY([opal_align_value],
                [ac_cv_alignof_]AS_TR_SH([$1]))

    # This $opal_cv_c_align_* shell variable is used elsewhere in
    # configure.ac
    AS_VAR_COPY([opal_cv_c_align_]AS_TR_SH([$1]),
                [opal_align_value])

    # This #define is used in C code.
    AC_DEFINE_UNQUOTED([$2], [$opal_align_value], [Alignment of $1])

    AC_LANG_POP([C])
    OPAL_VAR_SCOPE_POP
])