File: lam_get_sizeof.m4

package info (click to toggle)
lam 6.5.6-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 15,464 kB
  • ctags: 11,670
  • sloc: ansic: 101,210; cpp: 12,146; sh: 10,821; makefile: 4,050; fortran: 218
file content (35 lines) | stat: -rw-r--r-- 906 bytes parent folder | download
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
dnl -*- shell-script -*-

#
# $Id: lam_get_sizeof.m4,v 1.2 2001/01/20 14:20:39 jsquyres Exp $
#
# This file is part of the University of Notre Dame implementation of
# LAM/MPI.  See the LICENSE file in the top-level directory for
# license and copyright details.

define(LAM_GET_SIZEOF,[
# Determine datatype size. 
# First arg is type, 2nd (optional) arg is config var to define.
AC_MSG_CHECKING(size of $1)
cat > conftest.c <<EOF
#include <stddef.h>
#include <stdio.h>
int main(int argc, char** argv)
{
    FILE *f=fopen("conftestval", "w");
    if (!f) return 1;
    fprintf(f, "%d\n", sizeof($1));
    return 0;
}
EOF
$CC $CFLAGS -o conftest conftest.c 1>&5 2>&1
if test -s conftest && (./conftest; exit) 2>/dev/null; then
    lam_ac_size=`cat conftestval`
else
    lam_ac_size=0
fi
AC_MSG_RESULT($lam_ac_size)
if test -n "$2"; then
    AC_DEFINE_UNQUOTED($2,$lam_ac_size)
fi
/bin/rm -f conftest*])dnl