2001-09-27 21:28:15 +08:00
|
|
|
# -*- Autotest -*-
|
|
|
|
|
|
|
|
AT_BANNER([C low level compiling/preprocessing macros.])
|
|
|
|
|
2009-03-10 02:25:18 +08:00
|
|
|
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009
|
|
|
|
# Free Software Foundation, Inc.
|
2001-09-27 21:28:15 +08:00
|
|
|
#
|
2007-07-21 07:11:49 +08:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2001-09-27 21:28:15 +08:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2008-04-04 23:09:47 +08:00
|
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
# any later version.
|
2001-09-27 21:28:15 +08:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2008-04-04 23:09:47 +08:00
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
# 02110-1301, USA.
|
2001-09-27 21:28:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
# Since the macros which compile are required by most tests, check
|
|
|
|
# them first. But remember that looking for a compiler is even more
|
|
|
|
# primitive, so check those first.
|
|
|
|
|
|
|
|
|
|
|
|
## ------------ ##
|
|
|
|
## Extensions. ##
|
|
|
|
## ------------ ##
|
|
|
|
|
|
|
|
# As far as we know only `foo', `foo.exe' are possible executable,
|
|
|
|
# and `foo.o', `foo.obj' are possible object files. Autoconf must not
|
|
|
|
# know that, but it is OK for the test suite to take this into account.
|
|
|
|
AT_CHECK_MACRO([Extensions],
|
|
|
|
[[AC_PROG_CC
|
|
|
|
case $ac_exeext in
|
|
|
|
'' | '.exe' ) ;;
|
|
|
|
* ) AC_MSG_ERROR([suspicious executable suffix: $ac_exeext]);;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $ac_objext in
|
|
|
|
'o' | 'obj' ) ;;
|
|
|
|
* ) AC_MSG_ERROR([suspicious object suffix: $ac_objext]);;
|
|
|
|
esac
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## -------------------------- ##
|
|
|
|
## Broken/missing compilers. ##
|
|
|
|
## -------------------------- ##
|
|
|
|
|
|
|
|
|
|
|
|
# Check that Autoconf correctly diagnoses broken compilers, and in
|
|
|
|
# particular, if it does not exit 77, the test suite is in trouble...
|
|
|
|
# FIXME: Once a precise message decided, check stderr of configure.
|
|
|
|
AT_SETUP([Broken/missing compilers])
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
CC=no-such-compiler
|
|
|
|
AC_PROG_CC
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE([], 77, ignore, ignore)
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
## ------------ ##
|
|
|
|
## C keywords. ##
|
|
|
|
## ------------ ##
|
|
|
|
|
2005-07-07 05:39:30 +08:00
|
|
|
# GCC supports `const', `typeof', and `volatile'.
|
2001-09-27 21:28:15 +08:00
|
|
|
AT_CHECK_MACRO([C keywords],
|
|
|
|
[[AC_PROG_CC
|
|
|
|
AC_C_CONST
|
2005-07-07 05:39:30 +08:00
|
|
|
AC_C_TYPEOF
|
2001-09-27 21:28:15 +08:00
|
|
|
AC_C_VOLATILE
|
2005-07-07 05:39:30 +08:00
|
|
|
case $GCC,$ac_cv_c_const,$ac_cv_c_typeof,$ac_cv_c_volatile in
|
2001-09-27 21:28:15 +08:00
|
|
|
yes,*no*)
|
2005-07-07 05:39:30 +08:00
|
|
|
AC_MSG_ERROR([failed to detect `const', `typeof', or `volatile' support]);;
|
2001-09-27 21:28:15 +08:00
|
|
|
esac
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## --------------------------------- ##
|
|
|
|
## AC_PROG_CPP requires AC_PROG_CC. ##
|
|
|
|
## --------------------------------- ##
|
|
|
|
|
|
|
|
# Must invoke AC_PROG_CC.
|
|
|
|
AT_CHECK_MACRO([AC_PROG_CPP requires AC_PROG_CC],
|
|
|
|
[[AC_PROG_CPP
|
|
|
|
test -z "$CC" &&
|
|
|
|
AC_MSG_ERROR([looked for a C preprocessor without looking for a compiler])
|
|
|
|
]])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## --------------------------- ##
|
|
|
|
## AC_PROG_CPP with warnings. ##
|
|
|
|
## --------------------------- ##
|
|
|
|
|
|
|
|
|
|
|
|
# It's Ok for strict preprocessors to produce warnings.
|
|
|
|
|
|
|
|
AT_SETUP([AC_PROG_CPP with warnings])
|
|
|
|
|
|
|
|
AT_DATA([mycpp],
|
|
|
|
[[#! /bin/sh
|
|
|
|
echo noise >&2
|
2002-04-20 03:07:49 +08:00
|
|
|
exec "$@"
|
2001-09-27 21:28:15 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
chmod +x mycpp
|
|
|
|
|
|
|
|
_AT_CHECK_AC_MACRO(
|
|
|
|
[[AC_PROG_CPP
|
|
|
|
# If the preprocessor is not strict, just ignore
|
|
|
|
test "x$ac_c_preproc_warn_flag" = xyes &&
|
|
|
|
AC_MSG_ERROR([preprocessor has no warning option], 77)
|
|
|
|
CPP="./mycpp $CPP"
|
2008-11-03 17:19:44 +08:00
|
|
|
|
|
|
|
# Exercise CPP.
|
|
|
|
AC_CHECK_HEADERS(stdio.h autoconf_io.h, [], [], [-])]])
|
2001-09-27 21:28:15 +08:00
|
|
|
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[/* #undef HAVE_AUTOCONF_IO_H */
|
|
|
|
#define HAVE_STDIO_H 1
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
## ------------------------------ ##
|
|
|
|
## AC_PROG_CPP without warnings. ##
|
|
|
|
## ------------------------------ ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_PROG_CPP without warnings])
|
|
|
|
|
|
|
|
# Ignore if /lib/cpp doesn't work
|
'echo' has some portability problems, when given a first argument
with a leading '-', or when given any argument containing '\'.
Avoid using 'echo' in these cases.
* bin/Makefile.am $(bin_SCRIPTS): Rewrite to avoid 'echo' entirely.
* lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC): Likewise.
* lib/autoconf/fortran.m4 (_AC_PROG_FC): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* bin/autoconf.as: Use AS_ECHO rather than plain echo, when the
argument might be unportable.
* lib/autoconf/c.m4 (AC_PROG_CC_C_O): Likewise.
* lib/autoconf/erlang.m4 (AC_LANG(Erlang)): Likewise.
* lib/autoconf/fortran.m4 (_AC_PROG_FC_V_OUTPUT):
(_AC_FC_LIBRARY_LDFLAGS): Likewise.
* lib/autoconf/functions.m4 (AC_FUNC_GETLOADAVG): Likewise.
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ENABLE, _AC_INIT_PREPARE):
(_AC_ARG_VAR_VALIDATE, AC_ARG_PROGRAM, _AC_MSG_LOG_CONFTEST):
(AC_RUN_LOG, _AC_RUN_IFELSE, _AC_LIBOBJS_NORMALIZE): Likewise.
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Likewise.
* lib/autoconf/libs.m4 (_AC_PATH_X_DIRECT): Likewise.
* lib/autoconf/programs.m4 (_AC_FEATURE_CHECK_LENGTH):
(AC_PROG_MAKE_SET): Likewise.
* lib/autoconf/status.m4 (_AC_SRCDIRS, _AC_OUTPUT_HEADER):
(_AC_OUTPUT_SUBDIRS, _AC_OUTPUT_CONFIG_STATUS): Likewise.
* lib/autotest/general.m4 (_AT_CREATE_DEBUGGING_SCRIPT, AT_INIT):
(AT_CLEANUP, _AT_DECIDE_TRACEABLE, _AT_CHECK): Likewise.
* lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE, _AS_ECHO_UNQUOTED):
(_AS_BASENAME_SED, _AS_DIRNAME_SED, AS_MKDIR_P, AS_TMPDIR, AS_UNAME):
(AS_TR_SH, AS_TR_CPP, AS_VAR_GET): Likewise.
* bin/autoconf.as: Redo verbose flag implementation, as the old
scheme wouldn't work with AS_ECHO.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/autoconf/general.m4 (AC_MSG_RESULT, AC_MSG_RESULT_UNQUOTED):
Don't use ECHO_T, since ECHO_N is now reliable.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/autoconf/general.m4 (AC_ARG_PROGRAM): Use sed "$script"
rather than using a here-document to put the script into a file.
(_AC_DO_ECHO): Hoist the eval out of the echo, so that we can
use AS_ECHO.
* lib/m4sugar/m4sh.m4 (AS_VAR_GET): Likewise.
* lib/autoconf/programs.m4 (_AC_FEATURE_CHECK_LENGTH): Use
AS_ECHO_N rather than ECHO_N and ECHO_C. This doesn't fix any
bug, but we might as well stop using ECHO_N and ECHO_C internally.
* lib/autotest/general.m4 (AT_SETUP): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_ECHO_N): Likewise.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS):
(_AC_OUTPUT_MAIN_LOOP): Rework echo so that it has just one
operand, as AS_ECHO requires. Avoid double file name expansion.
* lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Invoke _AS_ECHO_PREPARE.
Don't set as_nl, since _AS_ECHO_PREPARE does that now.
(_AS_PREPARE): Comment that _AS_ECHO_N_PREPARE is just for user code.
(AS_ECHO, AS_ECHO_N, _AS_ECHO_PREPARE): New macros.
* tests/c.at (AC_PROG_CPP without warnings, AC_PROG_CPP via CC):
Double-quote strings that would otherwise contain M4 comments.
* tests/m4sh.at (AS_ECHO and AS_ECHO_N): New test.
2006-11-18 05:04:54 +08:00
|
|
|
AT_CHECK([[echo '#include <stdio.h>' | /lib/cpp || exit 77]],
|
2006-03-09 03:21:26 +08:00
|
|
|
[], [ignore], [ignore])
|
2001-09-27 21:28:15 +08:00
|
|
|
|
|
|
|
# A cpp which exit status is meaningless.
|
|
|
|
AT_DATA([mycpp],
|
|
|
|
[[#! /bin/sh
|
2002-04-20 03:07:49 +08:00
|
|
|
/lib/cpp "$@"
|
2001-09-27 21:28:15 +08:00
|
|
|
exit 0
|
|
|
|
]])
|
|
|
|
|
|
|
|
chmod +x mycpp
|
|
|
|
|
|
|
|
_AT_CHECK_AC_MACRO(
|
|
|
|
[[CPP=./mycpp
|
|
|
|
AC_PROG_CPP
|
|
|
|
test "x$ac_c_preproc_warn_flag" != xyes &&
|
|
|
|
AC_MSG_ERROR([failed to detect preprocessor warning option])
|
2008-11-03 17:19:44 +08:00
|
|
|
|
|
|
|
# Exercise CPP.
|
|
|
|
AC_CHECK_HEADERS(stdio.h autoconf_io.h, [], [], [-])]])
|
2001-09-27 21:28:15 +08:00
|
|
|
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[/* #undef HAVE_AUTOCONF_IO_H */
|
|
|
|
#define HAVE_STDIO_H 1
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## -------------------- ##
|
|
|
|
## AC_PROG_CPP via CC. ##
|
|
|
|
## -------------------- ##
|
|
|
|
|
|
|
|
|
|
|
|
# It's Ok for strict preprocessors to produce warnings.
|
|
|
|
|
|
|
|
AT_SETUP([AC_PROG_CPP via CC])
|
|
|
|
|
|
|
|
# Ignore if /lib/cpp doesn't work
|
'echo' has some portability problems, when given a first argument
with a leading '-', or when given any argument containing '\'.
Avoid using 'echo' in these cases.
* bin/Makefile.am $(bin_SCRIPTS): Rewrite to avoid 'echo' entirely.
* lib/autoconf/c.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC): Likewise.
* lib/autoconf/fortran.m4 (_AC_PROG_FC): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* bin/autoconf.as: Use AS_ECHO rather than plain echo, when the
argument might be unportable.
* lib/autoconf/c.m4 (AC_PROG_CC_C_O): Likewise.
* lib/autoconf/erlang.m4 (AC_LANG(Erlang)): Likewise.
* lib/autoconf/fortran.m4 (_AC_PROG_FC_V_OUTPUT):
(_AC_FC_LIBRARY_LDFLAGS): Likewise.
* lib/autoconf/functions.m4 (AC_FUNC_GETLOADAVG): Likewise.
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ENABLE, _AC_INIT_PREPARE):
(_AC_ARG_VAR_VALIDATE, AC_ARG_PROGRAM, _AC_MSG_LOG_CONFTEST):
(AC_RUN_LOG, _AC_RUN_IFELSE, _AC_LIBOBJS_NORMALIZE): Likewise.
* lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Likewise.
* lib/autoconf/libs.m4 (_AC_PATH_X_DIRECT): Likewise.
* lib/autoconf/programs.m4 (_AC_FEATURE_CHECK_LENGTH):
(AC_PROG_MAKE_SET): Likewise.
* lib/autoconf/status.m4 (_AC_SRCDIRS, _AC_OUTPUT_HEADER):
(_AC_OUTPUT_SUBDIRS, _AC_OUTPUT_CONFIG_STATUS): Likewise.
* lib/autotest/general.m4 (_AT_CREATE_DEBUGGING_SCRIPT, AT_INIT):
(AT_CLEANUP, _AT_DECIDE_TRACEABLE, _AT_CHECK): Likewise.
* lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE, _AS_ECHO_UNQUOTED):
(_AS_BASENAME_SED, _AS_DIRNAME_SED, AS_MKDIR_P, AS_TMPDIR, AS_UNAME):
(AS_TR_SH, AS_TR_CPP, AS_VAR_GET): Likewise.
* bin/autoconf.as: Redo verbose flag implementation, as the old
scheme wouldn't work with AS_ECHO.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/autoconf/general.m4 (AC_MSG_RESULT, AC_MSG_RESULT_UNQUOTED):
Don't use ECHO_T, since ECHO_N is now reliable.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/autoconf/general.m4 (AC_ARG_PROGRAM): Use sed "$script"
rather than using a here-document to put the script into a file.
(_AC_DO_ECHO): Hoist the eval out of the echo, so that we can
use AS_ECHO.
* lib/m4sugar/m4sh.m4 (AS_VAR_GET): Likewise.
* lib/autoconf/programs.m4 (_AC_FEATURE_CHECK_LENGTH): Use
AS_ECHO_N rather than ECHO_N and ECHO_C. This doesn't fix any
bug, but we might as well stop using ECHO_N and ECHO_C internally.
* lib/autotest/general.m4 (AT_SETUP): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_ECHO_N): Likewise.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS):
(_AC_OUTPUT_MAIN_LOOP): Rework echo so that it has just one
operand, as AS_ECHO requires. Avoid double file name expansion.
* lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE): Invoke _AS_ECHO_PREPARE.
Don't set as_nl, since _AS_ECHO_PREPARE does that now.
(_AS_PREPARE): Comment that _AS_ECHO_N_PREPARE is just for user code.
(AS_ECHO, AS_ECHO_N, _AS_ECHO_PREPARE): New macros.
* tests/c.at (AC_PROG_CPP without warnings, AC_PROG_CPP via CC):
Double-quote strings that would otherwise contain M4 comments.
* tests/m4sh.at (AS_ECHO and AS_ECHO_N): New test.
2006-11-18 05:04:54 +08:00
|
|
|
AT_CHECK([[echo '#include <stdio.h>' | /lib/cpp || exit 77]],
|
2006-03-09 03:21:26 +08:00
|
|
|
[], [ignore], [ignore])
|
2001-09-27 21:28:15 +08:00
|
|
|
|
|
|
|
AT_DATA([mycc],
|
|
|
|
[[#! /bin/sh
|
|
|
|
echo "Annoying copyright message" >&2
|
|
|
|
exec "$@"
|
|
|
|
]])
|
|
|
|
|
|
|
|
chmod +x mycc
|
|
|
|
|
|
|
|
# We go through the following contortions, in order to have the
|
|
|
|
# configure script go down the same codepaths as it would during a
|
|
|
|
# normal CPP selection check. If we explicitly set CPP, it goes down
|
|
|
|
# a different codepath.
|
|
|
|
_AT_CHECK_AC_MACRO(
|
|
|
|
[[AC_PROG_CC
|
|
|
|
CC="./mycc $CC"
|
|
|
|
AC_PROG_CPP
|
|
|
|
# The test $CC compiler should have been selected.
|
|
|
|
test "$CPP" != "$CC -E" &&
|
|
|
|
AC_MSG_ERROR([error messages on stderr cause the preprocessor selection to fail])
|
|
|
|
|
|
|
|
# Exercise CPP.
|
2008-11-03 17:19:44 +08:00
|
|
|
AC_CHECK_HEADERS(stdio.h autoconf_io.h, [], [], [-])]])
|
2001-09-27 21:28:15 +08:00
|
|
|
|
|
|
|
AT_CHECK_DEFINES(
|
|
|
|
[/* #undef HAVE_AUTOCONF_IO_H */
|
|
|
|
#define HAVE_STDIO_H 1
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
2008-03-21 14:57:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
## ------------------------------------ ##
|
|
|
|
## AC_NO_EXECUTABLES (working linker). ##
|
|
|
|
## ------------------------------------ ##
|
|
|
|
|
|
|
|
AT_CHECK_MACRO([AC_NO_EXECUTABLES (working linker)],
|
|
|
|
[AC_NO_EXECUTABLES
|
|
|
|
AC_PROG_CC
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
## ----------------------------------- ##
|
|
|
|
## AC_NO_EXECUTABLES (broken linker). ##
|
|
|
|
## ----------------------------------- ##
|
|
|
|
|
|
|
|
AT_CHECK_MACRO([AC_NO_EXECUTABLES (broken linker)],
|
|
|
|
[LDFLAGS=-lnosuchlibrary
|
|
|
|
AC_NO_EXECUTABLES
|
|
|
|
AC_PROG_CC
|
|
|
|
])
|
2008-08-04 20:56:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
## -------------------------- ##
|
|
|
|
## AC_USE_SYSTEM_EXTENSIONS. ##
|
|
|
|
## -------------------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_USE_SYSTEM_EXTENSIONS])
|
|
|
|
|
|
|
|
# Some existing configure.ac mixed AC_AIX (now an alias for
|
|
|
|
# AC_USE_SYSTEM_EXTENSIONS) and AC_DEFINE([__EXTENSIONS__]), which
|
|
|
|
# broke autoheader in 2.62. Test that this is supported.
|
|
|
|
|
|
|
|
_AT_CHECK_AC_MACRO(
|
|
|
|
[[AC_AIX
|
|
|
|
AC_DEFINE([__EXTENSIONS__], [1], [Manually defined for Solaris])
|
|
|
|
]])
|
|
|
|
|
|
|
|
_AT_CHECK_AC_MACRO(
|
|
|
|
[[AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
AC_DEFINE([__EXTENSIONS__], [1], [Manually defined for Solaris])
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
2009-03-10 02:25:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
## ----------------------- ##
|
|
|
|
## AC_C_RESTRICT and C++. ##
|
|
|
|
## ----------------------- ##
|
|
|
|
|
|
|
|
AT_SETUP([AC_C_RESTRICT and C++])
|
|
|
|
|
|
|
|
# In some compiler suites, the left hand doesn't know about everything
|
|
|
|
# the right hand does; or the user mixes the C compiler from one suite
|
|
|
|
# with the C++ compiler from another. In this case, Sun WorkShop CC
|
|
|
|
# not like the _Restrict accepted by cc.
|
|
|
|
|
|
|
|
AT_DATA([configure.ac],
|
|
|
|
[[AC_INIT
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CXX
|
|
|
|
AC_C_RESTRICT
|
|
|
|
AC_CONFIG_HEADERS([config.h])
|
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([Makefile.in],
|
|
|
|
[[CC = @CC@
|
|
|
|
CXX = @CXX@
|
|
|
|
CFLAGS = @CFLAGS@
|
|
|
|
CXXFLAGS = @CXXFLAGS@
|
|
|
|
CPPFLAGS = -I. @CPPFLAGS@
|
|
|
|
OBJEXT = @OBJEXT@
|
|
|
|
all: foo.$(OBJEXT) bar.$(OBJEXT)
|
|
|
|
cpp-works:
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c cpp-works.cpp
|
|
|
|
foo.$(OBJEXT): foo.c
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c foo.c
|
|
|
|
bar.$(OBJEXT): bar.cpp
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c bar.cpp
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([foo.c],
|
|
|
|
[[#include <config.h>
|
|
|
|
|
|
|
|
int foo (int * restrict i1, int * restrict i2)
|
|
|
|
{
|
|
|
|
return i1[0] + i2[0];
|
|
|
|
}
|
|
|
|
]])
|
|
|
|
|
|
|
|
cp foo.c bar.cpp
|
|
|
|
|
|
|
|
AT_DATA([cpp-works.cpp],
|
|
|
|
[[// This file is just to test whether we have a working C++ compiler at all
|
|
|
|
class foo { int x; };
|
|
|
|
class foo foobar;
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK([autoconf])
|
|
|
|
AT_CHECK([autoheader])
|
|
|
|
AT_CHECK([./configure], [], [ignore], [ignore])
|
|
|
|
AT_CHECK([${MAKE-make} cpp-works || exit 77], [], [ignore], [ignore])
|
|
|
|
AT_CHECK([${MAKE-make}], [], [ignore], [ignore])
|
|
|
|
|
|
|
|
AT_CLEANUP
|