File: cxx_have_nothrow_new.m4

package info (click to toggle)
lam 7.1.1-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 53,848 kB
  • ctags: 17,183
  • sloc: ansic: 155,642; sh: 9,196; cpp: 7,694; makefile: 5,560; perl: 476; fortran: 260
file content (71 lines) | stat: -rw-r--r-- 1,979 bytes parent folder | download | duplicates (10)
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
60
61
62
63
64
65
66
67
68
69
70
71
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2001-2002 The Trustees of Indiana University.  
dnl                         All rights reserved.
dnl Copyright (c) 1998-2001 University of Notre Dame. 
dnl                         All rights reserved.
dnl Copyright (c) 1994-1998 The Ohio State University.  
dnl                         All rights reserved.
dnl 
dnl This file is part of the LAM/MPI software package.  For license
dnl information, see the LICENSE file in the top level directory of the
dnl LAM/MPI source distribution.
dnl
dnl $Id: cxx_have_nothrow_new.m4,v 1.5 2003/02/04 17:47:20 jsquyres Exp $
dnl

define([LAM_CXX_HAVE_NOTHROW_NEW],[
#
# Arguments: None
#
# Depdendencies: None
#
# Check to see if the C++ compiler has std::nothrow support for new
# and new[]
#
# Defines LAM_CXX_NOTHROW_NEW_ARG to be either "(std::nothrow)" or ""
# Defines LAM_CXX_NOTHROW_NEW to be either 1 or 0
# Sets LAM_CXX_NOTHROW_NEW to be 1 or 0
#

# Do the rest
if test "$?CXXFLAGS" = 0; then
    CXXFLAGS=""
fi
AC_MSG_CHECKING([whether $CXX has new(std::nothrow)])
rm -f conftest.cc conftest.o
cat > conftest.cc <<EOF
#include <new>

int main(int argc, char* argv[]) {
  int *baz;
  unsigned int foo = 3;
  baz = new(std::nothrow) int;
  baz = new(std::nothrow) int[[foo - 1]];
}
EOF
echo configure:__oline__: $CXX $CXXFLAGS conftest.cc -o conftest >&5 
$CXX $CXXFLAGS conftest.cc -o conftest >&5 2>&5
if test -f conftest; then
    lsc_result=1
    lsc_define="(std::nothrow)"
    AC_MSG_RESULT([yes])
else
    echo configure:__oline__: here is the program that failed: >&5
    cat conftest.cc >&5
    lsc_result=0
    lsc_define=""
    AC_MSG_RESULT([no])
fi

# Set the result
LAM_CXX_NOTHROW_NEW="$lsc_result"
AC_DEFINE_UNQUOTED(LAM_CXX_NOTHROW_NEW, $lsc_result, 
    [Whether we have nothrow::new or not])
AC_DEFINE_UNQUOTED(LAM_CXX_NOTHROW_NEW_ARG, $lsc_define,
    [Whether nothrow::new requires an argument or not])

# Clean up
rm -f conftest*
unset lsc_result lsc_define])dnl