| 1 | # -*- Autotest -*-
|
|---|
| 2 |
|
|---|
| 3 | AT_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 |
|
|---|
| 32 | AT_SETUP([AC_LANG, AC_LANG_PUSH & AC_LANG_POP])
|
|---|
| 33 |
|
|---|
| 34 | AT_DATA([configure.ac],
|
|---|
| 35 | [[AC_INIT
|
|---|
| 36 | # C
|
|---|
| 37 | AC_LANG(C)
|
|---|
| 38 | # C
|
|---|
| 39 | AC_LANG_PUSH(C)
|
|---|
| 40 | # C C
|
|---|
| 41 | AC_LANG_PUSH(C++)
|
|---|
| 42 | # C++ C C
|
|---|
| 43 | AC_LANG(C++)
|
|---|
| 44 | # C++ C C
|
|---|
| 45 | AC_LANG_PUSH(Fortran 77)
|
|---|
| 46 | # F77 C++ C C
|
|---|
| 47 | AC_LANG_POP(Fortran 77)
|
|---|
| 48 | # C++ C C
|
|---|
| 49 | AC_LANG(C++)
|
|---|
| 50 | # C++ C C
|
|---|
| 51 | AC_LANG_POP(C++)
|
|---|
| 52 | # C C
|
|---|
| 53 | AC_LANG_POP(C)
|
|---|
| 54 | # C
|
|---|
| 55 | ]])
|
|---|
| 56 |
|
|---|
| 57 | AT_CHECK_AUTOCONF
|
|---|
| 58 | AT_CHECK([sed -n 's/^ac_ext=//p' configure], 0,
|
|---|
| 59 | [c
|
|---|
| 60 | c
|
|---|
| 61 | c
|
|---|
| 62 | cpp
|
|---|
| 63 | cpp
|
|---|
| 64 | f
|
|---|
| 65 | cpp
|
|---|
| 66 | cpp
|
|---|
| 67 | c
|
|---|
| 68 | c
|
|---|
| 69 | ])
|
|---|
| 70 |
|
|---|
| 71 | AT_CLEANUP
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 | ## ---------------------- ##
|
|---|
| 75 | ## AC_REQUIRE & AC_LANG. ##
|
|---|
| 76 | ## ---------------------- ##
|
|---|
| 77 |
|
|---|
| 78 | AT_SETUP([AC_REQUIRE & AC_LANG])
|
|---|
| 79 |
|
|---|
| 80 | AT_DATA([configure.ac],
|
|---|
| 81 | [[AC_DEFUN([AC_F77_1],
|
|---|
| 82 | [AC_LANG_PUSH([Fortran 77])
|
|---|
| 83 | if test $ac_ext != f; then
|
|---|
| 84 | AC_MSG_ERROR([F77_1: current shell language is $ac_ext, expected Fortran])
|
|---|
| 85 | fi
|
|---|
| 86 | AC_LANG_POP
|
|---|
| 87 | ])
|
|---|
| 88 |
|
|---|
| 89 |
|
|---|
| 90 | AC_DEFUN([AC_F77_2],
|
|---|
| 91 | [AC_LANG_PUSH([Fortran 77])
|
|---|
| 92 | AC_REQUIRE([AC_F77_1])
|
|---|
| 93 | if test $ac_ext != f; then
|
|---|
| 94 | AC_MSG_ERROR([F77_2: current shell language is $ac_ext, expected Fortran])
|
|---|
| 95 | fi
|
|---|
| 96 | AC_LANG_POP
|
|---|
| 97 | ])
|
|---|
| 98 |
|
|---|
| 99 | AC_INIT
|
|---|
| 100 | AC_F77_2
|
|---|
| 101 | AS_EXIT(0)
|
|---|
| 102 | ]])
|
|---|
| 103 |
|
|---|
| 104 | AT_CHECK_AUTOCONF
|
|---|
| 105 | AT_CHECK_CONFIGURE
|
|---|
| 106 |
|
|---|
| 107 | AT_CLEANUP
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 | ## --------------- ##
|
|---|
| 111 | ## AC_RUN_IFELSE. ##
|
|---|
| 112 | ## --------------- ##
|
|---|
| 113 |
|
|---|
| 114 | AT_SETUP([AC_RUN_IFELSE])
|
|---|
| 115 |
|
|---|
| 116 | AT_DATA([configure.ac],
|
|---|
| 117 | [[AC_INIT
|
|---|
| 118 |
|
|---|
| 119 | AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0])],
|
|---|
| 120 | [],
|
|---|
| 121 | [AC_MSG_ERROR([saw `return 0' as a failure])])
|
|---|
| 122 |
|
|---|
| 123 | AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 2])],
|
|---|
| 124 | [AC_MSG_ERROR([saw `return 2' as a success])],
|
|---|
| 125 | [status=$?
|
|---|
| 126 | test $status != 2 &&
|
|---|
| 127 | AC_MSG_ERROR([did not get as 2 exit status: $status])])
|
|---|
| 128 |
|
|---|
| 129 | # The old stinky one.
|
|---|
| 130 | AC_TRY_RUN([int main () { return 3; }],
|
|---|
| 131 | [AC_MSG_ERROR([saw `return 3' as a success])],
|
|---|
| 132 | [status=$?
|
|---|
| 133 | test $status != 3 &&
|
|---|
| 134 | AC_MSG_ERROR([did not get 3 as exit status: $status])])
|
|---|
| 135 |
|
|---|
| 136 | ]])
|
|---|
| 137 |
|
|---|
| 138 | AT_CHECK_AUTOCONF
|
|---|
| 139 | AT_CHECK_CONFIGURE([-q])
|
|---|
| 140 |
|
|---|
| 141 | AT_CLEANUP
|
|---|
| 142 |
|
|---|
| 143 | ## ------------------ ##
|
|---|
| 144 | ## AC_TRY_LINK_FUNC. ##
|
|---|
| 145 | ## ------------------ ##
|
|---|
| 146 |
|
|---|
| 147 | AT_CHECK_MACRO([AC_TRY_LINK_FUNC],
|
|---|
| 148 | [AC_TRY_LINK_FUNC(printf,,
|
|---|
| 149 | [AC_MSG_ERROR([cannot find `printf'])])
|
|---|
| 150 | AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this,
|
|---|
| 151 | [AC_MSG_ERROR([found a nonexistent function])])])
|
|---|