qmcpack/config/ac_cxx_bz_compiler.m4

181 lines
4.8 KiB
Plaintext

# aclocal.m4 generated automatically by aclocal 1.6.2 -*- Autoconf -*-
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
AC_DEFUN([AC_BZ_SET_COMPILER],
[cxxwith=`echo $1 | sed -e 's/ /@/'`
case "$cxxwith" in
*:*@*) # Full initialization syntax
CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)@.*/\1/p'`
CXXFLAGS=`echo "$cxxwith" | sed -n -e 's/.*:.*@\(.*\)/\1/p'`
;;
*:*) # Simple initialization syntax
CXX=`echo "$cxxwith" | sed -n -e 's/.*:\(.*\)/\1/p'`
CXXFLAGS=$3
;;
*) # Default values
CXX=$2
CXXFLAGS=$3
;;
esac])
# Standard stuff follows
AC_DEFUN([AC_CHECK_COMPILERS],
[
AC_ARG_ENABLE(debug,[ --enable-debug creates debugging code [default=no]],
[
if test $enableval = "no"; dnl
then ac_use_debug_code="no"
else ac_use_debug_code="yes"
fi
], [ac_use_debug_code="no"])
dnl this was AC_PROG_CC. I had to include it manualy, since I had to patch it
AC_MSG_CHECKING(for a C-Compiler)
dnl if there is one, print out. if not, don't matter
AC_MSG_RESULT($CC)
if test -z "$CC"; then AC_CHECK_PROG(CC, gcc, gcc) fi
if test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) fi
if test -z "$CC"; then AC_CHECK_PROG(CC, xlc, xlc) fi
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
AC_PROG_CC_WORKS
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
else
GCC=
fi
if test -z "$CFLAGS"; then
if test "$ac_use_debug_code" = "yes"; then
AC_PROG_CC_G
if test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g"
fi
else
if test "$GCC" = "yes"; then
CFLAGS="-O2"
else
CFLAGS=""
fi
fi
if test "$GCC" = "yes"; then
CFLAGS="$CFLAGS -Wall"
fi
fi
if test -z "$LDLFLAGS" && test "$ac_use_debug_code" = "no" && test "$GCC" = "yes"; then
LDFLAGS="-s"
fi
dnl this is AC_PROG_CPP. I had to include it here, since autoconf checks
dnl dependecies between AC_PROG_CPP and AC_PROG_CC (or is it automake?)
AC_MSG_CHECKING(how to run the C preprocessor)
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
AC_CACHE_VAL(ac_cv_prog_CPP,
[ # This must be in double quotes, not single quotes, because CPP may get
# substituted into the Makefile and "${CC-cc}" will confuse make.
CPP="${CC-cc} -E"
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
dnl Use a header file that comes with gcc, so configuring glibc
dnl with a fresh cross-compiler works.
AC_TRY_CPP([#include <assert.h>
Syntax Error], ,
CPP="${CC-cc} -E -traditional-cpp"
AC_TRY_CPP([#include <assert.h>
Syntax Error], , CPP=/lib/cpp))
ac_cv_prog_CPP="$CPP"])dnl
CPP="$ac_cv_prog_CPP"
else
ac_cv_prog_CPP="$CPP"
fi
AC_MSG_RESULT($CPP)
AC_SUBST(CPP)dnl
AC_MSG_CHECKING(for a C++-Compiler)
dnl if there is one, print out. if not, don't matter
AC_MSG_RESULT($CXX)
if test -z "$CXX"; then AC_CHECK_PROG(CXX, g++, g++) fi
if test -z "$CXX"; then AC_CHECK_PROG(CXX, CC, CC) fi
if test -z "$CXX"; then AC_CHECK_PROG(CXX, xlC, xlC) fi
if test -z "$CXX"; then AC_CHECK_PROG(CXX, DCC, DCC) fi
test -z "$CXX" && AC_MSG_ERROR([no acceptable C++-compiler found in \$PATH])
AC_PROG_CXX_WORKS
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
else
AC_MSG_CHECKING(whether we are using SPARC CC)
GXX=
cat > conftest.C << EOF
#ifdef __SUNPRO_CC
yes;
#endif
EOF
ac_try="$CXX -E conftest.C"
if { (eval echo configure:__online__: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_CC=yes
else
ac_cv_prog_CC=no
fi
AC_MSG_RESULT($ac_cv_prog_CC)
fi
if test -z "$CXXFLAGS"; then
if test "$ac_use_debug_code" = "yes"; then
AC_PROG_CXX_G
if test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g"
fi
if test "$ac_cv_prog_CC" = "yes"; then
CXXFLAGS="$CXXFLAGS -pto"
fi
else
if test "$GXX" = "yes"; then
CXXFLAGS="-O2"
else
if test "$ac_cv_prog_CC" = "yes"; then
CXXFLAGS="-pto -O2"
else
CXXFLAGS=""
fi
fi
fi
if test "$GXX" = "yes"; then
CXXFLAGS="$CXXFLAGS -Wall"
fi
fi
])