1# -*- Autotest -*- 2 3AT_BANNER([Low level compiling/preprocessing macros.]) 4 5# Copyright (C) 2000, 2001, 2003, 2005, 2006 Free Software Foundation, Inc. 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2, or (at your option) 10# any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program; if not, write to the Free Software 19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 20# 02110-1301, USA. 21 22 23# Since the macros which compile are required by most tests, check 24# them first. But remember that looking for a compiler is even more 25# primitive, so check those first. 26 27 28## ------------------------------------- ## 29## AC_LANG, AC_LANG_PUSH & AC_LANG_POP. ## 30## ------------------------------------- ## 31 32AT_SETUP([AC_LANG, AC_LANG_PUSH & AC_LANG_POP]) 33 34AT_DATA([configure.ac], 35[[AC_INIT 36# C 37AC_LANG(C) 38# C 39AC_LANG_PUSH(C) 40# C C 41AC_LANG_PUSH(C++) 42# C++ C C 43AC_LANG(C++) 44# C++ C C 45AC_LANG_PUSH(Fortran 77) 46# F77 C++ C C 47AC_LANG_POP(Fortran 77) 48# C++ C C 49AC_LANG(C++) 50# C++ C C 51AC_LANG_POP(C++) 52# C C 53AC_LANG_POP(C) 54# C 55]]) 56 57AT_CHECK_AUTOCONF 58AT_CHECK([sed -n 's/^ac_ext=//p' configure], 0, 59[c 60c 61c 62cpp 63cpp 64f 65cpp 66cpp 67c 68c 69]) 70 71AT_CLEANUP 72 73 74## ---------------------- ## 75## AC_REQUIRE & AC_LANG. ## 76## ---------------------- ## 77 78AT_SETUP([AC_REQUIRE & AC_LANG]) 79 80AT_DATA([configure.ac], 81[[AC_DEFUN([AC_F77_1], 82[AC_LANG_PUSH([Fortran 77]) 83if test $ac_ext != f; then 84 AC_MSG_ERROR([F77_1: current shell language is $ac_ext, expected Fortran]) 85fi 86AC_LANG_POP 87]) 88 89 90AC_DEFUN([AC_F77_2], 91[AC_LANG_PUSH([Fortran 77]) 92AC_REQUIRE([AC_F77_1]) 93if test $ac_ext != f; then 94 AC_MSG_ERROR([F77_2: current shell language is $ac_ext, expected Fortran]) 95fi 96AC_LANG_POP 97]) 98 99AC_INIT 100AC_F77_2 101AS_EXIT(0) 102]]) 103 104AT_CHECK_AUTOCONF 105AT_CHECK_CONFIGURE 106 107AT_CLEANUP 108 109 110## --------------- ## 111## AC_RUN_IFELSE. ## 112## --------------- ## 113 114AT_SETUP([AC_RUN_IFELSE]) 115 116AT_DATA([configure.ac], 117[[AC_INIT 118 119AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0])], 120 [], 121 [AC_MSG_ERROR([saw `return 0' as a failure])]) 122 123AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 2])], 124 [AC_MSG_ERROR([saw `return 2' as a success])], 125 [status=$? 126test $status != 2 && 127 AC_MSG_ERROR([did not get as 2 exit status: $status])]) 128 129# The old stinky one. 130AC_TRY_RUN([int main () { return 3; }], 131 [AC_MSG_ERROR([saw `return 3' as a success])], 132 [status=$? 133test $status != 3 && 134 AC_MSG_ERROR([did not get 3 as exit status: $status])]) 135 136]]) 137 138AT_CHECK_AUTOCONF 139AT_CHECK_CONFIGURE([-q]) 140 141AT_CLEANUP 142 143## ------------------ ## 144## AC_TRY_LINK_FUNC. ## 145## ------------------ ## 146 147AT_CHECK_MACRO([AC_TRY_LINK_FUNC], 148[AC_TRY_LINK_FUNC(printf,, 149 [AC_MSG_ERROR([cannot find `printf'])]) 150AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this, 151 [AC_MSG_ERROR([found a nonexistent function])])]) 152