| 1 | dnl Macros that test for specific features. | 
|---|
| 2 | dnl This file is part of Autoconf. | 
|---|
| 3 | dnl Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc. | 
|---|
| 4 | dnl | 
|---|
| 5 | dnl This program is free software; you can redistribute it and/or modify | 
|---|
| 6 | dnl it under the terms of the GNU General Public License as published by | 
|---|
| 7 | dnl the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 8 | dnl any later version. | 
|---|
| 9 | dnl | 
|---|
| 10 | dnl This program is distributed in the hope that it will be useful, | 
|---|
| 11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 13 | dnl GNU General Public License for more details. | 
|---|
| 14 | dnl | 
|---|
| 15 | dnl You should have received a copy of the GNU General Public License | 
|---|
| 16 | dnl along with this program; if not, write to the Free Software | 
|---|
| 17 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | 
|---|
| 18 | dnl 02111-1307, USA. | 
|---|
| 19 | dnl | 
|---|
| 20 | dnl As a special exception, the Free Software Foundation gives unlimited | 
|---|
| 21 | dnl permission to copy, distribute and modify the configure scripts that | 
|---|
| 22 | dnl are the output of Autoconf.  You need not follow the terms of the GNU | 
|---|
| 23 | dnl General Public License when using or distributing such scripts, even | 
|---|
| 24 | dnl though portions of the text of Autoconf appear in them.  The GNU | 
|---|
| 25 | dnl General Public License (GPL) does govern all other use of the material | 
|---|
| 26 | dnl that constitutes the Autoconf program. | 
|---|
| 27 | dnl | 
|---|
| 28 | dnl Certain portions of the Autoconf source text are designed to be copied | 
|---|
| 29 | dnl (in certain cases, depending on the input) into the output of | 
|---|
| 30 | dnl Autoconf.  We call these the "data" portions.  The rest of the Autoconf | 
|---|
| 31 | dnl source text consists of comments plus executable code that decides which | 
|---|
| 32 | dnl of the data portions to output in any given case.  We call these | 
|---|
| 33 | dnl comments and executable code the "non-data" portions.  Autoconf never | 
|---|
| 34 | dnl copies any of the non-data portions into its output. | 
|---|
| 35 | dnl | 
|---|
| 36 | dnl This special exception to the GPL applies to versions of Autoconf | 
|---|
| 37 | dnl released by the Free Software Foundation.  When you make and | 
|---|
| 38 | dnl distribute a modified version of Autoconf, you may extend this special | 
|---|
| 39 | dnl exception to the GPL to apply to your modified version as well, *unless* | 
|---|
| 40 | dnl your modified version has the potential to copy into its output some | 
|---|
| 41 | dnl of the text that was the non-data portion of the version that you started | 
|---|
| 42 | dnl with.  (In other words, unless your change moves or copies text from | 
|---|
| 43 | dnl the non-data portions to the data portions.)  If your modification has | 
|---|
| 44 | dnl such potential, you must delete any notice of this special exception | 
|---|
| 45 | dnl to the GPL from your modified version. | 
|---|
| 46 | dnl | 
|---|
| 47 | dnl Written by David MacKenzie, with help from | 
|---|
| 48 | dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, | 
|---|
| 49 | dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | dnl ### Checks for programs | 
|---|
| 53 |  | 
|---|
| 54 |  | 
|---|
| 55 | dnl Check whether to use -n, \c, or newline-tab to separate | 
|---|
| 56 | dnl checking messages from result messages. | 
|---|
| 57 | dnl Idea borrowed from dist 3.0. | 
|---|
| 58 | dnl Internal use only. | 
|---|
| 59 | AC_DEFUN(AC_PROG_ECHO_N, | 
|---|
| 60 | [if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then | 
|---|
| 61 | # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. | 
|---|
| 62 | if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then | 
|---|
| 63 | ac_n= ac_c=' | 
|---|
| 64 | ' ac_t='        ' | 
|---|
| 65 | else | 
|---|
| 66 | ac_n=-n ac_c= ac_t= | 
|---|
| 67 | fi | 
|---|
| 68 | else | 
|---|
| 69 | ac_n= ac_c='\c' ac_t= | 
|---|
| 70 | fi | 
|---|
| 71 | ]) | 
|---|
| 72 |  | 
|---|
| 73 | AC_DEFUN(AC_PROG_CC, | 
|---|
| 74 | [AC_BEFORE([$0], [AC_PROG_CPP])dnl | 
|---|
| 75 | AC_CHECK_PROG(CC, gcc, gcc) | 
|---|
| 76 | if test -z "$CC"; then | 
|---|
| 77 | AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) | 
|---|
| 78 | if test -z "$CC"; then | 
|---|
| 79 | case "`uname -s`" in | 
|---|
| 80 | *win32* | *WIN32*) | 
|---|
| 81 | AC_CHECK_PROG(CC, cl, cl) ;; | 
|---|
| 82 | esac | 
|---|
| 83 | fi | 
|---|
| 84 | test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) | 
|---|
| 85 | fi | 
|---|
| 86 |  | 
|---|
| 87 | AC_PROG_CC_WORKS | 
|---|
| 88 | AC_PROG_CC_GNU | 
|---|
| 89 |  | 
|---|
| 90 | if test $ac_cv_prog_gcc = yes; then | 
|---|
| 91 | GCC=yes | 
|---|
| 92 | else | 
|---|
| 93 | GCC= | 
|---|
| 94 | fi | 
|---|
| 95 |  | 
|---|
| 96 | dnl Check whether -g works, even if CFLAGS is set, in case the package | 
|---|
| 97 | dnl plays around with CFLAGS (such as to build both debugging and | 
|---|
| 98 | dnl normal versions of a library), tasteless as that idea is. | 
|---|
| 99 | ac_test_CFLAGS="${CFLAGS+set}" | 
|---|
| 100 | ac_save_CFLAGS="$CFLAGS" | 
|---|
| 101 | CFLAGS= | 
|---|
| 102 | AC_PROG_CC_G | 
|---|
| 103 | if test "$ac_test_CFLAGS" = set; then | 
|---|
| 104 | CFLAGS="$ac_save_CFLAGS" | 
|---|
| 105 | elif test $ac_cv_prog_cc_g = yes; then | 
|---|
| 106 | if test "$GCC" = yes; then | 
|---|
| 107 | CFLAGS="-g -O2" | 
|---|
| 108 | else | 
|---|
| 109 | CFLAGS="-g" | 
|---|
| 110 | fi | 
|---|
| 111 | else | 
|---|
| 112 | if test "$GCC" = yes; then | 
|---|
| 113 | CFLAGS="-O2" | 
|---|
| 114 | else | 
|---|
| 115 | CFLAGS= | 
|---|
| 116 | fi | 
|---|
| 117 | fi | 
|---|
| 118 | ]) | 
|---|
| 119 |  | 
|---|
| 120 | AC_DEFUN(AC_PROG_CXX, | 
|---|
| 121 | [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl | 
|---|
| 122 | AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc) | 
|---|
| 123 |  | 
|---|
| 124 | AC_PROG_CXX_WORKS | 
|---|
| 125 | AC_PROG_CXX_GNU | 
|---|
| 126 |  | 
|---|
| 127 | if test $ac_cv_prog_gxx = yes; then | 
|---|
| 128 | GXX=yes | 
|---|
| 129 | else | 
|---|
| 130 | GXX= | 
|---|
| 131 | fi | 
|---|
| 132 |  | 
|---|
| 133 | dnl Check whether -g works, even if CXXFLAGS is set, in case the package | 
|---|
| 134 | dnl plays around with CXXFLAGS (such as to build both debugging and | 
|---|
| 135 | dnl normal versions of a library), tasteless as that idea is. | 
|---|
| 136 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | 
|---|
| 137 | ac_save_CXXFLAGS="$CXXFLAGS" | 
|---|
| 138 | CXXFLAGS= | 
|---|
| 139 | AC_PROG_CXX_G | 
|---|
| 140 | if test "$ac_test_CXXFLAGS" = set; then | 
|---|
| 141 | CXXFLAGS="$ac_save_CXXFLAGS" | 
|---|
| 142 | elif test $ac_cv_prog_cxx_g = yes; then | 
|---|
| 143 | if test "$GXX" = yes; then | 
|---|
| 144 | CXXFLAGS="-g -O2" | 
|---|
| 145 | else | 
|---|
| 146 | CXXFLAGS="-g" | 
|---|
| 147 | fi | 
|---|
| 148 | else | 
|---|
| 149 | if test "$GXX" = yes; then | 
|---|
| 150 | CXXFLAGS="-O2" | 
|---|
| 151 | else | 
|---|
| 152 | CXXFLAGS= | 
|---|
| 153 | fi | 
|---|
| 154 | fi | 
|---|
| 155 | ]) | 
|---|
| 156 |  | 
|---|
| 157 | dnl Determine a Fortran 77 compiler to use.  If `F77' is not already set | 
|---|
| 158 | dnl in the environment, check for `g77', `f77' and `f2c', in that order. | 
|---|
| 159 | dnl Set the output variable `F77' to the name of the compiler found. | 
|---|
| 160 | dnl | 
|---|
| 161 | dnl If using `g77' (the GNU Fortran 77 compiler), then `AC_PROG_F77' | 
|---|
| 162 | dnl will set the shell variable `G77' to `yes', and empty otherwise.  If | 
|---|
| 163 | dnl the output variable `FFLAGS' was not already set in the environment, | 
|---|
| 164 | dnl then set it to `-g -02' for `g77' (or `-O2' where `g77' does not | 
|---|
| 165 | dnl accept `-g').  Otherwise, set `FFLAGS' to `-g' for all other Fortran | 
|---|
| 166 | dnl 77 compilers. | 
|---|
| 167 | dnl | 
|---|
| 168 | dnl AC_PROG_F77() | 
|---|
| 169 | AC_DEFUN(AC_PROG_F77, | 
|---|
| 170 | [AC_BEFORE([$0], [AC_PROG_CPP])dnl | 
|---|
| 171 | if test -z "$F77"; then | 
|---|
| 172 | AC_CHECK_PROGS(F77, g77 f77 f2c) | 
|---|
| 173 | test -z "$F77" && AC_MSG_ERROR([no acceptable Fortran 77 compiler found in \$PATH]) | 
|---|
| 174 | fi | 
|---|
| 175 |  | 
|---|
| 176 | AC_PROG_F77_WORKS | 
|---|
| 177 | AC_PROG_F77_GNU | 
|---|
| 178 |  | 
|---|
| 179 | if test $ac_cv_prog_g77 = yes; then | 
|---|
| 180 | G77=yes | 
|---|
| 181 | dnl Check whether -g works, even if FFLAGS is set, in case the package | 
|---|
| 182 | dnl plays around with FFLAGS (such as to build both debugging and | 
|---|
| 183 | dnl normal versions of a library), tasteless as that idea is. | 
|---|
| 184 | ac_test_FFLAGS="${FFLAGS+set}" | 
|---|
| 185 | ac_save_FFLAGS="$FFLAGS" | 
|---|
| 186 | FFLAGS= | 
|---|
| 187 | AC_PROG_F77_G | 
|---|
| 188 | if test "$ac_test_FFLAGS" = set; then | 
|---|
| 189 | FFLAGS="$ac_save_FFLAGS" | 
|---|
| 190 | elif test $ac_cv_prog_f77_g = yes; then | 
|---|
| 191 | FFLAGS="-g -O2" | 
|---|
| 192 | else | 
|---|
| 193 | FFLAGS="-O2" | 
|---|
| 194 | fi | 
|---|
| 195 | else | 
|---|
| 196 | G77= | 
|---|
| 197 | test "${FFLAGS+set}" = set || FFLAGS="-g" | 
|---|
| 198 | fi | 
|---|
| 199 | ]) | 
|---|
| 200 |  | 
|---|
| 201 | AC_DEFUN(AC_PROG_CC_WORKS, | 
|---|
| 202 | [AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works]) | 
|---|
| 203 | AC_LANG_SAVE | 
|---|
| 204 | AC_LANG_C | 
|---|
| 205 | AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross) | 
|---|
| 206 | AC_LANG_RESTORE | 
|---|
| 207 | AC_MSG_RESULT($ac_cv_prog_cc_works) | 
|---|
| 208 | if test $ac_cv_prog_cc_works = no; then | 
|---|
| 209 | AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.]) | 
|---|
| 210 | fi | 
|---|
| 211 | AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler]) | 
|---|
| 212 | AC_MSG_RESULT($ac_cv_prog_cc_cross) | 
|---|
| 213 | cross_compiling=$ac_cv_prog_cc_cross | 
|---|
| 214 | ]) | 
|---|
| 215 |  | 
|---|
| 216 | AC_DEFUN(AC_PROG_CXX_WORKS, | 
|---|
| 217 | [AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works]) | 
|---|
| 218 | AC_LANG_SAVE | 
|---|
| 219 | AC_LANG_CPLUSPLUS | 
|---|
| 220 | AC_TRY_COMPILER([int main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross) | 
|---|
| 221 | AC_LANG_RESTORE | 
|---|
| 222 | AC_MSG_RESULT($ac_cv_prog_cxx_works) | 
|---|
| 223 | if test $ac_cv_prog_cxx_works = no; then | 
|---|
| 224 | AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.]) | 
|---|
| 225 | fi | 
|---|
| 226 | AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler]) | 
|---|
| 227 | AC_MSG_RESULT($ac_cv_prog_cxx_cross) | 
|---|
| 228 | cross_compiling=$ac_cv_prog_cxx_cross | 
|---|
| 229 | ]) | 
|---|
| 230 |  | 
|---|
| 231 | dnl Test whether the Fortran 77 compiler can compile and link a trivial | 
|---|
| 232 | dnl Fortran program.  Also, test whether the Fortran 77 compiler is a | 
|---|
| 233 | dnl cross-compiler (which may realistically be the case if the Fortran | 
|---|
| 234 | dnl compiler is `g77'). | 
|---|
| 235 | dnl | 
|---|
| 236 | dnl AC_PROG_F77_WORKS() | 
|---|
| 237 | AC_DEFUN(AC_PROG_F77_WORKS, | 
|---|
| 238 | [AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) works]) | 
|---|
| 239 | AC_LANG_SAVE | 
|---|
| 240 | AC_LANG_FORTRAN77 | 
|---|
| 241 | AC_TRY_COMPILER(dnl | 
|---|
| 242 | [      program conftest | 
|---|
| 243 | end | 
|---|
| 244 | ], ac_cv_prog_f77_works, ac_cv_prog_f77_cross) | 
|---|
| 245 | AC_LANG_RESTORE | 
|---|
| 246 | AC_MSG_RESULT($ac_cv_prog_f77_works) | 
|---|
| 247 | if test $ac_cv_prog_f77_works = no; then | 
|---|
| 248 | AC_MSG_ERROR([installation or configuration problem: Fortran 77 compiler cannot create executables.]) | 
|---|
| 249 | fi | 
|---|
| 250 | AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler]) | 
|---|
| 251 | AC_MSG_RESULT($ac_cv_prog_f77_cross) | 
|---|
| 252 | cross_compiling=$ac_cv_prog_f77_cross | 
|---|
| 253 | ]) | 
|---|
| 254 |  | 
|---|
| 255 | AC_DEFUN(AC_PROG_CC_GNU, | 
|---|
| 256 | [AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc, | 
|---|
| 257 | [dnl The semicolon is to pacify NeXT's syntax-checking cpp. | 
|---|
| 258 | cat > conftest.c <<EOF | 
|---|
| 259 | #ifdef __GNUC__ | 
|---|
| 260 | yes; | 
|---|
| 261 | #endif | 
|---|
| 262 | EOF | 
|---|
| 263 | if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then | 
|---|
| 264 | ac_cv_prog_gcc=yes | 
|---|
| 265 | else | 
|---|
| 266 | ac_cv_prog_gcc=no | 
|---|
| 267 | fi])]) | 
|---|
| 268 |  | 
|---|
| 269 | AC_DEFUN(AC_PROG_CXX_GNU, | 
|---|
| 270 | [AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx, | 
|---|
| 271 | [dnl The semicolon is to pacify NeXT's syntax-checking cpp. | 
|---|
| 272 | cat > conftest.C <<EOF | 
|---|
| 273 | #ifdef __GNUC__ | 
|---|
| 274 | yes; | 
|---|
| 275 | #endif | 
|---|
| 276 | EOF | 
|---|
| 277 | if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then | 
|---|
| 278 | ac_cv_prog_gxx=yes | 
|---|
| 279 | else | 
|---|
| 280 | ac_cv_prog_gxx=no | 
|---|
| 281 | fi])]) | 
|---|
| 282 |  | 
|---|
| 283 | dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77 | 
|---|
| 284 | dnl Compiler).  This test depends on whether the Fortran 77 compiler can | 
|---|
| 285 | dnl do CPP pre-processing. | 
|---|
| 286 | dnl | 
|---|
| 287 | dnl AC_PROG_F77_GNU() | 
|---|
| 288 | AC_DEFUN(AC_PROG_F77_GNU, | 
|---|
| 289 | [AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77, | 
|---|
| 290 | [cat > conftest.fpp <<EOF | 
|---|
| 291 | #ifdef __GNUC__ | 
|---|
| 292 | yes | 
|---|
| 293 | #endif | 
|---|
| 294 | EOF | 
|---|
| 295 | if AC_TRY_COMMAND($F77 -E conftest.fpp) | egrep yes >/dev/null 2>&1; then | 
|---|
| 296 | ac_cv_prog_g77=yes | 
|---|
| 297 | else | 
|---|
| 298 | ac_cv_prog_g77=no | 
|---|
| 299 | fi])]) | 
|---|
| 300 |  | 
|---|
| 301 | AC_DEFUN(AC_PROG_CC_G, | 
|---|
| 302 | [AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g, | 
|---|
| 303 | [echo 'void f(){}' > conftest.c | 
|---|
| 304 | if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then | 
|---|
| 305 | ac_cv_prog_cc_g=yes | 
|---|
| 306 | else | 
|---|
| 307 | ac_cv_prog_cc_g=no | 
|---|
| 308 | fi | 
|---|
| 309 | rm -f conftest* | 
|---|
| 310 | ])]) | 
|---|
| 311 |  | 
|---|
| 312 | AC_DEFUN(AC_PROG_CXX_G, | 
|---|
| 313 | [AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g, | 
|---|
| 314 | [echo 'void f(){}' > conftest.cc | 
|---|
| 315 | if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then | 
|---|
| 316 | ac_cv_prog_cxx_g=yes | 
|---|
| 317 | else | 
|---|
| 318 | ac_cv_prog_cxx_g=no | 
|---|
| 319 | fi | 
|---|
| 320 | rm -f conftest* | 
|---|
| 321 | ])]) | 
|---|
| 322 |  | 
|---|
| 323 | dnl Test whether the Fortran 77 compiler can accept the `-g' option to | 
|---|
| 324 | dnl enable debugging. | 
|---|
| 325 | dnl | 
|---|
| 326 | dnl AC_PROG_F77_G() | 
|---|
| 327 | AC_DEFUN(AC_PROG_F77_G, | 
|---|
| 328 | [AC_CACHE_CHECK(whether $F77 accepts -g, ac_cv_prog_f77_g, | 
|---|
| 329 | [cat > conftest.f << EOF | 
|---|
| 330 | program conftest | 
|---|
| 331 | end | 
|---|
| 332 | EOF | 
|---|
| 333 | if test -z "`$F77 -g -c conftest.f 2>&1`"; then | 
|---|
| 334 | ac_cv_prog_f77_g=yes | 
|---|
| 335 | else | 
|---|
| 336 | ac_cv_prog_f77_g=no | 
|---|
| 337 | fi | 
|---|
| 338 | rm -f conftest* | 
|---|
| 339 | ])]) | 
|---|
| 340 |  | 
|---|
| 341 | AC_DEFUN(AC_PROG_GCC_TRADITIONAL, | 
|---|
| 342 | [AC_REQUIRE([AC_PROG_CC])dnl | 
|---|
| 343 | AC_REQUIRE([AC_PROG_CPP])dnl | 
|---|
| 344 | if test $ac_cv_prog_gcc = yes; then | 
|---|
| 345 | AC_CACHE_CHECK(whether ${CC-cc} needs -traditional, | 
|---|
| 346 | ac_cv_prog_gcc_traditional, | 
|---|
| 347 | [  ac_pattern="Autoconf.*'x'" | 
|---|
| 348 | AC_EGREP_CPP($ac_pattern, [#include <sgtty.h> | 
|---|
| 349 | Autoconf TIOCGETP], | 
|---|
| 350 | ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no) | 
|---|
| 351 |  | 
|---|
| 352 | if test $ac_cv_prog_gcc_traditional = no; then | 
|---|
| 353 | AC_EGREP_CPP($ac_pattern, [#include <termio.h> | 
|---|
| 354 | Autoconf TCGETA], | 
|---|
| 355 | ac_cv_prog_gcc_traditional=yes) | 
|---|
| 356 | fi]) | 
|---|
| 357 | if test $ac_cv_prog_gcc_traditional = yes; then | 
|---|
| 358 | CC="$CC -traditional" | 
|---|
| 359 | fi | 
|---|
| 360 | fi | 
|---|
| 361 | ]) | 
|---|
| 362 |  | 
|---|
| 363 | AC_DEFUN(AC_PROG_CC_C_O, | 
|---|
| 364 | [if test "x$CC" != xcc; then | 
|---|
| 365 | AC_MSG_CHECKING(whether $CC and cc understand -c and -o together) | 
|---|
| 366 | else | 
|---|
| 367 | AC_MSG_CHECKING(whether cc understands -c and -o together) | 
|---|
| 368 | fi | 
|---|
| 369 | set dummy $CC; ac_cc="`echo [$]2 | | 
|---|
| 370 | changequote(, )dnl | 
|---|
| 371 | sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" | 
|---|
| 372 | changequote([, ])dnl | 
|---|
| 373 | AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o, | 
|---|
| 374 | [echo 'foo(){}' > conftest.c | 
|---|
| 375 | # Make sure it works both with $CC and with simple cc. | 
|---|
| 376 | # We do the test twice because some compilers refuse to overwrite an | 
|---|
| 377 | # existing .o file with -o, though they will create one. | 
|---|
| 378 | ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC' | 
|---|
| 379 | if AC_TRY_EVAL(ac_try) && | 
|---|
| 380 | test -f conftest.o && AC_TRY_EVAL(ac_try); | 
|---|
| 381 | then | 
|---|
| 382 | eval ac_cv_prog_cc_${ac_cc}_c_o=yes | 
|---|
| 383 | if test "x$CC" != xcc; then | 
|---|
| 384 | # Test first that cc exists at all. | 
|---|
| 385 | if AC_TRY_COMMAND(cc -c conftest.c 1>&AC_FD_CC); then | 
|---|
| 386 | ac_try='cc -c conftest.c -o conftest.o 1>&AC_FD_CC' | 
|---|
| 387 | if AC_TRY_EVAL(ac_try) && | 
|---|
| 388 | test -f conftest.o && AC_TRY_EVAL(ac_try); | 
|---|
| 389 | then | 
|---|
| 390 | # cc works too. | 
|---|
| 391 | : | 
|---|
| 392 | else | 
|---|
| 393 | # cc exists but doesn't like -o. | 
|---|
| 394 | eval ac_cv_prog_cc_${ac_cc}_c_o=no | 
|---|
| 395 | fi | 
|---|
| 396 | fi | 
|---|
| 397 | fi | 
|---|
| 398 | else | 
|---|
| 399 | eval ac_cv_prog_cc_${ac_cc}_c_o=no | 
|---|
| 400 | fi | 
|---|
| 401 | rm -f conftest* | 
|---|
| 402 | ])dnl | 
|---|
| 403 | if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then | 
|---|
| 404 | AC_MSG_RESULT(yes) | 
|---|
| 405 | else | 
|---|
| 406 | AC_MSG_RESULT(no) | 
|---|
| 407 | AC_DEFINE(NO_MINUS_C_MINUS_O) | 
|---|
| 408 | fi | 
|---|
| 409 | ]) | 
|---|
| 410 |  | 
|---|
| 411 | dnl Test if the Fortran 77 compiler accepts the options `-c' and `-o' | 
|---|
| 412 | dnl simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not. | 
|---|
| 413 | dnl | 
|---|
| 414 | dnl The usefulness of this macro is questionable, as I can't really see | 
|---|
| 415 | dnl why anyone would use it.  The only reason I include it is for | 
|---|
| 416 | dnl completeness, since a similar test exists for the C compiler. | 
|---|
| 417 | dnl | 
|---|
| 418 | dnl AC_PROG_F77_C_O | 
|---|
| 419 | AC_DEFUN(AC_PROG_F77_C_O, | 
|---|
| 420 | [AC_BEFORE([$0], [AC_PROG_F77])dnl | 
|---|
| 421 | AC_MSG_CHECKING(whether $F77 understand -c and -o together) | 
|---|
| 422 | set dummy $F77; ac_f77="`echo [$]2 | | 
|---|
| 423 | changequote(, )dnl | 
|---|
| 424 | sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" | 
|---|
| 425 | changequote([, ])dnl | 
|---|
| 426 | AC_CACHE_VAL(ac_cv_prog_f77_${ac_f77}_c_o, | 
|---|
| 427 | [cat > conftest.f << EOF | 
|---|
| 428 | program conftest | 
|---|
| 429 | end | 
|---|
| 430 | EOF | 
|---|
| 431 | # We do the `AC_TRY_EVAL' test twice because some compilers refuse to | 
|---|
| 432 | # overwrite an existing `.o' file with `-o', although they will create | 
|---|
| 433 | # one. | 
|---|
| 434 | ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o 1>&AC_FD_CC' | 
|---|
| 435 | if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then | 
|---|
| 436 | eval ac_cv_prog_f77_${ac_f77}_c_o=yes | 
|---|
| 437 | else | 
|---|
| 438 | eval ac_cv_prog_f77_${ac_f77}_c_o=no | 
|---|
| 439 | fi | 
|---|
| 440 | rm -f conftest* | 
|---|
| 441 | ])dnl | 
|---|
| 442 | if eval "test \"`echo '$ac_cv_prog_f77_'${ac_f77}_c_o`\" = yes"; then | 
|---|
| 443 | AC_MSG_RESULT(yes) | 
|---|
| 444 | else | 
|---|
| 445 | AC_MSG_RESULT(no) | 
|---|
| 446 | AC_DEFINE(F77_NO_MINUS_C_MINUS_O) | 
|---|
| 447 | fi | 
|---|
| 448 | ]) | 
|---|
| 449 |  | 
|---|
| 450 | dnl Define SET_MAKE to set ${MAKE} if make doesn't. | 
|---|
| 451 | AC_DEFUN(AC_PROG_MAKE_SET, | 
|---|
| 452 | [AC_MSG_CHECKING(whether ${MAKE-make} sets \${MAKE}) | 
|---|
| 453 | set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'` | 
|---|
| 454 | AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set, | 
|---|
| 455 | [cat > conftestmake <<\EOF | 
|---|
| 456 | all: | 
|---|
| 457 | @echo 'ac_maketemp="${MAKE}"' | 
|---|
| 458 | EOF | 
|---|
| 459 | changequote(, )dnl | 
|---|
| 460 | # GNU make sometimes prints "make[1]: Entering...", which would confuse us. | 
|---|
| 461 | eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` | 
|---|
| 462 | changequote([, ])dnl | 
|---|
| 463 | if test -n "$ac_maketemp"; then | 
|---|
| 464 | eval ac_cv_prog_make_${ac_make}_set=yes | 
|---|
| 465 | else | 
|---|
| 466 | eval ac_cv_prog_make_${ac_make}_set=no | 
|---|
| 467 | fi | 
|---|
| 468 | rm -f conftestmake])dnl | 
|---|
| 469 | if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then | 
|---|
| 470 | AC_MSG_RESULT(yes) | 
|---|
| 471 | SET_MAKE= | 
|---|
| 472 | else | 
|---|
| 473 | AC_MSG_RESULT(no) | 
|---|
| 474 | SET_MAKE="MAKE=${MAKE-make}" | 
|---|
| 475 | fi | 
|---|
| 476 | AC_SUBST([SET_MAKE])dnl | 
|---|
| 477 | ]) | 
|---|
| 478 |  | 
|---|
| 479 | AC_DEFUN(AC_PROG_RANLIB, | 
|---|
| 480 | [AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)]) | 
|---|
| 481 |  | 
|---|
| 482 | dnl Check for mawk first since it's generally faster. | 
|---|
| 483 | AC_DEFUN(AC_PROG_AWK, | 
|---|
| 484 | [AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )]) | 
|---|
| 485 |  | 
|---|
| 486 | AC_DEFUN(AC_PROG_YACC, | 
|---|
| 487 | [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)]) | 
|---|
| 488 |  | 
|---|
| 489 | AC_DEFUN(AC_PROG_CPP, | 
|---|
| 490 | [AC_MSG_CHECKING(how to run the C preprocessor) | 
|---|
| 491 | # On Suns, sometimes $CPP names a directory. | 
|---|
| 492 | if test -n "$CPP" && test -d "$CPP"; then | 
|---|
| 493 | CPP= | 
|---|
| 494 | fi | 
|---|
| 495 | if test -z "$CPP"; then | 
|---|
| 496 | AC_CACHE_VAL(ac_cv_prog_CPP, | 
|---|
| 497 | [  # This must be in double quotes, not single quotes, because CPP may get | 
|---|
| 498 | # substituted into the Makefile and "${CC-cc}" will confuse make. | 
|---|
| 499 | CPP="${CC-cc} -E" | 
|---|
| 500 | # On the NeXT, cc -E runs the code through the compiler's parser, | 
|---|
| 501 | # not just through cpp. | 
|---|
| 502 | dnl Use a header file that comes with gcc, so configuring glibc | 
|---|
| 503 | dnl with a fresh cross-compiler works. | 
|---|
| 504 | AC_TRY_CPP([#include <assert.h> | 
|---|
| 505 | Syntax Error], , | 
|---|
| 506 | CPP="${CC-cc} -E -traditional-cpp" | 
|---|
| 507 | AC_TRY_CPP([#include <assert.h> | 
|---|
| 508 | Syntax Error], , | 
|---|
| 509 | CPP="${CC-cc} -nologo -E" | 
|---|
| 510 | AC_TRY_CPP([#include <assert.h> | 
|---|
| 511 | Syntax Error], , CPP=/lib/cpp))) | 
|---|
| 512 | ac_cv_prog_CPP="$CPP"])dnl | 
|---|
| 513 | CPP="$ac_cv_prog_CPP" | 
|---|
| 514 | else | 
|---|
| 515 | ac_cv_prog_CPP="$CPP" | 
|---|
| 516 | fi | 
|---|
| 517 | AC_MSG_RESULT($CPP) | 
|---|
| 518 | AC_SUBST(CPP)dnl | 
|---|
| 519 | ]) | 
|---|
| 520 |  | 
|---|
| 521 | AC_DEFUN(AC_PROG_CXXCPP, | 
|---|
| 522 | [AC_MSG_CHECKING(how to run the C++ preprocessor) | 
|---|
| 523 | if test -z "$CXXCPP"; then | 
|---|
| 524 | AC_CACHE_VAL(ac_cv_prog_CXXCPP, | 
|---|
| 525 | [AC_LANG_SAVE[]dnl | 
|---|
| 526 | AC_LANG_CPLUSPLUS[]dnl | 
|---|
| 527 | CXXCPP="${CXX-g++} -E" | 
|---|
| 528 | AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp) | 
|---|
| 529 | ac_cv_prog_CXXCPP="$CXXCPP" | 
|---|
| 530 | AC_LANG_RESTORE[]dnl | 
|---|
| 531 | fi])dnl | 
|---|
| 532 | CXXCPP="$ac_cv_prog_CXXCPP" | 
|---|
| 533 | AC_MSG_RESULT($CXXCPP) | 
|---|
| 534 | AC_SUBST(CXXCPP)dnl | 
|---|
| 535 | ]) | 
|---|
| 536 |  | 
|---|
| 537 | dnl Require finding the C or C++ preprocessor, whichever is the | 
|---|
| 538 | dnl current language. | 
|---|
| 539 | AC_DEFUN(AC_REQUIRE_CPP, | 
|---|
| 540 | [ifelse(AC_LANG, C, [AC_REQUIRE([AC_PROG_CPP])], [AC_REQUIRE([AC_PROG_CXXCPP])])]) | 
|---|
| 541 |  | 
|---|
| 542 | AC_DEFUN(AC_PROG_LEX, | 
|---|
| 543 | [AC_CHECK_PROG(LEX, flex, flex, lex) | 
|---|
| 544 | if test -z "$LEXLIB" | 
|---|
| 545 | then | 
|---|
| 546 | case "$LEX" in | 
|---|
| 547 | flex*) ac_lib=fl ;; | 
|---|
| 548 | *) ac_lib=l ;; | 
|---|
| 549 | esac | 
|---|
| 550 | AC_CHECK_LIB($ac_lib, yywrap, LEXLIB="-l$ac_lib") | 
|---|
| 551 | fi | 
|---|
| 552 | AC_SUBST(LEXLIB)]) | 
|---|
| 553 |  | 
|---|
| 554 | dnl Check if lex declares yytext as a char * by default, not a char[]. | 
|---|
| 555 | undefine([AC_DECL_YYTEXT]) | 
|---|
| 556 | AC_DEFUN(AC_DECL_YYTEXT, | 
|---|
| 557 | [AC_REQUIRE_CPP()dnl | 
|---|
| 558 | AC_REQUIRE([AC_PROG_LEX])dnl | 
|---|
| 559 | AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root, | 
|---|
| 560 | [# The minimal lex program is just a single line: %%.  But some broken lexes | 
|---|
| 561 | # (Solaris, I think it was) want two %% lines, so accommodate them. | 
|---|
| 562 | echo '%% | 
|---|
| 563 | %%' | $LEX | 
|---|
| 564 | if test -f lex.yy.c; then | 
|---|
| 565 | ac_cv_prog_lex_root=lex.yy | 
|---|
| 566 | elif test -f lexyy.c; then | 
|---|
| 567 | ac_cv_prog_lex_root=lexyy | 
|---|
| 568 | else | 
|---|
| 569 | AC_MSG_ERROR(cannot find output from $LEX; giving up) | 
|---|
| 570 | fi]) | 
|---|
| 571 | LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root | 
|---|
| 572 | AC_SUBST(LEX_OUTPUT_ROOT)dnl | 
|---|
| 573 |  | 
|---|
| 574 | AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer, | 
|---|
| 575 | [# POSIX says lex can declare yytext either as a pointer or an array; the | 
|---|
| 576 | # default is implementation-dependent. Figure out which it is, since | 
|---|
| 577 | # not all implementations provide the %pointer and %array declarations. | 
|---|
| 578 | ac_cv_prog_lex_yytext_pointer=no | 
|---|
| 579 | echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c | 
|---|
| 580 | ac_save_LIBS="$LIBS" | 
|---|
| 581 | LIBS="$LIBS $LEXLIB" | 
|---|
| 582 | AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes) | 
|---|
| 583 | LIBS="$ac_save_LIBS" | 
|---|
| 584 | rm -f "${LEX_OUTPUT_ROOT}.c" | 
|---|
| 585 | ]) | 
|---|
| 586 | dnl | 
|---|
| 587 | if test $ac_cv_prog_lex_yytext_pointer = yes; then | 
|---|
| 588 | AC_DEFINE(YYTEXT_POINTER) | 
|---|
| 589 | fi | 
|---|
| 590 | ]) | 
|---|
| 591 |  | 
|---|
| 592 | AC_DEFUN(AC_PROG_INSTALL, | 
|---|
| 593 | [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl | 
|---|
| 594 | # Find a good install program.  We prefer a C program (faster), | 
|---|
| 595 | # so one script is as good as another.  But avoid the broken or | 
|---|
| 596 | # incompatible versions: | 
|---|
| 597 | # SysV /etc/install, /usr/sbin/install | 
|---|
| 598 | # SunOS /usr/etc/install | 
|---|
| 599 | # IRIX /sbin/install | 
|---|
| 600 | # AIX /bin/install | 
|---|
| 601 | # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag | 
|---|
| 602 | # AFS /usr/afsws/bin/install, which mishandles nonexistent args | 
|---|
| 603 | # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" | 
|---|
| 604 | # ./install, which can be erroneously created by make from ./install.sh. | 
|---|
| 605 | AC_MSG_CHECKING(for a BSD compatible install) | 
|---|
| 606 | if test -z "$INSTALL"; then | 
|---|
| 607 | AC_CACHE_VAL(ac_cv_path_install, | 
|---|
| 608 | [  IFS="${IFS=  }"; ac_save_IFS="$IFS"; IFS="$PATH_IFS" | 
|---|
| 609 | for ac_dir in $PATH; do | 
|---|
| 610 | # Account for people who put trailing slashes in PATH elements. | 
|---|
| 611 | case "$ac_dir/" in | 
|---|
| 612 | /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; | 
|---|
| 613 | # We reject the install program from OS/2 or W3.1 | 
|---|
| 614 | */OS2|*/OS2/*|*/WINDOWS|*/WINDOWS/*) ;; | 
|---|
| 615 | *) | 
|---|
| 616 | # OSF1 and SCO ODT 3.0 have their own names for install. | 
|---|
| 617 | # Don't use installbsd from OSF since it installs stuff as root | 
|---|
| 618 | # by default. | 
|---|
| 619 | for ac_prog in ginstall scoinst install; do | 
|---|
| 620 | if test -f $ac_dir/$ac_prog$ac_exeext; then | 
|---|
| 621 | if test $ac_prog = install && | 
|---|
| 622 | grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then | 
|---|
| 623 | # AIX install.  It has an incompatible calling convention. | 
|---|
| 624 | : | 
|---|
| 625 | else | 
|---|
| 626 | ac_cv_path_install="$ac_dir/$ac_prog$ac_exeext -c" | 
|---|
| 627 | break 2 | 
|---|
| 628 | fi | 
|---|
| 629 | fi | 
|---|
| 630 | done | 
|---|
| 631 | ;; | 
|---|
| 632 | esac | 
|---|
| 633 | done | 
|---|
| 634 | IFS="$ac_save_IFS" | 
|---|
| 635 | ])dnl | 
|---|
| 636 | if test "${ac_cv_path_install+set}" = set; then | 
|---|
| 637 | INSTALL="$ac_cv_path_install" | 
|---|
| 638 | else | 
|---|
| 639 | # As a last resort, use the slow shell script.  We don't cache a | 
|---|
| 640 | # path for INSTALL within a source directory, because that will | 
|---|
| 641 | # break other packages using the cache if that directory is | 
|---|
| 642 | # removed, or if the path is relative. | 
|---|
| 643 | INSTALL="$ac_install_sh" | 
|---|
| 644 | fi | 
|---|
| 645 | fi | 
|---|
| 646 | dnl We do special magic for INSTALL instead of AC_SUBST, to get | 
|---|
| 647 | dnl relative paths right. | 
|---|
| 648 | AC_MSG_RESULT($INSTALL) | 
|---|
| 649 |  | 
|---|
| 650 | # Use test -z because SunOS4 sh mishandles braces in ${var-val}. | 
|---|
| 651 | # It thinks the first close brace ends the variable substitution. | 
|---|
| 652 | test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' | 
|---|
| 653 | AC_SUBST(INSTALL_PROGRAM)dnl | 
|---|
| 654 |  | 
|---|
| 655 | test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' | 
|---|
| 656 | AC_SUBST(INSTALL_SCRIPT)dnl | 
|---|
| 657 |  | 
|---|
| 658 | test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' | 
|---|
| 659 | AC_SUBST(INSTALL_DATA)dnl | 
|---|
| 660 | ]) | 
|---|
| 661 |  | 
|---|
| 662 | AC_DEFUN(AC_PROG_LN_S, | 
|---|
| 663 | [AC_MSG_CHECKING(whether ln -s works) | 
|---|
| 664 | AC_CACHE_VAL(ac_cv_prog_LN_S, | 
|---|
| 665 | [rm -f conftestdata | 
|---|
| 666 | if ln -s X conftestdata 2>/dev/null | 
|---|
| 667 | then | 
|---|
| 668 | rm -f conftestdata | 
|---|
| 669 | ac_cv_prog_LN_S="ln -s" | 
|---|
| 670 | else | 
|---|
| 671 | echo A > conftestdata; | 
|---|
| 672 | if ln conftestdata conftestdata2 2>/dev/null; then | 
|---|
| 673 | ac_cv_prog_LN_S=ln | 
|---|
| 674 | else | 
|---|
| 675 | ac_cv_prog_LN_S=cp | 
|---|
| 676 | fi | 
|---|
| 677 | fi | 
|---|
| 678 | rm -f conftestdata*])dnl | 
|---|
| 679 | LN_S="$ac_cv_prog_LN_S" | 
|---|
| 680 | if test "$ac_cv_prog_LN_S" = "ln -s"; then | 
|---|
| 681 | AC_MSG_RESULT(yes) | 
|---|
| 682 | else | 
|---|
| 683 | AC_MSG_RESULT(no) | 
|---|
| 684 | fi | 
|---|
| 685 | AC_SUBST(LN_S)dnl | 
|---|
| 686 | ]) | 
|---|
| 687 |  | 
|---|
| 688 | define(AC_RSH, | 
|---|
| 689 | [errprint(__file__:__line__: [$0] has been removed; replace it with equivalent code | 
|---|
| 690 | )m4exit(4)]) | 
|---|
| 691 |  | 
|---|
| 692 |  | 
|---|
| 693 | dnl ### Checks for header files | 
|---|
| 694 |  | 
|---|
| 695 |  | 
|---|
| 696 | AC_DEFUN(AC_HEADER_STDC, | 
|---|
| 697 | [AC_REQUIRE_CPP()dnl | 
|---|
| 698 | AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc, | 
|---|
| 699 | [AC_TRY_CPP([#include <stdlib.h> | 
|---|
| 700 | #include <stdarg.h> | 
|---|
| 701 | #include <string.h> | 
|---|
| 702 | #include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no) | 
|---|
| 703 |  | 
|---|
| 704 | if test $ac_cv_header_stdc = yes; then | 
|---|
| 705 | # SunOS 4.x string.h does not declare mem*, contrary to ANSI. | 
|---|
| 706 | AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no) | 
|---|
| 707 | fi | 
|---|
| 708 |  | 
|---|
| 709 | if test $ac_cv_header_stdc = yes; then | 
|---|
| 710 | # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. | 
|---|
| 711 | AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no) | 
|---|
| 712 | fi | 
|---|
| 713 |  | 
|---|
| 714 | if test $ac_cv_header_stdc = yes; then | 
|---|
| 715 | # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. | 
|---|
| 716 | AC_TRY_RUN([#include <ctype.h> | 
|---|
| 717 | #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') | 
|---|
| 718 | #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) | 
|---|
| 719 | #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) | 
|---|
| 720 | int main () { int i; for (i = 0; i < 256; i++) | 
|---|
| 721 | if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); | 
|---|
| 722 | exit (0); } | 
|---|
| 723 | ], , ac_cv_header_stdc=no, :) | 
|---|
| 724 | fi]) | 
|---|
| 725 | if test $ac_cv_header_stdc = yes; then | 
|---|
| 726 | AC_DEFINE(STDC_HEADERS) | 
|---|
| 727 | fi | 
|---|
| 728 | ]) | 
|---|
| 729 |  | 
|---|
| 730 | AC_DEFUN(AC_UNISTD_H, | 
|---|
| 731 | [AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(unistd.h)])dnl | 
|---|
| 732 | AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))]) | 
|---|
| 733 |  | 
|---|
| 734 | AC_DEFUN(AC_USG, | 
|---|
| 735 | [AC_OBSOLETE([$0], | 
|---|
| 736 | [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H])dnl | 
|---|
| 737 | AC_MSG_CHECKING([for BSD string and memory functions]) | 
|---|
| 738 | AC_TRY_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);], | 
|---|
| 739 | [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(USG)])]) | 
|---|
| 740 |  | 
|---|
| 741 |  | 
|---|
| 742 | dnl If memchr and the like aren't declared in <string.h>, include <memory.h>. | 
|---|
| 743 | dnl To avoid problems, don't check for gcc2 built-ins. | 
|---|
| 744 | AC_DEFUN(AC_MEMORY_H, | 
|---|
| 745 | [AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H])dnl | 
|---|
| 746 | AC_MSG_CHECKING(whether string.h declares mem functions) | 
|---|
| 747 | AC_EGREP_HEADER(memchr, string.h, ac_found=yes, ac_found=no) | 
|---|
| 748 | AC_MSG_RESULT($ac_found) | 
|---|
| 749 | if test $ac_found = no; then | 
|---|
| 750 | AC_CHECK_HEADER(memory.h, [AC_DEFINE(NEED_MEMORY_H)]) | 
|---|
| 751 | fi | 
|---|
| 752 | ]) | 
|---|
| 753 |  | 
|---|
| 754 | AC_DEFUN(AC_HEADER_MAJOR, | 
|---|
| 755 | [AC_CACHE_CHECK(whether sys/types.h defines makedev, | 
|---|
| 756 | ac_cv_header_sys_types_h_makedev, | 
|---|
| 757 | [AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);], | 
|---|
| 758 | ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no) | 
|---|
| 759 | ]) | 
|---|
| 760 |  | 
|---|
| 761 | if test $ac_cv_header_sys_types_h_makedev = no; then | 
|---|
| 762 | AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)]) | 
|---|
| 763 |  | 
|---|
| 764 | if test $ac_cv_header_sys_mkdev_h = no; then | 
|---|
| 765 | AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)]) | 
|---|
| 766 | fi | 
|---|
| 767 | fi | 
|---|
| 768 | ]) | 
|---|
| 769 |  | 
|---|
| 770 | AC_DEFUN(AC_HEADER_DIRENT, | 
|---|
| 771 | [ac_header_dirent=no | 
|---|
| 772 | AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h, | 
|---|
| 773 | [ac_header_dirent=$ac_hdr; break]) | 
|---|
| 774 | # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. | 
|---|
| 775 | if test $ac_header_dirent = dirent.h; then | 
|---|
| 776 | AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir") | 
|---|
| 777 | else | 
|---|
| 778 | AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx") | 
|---|
| 779 | fi | 
|---|
| 780 | ]) | 
|---|
| 781 |  | 
|---|
| 782 | dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE | 
|---|
| 783 | dnl defines the type `DIR'.  dirent.h on NextStep 3.2 doesn't. | 
|---|
| 784 | dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND) | 
|---|
| 785 | AC_DEFUN(AC_CHECK_HEADER_DIRENT, | 
|---|
| 786 | [ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` | 
|---|
| 787 | AC_MSG_CHECKING([for $1 that defines DIR]) | 
|---|
| 788 | AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe, | 
|---|
| 789 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 790 | #include <$1>], [DIR *dirp = 0;], | 
|---|
| 791 | eval "ac_cv_header_dirent_$ac_safe=yes", | 
|---|
| 792 | eval "ac_cv_header_dirent_$ac_safe=no")])dnl | 
|---|
| 793 | if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then | 
|---|
| 794 | AC_MSG_RESULT(yes) | 
|---|
| 795 | $2 | 
|---|
| 796 | else | 
|---|
| 797 | AC_MSG_RESULT(no) | 
|---|
| 798 | fi | 
|---|
| 799 | ]) | 
|---|
| 800 |  | 
|---|
| 801 | dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that | 
|---|
| 802 | dnl defines `DIR'. | 
|---|
| 803 | dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION]) | 
|---|
| 804 | define(AC_CHECK_HEADERS_DIRENT, | 
|---|
| 805 | [for ac_hdr in $1 | 
|---|
| 806 | do | 
|---|
| 807 | AC_CHECK_HEADER_DIRENT($ac_hdr, | 
|---|
| 808 | [changequote(, )dnl | 
|---|
| 809 | ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` | 
|---|
| 810 | changequote([, ])dnl | 
|---|
| 811 | AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl | 
|---|
| 812 | done]) | 
|---|
| 813 |  | 
|---|
| 814 | AC_DEFUN(AC_DIR_HEADER, | 
|---|
| 815 | [AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl | 
|---|
| 816 | ac_header_dirent=no | 
|---|
| 817 | for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do | 
|---|
| 818 | AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break]) | 
|---|
| 819 | done | 
|---|
| 820 |  | 
|---|
| 821 | case "$ac_header_dirent" in | 
|---|
| 822 | dirent.h) AC_DEFINE(DIRENT) ;; | 
|---|
| 823 | sys/ndir.h) AC_DEFINE(SYSNDIR) ;; | 
|---|
| 824 | sys/dir.h) AC_DEFINE(SYSDIR) ;; | 
|---|
| 825 | ndir.h) AC_DEFINE(NDIR) ;; | 
|---|
| 826 | esac | 
|---|
| 827 |  | 
|---|
| 828 | AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void, | 
|---|
| 829 | [AC_TRY_RUN([#include <sys/types.h> | 
|---|
| 830 | #include <$ac_header_dirent> | 
|---|
| 831 | int closedir(); main() { exit(closedir(opendir(".")) != 0); }], | 
|---|
| 832 | ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)]) | 
|---|
| 833 | if test $ac_cv_func_closedir_void = yes; then | 
|---|
| 834 | AC_DEFINE(VOID_CLOSEDIR) | 
|---|
| 835 | fi | 
|---|
| 836 | ]) | 
|---|
| 837 |  | 
|---|
| 838 | AC_DEFUN(AC_HEADER_STAT, | 
|---|
| 839 | [AC_CACHE_CHECK(whether stat file-mode macros are broken, | 
|---|
| 840 | ac_cv_header_stat_broken, | 
|---|
| 841 | [AC_EGREP_CPP([You lose], [#include <sys/types.h> | 
|---|
| 842 | #include <sys/stat.h> | 
|---|
| 843 |  | 
|---|
| 844 | #if defined(S_ISBLK) && defined(S_IFDIR) | 
|---|
| 845 | # if S_ISBLK (S_IFDIR) | 
|---|
| 846 | You lose. | 
|---|
| 847 | # endif | 
|---|
| 848 | #endif | 
|---|
| 849 |  | 
|---|
| 850 | #if defined(S_ISBLK) && defined(S_IFCHR) | 
|---|
| 851 | # if S_ISBLK (S_IFCHR) | 
|---|
| 852 | You lose. | 
|---|
| 853 | # endif | 
|---|
| 854 | #endif | 
|---|
| 855 |  | 
|---|
| 856 | #if defined(S_ISLNK) && defined(S_IFREG) | 
|---|
| 857 | # if S_ISLNK (S_IFREG) | 
|---|
| 858 | You lose. | 
|---|
| 859 | # endif | 
|---|
| 860 | #endif | 
|---|
| 861 |  | 
|---|
| 862 | #if defined(S_ISSOCK) && defined(S_IFREG) | 
|---|
| 863 | # if S_ISSOCK (S_IFREG) | 
|---|
| 864 | You lose. | 
|---|
| 865 | # endif | 
|---|
| 866 | #endif | 
|---|
| 867 | ], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)]) | 
|---|
| 868 | if test $ac_cv_header_stat_broken = yes; then | 
|---|
| 869 | AC_DEFINE(STAT_MACROS_BROKEN) | 
|---|
| 870 | fi | 
|---|
| 871 | ]) | 
|---|
| 872 |  | 
|---|
| 873 | AC_DEFUN(AC_DECL_SYS_SIGLIST, | 
|---|
| 874 | [AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h], | 
|---|
| 875 | ac_cv_decl_sys_siglist, | 
|---|
| 876 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 877 | #include <signal.h> | 
|---|
| 878 | /* NetBSD declares sys_siglist in unistd.h.  */ | 
|---|
| 879 | #ifdef HAVE_UNISTD_H | 
|---|
| 880 | #include <unistd.h> | 
|---|
| 881 | #endif], [char *msg = *(sys_siglist + 1);], | 
|---|
| 882 | ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)]) | 
|---|
| 883 | if test $ac_cv_decl_sys_siglist = yes; then | 
|---|
| 884 | AC_DEFINE(SYS_SIGLIST_DECLARED) | 
|---|
| 885 | fi | 
|---|
| 886 | ]) | 
|---|
| 887 |  | 
|---|
| 888 | AC_DEFUN(AC_HEADER_SYS_WAIT, | 
|---|
| 889 | [AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible], | 
|---|
| 890 | ac_cv_header_sys_wait_h, | 
|---|
| 891 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 892 | #include <sys/wait.h> | 
|---|
| 893 | #ifndef WEXITSTATUS | 
|---|
| 894 | #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) | 
|---|
| 895 | #endif | 
|---|
| 896 | #ifndef WIFEXITED | 
|---|
| 897 | #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) | 
|---|
| 898 | #endif], [int s; | 
|---|
| 899 | wait (&s); | 
|---|
| 900 | s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;], | 
|---|
| 901 | ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)]) | 
|---|
| 902 | if test $ac_cv_header_sys_wait_h = yes; then | 
|---|
| 903 | AC_DEFINE(HAVE_SYS_WAIT_H) | 
|---|
| 904 | fi | 
|---|
| 905 | ]) | 
|---|
| 906 |  | 
|---|
| 907 |  | 
|---|
| 908 | dnl ### Checks for typedefs | 
|---|
| 909 |  | 
|---|
| 910 |  | 
|---|
| 911 | AC_DEFUN(AC_TYPE_GETGROUPS, | 
|---|
| 912 | [AC_REQUIRE([AC_TYPE_UID_T])dnl | 
|---|
| 913 | AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups, | 
|---|
| 914 | [AC_TRY_RUN( | 
|---|
| 915 | changequote(<<, >>)dnl | 
|---|
| 916 | << | 
|---|
| 917 | /* Thanks to Mike Rendell for this test.  */ | 
|---|
| 918 | #include <sys/types.h> | 
|---|
| 919 | #define NGID 256 | 
|---|
| 920 | #undef MAX | 
|---|
| 921 | #define MAX(x, y) ((x) > (y) ? (x) : (y)) | 
|---|
| 922 | main() | 
|---|
| 923 | { | 
|---|
| 924 | gid_t gidset[NGID]; | 
|---|
| 925 | int i, n; | 
|---|
| 926 | union { gid_t gval; long lval; }  val; | 
|---|
| 927 |  | 
|---|
| 928 | val.lval = -1; | 
|---|
| 929 | for (i = 0; i < NGID; i++) | 
|---|
| 930 | gidset[i] = val.gval; | 
|---|
| 931 | n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, | 
|---|
| 932 | gidset); | 
|---|
| 933 | /* Exit non-zero if getgroups seems to require an array of ints.  This | 
|---|
| 934 | happens when gid_t is short but getgroups modifies an array of ints.  */ | 
|---|
| 935 | exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); | 
|---|
| 936 | } | 
|---|
| 937 | >>, | 
|---|
| 938 | changequote([, ])dnl | 
|---|
| 939 | ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int, | 
|---|
| 940 | ac_cv_type_getgroups=cross) | 
|---|
| 941 | if test $ac_cv_type_getgroups = cross; then | 
|---|
| 942 | dnl When we can't run the test program (we are cross compiling), presume | 
|---|
| 943 | dnl that <unistd.h> has either an accurate prototype for getgroups or none. | 
|---|
| 944 | dnl Old systems without prototypes probably use int. | 
|---|
| 945 | AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h, | 
|---|
| 946 | ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int) | 
|---|
| 947 | fi]) | 
|---|
| 948 | AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups) | 
|---|
| 949 | ]) | 
|---|
| 950 |  | 
|---|
| 951 | AC_DEFUN(AC_TYPE_UID_T, | 
|---|
| 952 | [AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t, | 
|---|
| 953 | [AC_EGREP_HEADER(uid_t, sys/types.h, | 
|---|
| 954 | ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)]) | 
|---|
| 955 | if test $ac_cv_type_uid_t = no; then | 
|---|
| 956 | AC_DEFINE(uid_t, int) | 
|---|
| 957 | AC_DEFINE(gid_t, int) | 
|---|
| 958 | fi | 
|---|
| 959 | ]) | 
|---|
| 960 |  | 
|---|
| 961 | AC_DEFUN(AC_TYPE_SIZE_T, | 
|---|
| 962 | [AC_CHECK_TYPE(size_t, unsigned)]) | 
|---|
| 963 |  | 
|---|
| 964 | AC_DEFUN(AC_TYPE_PID_T, | 
|---|
| 965 | [AC_CHECK_TYPE(pid_t, int)]) | 
|---|
| 966 |  | 
|---|
| 967 | AC_DEFUN(AC_TYPE_OFF_T, | 
|---|
| 968 | [AC_CHECK_TYPE(off_t, long)]) | 
|---|
| 969 |  | 
|---|
| 970 | AC_DEFUN(AC_TYPE_MODE_T, | 
|---|
| 971 | [AC_CHECK_TYPE(mode_t, int)]) | 
|---|
| 972 |  | 
|---|
| 973 | dnl Note that identifiers starting with SIG are reserved by ANSI C. | 
|---|
| 974 | AC_DEFUN(AC_TYPE_SIGNAL, | 
|---|
| 975 | [AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal, | 
|---|
| 976 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 977 | #include <signal.h> | 
|---|
| 978 | #ifdef signal | 
|---|
| 979 | #undef signal | 
|---|
| 980 | #endif | 
|---|
| 981 | #ifdef __cplusplus | 
|---|
| 982 | extern "C" void (*signal (int, void (*)(int)))(int); | 
|---|
| 983 | #else | 
|---|
| 984 | void (*signal ()) (); | 
|---|
| 985 | #endif | 
|---|
| 986 | ], | 
|---|
| 987 | [int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)]) | 
|---|
| 988 | AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal) | 
|---|
| 989 | ]) | 
|---|
| 990 |  | 
|---|
| 991 |  | 
|---|
| 992 | dnl ### Checks for functions | 
|---|
| 993 |  | 
|---|
| 994 |  | 
|---|
| 995 | AC_DEFUN(AC_FUNC_CLOSEDIR_VOID, | 
|---|
| 996 | [AC_REQUIRE([AC_HEADER_DIRENT])dnl | 
|---|
| 997 | AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void, | 
|---|
| 998 | [AC_TRY_RUN([#include <sys/types.h> | 
|---|
| 999 | #include <$ac_header_dirent> | 
|---|
| 1000 | int closedir(); main() { exit(closedir(opendir(".")) != 0); }], | 
|---|
| 1001 | ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)]) | 
|---|
| 1002 | if test $ac_cv_func_closedir_void = yes; then | 
|---|
| 1003 | AC_DEFINE(CLOSEDIR_VOID) | 
|---|
| 1004 | fi | 
|---|
| 1005 | ]) | 
|---|
| 1006 |  | 
|---|
| 1007 | AC_DEFUN(AC_FUNC_FNMATCH, | 
|---|
| 1008 | [AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works, | 
|---|
| 1009 | # Some versions of Solaris or SCO have a broken fnmatch function. | 
|---|
| 1010 | # So we run a test program.  If we are cross-compiling, take no chance. | 
|---|
| 1011 | # Thanks to John Oleynick and Franc,ois Pinard for this test. | 
|---|
| 1012 | [AC_TRY_RUN([main() { exit (fnmatch ("a*", "abc", 0) != 0); }], | 
|---|
| 1013 | ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no, | 
|---|
| 1014 | ac_cv_func_fnmatch_works=no)]) | 
|---|
| 1015 | if test $ac_cv_func_fnmatch_works = yes; then | 
|---|
| 1016 | AC_DEFINE(HAVE_FNMATCH) | 
|---|
| 1017 | fi | 
|---|
| 1018 | ]) | 
|---|
| 1019 |  | 
|---|
| 1020 | AC_DEFUN(AC_FUNC_MMAP, | 
|---|
| 1021 | [AC_CHECK_HEADERS(unistd.h) | 
|---|
| 1022 | AC_CHECK_FUNCS(getpagesize) | 
|---|
| 1023 | AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, | 
|---|
| 1024 | [AC_TRY_RUN([ | 
|---|
| 1025 | /* Thanks to Mike Haertel and Jim Avera for this test. | 
|---|
| 1026 | Here is a matrix of mmap possibilities: | 
|---|
| 1027 | mmap private not fixed | 
|---|
| 1028 | mmap private fixed at somewhere currently unmapped | 
|---|
| 1029 | mmap private fixed at somewhere already mapped | 
|---|
| 1030 | mmap shared not fixed | 
|---|
| 1031 | mmap shared fixed at somewhere currently unmapped | 
|---|
| 1032 | mmap shared fixed at somewhere already mapped | 
|---|
| 1033 | For private mappings, we should verify that changes cannot be read() | 
|---|
| 1034 | back from the file, nor mmap's back from the file at a different | 
|---|
| 1035 | address.  (There have been systems where private was not correctly | 
|---|
| 1036 | implemented like the infamous i386 svr4.0, and systems where the | 
|---|
| 1037 | VM page cache was not coherent with the filesystem buffer cache | 
|---|
| 1038 | like early versions of FreeBSD and possibly contemporary NetBSD.) | 
|---|
| 1039 | For shared mappings, we should conversely verify that changes get | 
|---|
| 1040 | propogated back to all the places they're supposed to be. | 
|---|
| 1041 |  | 
|---|
| 1042 | Grep wants private fixed already mapped. | 
|---|
| 1043 | The main things grep needs to know about mmap are: | 
|---|
| 1044 | * does it exist and is it safe to write into the mmap'd area | 
|---|
| 1045 | * how to use it (BSD variants)  */ | 
|---|
| 1046 | #include <sys/types.h> | 
|---|
| 1047 | #include <fcntl.h> | 
|---|
| 1048 | #include <sys/mman.h> | 
|---|
| 1049 |  | 
|---|
| 1050 | /* This mess was copied from the GNU getpagesize.h.  */ | 
|---|
| 1051 | #ifndef HAVE_GETPAGESIZE | 
|---|
| 1052 | # ifdef HAVE_UNISTD_H | 
|---|
| 1053 | #  include <unistd.h> | 
|---|
| 1054 | # endif | 
|---|
| 1055 |  | 
|---|
| 1056 | /* Assume that all systems that can run configure have sys/param.h.  */ | 
|---|
| 1057 | # ifndef HAVE_SYS_PARAM_H | 
|---|
| 1058 | #  define HAVE_SYS_PARAM_H 1 | 
|---|
| 1059 | # endif | 
|---|
| 1060 |  | 
|---|
| 1061 | # ifdef _SC_PAGESIZE | 
|---|
| 1062 | #  define getpagesize() sysconf(_SC_PAGESIZE) | 
|---|
| 1063 | # else /* no _SC_PAGESIZE */ | 
|---|
| 1064 | #  ifdef HAVE_SYS_PARAM_H | 
|---|
| 1065 | #   include <sys/param.h> | 
|---|
| 1066 | #   ifdef EXEC_PAGESIZE | 
|---|
| 1067 | #    define getpagesize() EXEC_PAGESIZE | 
|---|
| 1068 | #   else /* no EXEC_PAGESIZE */ | 
|---|
| 1069 | #    ifdef NBPG | 
|---|
| 1070 | #     define getpagesize() NBPG * CLSIZE | 
|---|
| 1071 | #     ifndef CLSIZE | 
|---|
| 1072 | #      define CLSIZE 1 | 
|---|
| 1073 | #     endif /* no CLSIZE */ | 
|---|
| 1074 | #    else /* no NBPG */ | 
|---|
| 1075 | #     ifdef NBPC | 
|---|
| 1076 | #      define getpagesize() NBPC | 
|---|
| 1077 | #     else /* no NBPC */ | 
|---|
| 1078 | #      ifdef PAGESIZE | 
|---|
| 1079 | #       define getpagesize() PAGESIZE | 
|---|
| 1080 | #      endif /* PAGESIZE */ | 
|---|
| 1081 | #     endif /* no NBPC */ | 
|---|
| 1082 | #    endif /* no NBPG */ | 
|---|
| 1083 | #   endif /* no EXEC_PAGESIZE */ | 
|---|
| 1084 | #  else /* no HAVE_SYS_PARAM_H */ | 
|---|
| 1085 | #   define getpagesize() 8192   /* punt totally */ | 
|---|
| 1086 | #  endif /* no HAVE_SYS_PARAM_H */ | 
|---|
| 1087 | # endif /* no _SC_PAGESIZE */ | 
|---|
| 1088 |  | 
|---|
| 1089 | #endif /* no HAVE_GETPAGESIZE */ | 
|---|
| 1090 |  | 
|---|
| 1091 | #ifdef __cplusplus | 
|---|
| 1092 | extern "C" { void *malloc(unsigned); } | 
|---|
| 1093 | #else | 
|---|
| 1094 | char *malloc(); | 
|---|
| 1095 | #endif | 
|---|
| 1096 |  | 
|---|
| 1097 | int | 
|---|
| 1098 | main() | 
|---|
| 1099 | { | 
|---|
| 1100 | char *data, *data2, *data3; | 
|---|
| 1101 | int i, pagesize; | 
|---|
| 1102 | int fd; | 
|---|
| 1103 |  | 
|---|
| 1104 | pagesize = getpagesize(); | 
|---|
| 1105 |  | 
|---|
| 1106 | /* | 
|---|
| 1107 | * First, make a file with some known garbage in it. | 
|---|
| 1108 | */ | 
|---|
| 1109 | data = malloc(pagesize); | 
|---|
| 1110 | if (!data) | 
|---|
| 1111 | exit(1); | 
|---|
| 1112 | for (i = 0; i < pagesize; ++i) | 
|---|
| 1113 | *(data + i) = rand(); | 
|---|
| 1114 | umask(0); | 
|---|
| 1115 | fd = creat("conftestmmap", 0600); | 
|---|
| 1116 | if (fd < 0) | 
|---|
| 1117 | exit(1); | 
|---|
| 1118 | if (write(fd, data, pagesize) != pagesize) | 
|---|
| 1119 | exit(1); | 
|---|
| 1120 | close(fd); | 
|---|
| 1121 |  | 
|---|
| 1122 | /* | 
|---|
| 1123 | * Next, try to mmap the file at a fixed address which | 
|---|
| 1124 | * already has something else allocated at it.  If we can, | 
|---|
| 1125 | * also make sure that we see the same garbage. | 
|---|
| 1126 | */ | 
|---|
| 1127 | fd = open("conftestmmap", O_RDWR); | 
|---|
| 1128 | if (fd < 0) | 
|---|
| 1129 | exit(1); | 
|---|
| 1130 | data2 = malloc(2 * pagesize); | 
|---|
| 1131 | if (!data2) | 
|---|
| 1132 | exit(1); | 
|---|
| 1133 | data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); | 
|---|
| 1134 | if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, | 
|---|
| 1135 | MAP_PRIVATE | MAP_FIXED, fd, 0L)) | 
|---|
| 1136 | exit(1); | 
|---|
| 1137 | for (i = 0; i < pagesize; ++i) | 
|---|
| 1138 | if (*(data + i) != *(data2 + i)) | 
|---|
| 1139 | exit(1); | 
|---|
| 1140 |  | 
|---|
| 1141 | /* | 
|---|
| 1142 | * Finally, make sure that changes to the mapped area | 
|---|
| 1143 | * do not percolate back to the file as seen by read(). | 
|---|
| 1144 | * (This is a bug on some variants of i386 svr4.0.) | 
|---|
| 1145 | */ | 
|---|
| 1146 | for (i = 0; i < pagesize; ++i) | 
|---|
| 1147 | *(data2 + i) = *(data2 + i) + 1; | 
|---|
| 1148 | data3 = malloc(pagesize); | 
|---|
| 1149 | if (!data3) | 
|---|
| 1150 | exit(1); | 
|---|
| 1151 | if (read(fd, data3, pagesize) != pagesize) | 
|---|
| 1152 | exit(1); | 
|---|
| 1153 | for (i = 0; i < pagesize; ++i) | 
|---|
| 1154 | if (*(data + i) != *(data3 + i)) | 
|---|
| 1155 | exit(1); | 
|---|
| 1156 | close(fd); | 
|---|
| 1157 | unlink("conftestmmap"); | 
|---|
| 1158 | exit(0); | 
|---|
| 1159 | } | 
|---|
| 1160 | ], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no, | 
|---|
| 1161 | ac_cv_func_mmap_fixed_mapped=no)]) | 
|---|
| 1162 | if test $ac_cv_func_mmap_fixed_mapped = yes; then | 
|---|
| 1163 | AC_DEFINE(HAVE_MMAP) | 
|---|
| 1164 | fi | 
|---|
| 1165 | ]) | 
|---|
| 1166 |  | 
|---|
| 1167 | AC_DEFUN(AC_FUNC_GETPGRP, | 
|---|
| 1168 | [AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void, | 
|---|
| 1169 | [AC_TRY_RUN([ | 
|---|
| 1170 | /* | 
|---|
| 1171 | * If this system has a BSD-style getpgrp(), | 
|---|
| 1172 | * which takes a pid argument, exit unsuccessfully. | 
|---|
| 1173 | * | 
|---|
| 1174 | * Snarfed from Chet Ramey's bash pgrp.c test program | 
|---|
| 1175 | */ | 
|---|
| 1176 | #include <stdio.h> | 
|---|
| 1177 | #include <sys/types.h> | 
|---|
| 1178 |  | 
|---|
| 1179 | int     pid; | 
|---|
| 1180 | int     pg1, pg2, pg3, pg4; | 
|---|
| 1181 | int     ng, np, s, child; | 
|---|
| 1182 |  | 
|---|
| 1183 | main() | 
|---|
| 1184 | { | 
|---|
| 1185 | pid = getpid(); | 
|---|
| 1186 | pg1 = getpgrp(0); | 
|---|
| 1187 | pg2 = getpgrp(); | 
|---|
| 1188 | pg3 = getpgrp(pid); | 
|---|
| 1189 | pg4 = getpgrp(1); | 
|---|
| 1190 |  | 
|---|
| 1191 | /* | 
|---|
| 1192 | * If all of these values are the same, it's pretty sure that | 
|---|
| 1193 | * we're on a system that ignores getpgrp's first argument. | 
|---|
| 1194 | */ | 
|---|
| 1195 | if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) | 
|---|
| 1196 | exit(0); | 
|---|
| 1197 |  | 
|---|
| 1198 | child = fork(); | 
|---|
| 1199 | if (child < 0) | 
|---|
| 1200 | exit(1); | 
|---|
| 1201 | else if (child == 0) { | 
|---|
| 1202 | np = getpid(); | 
|---|
| 1203 | /* | 
|---|
| 1204 | * If this is Sys V, this will not work; pgrp will be | 
|---|
| 1205 | * set to np because setpgrp just changes a pgrp to be | 
|---|
| 1206 | * the same as the pid. | 
|---|
| 1207 | */ | 
|---|
| 1208 | setpgrp(np, pg1); | 
|---|
| 1209 | ng = getpgrp(0);        /* Same result for Sys V and BSD */ | 
|---|
| 1210 | if (ng == pg1) { | 
|---|
| 1211 | exit(1); | 
|---|
| 1212 | } else { | 
|---|
| 1213 | exit(0); | 
|---|
| 1214 | } | 
|---|
| 1215 | } else { | 
|---|
| 1216 | wait(&s); | 
|---|
| 1217 | exit(s>>8); | 
|---|
| 1218 | } | 
|---|
| 1219 | } | 
|---|
| 1220 | ], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no, | 
|---|
| 1221 | AC_MSG_ERROR(cannot check getpgrp if cross compiling)) | 
|---|
| 1222 | ]) | 
|---|
| 1223 | if test $ac_cv_func_getpgrp_void = yes; then | 
|---|
| 1224 | AC_DEFINE(GETPGRP_VOID) | 
|---|
| 1225 | fi | 
|---|
| 1226 | ]) | 
|---|
| 1227 |  | 
|---|
| 1228 | AC_DEFUN(AC_FUNC_SETPGRP, | 
|---|
| 1229 | [AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, | 
|---|
| 1230 | AC_TRY_RUN([ | 
|---|
| 1231 | #ifdef HAVE_UNISTD_H | 
|---|
| 1232 | #include <unistd.h> | 
|---|
| 1233 | #endif | 
|---|
| 1234 |  | 
|---|
| 1235 | /* | 
|---|
| 1236 | * If this system has a BSD-style setpgrp, which takes arguments, exit | 
|---|
| 1237 | * successfully. | 
|---|
| 1238 | */ | 
|---|
| 1239 | main() | 
|---|
| 1240 | { | 
|---|
| 1241 | if (setpgrp(1,1) == -1) | 
|---|
| 1242 | exit(0); | 
|---|
| 1243 | else | 
|---|
| 1244 | exit(1); | 
|---|
| 1245 | } | 
|---|
| 1246 | ], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes, | 
|---|
| 1247 | AC_MSG_ERROR(cannot check setpgrp if cross compiling)) | 
|---|
| 1248 | ) | 
|---|
| 1249 | if test $ac_cv_func_setpgrp_void = yes; then | 
|---|
| 1250 | AC_DEFINE(SETPGRP_VOID) | 
|---|
| 1251 | fi | 
|---|
| 1252 | ]) | 
|---|
| 1253 |  | 
|---|
| 1254 | AC_DEFUN(AC_FUNC_VPRINTF, | 
|---|
| 1255 | [AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) | 
|---|
| 1256 | if test "$ac_cv_func_vprintf" != yes; then | 
|---|
| 1257 | AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) | 
|---|
| 1258 | fi | 
|---|
| 1259 | ]) | 
|---|
| 1260 |  | 
|---|
| 1261 | AC_DEFUN(AC_FUNC_VFORK, | 
|---|
| 1262 | [AC_REQUIRE([AC_TYPE_PID_T])dnl | 
|---|
| 1263 | AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H)) | 
|---|
| 1264 | AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, | 
|---|
| 1265 | [AC_TRY_RUN([/* Thanks to Paul Eggert for this test.  */ | 
|---|
| 1266 | #include <stdio.h> | 
|---|
| 1267 | #include <sys/types.h> | 
|---|
| 1268 | #include <sys/stat.h> | 
|---|
| 1269 | #ifdef HAVE_UNISTD_H | 
|---|
| 1270 | #include <unistd.h> | 
|---|
| 1271 | #endif | 
|---|
| 1272 | #ifdef HAVE_VFORK_H | 
|---|
| 1273 | #include <vfork.h> | 
|---|
| 1274 | #endif | 
|---|
| 1275 | /* On some sparc systems, changes by the child to local and incoming | 
|---|
| 1276 | argument registers are propagated back to the parent. | 
|---|
| 1277 | The compiler is told about this with #include <vfork.h>, | 
|---|
| 1278 | but some compilers (e.g. gcc -O) don't grok <vfork.h>. | 
|---|
| 1279 | Test for this by using a static variable whose address | 
|---|
| 1280 | is put into a register that is clobbered by the vfork.  */ | 
|---|
| 1281 | static | 
|---|
| 1282 | #ifdef __cplusplus | 
|---|
| 1283 | sparc_address_test (int arg) | 
|---|
| 1284 | #else | 
|---|
| 1285 | sparc_address_test (arg) int arg; | 
|---|
| 1286 | #endif | 
|---|
| 1287 | { | 
|---|
| 1288 | static pid_t child; | 
|---|
| 1289 | if (!child) { | 
|---|
| 1290 | child = vfork (); | 
|---|
| 1291 | if (child < 0) { | 
|---|
| 1292 | perror ("vfork"); | 
|---|
| 1293 | _exit(2); | 
|---|
| 1294 | } | 
|---|
| 1295 | if (!child) { | 
|---|
| 1296 | arg = getpid(); | 
|---|
| 1297 | write(-1, "", 0); | 
|---|
| 1298 | _exit (arg); | 
|---|
| 1299 | } | 
|---|
| 1300 | } | 
|---|
| 1301 | } | 
|---|
| 1302 | main() { | 
|---|
| 1303 | pid_t parent = getpid (); | 
|---|
| 1304 | pid_t child; | 
|---|
| 1305 |  | 
|---|
| 1306 | sparc_address_test (); | 
|---|
| 1307 |  | 
|---|
| 1308 | child = vfork (); | 
|---|
| 1309 |  | 
|---|
| 1310 | if (child == 0) { | 
|---|
| 1311 | /* Here is another test for sparc vfork register problems. | 
|---|
| 1312 | This test uses lots of local variables, at least | 
|---|
| 1313 | as many local variables as main has allocated so far | 
|---|
| 1314 | including compiler temporaries.  4 locals are enough for | 
|---|
| 1315 | gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. | 
|---|
| 1316 | A buggy compiler should reuse the register of parent | 
|---|
| 1317 | for one of the local variables, since it will think that | 
|---|
| 1318 | parent can't possibly be used any more in this routine. | 
|---|
| 1319 | Assigning to the local variable will thus munge parent | 
|---|
| 1320 | in the parent process.  */ | 
|---|
| 1321 | pid_t | 
|---|
| 1322 | p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), | 
|---|
| 1323 | p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); | 
|---|
| 1324 | /* Convince the compiler that p..p7 are live; otherwise, it might | 
|---|
| 1325 | use the same hardware register for all 8 local variables.  */ | 
|---|
| 1326 | if (p != p1 || p != p2 || p != p3 || p != p4 | 
|---|
| 1327 | || p != p5 || p != p6 || p != p7) | 
|---|
| 1328 | _exit(1); | 
|---|
| 1329 |  | 
|---|
| 1330 | /* On some systems (e.g. IRIX 3.3), | 
|---|
| 1331 | vfork doesn't separate parent from child file descriptors. | 
|---|
| 1332 | If the child closes a descriptor before it execs or exits, | 
|---|
| 1333 | this munges the parent's descriptor as well. | 
|---|
| 1334 | Test for this by closing stdout in the child.  */ | 
|---|
| 1335 | _exit(close(fileno(stdout)) != 0); | 
|---|
| 1336 | } else { | 
|---|
| 1337 | int status; | 
|---|
| 1338 | struct stat st; | 
|---|
| 1339 |  | 
|---|
| 1340 | while (wait(&status) != child) | 
|---|
| 1341 | ; | 
|---|
| 1342 | exit( | 
|---|
| 1343 | /* Was there some problem with vforking?  */ | 
|---|
| 1344 | child < 0 | 
|---|
| 1345 |  | 
|---|
| 1346 | /* Did the child fail?  (This shouldn't happen.)  */ | 
|---|
| 1347 | || status | 
|---|
| 1348 |  | 
|---|
| 1349 | /* Did the vfork/compiler bug occur?  */ | 
|---|
| 1350 | || parent != getpid() | 
|---|
| 1351 |  | 
|---|
| 1352 | /* Did the file descriptor bug occur?  */ | 
|---|
| 1353 | || fstat(fileno(stdout), &st) != 0 | 
|---|
| 1354 | ); | 
|---|
| 1355 | } | 
|---|
| 1356 | }], | 
|---|
| 1357 | ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork) | 
|---|
| 1358 | ac_cv_func_vfork_works=$ac_cv_func_vfork)]) | 
|---|
| 1359 | if test $ac_cv_func_vfork_works = no; then | 
|---|
| 1360 | AC_DEFINE(vfork, fork) | 
|---|
| 1361 | fi | 
|---|
| 1362 | ]) | 
|---|
| 1363 |  | 
|---|
| 1364 | AC_DEFUN(AC_FUNC_WAIT3, | 
|---|
| 1365 | [AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage, | 
|---|
| 1366 | [AC_TRY_RUN([#include <sys/types.h> | 
|---|
| 1367 | #include <sys/time.h> | 
|---|
| 1368 | #include <sys/resource.h> | 
|---|
| 1369 | #include <stdio.h> | 
|---|
| 1370 | /* HP-UX has wait3 but does not fill in rusage at all.  */ | 
|---|
| 1371 | main() { | 
|---|
| 1372 | struct rusage r; | 
|---|
| 1373 | int i; | 
|---|
| 1374 | /* Use a field that we can force nonzero -- | 
|---|
| 1375 | voluntary context switches. | 
|---|
| 1376 | For systems like NeXT and OSF/1 that don't set it, | 
|---|
| 1377 | also use the system CPU time.  And page faults (I/O) for Linux.  */ | 
|---|
| 1378 | r.ru_nvcsw = 0; | 
|---|
| 1379 | r.ru_stime.tv_sec = 0; | 
|---|
| 1380 | r.ru_stime.tv_usec = 0; | 
|---|
| 1381 | r.ru_majflt = r.ru_minflt = 0; | 
|---|
| 1382 | switch (fork()) { | 
|---|
| 1383 | case 0: /* Child.  */ | 
|---|
| 1384 | sleep(1); /* Give up the CPU.  */ | 
|---|
| 1385 | _exit(0); | 
|---|
| 1386 | case -1: _exit(0); /* What can we do?  */ | 
|---|
| 1387 | default: /* Parent.  */ | 
|---|
| 1388 | wait3(&i, 0, &r); | 
|---|
| 1389 | sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines.  */ | 
|---|
| 1390 | exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 | 
|---|
| 1391 | && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); | 
|---|
| 1392 | } | 
|---|
| 1393 | }], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no, | 
|---|
| 1394 | ac_cv_func_wait3_rusage=no)]) | 
|---|
| 1395 | if test $ac_cv_func_wait3_rusage = yes; then | 
|---|
| 1396 | AC_DEFINE(HAVE_WAIT3) | 
|---|
| 1397 | fi | 
|---|
| 1398 | ]) | 
|---|
| 1399 |  | 
|---|
| 1400 | AC_DEFUN(AC_FUNC_ALLOCA, | 
|---|
| 1401 | [AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. | 
|---|
| 1402 | # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works | 
|---|
| 1403 | # for constant arguments.  Useless! | 
|---|
| 1404 | AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h, | 
|---|
| 1405 | [AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));], | 
|---|
| 1406 | ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)]) | 
|---|
| 1407 | if test $ac_cv_header_alloca_h = yes; then | 
|---|
| 1408 | AC_DEFINE(HAVE_ALLOCA_H) | 
|---|
| 1409 | fi | 
|---|
| 1410 |  | 
|---|
| 1411 | AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works, | 
|---|
| 1412 | [AC_TRY_LINK([ | 
|---|
| 1413 | #ifdef __GNUC__ | 
|---|
| 1414 | # define alloca __builtin_alloca | 
|---|
| 1415 | #else | 
|---|
| 1416 | # ifdef _MSC_VER | 
|---|
| 1417 | #  include <malloc.h> | 
|---|
| 1418 | #  define alloca _alloca | 
|---|
| 1419 | # else | 
|---|
| 1420 | #  if HAVE_ALLOCA_H | 
|---|
| 1421 | #   include <alloca.h> | 
|---|
| 1422 | #  else | 
|---|
| 1423 | #   ifdef _AIX | 
|---|
| 1424 | #pragma alloca | 
|---|
| 1425 | #   else | 
|---|
| 1426 | #    ifndef alloca /* predefined by HP cc +Olibcalls */ | 
|---|
| 1427 | char *alloca (); | 
|---|
| 1428 | #    endif | 
|---|
| 1429 | #   endif | 
|---|
| 1430 | #  endif | 
|---|
| 1431 | # endif | 
|---|
| 1432 | #endif | 
|---|
| 1433 | ], [char *p = (char *) alloca(1);], | 
|---|
| 1434 | ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)]) | 
|---|
| 1435 | if test $ac_cv_func_alloca_works = yes; then | 
|---|
| 1436 | AC_DEFINE(HAVE_ALLOCA) | 
|---|
| 1437 | fi | 
|---|
| 1438 |  | 
|---|
| 1439 | if test $ac_cv_func_alloca_works = no; then | 
|---|
| 1440 | # The SVR3 libPW and SVR4 libucb both contain incompatible functions | 
|---|
| 1441 | # that cause trouble.  Some versions do not even contain alloca or | 
|---|
| 1442 | # contain a buggy version.  If you still want to use their alloca, | 
|---|
| 1443 | # use ar to extract alloca.o from them instead of compiling alloca.c. | 
|---|
| 1444 | ALLOCA=alloca.${ac_objext} | 
|---|
| 1445 | AC_DEFINE(C_ALLOCA) | 
|---|
| 1446 |  | 
|---|
| 1447 | AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray, | 
|---|
| 1448 | [AC_EGREP_CPP(webecray, | 
|---|
| 1449 | [#if defined(CRAY) && ! defined(CRAY2) | 
|---|
| 1450 | webecray | 
|---|
| 1451 | #else | 
|---|
| 1452 | wenotbecray | 
|---|
| 1453 | #endif | 
|---|
| 1454 | ], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) | 
|---|
| 1455 | if test $ac_cv_os_cray = yes; then | 
|---|
| 1456 | for ac_func in _getb67 GETB67 getb67; do | 
|---|
| 1457 | AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func) | 
|---|
| 1458 | break]) | 
|---|
| 1459 | done | 
|---|
| 1460 | fi | 
|---|
| 1461 |  | 
|---|
| 1462 | AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, | 
|---|
| 1463 | [AC_TRY_RUN([find_stack_direction () | 
|---|
| 1464 | { | 
|---|
| 1465 | static char *addr = 0; | 
|---|
| 1466 | auto char dummy; | 
|---|
| 1467 | if (addr == 0) | 
|---|
| 1468 | { | 
|---|
| 1469 | addr = &dummy; | 
|---|
| 1470 | return find_stack_direction (); | 
|---|
| 1471 | } | 
|---|
| 1472 | else | 
|---|
| 1473 | return (&dummy > addr) ? 1 : -1; | 
|---|
| 1474 | } | 
|---|
| 1475 | main () | 
|---|
| 1476 | { | 
|---|
| 1477 | exit (find_stack_direction() < 0); | 
|---|
| 1478 | }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, | 
|---|
| 1479 | ac_cv_c_stack_direction=0)]) | 
|---|
| 1480 | AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) | 
|---|
| 1481 | fi | 
|---|
| 1482 | AC_SUBST(ALLOCA)dnl | 
|---|
| 1483 | ]) | 
|---|
| 1484 |  | 
|---|
| 1485 | AC_DEFUN(AC_FUNC_GETLOADAVG, | 
|---|
| 1486 | [ac_have_func=no # yes means we've found a way to get the load average. | 
|---|
| 1487 |  | 
|---|
| 1488 | # Some systems with -lutil have (and need) -lkvm as well, some do not. | 
|---|
| 1489 | # On Solaris, -lkvm requires nlist from -lelf, so check that first | 
|---|
| 1490 | # to get the right answer into the cache. | 
|---|
| 1491 | AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS") | 
|---|
| 1492 | AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS") | 
|---|
| 1493 | # Check for the 4.4BSD definition of getloadavg. | 
|---|
| 1494 | AC_CHECK_LIB(util, getloadavg, | 
|---|
| 1495 | [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes]) | 
|---|
| 1496 |  | 
|---|
| 1497 | if test $ac_have_func = no; then | 
|---|
| 1498 | # There is a commonly available library for RS/6000 AIX. | 
|---|
| 1499 | # Since it is not a standard part of AIX, it might be installed locally. | 
|---|
| 1500 | ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS" | 
|---|
| 1501 | AC_CHECK_LIB(getloadavg, getloadavg, | 
|---|
| 1502 | LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS") | 
|---|
| 1503 | fi | 
|---|
| 1504 |  | 
|---|
| 1505 | # Make sure it is really in the library, if we think we found it. | 
|---|
| 1506 | AC_REPLACE_FUNCS(getloadavg) | 
|---|
| 1507 |  | 
|---|
| 1508 | if test $ac_cv_func_getloadavg = yes; then | 
|---|
| 1509 | AC_DEFINE(HAVE_GETLOADAVG) | 
|---|
| 1510 | ac_have_func=yes | 
|---|
| 1511 | else | 
|---|
| 1512 | # Figure out what our getloadavg.c needs. | 
|---|
| 1513 | ac_have_func=no | 
|---|
| 1514 | AC_CHECK_HEADER(sys/dg_sys_info.h, | 
|---|
| 1515 | [ac_have_func=yes; AC_DEFINE(DGUX) | 
|---|
| 1516 | AC_CHECK_LIB(dgc, dg_sys_info)]) | 
|---|
| 1517 |  | 
|---|
| 1518 | # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it | 
|---|
| 1519 | # uses stabs), but it is still SVR4.  We cannot check for <elf.h> because | 
|---|
| 1520 | # Irix 4.0.5F has the header but not the library. | 
|---|
| 1521 | if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then | 
|---|
| 1522 | ac_have_func=yes; AC_DEFINE(SVR4) | 
|---|
| 1523 | fi | 
|---|
| 1524 |  | 
|---|
| 1525 | if test $ac_have_func = no; then | 
|---|
| 1526 | AC_CHECK_HEADER(inq_stats/cpustats.h, | 
|---|
| 1527 | [ac_have_func=yes; AC_DEFINE(UMAX) | 
|---|
| 1528 | AC_DEFINE(UMAX4_3)]) | 
|---|
| 1529 | fi | 
|---|
| 1530 |  | 
|---|
| 1531 | if test $ac_have_func = no; then | 
|---|
| 1532 | AC_CHECK_HEADER(sys/cpustats.h, | 
|---|
| 1533 | [ac_have_func=yes; AC_DEFINE(UMAX)]) | 
|---|
| 1534 | fi | 
|---|
| 1535 |  | 
|---|
| 1536 | if test $ac_have_func = no; then | 
|---|
| 1537 | AC_CHECK_HEADERS(mach/mach.h) | 
|---|
| 1538 | fi | 
|---|
| 1539 |  | 
|---|
| 1540 | AC_CHECK_HEADER(nlist.h, | 
|---|
| 1541 | [AC_DEFINE(NLIST_STRUCT) | 
|---|
| 1542 | AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un, | 
|---|
| 1543 | [AC_TRY_COMPILE([#include <nlist.h>], | 
|---|
| 1544 | [struct nlist n; n.n_un.n_name = 0;], | 
|---|
| 1545 | ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)]) | 
|---|
| 1546 | if test $ac_cv_struct_nlist_n_un = yes; then | 
|---|
| 1547 | AC_DEFINE(NLIST_NAME_UNION) | 
|---|
| 1548 | fi | 
|---|
| 1549 | ])dnl | 
|---|
| 1550 | fi # Do not have getloadavg in system libraries. | 
|---|
| 1551 |  | 
|---|
| 1552 | # Some definitions of getloadavg require that the program be installed setgid. | 
|---|
| 1553 | dnl FIXME Don't hardwire the path of getloadavg.c in the top-level directory. | 
|---|
| 1554 | AC_CACHE_CHECK(whether getloadavg requires setgid, | 
|---|
| 1555 | ac_cv_func_getloadavg_setgid, | 
|---|
| 1556 | [AC_EGREP_CPP([Yowza Am I SETGID yet], | 
|---|
| 1557 | [#include "$srcdir/getloadavg.c" | 
|---|
| 1558 | #ifdef LDAV_PRIVILEGED | 
|---|
| 1559 | Yowza Am I SETGID yet | 
|---|
| 1560 | #endif], | 
|---|
| 1561 | ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)]) | 
|---|
| 1562 | if test $ac_cv_func_getloadavg_setgid = yes; then | 
|---|
| 1563 | NEED_SETGID=true; AC_DEFINE(GETLOADAVG_PRIVILEGED) | 
|---|
| 1564 | else | 
|---|
| 1565 | NEED_SETGID=false | 
|---|
| 1566 | fi | 
|---|
| 1567 | AC_SUBST(NEED_SETGID)dnl | 
|---|
| 1568 |  | 
|---|
| 1569 | if test $ac_cv_func_getloadavg_setgid = yes; then | 
|---|
| 1570 | AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem, | 
|---|
| 1571 | [changequote(, )dnl | 
|---|
| 1572 | # On Solaris, /dev/kmem is a symlink.  Get info on the real file. | 
|---|
| 1573 | ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null` | 
|---|
| 1574 | # If we got an error (system does not support symlinks), try without -L. | 
|---|
| 1575 | test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` | 
|---|
| 1576 | ac_cv_group_kmem=`echo $ac_ls_output \ | 
|---|
| 1577 | | sed -ne 's/[      ][      ]*/ /g; | 
|---|
| 1578 | s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\)  *.*/\1/; | 
|---|
| 1579 | / /s/.* //;p;'` | 
|---|
| 1580 | changequote([, ])dnl | 
|---|
| 1581 | ]) | 
|---|
| 1582 | KMEM_GROUP=$ac_cv_group_kmem | 
|---|
| 1583 | fi | 
|---|
| 1584 | AC_SUBST(KMEM_GROUP)dnl | 
|---|
| 1585 | ]) | 
|---|
| 1586 |  | 
|---|
| 1587 | AC_DEFUN(AC_FUNC_UTIME_NULL, | 
|---|
| 1588 | [AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null, | 
|---|
| 1589 | [rm -f conftestdata; > conftestdata | 
|---|
| 1590 | # Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong. | 
|---|
| 1591 | AC_TRY_RUN([#include <sys/types.h> | 
|---|
| 1592 | #include <sys/stat.h> | 
|---|
| 1593 | main() { | 
|---|
| 1594 | struct stat s, t; | 
|---|
| 1595 | exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0 | 
|---|
| 1596 | && stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime | 
|---|
| 1597 | && t.st_mtime - s.st_mtime < 120)); | 
|---|
| 1598 | }], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no, | 
|---|
| 1599 | ac_cv_func_utime_null=no) | 
|---|
| 1600 | rm -f core core.* *.core]) | 
|---|
| 1601 | if test $ac_cv_func_utime_null = yes; then | 
|---|
| 1602 | AC_DEFINE(HAVE_UTIME_NULL) | 
|---|
| 1603 | fi | 
|---|
| 1604 | ]) | 
|---|
| 1605 |  | 
|---|
| 1606 | AC_DEFUN(AC_FUNC_STRCOLL, | 
|---|
| 1607 | [AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works, | 
|---|
| 1608 | [AC_TRY_RUN([#include <string.h> | 
|---|
| 1609 | main () | 
|---|
| 1610 | { | 
|---|
| 1611 | exit (strcoll ("abc", "def") >= 0 || | 
|---|
| 1612 | strcoll ("ABC", "DEF") >= 0 || | 
|---|
| 1613 | strcoll ("123", "456") >= 0); | 
|---|
| 1614 | }], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no, | 
|---|
| 1615 | ac_cv_func_strcoll_works=no)]) | 
|---|
| 1616 | if test $ac_cv_func_strcoll_works = yes; then | 
|---|
| 1617 | AC_DEFINE(HAVE_STRCOLL) | 
|---|
| 1618 | fi | 
|---|
| 1619 | ]) | 
|---|
| 1620 |  | 
|---|
| 1621 | AC_DEFUN(AC_FUNC_SETVBUF_REVERSED, | 
|---|
| 1622 | [AC_CACHE_CHECK(whether setvbuf arguments are reversed, | 
|---|
| 1623 | ac_cv_func_setvbuf_reversed, | 
|---|
| 1624 | [AC_TRY_RUN([#include <stdio.h> | 
|---|
| 1625 | /* If setvbuf has the reversed format, exit 0. */ | 
|---|
| 1626 | main () { | 
|---|
| 1627 | /* This call has the arguments reversed. | 
|---|
| 1628 | A reversed system may check and see that the address of main | 
|---|
| 1629 | is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */ | 
|---|
| 1630 | if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0) | 
|---|
| 1631 | exit(1); | 
|---|
| 1632 | putc('\r', stdout); | 
|---|
| 1633 | exit(0);                      /* Non-reversed systems segv here.  */ | 
|---|
| 1634 | }], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no) | 
|---|
| 1635 | rm -f core core.* *.core]) | 
|---|
| 1636 | if test $ac_cv_func_setvbuf_reversed = yes; then | 
|---|
| 1637 | AC_DEFINE(SETVBUF_REVERSED) | 
|---|
| 1638 | fi | 
|---|
| 1639 | ]) | 
|---|
| 1640 |  | 
|---|
| 1641 | AC_DEFUN(AC_FUNC_GETMNTENT, | 
|---|
| 1642 | [# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. | 
|---|
| 1643 | AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS", | 
|---|
| 1644 | [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS", | 
|---|
| 1645 | [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])]) | 
|---|
| 1646 | AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])]) | 
|---|
| 1647 |  | 
|---|
| 1648 | AC_DEFUN(AC_FUNC_STRFTIME, | 
|---|
| 1649 | [AC_CHECK_FUNC(strftime, [AC_DEFINE(HAVE_STRFTIME)], | 
|---|
| 1650 | [# strftime is in -lintl on SCO UNIX. | 
|---|
| 1651 | AC_CHECK_LIB(intl, strftime, | 
|---|
| 1652 | [AC_DEFINE(HAVE_STRFTIME) | 
|---|
| 1653 | LIBS="-lintl $LIBS"])])]) | 
|---|
| 1654 |  | 
|---|
| 1655 | AC_DEFUN(AC_FUNC_MEMCMP, | 
|---|
| 1656 | [AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean, | 
|---|
| 1657 | [AC_TRY_RUN([ | 
|---|
| 1658 | main() | 
|---|
| 1659 | { | 
|---|
| 1660 | char c0 = 0x40, c1 = 0x80, c2 = 0x81; | 
|---|
| 1661 | exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1); | 
|---|
| 1662 | } | 
|---|
| 1663 | ], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no, | 
|---|
| 1664 | ac_cv_func_memcmp_clean=no)]) | 
|---|
| 1665 | test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" | 
|---|
| 1666 | AC_SUBST(LIBOBJS)dnl | 
|---|
| 1667 | ]) | 
|---|
| 1668 |  | 
|---|
| 1669 | AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, | 
|---|
| 1670 | [AC_MSG_CHECKING([types of arguments for select()]) | 
|---|
| 1671 | AC_CACHE_VAL(ac_cv_func_select_arg234,dnl | 
|---|
| 1672 | [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl | 
|---|
| 1673 | [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl | 
|---|
| 1674 | [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do | 
|---|
| 1675 | for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do | 
|---|
| 1676 | for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do | 
|---|
| 1677 | AC_TRY_COMPILE(dnl | 
|---|
| 1678 | [#ifdef HAVE_SYS_TYPES_H | 
|---|
| 1679 | #include <sys/types.h> | 
|---|
| 1680 | #endif | 
|---|
| 1681 | #ifdef HAVE_SYS_TIME_H | 
|---|
| 1682 | #include <sys/time.h> | 
|---|
| 1683 | #endif | 
|---|
| 1684 | #ifdef HAVE_SYS_SELECT_H | 
|---|
| 1685 | #include <sys/select.h> | 
|---|
| 1686 | #endif | 
|---|
| 1687 | #ifdef HAVE_SYS_SOCKET_H | 
|---|
| 1688 | #include <sys/socket.h> | 
|---|
| 1689 | #endif | 
|---|
| 1690 | extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl | 
|---|
| 1691 | [ac_not_found=no ; break 3],ac_not_found=yes) | 
|---|
| 1692 | done | 
|---|
| 1693 | done | 
|---|
| 1694 | done | 
|---|
| 1695 | ])dnl AC_CACHE_VAL | 
|---|
| 1696 | ])dnl AC_CACHE_VAL | 
|---|
| 1697 | ])dnl AC_CACHE_VAL | 
|---|
| 1698 | if test "$ac_not_found" = yes; then | 
|---|
| 1699 | ac_cv_func_select_arg1=int | 
|---|
| 1700 | ac_cv_func_select_arg234='int *' | 
|---|
| 1701 | ac_cv_func_select_arg5='struct timeval *' | 
|---|
| 1702 | fi | 
|---|
| 1703 | AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5]) | 
|---|
| 1704 | AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1) | 
|---|
| 1705 | AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234)) | 
|---|
| 1706 | AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5)) | 
|---|
| 1707 | ]) | 
|---|
| 1708 |  | 
|---|
| 1709 |  | 
|---|
| 1710 | dnl ### Checks for structure members | 
|---|
| 1711 |  | 
|---|
| 1712 |  | 
|---|
| 1713 | AC_DEFUN(AC_HEADER_TIME, | 
|---|
| 1714 | [AC_CACHE_CHECK([whether time.h and sys/time.h may both be included], | 
|---|
| 1715 | ac_cv_header_time, | 
|---|
| 1716 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 1717 | #include <sys/time.h> | 
|---|
| 1718 | #include <time.h>], | 
|---|
| 1719 | [struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)]) | 
|---|
| 1720 | if test $ac_cv_header_time = yes; then | 
|---|
| 1721 | AC_DEFINE(TIME_WITH_SYS_TIME) | 
|---|
| 1722 | fi | 
|---|
| 1723 | ]) | 
|---|
| 1724 |  | 
|---|
| 1725 | AC_DEFUN(AC_STRUCT_TM, | 
|---|
| 1726 | [AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h], | 
|---|
| 1727 | ac_cv_struct_tm, | 
|---|
| 1728 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 1729 | #include <time.h>], | 
|---|
| 1730 | [struct tm *tp; tp->tm_sec;], | 
|---|
| 1731 | ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)]) | 
|---|
| 1732 | if test $ac_cv_struct_tm = sys/time.h; then | 
|---|
| 1733 | AC_DEFINE(TM_IN_SYS_TIME) | 
|---|
| 1734 | fi | 
|---|
| 1735 | ]) | 
|---|
| 1736 |  | 
|---|
| 1737 | AC_DEFUN(AC_STRUCT_TIMEZONE, | 
|---|
| 1738 | [AC_REQUIRE([AC_STRUCT_TM])dnl | 
|---|
| 1739 | AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone, | 
|---|
| 1740 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 1741 | #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;], | 
|---|
| 1742 | ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)]) | 
|---|
| 1743 | if test "$ac_cv_struct_tm_zone" = yes; then | 
|---|
| 1744 | AC_DEFINE(HAVE_TM_ZONE) | 
|---|
| 1745 | else | 
|---|
| 1746 | AC_CACHE_CHECK(for tzname, ac_cv_var_tzname, | 
|---|
| 1747 | [AC_TRY_LINK( | 
|---|
| 1748 | changequote(<<, >>)dnl | 
|---|
| 1749 | <<#include <time.h> | 
|---|
| 1750 | #ifndef tzname /* For SGI.  */ | 
|---|
| 1751 | extern char *tzname[]; /* RS6000 and others reject char **tzname.  */ | 
|---|
| 1752 | #endif>>, | 
|---|
| 1753 | changequote([, ])dnl | 
|---|
| 1754 | [atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)]) | 
|---|
| 1755 | if test $ac_cv_var_tzname = yes; then | 
|---|
| 1756 | AC_DEFINE(HAVE_TZNAME) | 
|---|
| 1757 | fi | 
|---|
| 1758 | fi | 
|---|
| 1759 | ]) | 
|---|
| 1760 |  | 
|---|
| 1761 | AC_DEFUN(AC_STRUCT_ST_BLOCKS, | 
|---|
| 1762 | [AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks, | 
|---|
| 1763 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 1764 | #include <sys/stat.h>], [struct stat s; s.st_blocks;], | 
|---|
| 1765 | ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)]) | 
|---|
| 1766 | if test $ac_cv_struct_st_blocks = yes; then | 
|---|
| 1767 | AC_DEFINE(HAVE_ST_BLOCKS) | 
|---|
| 1768 | else | 
|---|
| 1769 | LIBOBJS="$LIBOBJS fileblocks.${ac_objext}" | 
|---|
| 1770 | fi | 
|---|
| 1771 | AC_SUBST(LIBOBJS)dnl | 
|---|
| 1772 | ]) | 
|---|
| 1773 |  | 
|---|
| 1774 | AC_DEFUN(AC_STRUCT_ST_BLKSIZE, | 
|---|
| 1775 | [AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize, | 
|---|
| 1776 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 1777 | #include <sys/stat.h>], [struct stat s; s.st_blksize;], | 
|---|
| 1778 | ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)]) | 
|---|
| 1779 | if test $ac_cv_struct_st_blksize = yes; then | 
|---|
| 1780 | AC_DEFINE(HAVE_ST_BLKSIZE) | 
|---|
| 1781 | fi | 
|---|
| 1782 | ]) | 
|---|
| 1783 |  | 
|---|
| 1784 | AC_DEFUN(AC_STRUCT_ST_RDEV, | 
|---|
| 1785 | [AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev, | 
|---|
| 1786 | [AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 1787 | #include <sys/stat.h>], [struct stat s; s.st_rdev;], | 
|---|
| 1788 | ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)]) | 
|---|
| 1789 | if test $ac_cv_struct_st_rdev = yes; then | 
|---|
| 1790 | AC_DEFINE(HAVE_ST_RDEV) | 
|---|
| 1791 | fi | 
|---|
| 1792 | ]) | 
|---|
| 1793 |  | 
|---|
| 1794 |  | 
|---|
| 1795 | dnl ### Checks for compiler characteristics | 
|---|
| 1796 |  | 
|---|
| 1797 |  | 
|---|
| 1798 | AC_DEFUN(AC_C_CROSS, | 
|---|
| 1799 | [AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])]) | 
|---|
| 1800 |  | 
|---|
| 1801 | AC_DEFUN(AC_C_CHAR_UNSIGNED, | 
|---|
| 1802 | [AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, | 
|---|
| 1803 | [if test "$GCC" = yes; then | 
|---|
| 1804 | # GCC predefines this symbol on systems where it applies. | 
|---|
| 1805 | AC_EGREP_CPP(yes, | 
|---|
| 1806 | [#ifdef __CHAR_UNSIGNED__ | 
|---|
| 1807 | yes | 
|---|
| 1808 | #endif | 
|---|
| 1809 | ], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no) | 
|---|
| 1810 | else | 
|---|
| 1811 | AC_TRY_RUN( | 
|---|
| 1812 | [/* volatile prevents gcc2 from optimizing the test away on sparcs.  */ | 
|---|
| 1813 | #if !defined(__STDC__) || __STDC__ != 1 | 
|---|
| 1814 | #define volatile | 
|---|
| 1815 | #endif | 
|---|
| 1816 | main() { | 
|---|
| 1817 | volatile char c = 255; exit(c < 0); | 
|---|
| 1818 | }], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no) | 
|---|
| 1819 | fi]) | 
|---|
| 1820 | if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then | 
|---|
| 1821 | AC_DEFINE(__CHAR_UNSIGNED__) | 
|---|
| 1822 | fi | 
|---|
| 1823 | ]) | 
|---|
| 1824 |  | 
|---|
| 1825 | AC_DEFUN(AC_C_LONG_DOUBLE, | 
|---|
| 1826 | [AC_CACHE_CHECK(for long double, ac_cv_c_long_double, | 
|---|
| 1827 | [if test "$GCC" = yes; then | 
|---|
| 1828 | ac_cv_c_long_double=yes | 
|---|
| 1829 | else | 
|---|
| 1830 | AC_TRY_RUN([int main() { | 
|---|
| 1831 | /* The Stardent Vistra knows sizeof(long double), but does not support it.  */ | 
|---|
| 1832 | long double foo = 0.0; | 
|---|
| 1833 | /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */ | 
|---|
| 1834 | exit(sizeof(long double) < sizeof(double)); }], | 
|---|
| 1835 | ac_cv_c_long_double=yes, ac_cv_c_long_double=no) | 
|---|
| 1836 | fi]) | 
|---|
| 1837 | if test $ac_cv_c_long_double = yes; then | 
|---|
| 1838 | AC_DEFINE(HAVE_LONG_DOUBLE) | 
|---|
| 1839 | fi | 
|---|
| 1840 | ]) | 
|---|
| 1841 |  | 
|---|
| 1842 | AC_DEFUN(AC_INT_16_BITS, | 
|---|
| 1843 | [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl | 
|---|
| 1844 | AC_MSG_CHECKING(whether int is 16 bits) | 
|---|
| 1845 | AC_TRY_RUN([main() { exit(sizeof(int) != 2); }], | 
|---|
| 1846 | [AC_MSG_RESULT(yes) | 
|---|
| 1847 | AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no)) | 
|---|
| 1848 | ]) | 
|---|
| 1849 |  | 
|---|
| 1850 | AC_DEFUN(AC_LONG_64_BITS, | 
|---|
| 1851 | [AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl | 
|---|
| 1852 | AC_MSG_CHECKING(whether long int is 64 bits) | 
|---|
| 1853 | AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }], | 
|---|
| 1854 | [AC_MSG_RESULT(yes) | 
|---|
| 1855 | AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no)) | 
|---|
| 1856 | ]) | 
|---|
| 1857 |  | 
|---|
| 1858 | AC_DEFUN(AC_C_BIGENDIAN, | 
|---|
| 1859 | [AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, | 
|---|
| 1860 | [ac_cv_c_bigendian=unknown | 
|---|
| 1861 | # See if sys/param.h defines the BYTE_ORDER macro. | 
|---|
| 1862 | AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 1863 | #include <sys/param.h>], [ | 
|---|
| 1864 | #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN | 
|---|
| 1865 | bogus endian macros | 
|---|
| 1866 | #endif], [# It does; now see whether it defined to BIG_ENDIAN or not. | 
|---|
| 1867 | AC_TRY_COMPILE([#include <sys/types.h> | 
|---|
| 1868 | #include <sys/param.h>], [ | 
|---|
| 1869 | #if BYTE_ORDER != BIG_ENDIAN | 
|---|
| 1870 | not big endian | 
|---|
| 1871 | #endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) | 
|---|
| 1872 | if test $ac_cv_c_bigendian = unknown; then | 
|---|
| 1873 | AC_TRY_RUN([main () { | 
|---|
| 1874 | /* Are we little or big endian?  From Harbison&Steele.  */ | 
|---|
| 1875 | union | 
|---|
| 1876 | { | 
|---|
| 1877 | long l; | 
|---|
| 1878 | char c[sizeof (long)]; | 
|---|
| 1879 | } u; | 
|---|
| 1880 | u.l = 1; | 
|---|
| 1881 | exit (u.c[sizeof (long) - 1] == 1); | 
|---|
| 1882 | }], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes) | 
|---|
| 1883 | fi]) | 
|---|
| 1884 | if test $ac_cv_c_bigendian = yes; then | 
|---|
| 1885 | AC_DEFINE(WORDS_BIGENDIAN) | 
|---|
| 1886 | fi | 
|---|
| 1887 | ]) | 
|---|
| 1888 |  | 
|---|
| 1889 | dnl Do nothing if the compiler accepts the inline keyword. | 
|---|
| 1890 | dnl Otherwise define inline to __inline__ or __inline if one of those work, | 
|---|
| 1891 | dnl otherwise define inline to be empty. | 
|---|
| 1892 | AC_DEFUN(AC_C_INLINE, | 
|---|
| 1893 | [AC_CACHE_CHECK([for inline], ac_cv_c_inline, | 
|---|
| 1894 | [ac_cv_c_inline=no | 
|---|
| 1895 | for ac_kw in inline __inline__ __inline; do | 
|---|
| 1896 | AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break]) | 
|---|
| 1897 | done | 
|---|
| 1898 | ]) | 
|---|
| 1899 | case "$ac_cv_c_inline" in | 
|---|
| 1900 | inline | yes) ;; | 
|---|
| 1901 | no) AC_DEFINE(inline, ) ;; | 
|---|
| 1902 | *)  AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;; | 
|---|
| 1903 | esac | 
|---|
| 1904 | ]) | 
|---|
| 1905 |  | 
|---|
| 1906 | AC_DEFUN(AC_C_CONST, | 
|---|
| 1907 | [dnl This message is consistent in form with the other checking messages, | 
|---|
| 1908 | dnl and with the result message. | 
|---|
| 1909 | AC_CACHE_CHECK([for working const], ac_cv_c_const, | 
|---|
| 1910 | [AC_TRY_COMPILE(, | 
|---|
| 1911 | changequote(<<, >>)dnl | 
|---|
| 1912 | << | 
|---|
| 1913 | /* Ultrix mips cc rejects this.  */ | 
|---|
| 1914 | typedef int charset[2]; const charset x; | 
|---|
| 1915 | /* SunOS 4.1.1 cc rejects this.  */ | 
|---|
| 1916 | char const *const *ccp; | 
|---|
| 1917 | char **p; | 
|---|
| 1918 | /* NEC SVR4.0.2 mips cc rejects this.  */ | 
|---|
| 1919 | struct point {int x, y;}; | 
|---|
| 1920 | static struct point const zero = {0,0}; | 
|---|
| 1921 | /* AIX XL C 1.02.0.0 rejects this. | 
|---|
| 1922 | It does not let you subtract one const X* pointer from another in an arm | 
|---|
| 1923 | of an if-expression whose if-part is not a constant expression */ | 
|---|
| 1924 | const char *g = "string"; | 
|---|
| 1925 | ccp = &g + (g ? g-g : 0); | 
|---|
| 1926 | /* HPUX 7.0 cc rejects these. */ | 
|---|
| 1927 | ++ccp; | 
|---|
| 1928 | p = (char**) ccp; | 
|---|
| 1929 | ccp = (char const *const *) p; | 
|---|
| 1930 | { /* SCO 3.2v4 cc rejects this.  */ | 
|---|
| 1931 | char *t; | 
|---|
| 1932 | char const *s = 0 ? (char *) 0 : (char const *) 0; | 
|---|
| 1933 |  | 
|---|
| 1934 | *t++ = 0; | 
|---|
| 1935 | } | 
|---|
| 1936 | { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */ | 
|---|
| 1937 | int x[] = {25, 17}; | 
|---|
| 1938 | const int *foo = &x[0]; | 
|---|
| 1939 | ++foo; | 
|---|
| 1940 | } | 
|---|
| 1941 | { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ | 
|---|
| 1942 | typedef const int *iptr; | 
|---|
| 1943 | iptr p = 0; | 
|---|
| 1944 | ++p; | 
|---|
| 1945 | } | 
|---|
| 1946 | { /* AIX XL C 1.02.0.0 rejects this saying | 
|---|
| 1947 | "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ | 
|---|
| 1948 | struct s { int j; const int *ap[3]; }; | 
|---|
| 1949 | struct s *b; b->j = 5; | 
|---|
| 1950 | } | 
|---|
| 1951 | { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ | 
|---|
| 1952 | const int foo = 10; | 
|---|
| 1953 | } | 
|---|
| 1954 | >>, | 
|---|
| 1955 | changequote([, ])dnl | 
|---|
| 1956 | ac_cv_c_const=yes, ac_cv_c_const=no)]) | 
|---|
| 1957 | if test $ac_cv_c_const = no; then | 
|---|
| 1958 | AC_DEFINE(const, ) | 
|---|
| 1959 | fi | 
|---|
| 1960 | ]) | 
|---|
| 1961 |  | 
|---|
| 1962 | AC_DEFUN(AC_C_STRINGIZE, [ | 
|---|
| 1963 | AC_REQUIRE([AC_PROG_CPP]) | 
|---|
| 1964 | AC_MSG_CHECKING([for preprocessor stringizing operator]) | 
|---|
| 1965 | AC_CACHE_VAL(ac_cv_c_stringize, | 
|---|
| 1966 | AC_EGREP_CPP([#teststring],[ | 
|---|
| 1967 | #define x(y) #y | 
|---|
| 1968 |  | 
|---|
| 1969 | char *s = x(teststring); | 
|---|
| 1970 | ], ac_cv_c_stringize=no, ac_cv_c_stringize=yes)) | 
|---|
| 1971 | if test "${ac_cv_c_stringize}" = yes | 
|---|
| 1972 | then | 
|---|
| 1973 | AC_DEFINE(HAVE_STRINGIZE) | 
|---|
| 1974 | fi | 
|---|
| 1975 | AC_MSG_RESULT([${ac_cv_c_stringize}]) | 
|---|
| 1976 | ])dnl | 
|---|
| 1977 |  | 
|---|
| 1978 | define(AC_ARG_ARRAY, | 
|---|
| 1979 | [errprint(__file__:__line__: [$0] has been removed; don't do unportable things with arguments | 
|---|
| 1980 | )m4exit(4)]) | 
|---|
| 1981 |  | 
|---|
| 1982 | dnl Check the object extension used by the compiler: typically .o or | 
|---|
| 1983 | dnl .obj.  If this is called, some other behaviour will change, | 
|---|
| 1984 | dnl determined by ac_objext. | 
|---|
| 1985 | AC_DEFUN(AC_OBJEXT, | 
|---|
| 1986 | [AC_MSG_CHECKING([for object suffix]) | 
|---|
| 1987 | AC_CACHE_VAL(ac_cv_objext, | 
|---|
| 1988 | [rm -f conftest* | 
|---|
| 1989 | echo 'int i = 1;' > conftest.$ac_ext | 
|---|
| 1990 | if AC_TRY_EVAL(ac_compile); then | 
|---|
| 1991 | for ac_file in conftest.*; do | 
|---|
| 1992 | case $ac_file in | 
|---|
| 1993 | *.c) ;; | 
|---|
| 1994 | *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; | 
|---|
| 1995 | esac | 
|---|
| 1996 | done | 
|---|
| 1997 | else | 
|---|
| 1998 | AC_MSG_ERROR([installation or configuration problem; compiler does not work]) | 
|---|
| 1999 | fi | 
|---|
| 2000 | rm -f conftest*]) | 
|---|
| 2001 | AC_MSG_RESULT($ac_cv_objext) | 
|---|
| 2002 | OBJEXT=$ac_cv_objext | 
|---|
| 2003 | ac_objext=$ac_cv_objext | 
|---|
| 2004 | AC_SUBST(OBJEXT)]) | 
|---|
| 2005 |  | 
|---|
| 2006 | dnl Determine the linker flags (e.g. `-L' and `-l') for the Fortran 77 | 
|---|
| 2007 | dnl intrinsic and run-time libraries that are required to successfully | 
|---|
| 2008 | dnl link a Fortran 77 program or shared library.  The output variable | 
|---|
| 2009 | dnl FLIBS is set to these flags. | 
|---|
| 2010 | dnl | 
|---|
| 2011 | dnl This macro is intended to be used in those situations when it is | 
|---|
| 2012 | dnl necessary to mix, e.g. C++ and Fortran 77, source code into a single | 
|---|
| 2013 | dnl program or shared library. | 
|---|
| 2014 | dnl | 
|---|
| 2015 | dnl For example, if object files from a C++ and Fortran 77 compiler must | 
|---|
| 2016 | dnl be linked together, then the C++ compiler/linker must be used for | 
|---|
| 2017 | dnl linking (since special C++-ish things need to happen at link time | 
|---|
| 2018 | dnl like calling global constructors, instantiating templates, enabling | 
|---|
| 2019 | dnl exception support, etc.). | 
|---|
| 2020 | dnl | 
|---|
| 2021 | dnl However, the Fortran 77 intrinsic and run-time libraries must be | 
|---|
| 2022 | dnl linked in as well, but the C++ compiler/linker doesn't know how to | 
|---|
| 2023 | dnl add these Fortran 77 libraries.  Hence, the macro | 
|---|
| 2024 | dnl `AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77 | 
|---|
| 2025 | dnl libraries. | 
|---|
| 2026 | dnl | 
|---|
| 2027 | dnl This macro was packaged in its current form by Matthew D. Langston | 
|---|
| 2028 | dnl <langston@SLAC.Stanford.EDU>.  However, nearly all of this macro | 
|---|
| 2029 | dnl came from the `OCTAVE_FLIBS' macro in `octave-2.0.13/aclocal.m4', | 
|---|
| 2030 | dnl and full credit should go to John W. Eaton for writing this | 
|---|
| 2031 | dnl extremely useful macro.  Thank you John. | 
|---|
| 2032 | dnl | 
|---|
| 2033 | dnl AC_F77_LIBRARY_LDFLAGS() | 
|---|
| 2034 | AC_DEFUN(AC_F77_LIBRARY_LDFLAGS, | 
|---|
| 2035 | [AC_MSG_CHECKING([for Fortran 77 libraries]) | 
|---|
| 2036 | AC_REQUIRE([AC_PROG_F77]) | 
|---|
| 2037 | AC_REQUIRE([AC_CANONICAL_HOST]) | 
|---|
| 2038 | AC_CACHE_VAL(ac_cv_flibs, | 
|---|
| 2039 | [changequote(, )dnl | 
|---|
| 2040 | dnl Write a minimal program and compile it with -v.  I don't know what | 
|---|
| 2041 | dnl to do if your compiler doesn't have -v... | 
|---|
| 2042 | echo "      END" > conftest.f | 
|---|
| 2043 | foutput=`${F77} -v -o conftest conftest.f 2>&1` | 
|---|
| 2044 | dnl | 
|---|
| 2045 | dnl The easiest thing to do for xlf output is to replace all the commas | 
|---|
| 2046 | dnl with spaces.  Try to only do that if the output is really from xlf, | 
|---|
| 2047 | dnl since doing that causes problems on other systems. | 
|---|
| 2048 | dnl | 
|---|
| 2049 | xlf_p=`echo $foutput | grep xlfentry` | 
|---|
| 2050 | if test -n "$xlf_p"; then | 
|---|
| 2051 | foutput=`echo $foutput | sed 's/,/ /g'` | 
|---|
| 2052 | fi | 
|---|
| 2053 | dnl | 
|---|
| 2054 | ld_run_path=`echo $foutput | \ | 
|---|
| 2055 | sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'` | 
|---|
| 2056 | dnl | 
|---|
| 2057 | dnl We are only supposed to find this on Solaris systems... | 
|---|
| 2058 | dnl Uh, the run path should be absolute, shouldn't it? | 
|---|
| 2059 | dnl | 
|---|
| 2060 | case "$ld_run_path" in | 
|---|
| 2061 | /*) | 
|---|
| 2062 | if test "$ac_cv_prog_gcc" = yes; then | 
|---|
| 2063 | ld_run_path="-Xlinker -R -Xlinker $ld_run_path" | 
|---|
| 2064 | else | 
|---|
| 2065 | ld_run_path="-R $ld_run_path" | 
|---|
| 2066 | fi | 
|---|
| 2067 | ;; | 
|---|
| 2068 | *) | 
|---|
| 2069 | ld_run_path= | 
|---|
| 2070 | ;; | 
|---|
| 2071 | esac | 
|---|
| 2072 | dnl | 
|---|
| 2073 | flibs= | 
|---|
| 2074 | lflags= | 
|---|
| 2075 | dnl | 
|---|
| 2076 | dnl If want_arg is set, we know we want the arg to be added to the list, | 
|---|
| 2077 | dnl so we don't have to examine it. | 
|---|
| 2078 | dnl | 
|---|
| 2079 | want_arg= | 
|---|
| 2080 | dnl | 
|---|
| 2081 | for arg in $foutput; do | 
|---|
| 2082 | old_want_arg=$want_arg | 
|---|
| 2083 | want_arg= | 
|---|
| 2084 | dnl | 
|---|
| 2085 | dnl None of the options that take arguments expect the argument to | 
|---|
| 2086 | dnl start with a -, so pretend we didn't see anything special. | 
|---|
| 2087 | dnl | 
|---|
| 2088 | if test -n "$old_want_arg"; then | 
|---|
| 2089 | case "$arg" in | 
|---|
| 2090 | -*) | 
|---|
| 2091 | old_want_arg= | 
|---|
| 2092 | ;; | 
|---|
| 2093 | esac | 
|---|
| 2094 | fi | 
|---|
| 2095 | case "$old_want_arg" in | 
|---|
| 2096 | '') | 
|---|
| 2097 | case $arg in | 
|---|
| 2098 | /*.a) | 
|---|
| 2099 | exists=false | 
|---|
| 2100 | for f in $lflags; do | 
|---|
| 2101 | if test x$arg = x$f; then | 
|---|
| 2102 | exists=true | 
|---|
| 2103 | fi | 
|---|
| 2104 | done | 
|---|
| 2105 | if $exists; then | 
|---|
| 2106 | arg= | 
|---|
| 2107 | else | 
|---|
| 2108 | lflags="$lflags $arg" | 
|---|
| 2109 | fi | 
|---|
| 2110 | ;; | 
|---|
| 2111 | -bI:*) | 
|---|
| 2112 | exists=false | 
|---|
| 2113 | for f in $lflags; do | 
|---|
| 2114 | if test x$arg = x$f; then | 
|---|
| 2115 | exists=true | 
|---|
| 2116 | fi | 
|---|
| 2117 | done | 
|---|
| 2118 | if $exists; then | 
|---|
| 2119 | arg= | 
|---|
| 2120 | else | 
|---|
| 2121 | if test "$ac_cv_prog_gcc" = yes; then | 
|---|
| 2122 | lflags="$lflags -Xlinker $arg" | 
|---|
| 2123 | else | 
|---|
| 2124 | lflags="$lflags $arg" | 
|---|
| 2125 | fi | 
|---|
| 2126 | fi | 
|---|
| 2127 | ;; | 
|---|
| 2128 | -lang* | -lcrt0.o | -lc | -lgcc) | 
|---|
| 2129 | arg= | 
|---|
| 2130 | ;; | 
|---|
| 2131 | -[lLR]) | 
|---|
| 2132 | want_arg=$arg | 
|---|
| 2133 | arg= | 
|---|
| 2134 | ;; | 
|---|
| 2135 | -[lLR]*) | 
|---|
| 2136 | exists=false | 
|---|
| 2137 | for f in $lflags; do | 
|---|
| 2138 | if test x$arg = x$f; then | 
|---|
| 2139 | exists=true | 
|---|
| 2140 | fi | 
|---|
| 2141 | done | 
|---|
| 2142 | if $exists; then | 
|---|
| 2143 | arg= | 
|---|
| 2144 | else | 
|---|
| 2145 | case "$arg" in | 
|---|
| 2146 | -lkernel32) | 
|---|
| 2147 | case "$canonical_host_type" in | 
|---|
| 2148 | *-*-cygwin*) | 
|---|
| 2149 | arg= | 
|---|
| 2150 | ;; | 
|---|
| 2151 | *) | 
|---|
| 2152 | lflags="$lflags $arg" | 
|---|
| 2153 | ;; | 
|---|
| 2154 | esac | 
|---|
| 2155 | ;; | 
|---|
| 2156 | -lm) | 
|---|
| 2157 | ;; | 
|---|
| 2158 | *) | 
|---|
| 2159 | lflags="$lflags $arg" | 
|---|
| 2160 | ;; | 
|---|
| 2161 | esac | 
|---|
| 2162 | fi | 
|---|
| 2163 | ;; | 
|---|
| 2164 | -u) | 
|---|
| 2165 | want_arg=$arg | 
|---|
| 2166 | arg= | 
|---|
| 2167 | ;; | 
|---|
| 2168 | -Y) | 
|---|
| 2169 | want_arg=$arg | 
|---|
| 2170 | arg= | 
|---|
| 2171 | ;; | 
|---|
| 2172 | *) | 
|---|
| 2173 | arg= | 
|---|
| 2174 | ;; | 
|---|
| 2175 | esac | 
|---|
| 2176 | ;; | 
|---|
| 2177 | -[lLR]) | 
|---|
| 2178 | arg="$old_want_arg $arg" | 
|---|
| 2179 | ;; | 
|---|
| 2180 | -u) | 
|---|
| 2181 | arg="-u $arg" | 
|---|
| 2182 | ;; | 
|---|
| 2183 | -Y) | 
|---|
| 2184 | dnl | 
|---|
| 2185 | dnl Should probably try to ensure unique directory options here too. | 
|---|
| 2186 | dnl This probably only applies to Solaris systems, and then will only | 
|---|
| 2187 | dnl work with gcc... | 
|---|
| 2188 | dnl | 
|---|
| 2189 | arg=`echo $arg | sed -e 's%^P,%%'` | 
|---|
| 2190 | SAVE_IFS=$IFS | 
|---|
| 2191 | IFS="$PATH_IFS" | 
|---|
| 2192 | list= | 
|---|
| 2193 | for elt in $arg; do | 
|---|
| 2194 | list="$list -L$elt" | 
|---|
| 2195 | done | 
|---|
| 2196 | IFS=$SAVE_IFS | 
|---|
| 2197 | arg="$list" | 
|---|
| 2198 | ;; | 
|---|
| 2199 | esac | 
|---|
| 2200 | dnl | 
|---|
| 2201 | if test -n "$arg"; then | 
|---|
| 2202 | flibs="$flibs $arg" | 
|---|
| 2203 | fi | 
|---|
| 2204 | done | 
|---|
| 2205 | if test -n "$ld_run_path"; then | 
|---|
| 2206 | flibs_result="$ld_run_path $flibs" | 
|---|
| 2207 | else | 
|---|
| 2208 | flibs_result="$flibs" | 
|---|
| 2209 | fi | 
|---|
| 2210 | changequote([, ])dnl | 
|---|
| 2211 | ac_cv_flibs="$flibs_result"]) | 
|---|
| 2212 | FLIBS="$ac_cv_flibs" | 
|---|
| 2213 | AC_SUBST(FLIBS)dnl | 
|---|
| 2214 | AC_MSG_RESULT($FLIBS) | 
|---|
| 2215 | ]) | 
|---|
| 2216 |  | 
|---|
| 2217 |  | 
|---|
| 2218 | dnl ### Checks for operating system services | 
|---|
| 2219 |  | 
|---|
| 2220 |  | 
|---|
| 2221 | AC_DEFUN(AC_SYS_INTERPRETER, | 
|---|
| 2222 | [# Pull the hash mark out of the macro call to avoid m4 problems. | 
|---|
| 2223 | ac_msg="whether #! works in shell scripts" | 
|---|
| 2224 | AC_CACHE_CHECK($ac_msg, ac_cv_sys_interpreter, | 
|---|
| 2225 | [echo '#! /bin/cat | 
|---|
| 2226 | exit 69 | 
|---|
| 2227 | ' > conftest | 
|---|
| 2228 | chmod u+x conftest | 
|---|
| 2229 | (SHELL=/bin/sh; export SHELL; ./conftest >/dev/null) | 
|---|
| 2230 | if test $? -ne 69; then | 
|---|
| 2231 | ac_cv_sys_interpreter=yes | 
|---|
| 2232 | else | 
|---|
| 2233 | ac_cv_sys_interpreter=no | 
|---|
| 2234 | fi | 
|---|
| 2235 | rm -f conftest]) | 
|---|
| 2236 | interpval="$ac_cv_sys_interpreter" | 
|---|
| 2237 | ]) | 
|---|
| 2238 |  | 
|---|
| 2239 | define(AC_HAVE_POUNDBANG, | 
|---|
| 2240 | [errprint(__file__:__line__: [$0 has been replaced by AC_SYS_INTERPRETER, taking no arguments | 
|---|
| 2241 | ])m4exit(4)]) | 
|---|
| 2242 |  | 
|---|
| 2243 | AC_DEFUN(AC_SYS_LONG_FILE_NAMES, | 
|---|
| 2244 | [AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names, | 
|---|
| 2245 | [ac_cv_sys_long_file_names=yes | 
|---|
| 2246 | # Test for long file names in all the places we know might matter: | 
|---|
| 2247 | #      .                the current directory, where building will happen | 
|---|
| 2248 | #      $prefix/lib      where we will be installing things | 
|---|
| 2249 | #      $exec_prefix/lib likewise | 
|---|
| 2250 | # eval it to expand exec_prefix. | 
|---|
| 2251 | #      $TMPDIR          if set, where it might want to write temporary files | 
|---|
| 2252 | # if $TMPDIR is not set: | 
|---|
| 2253 | #      /tmp             where it might want to write temporary files | 
|---|
| 2254 | #      /var/tmp         likewise | 
|---|
| 2255 | #      /usr/tmp         likewise | 
|---|
| 2256 | if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then | 
|---|
| 2257 | ac_tmpdirs="$TMPDIR" | 
|---|
| 2258 | else | 
|---|
| 2259 | ac_tmpdirs='/tmp /var/tmp /usr/tmp' | 
|---|
| 2260 | fi | 
|---|
| 2261 | for ac_dir in  . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do | 
|---|
| 2262 | test -d $ac_dir || continue | 
|---|
| 2263 | test -w $ac_dir || continue # It is less confusing to not echo anything here. | 
|---|
| 2264 | (echo 1 > $ac_dir/conftest9012345) 2>/dev/null | 
|---|
| 2265 | (echo 2 > $ac_dir/conftest9012346) 2>/dev/null | 
|---|
| 2266 | val=`cat $ac_dir/conftest9012345 2>/dev/null` | 
|---|
| 2267 | if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then | 
|---|
| 2268 | ac_cv_sys_long_file_names=no | 
|---|
| 2269 | rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null | 
|---|
| 2270 | break | 
|---|
| 2271 | fi | 
|---|
| 2272 | rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null | 
|---|
| 2273 | done]) | 
|---|
| 2274 | if test $ac_cv_sys_long_file_names = yes; then | 
|---|
| 2275 | AC_DEFINE(HAVE_LONG_FILE_NAMES) | 
|---|
| 2276 | fi | 
|---|
| 2277 | ]) | 
|---|
| 2278 |  | 
|---|
| 2279 | AC_DEFUN(AC_SYS_RESTARTABLE_SYSCALLS, | 
|---|
| 2280 | [AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls, | 
|---|
| 2281 | [AC_TRY_RUN( | 
|---|
| 2282 | [/* Exit 0 (true) if wait returns something other than -1, | 
|---|
| 2283 | i.e. the pid of the child, which means that wait was restarted | 
|---|
| 2284 | after getting the signal.  */ | 
|---|
| 2285 | #include <sys/types.h> | 
|---|
| 2286 | #include <signal.h> | 
|---|
| 2287 | ucatch (isig) { } | 
|---|
| 2288 | main () { | 
|---|
| 2289 | int i = fork (), status; | 
|---|
| 2290 | if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); } | 
|---|
| 2291 | signal (SIGINT, ucatch); | 
|---|
| 2292 | status = wait(&i); | 
|---|
| 2293 | if (status == -1) wait(&i); | 
|---|
| 2294 | exit (status == -1); | 
|---|
| 2295 | } | 
|---|
| 2296 | ], ac_cv_sys_restartable_syscalls=yes, ac_cv_sys_restartable_syscalls=no)]) | 
|---|
| 2297 | if test $ac_cv_sys_restartable_syscalls = yes; then | 
|---|
| 2298 | AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS) | 
|---|
| 2299 | fi | 
|---|
| 2300 | ]) | 
|---|
| 2301 |  | 
|---|
| 2302 | AC_DEFUN(AC_PATH_X, | 
|---|
| 2303 | [AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally. | 
|---|
| 2304 | # If we find X, set shell vars x_includes and x_libraries to the | 
|---|
| 2305 | # paths, otherwise set no_x=yes. | 
|---|
| 2306 | # Uses ac_ vars as temps to allow command line to override cache and checks. | 
|---|
| 2307 | # --without-x overrides everything else, but does not touch the cache. | 
|---|
| 2308 | AC_MSG_CHECKING(for X) | 
|---|
| 2309 |  | 
|---|
| 2310 | AC_ARG_WITH(x, [  --with-x                use the X Window System]) | 
|---|
| 2311 | # $have_x is `yes', `no', `disabled', or empty when we do not yet know. | 
|---|
| 2312 | if test "x$with_x" = xno; then | 
|---|
| 2313 | # The user explicitly disabled X. | 
|---|
| 2314 | have_x=disabled | 
|---|
| 2315 | else | 
|---|
| 2316 | if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then | 
|---|
| 2317 | # Both variables are already set. | 
|---|
| 2318 | have_x=yes | 
|---|
| 2319 | else | 
|---|
| 2320 | AC_CACHE_VAL(ac_cv_have_x, | 
|---|
| 2321 | [# One or both of the vars are not set, and there is no cached value. | 
|---|
| 2322 | ac_x_includes=NO ac_x_libraries=NO | 
|---|
| 2323 | AC_PATH_X_XMKMF | 
|---|
| 2324 | AC_PATH_X_DIRECT | 
|---|
| 2325 | if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then | 
|---|
| 2326 | # Didn't find X anywhere.  Cache the known absence of X. | 
|---|
| 2327 | ac_cv_have_x="have_x=no" | 
|---|
| 2328 | else | 
|---|
| 2329 | # Record where we found X for the cache. | 
|---|
| 2330 | ac_cv_have_x="have_x=yes \ | 
|---|
| 2331 | ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" | 
|---|
| 2332 | fi])dnl | 
|---|
| 2333 | fi | 
|---|
| 2334 | eval "$ac_cv_have_x" | 
|---|
| 2335 | fi # $with_x != no | 
|---|
| 2336 |  | 
|---|
| 2337 | if test "$have_x" != yes; then | 
|---|
| 2338 | AC_MSG_RESULT($have_x) | 
|---|
| 2339 | no_x=yes | 
|---|
| 2340 | else | 
|---|
| 2341 | # If each of the values was on the command line, it overrides each guess. | 
|---|
| 2342 | test "x$x_includes" = xNONE && x_includes=$ac_x_includes | 
|---|
| 2343 | test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries | 
|---|
| 2344 | # Update the cache value to reflect the command line values. | 
|---|
| 2345 | ac_cv_have_x="have_x=yes \ | 
|---|
| 2346 | ac_x_includes=$x_includes ac_x_libraries=$x_libraries" | 
|---|
| 2347 | AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) | 
|---|
| 2348 | fi | 
|---|
| 2349 | ]) | 
|---|
| 2350 |  | 
|---|
| 2351 | dnl Internal subroutine of AC_PATH_X. | 
|---|
| 2352 | dnl Set ac_x_includes and/or ac_x_libraries. | 
|---|
| 2353 | AC_DEFUN(AC_PATH_X_XMKMF, | 
|---|
| 2354 | [rm -fr conftestdir | 
|---|
| 2355 | if mkdir conftestdir; then | 
|---|
| 2356 | cd conftestdir | 
|---|
| 2357 | # Make sure to not put "make" in the Imakefile rules, since we grep it out. | 
|---|
| 2358 | cat > Imakefile <<'EOF' | 
|---|
| 2359 | acfindx: | 
|---|
| 2360 | @sh -c 'echo \'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${DESTDIR}${USRLIBDIR}"; ac_im_libdir="${DESTDIR}${LIBDIR}"\'' | 
|---|
| 2361 | EOF | 
|---|
| 2362 | if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then | 
|---|
| 2363 | # GNU make sometimes prints "make[1]: Entering...", which would confuse us. | 
|---|
| 2364 | eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` | 
|---|
| 2365 | # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. | 
|---|
| 2366 | for ac_extension in a so sl; do | 
|---|
| 2367 | if test ! -f $ac_im_usrlibdir/${ac_cv_libpre}X11.$ac_extension && | 
|---|
| 2368 | test -f $ac_im_libdir/${ac_cv_libpre}X11.$ac_extension; then | 
|---|
| 2369 | ac_im_usrlibdir=$ac_im_libdir; break | 
|---|
| 2370 | fi | 
|---|
| 2371 | done | 
|---|
| 2372 | # Screen out bogus values from the imake configuration.  They are | 
|---|
| 2373 | # bogus both because they are the default anyway, and because | 
|---|
| 2374 | # using them would break gcc on systems where it needs fixed includes. | 
|---|
| 2375 | case "$ac_im_incroot" in | 
|---|
| 2376 | /usr/include) ;; | 
|---|
| 2377 | *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; | 
|---|
| 2378 | esac | 
|---|
| 2379 | case "$ac_im_usrlibdir" in | 
|---|
| 2380 | /usr/lib | /lib) ;; | 
|---|
| 2381 | *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; | 
|---|
| 2382 | esac | 
|---|
| 2383 | fi | 
|---|
| 2384 | cd .. | 
|---|
| 2385 | rm -fr conftestdir | 
|---|
| 2386 | fi | 
|---|
| 2387 | ]) | 
|---|
| 2388 |  | 
|---|
| 2389 | dnl Internal subroutine of AC_PATH_X. | 
|---|
| 2390 | dnl Set ac_x_includes and/or ac_x_libraries. | 
|---|
| 2391 | AC_DEFUN(AC_PATH_X_DIRECT, | 
|---|
| 2392 | [if test "$ac_x_includes" = NO; then | 
|---|
| 2393 | # Guess where to find include files, by looking for this one X11 .h file. | 
|---|
| 2394 | test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h | 
|---|
| 2395 |  | 
|---|
| 2396 | # First, try using that file with no special directory specified. | 
|---|
| 2397 | AC_TRY_CPP([#include <$x_direct_test_include>], | 
|---|
| 2398 | [# We can compile using X headers with no special include directory. | 
|---|
| 2399 | ac_x_includes=], | 
|---|
| 2400 | [# Look for the header file in a standard set of common directories. | 
|---|
| 2401 | # Check X11 before X11Rn because it is often a symlink to the current release. | 
|---|
| 2402 | for ac_dir in               \ | 
|---|
| 2403 | /usr/X11/include          \ | 
|---|
| 2404 | /usr/X11R6/include        \ | 
|---|
| 2405 | /usr/X11R5/include        \ | 
|---|
| 2406 | /usr/X11R4/include        \ | 
|---|
| 2407 | \ | 
|---|
| 2408 | /usr/include/X11          \ | 
|---|
| 2409 | /usr/include/X11R6        \ | 
|---|
| 2410 | /usr/include/X11R5        \ | 
|---|
| 2411 | /usr/include/X11R4        \ | 
|---|
| 2412 | \ | 
|---|
| 2413 | /usr/local/X11/include    \ | 
|---|
| 2414 | /usr/local/X11R6/include  \ | 
|---|
| 2415 | /usr/local/X11R5/include  \ | 
|---|
| 2416 | /usr/local/X11R4/include  \ | 
|---|
| 2417 | \ | 
|---|
| 2418 | /usr/local/include/X11    \ | 
|---|
| 2419 | /usr/local/include/X11R6  \ | 
|---|
| 2420 | /usr/local/include/X11R5  \ | 
|---|
| 2421 | /usr/local/include/X11R4  \ | 
|---|
| 2422 | \ | 
|---|
| 2423 | /usr/X386/include         \ | 
|---|
| 2424 | /usr/x386/include         \ | 
|---|
| 2425 | /usr/XFree86/include/X11  \ | 
|---|
| 2426 | \ | 
|---|
| 2427 | /usr/include              \ | 
|---|
| 2428 | /usr/local/include        \ | 
|---|
| 2429 | /usr/unsupported/include  \ | 
|---|
| 2430 | /usr/athena/include       \ | 
|---|
| 2431 | /usr/local/x11r5/include  \ | 
|---|
| 2432 | /usr/lpp/Xamples/include  \ | 
|---|
| 2433 | \ | 
|---|
| 2434 | /usr/openwin/include      \ | 
|---|
| 2435 | /usr/openwin/share/include \ | 
|---|
| 2436 | ; \ | 
|---|
| 2437 | do | 
|---|
| 2438 | if test -r "$ac_dir/$x_direct_test_include"; then | 
|---|
| 2439 | ac_x_includes=$ac_dir | 
|---|
| 2440 | break | 
|---|
| 2441 | fi | 
|---|
| 2442 | done]) | 
|---|
| 2443 | fi # $ac_x_includes = NO | 
|---|
| 2444 |  | 
|---|
| 2445 | if test "$ac_x_libraries" = NO; then | 
|---|
| 2446 | # Check for the libraries. | 
|---|
| 2447 |  | 
|---|
| 2448 | test -z "$x_direct_test_library" && x_direct_test_library=Xt | 
|---|
| 2449 | test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc | 
|---|
| 2450 |  | 
|---|
| 2451 | # See if we find them without any special options. | 
|---|
| 2452 | # Don't add to $LIBS permanently. | 
|---|
| 2453 | ac_save_LIBS="$LIBS" | 
|---|
| 2454 | LIBS="-l$x_direct_test_library $LIBS" | 
|---|
| 2455 | AC_TRY_LINK(, [${x_direct_test_function}()], | 
|---|
| 2456 | [LIBS="$ac_save_LIBS" | 
|---|
| 2457 | # We can link X programs with no special library path. | 
|---|
| 2458 | ac_x_libraries=], | 
|---|
| 2459 | [LIBS="$ac_save_LIBS" | 
|---|
| 2460 | # First see if replacing the include by lib works. | 
|---|
| 2461 | # Check X11 before X11Rn because it is often a symlink to the current release. | 
|---|
| 2462 | for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ | 
|---|
| 2463 | /usr/X11/lib          \ | 
|---|
| 2464 | /usr/X11R6/lib        \ | 
|---|
| 2465 | /usr/X11R5/lib        \ | 
|---|
| 2466 | /usr/X11R4/lib        \ | 
|---|
| 2467 | \ | 
|---|
| 2468 | /usr/lib/X11          \ | 
|---|
| 2469 | /usr/lib/X11R6        \ | 
|---|
| 2470 | /usr/lib/X11R5        \ | 
|---|
| 2471 | /usr/lib/X11R4        \ | 
|---|
| 2472 | \ | 
|---|
| 2473 | /usr/local/X11/lib    \ | 
|---|
| 2474 | /usr/local/X11R6/lib  \ | 
|---|
| 2475 | /usr/local/X11R5/lib  \ | 
|---|
| 2476 | /usr/local/X11R4/lib  \ | 
|---|
| 2477 | \ | 
|---|
| 2478 | /usr/local/lib/X11    \ | 
|---|
| 2479 | /usr/local/lib/X11R6  \ | 
|---|
| 2480 | /usr/local/lib/X11R5  \ | 
|---|
| 2481 | /usr/local/lib/X11R4  \ | 
|---|
| 2482 | \ | 
|---|
| 2483 | /usr/X386/lib         \ | 
|---|
| 2484 | /usr/x386/lib         \ | 
|---|
| 2485 | /usr/XFree86/lib/X11  \ | 
|---|
| 2486 | \ | 
|---|
| 2487 | /usr/lib              \ | 
|---|
| 2488 | /usr/local/lib        \ | 
|---|
| 2489 | /usr/unsupported/lib  \ | 
|---|
| 2490 | /usr/athena/lib       \ | 
|---|
| 2491 | /usr/local/x11r5/lib  \ | 
|---|
| 2492 | /usr/lpp/Xamples/lib  \ | 
|---|
| 2493 | /lib/usr/lib/X11      \ | 
|---|
| 2494 | \ | 
|---|
| 2495 | /usr/openwin/lib      \ | 
|---|
| 2496 | /usr/openwin/share/lib \ | 
|---|
| 2497 | ; \ | 
|---|
| 2498 | do | 
|---|
| 2499 | dnl Don't even attempt the hair of trying to link an X program! | 
|---|
| 2500 | for ac_extension in a so sl; do | 
|---|
| 2501 | if test -r $ac_dir/${ac_cv_libpre}${x_direct_test_library}.$ac_extension; then | 
|---|
| 2502 | ac_x_libraries=$ac_dir | 
|---|
| 2503 | break 2 | 
|---|
| 2504 | fi | 
|---|
| 2505 | done | 
|---|
| 2506 | done]) | 
|---|
| 2507 | fi # $ac_x_libraries = NO | 
|---|
| 2508 | ]) | 
|---|
| 2509 |  | 
|---|
| 2510 | dnl Find additional X libraries, magic flags, etc. | 
|---|
| 2511 | AC_DEFUN(AC_PATH_XTRA, | 
|---|
| 2512 | [AC_REQUIRE([AC_PATH_X])dnl | 
|---|
| 2513 | if test "$no_x" = yes; then | 
|---|
| 2514 | # Not all programs may use this symbol, but it does not hurt to define it. | 
|---|
| 2515 | AC_DEFINE(X_DISPLAY_MISSING) | 
|---|
| 2516 | X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= | 
|---|
| 2517 | else | 
|---|
| 2518 | if test -n "$x_includes"; then | 
|---|
| 2519 | X_CFLAGS="$X_CFLAGS -I$x_includes" | 
|---|
| 2520 | fi | 
|---|
| 2521 | test -n "$x_includes" && CPPFLAGS="$CPPFLAGS -I$x_includes" | 
|---|
| 2522 |  | 
|---|
| 2523 | # It would also be nice to do this for all -L options, not just this one. | 
|---|
| 2524 | if test -n "$x_libraries"; then | 
|---|
| 2525 | X_LIBS="$X_LIBS -L$x_libraries" | 
|---|
| 2526 | dnl FIXME banish uname from this macro! | 
|---|
| 2527 | # For Solaris; some versions of Sun CC require a space after -R and | 
|---|
| 2528 | # others require no space.  Words are not sufficient . . . . | 
|---|
| 2529 | case "`(uname -sr) 2>/dev/null`" in | 
|---|
| 2530 | "SunOS 5"*) | 
|---|
| 2531 | AC_MSG_CHECKING(whether -R must be followed by a space) | 
|---|
| 2532 | ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" | 
|---|
| 2533 | AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no) | 
|---|
| 2534 | if test $ac_R_nospace = yes; then | 
|---|
| 2535 | AC_MSG_RESULT(no) | 
|---|
| 2536 | X_LIBS="$X_LIBS -R$x_libraries" | 
|---|
| 2537 | else | 
|---|
| 2538 | LIBS="$ac_xsave_LIBS -R $x_libraries" | 
|---|
| 2539 | AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no) | 
|---|
| 2540 | if test $ac_R_space = yes; then | 
|---|
| 2541 | AC_MSG_RESULT(yes) | 
|---|
| 2542 | X_LIBS="$X_LIBS -R $x_libraries" | 
|---|
| 2543 | else | 
|---|
| 2544 | AC_MSG_RESULT(neither works) | 
|---|
| 2545 | fi | 
|---|
| 2546 | fi | 
|---|
| 2547 | LIBS="$ac_xsave_LIBS" | 
|---|
| 2548 | esac | 
|---|
| 2549 | fi | 
|---|
| 2550 |  | 
|---|
| 2551 | # Check for system-dependent libraries X programs must link with. | 
|---|
| 2552 | # Do this before checking for the system-independent R6 libraries | 
|---|
| 2553 | # (-lICE), since we may need -lsocket or whatever for X linking. | 
|---|
| 2554 |  | 
|---|
| 2555 | if test "$ISC" = yes; then | 
|---|
| 2556 | X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" | 
|---|
| 2557 | else | 
|---|
| 2558 | # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X | 
|---|
| 2559 | # libraries were built with DECnet support.  And karl@cs.umb.edu says | 
|---|
| 2560 | # the Alpha needs dnet_stub (dnet does not exist). | 
|---|
| 2561 | AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) | 
|---|
| 2562 | if test $ac_cv_lib_dnet_dnet_ntoa = no; then | 
|---|
| 2563 | AC_CHECK_LIB(dnet_stub, dnet_ntoa, | 
|---|
| 2564 | [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) | 
|---|
| 2565 | fi | 
|---|
| 2566 |  | 
|---|
| 2567 | # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, | 
|---|
| 2568 | # to get the SysV transport functions. | 
|---|
| 2569 | # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) | 
|---|
| 2570 | # needs -lnsl. | 
|---|
| 2571 | # The nsl library prevents programs from opening the X display | 
|---|
| 2572 | # on Irix 5.2, according to dickey@clark.net. | 
|---|
| 2573 | AC_CHECK_FUNC(gethostbyname) | 
|---|
| 2574 | if test $ac_cv_func_gethostbyname = no; then | 
|---|
| 2575 | AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") | 
|---|
| 2576 | fi | 
|---|
| 2577 |  | 
|---|
| 2578 | # lieder@skyler.mavd.honeywell.com says without -lsocket, | 
|---|
| 2579 | # socket/setsockopt and other routines are undefined under SCO ODT | 
|---|
| 2580 | # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary | 
|---|
| 2581 | # on later versions), says simon@lia.di.epfl.ch: it contains | 
|---|
| 2582 | # gethostby* variants that don't use the nameserver (or something). | 
|---|
| 2583 | # -lsocket must be given before -lnsl if both are needed. | 
|---|
| 2584 | # We assume that if connect needs -lnsl, so does gethostbyname. | 
|---|
| 2585 | AC_CHECK_FUNC(connect) | 
|---|
| 2586 | if test $ac_cv_func_connect = no; then | 
|---|
| 2587 | AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , | 
|---|
| 2588 | $X_EXTRA_LIBS) | 
|---|
| 2589 | fi | 
|---|
| 2590 |  | 
|---|
| 2591 | # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. | 
|---|
| 2592 | AC_CHECK_FUNC(remove) | 
|---|
| 2593 | if test $ac_cv_func_remove = no; then | 
|---|
| 2594 | AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") | 
|---|
| 2595 | fi | 
|---|
| 2596 |  | 
|---|
| 2597 | # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. | 
|---|
| 2598 | AC_CHECK_FUNC(shmat) | 
|---|
| 2599 | if test $ac_cv_func_shmat = no; then | 
|---|
| 2600 | AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc") | 
|---|
| 2601 | fi | 
|---|
| 2602 | # XFree86/OS2 | 
|---|
| 2603 | if test $ac_cv_func_shmat = no; then | 
|---|
| 2604 | AC_CHECK_LIB(shm, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lshm") | 
|---|
| 2605 | fi | 
|---|
| 2606 | fi | 
|---|
| 2607 |  | 
|---|
| 2608 | # Check for libraries that X11R6 Xt/Xaw programs need. | 
|---|
| 2609 | ac_save_LDFLAGS="$LDFLAGS" | 
|---|
| 2610 | test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" | 
|---|
| 2611 | # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to | 
|---|
| 2612 | # check for ICE first), but we must link in the order -lSM -lICE or | 
|---|
| 2613 | # we get undefined symbols.  So assume we have SM if we have ICE. | 
|---|
| 2614 | # These have to be linked with before -lX11, unlike the other | 
|---|
| 2615 | # libraries we check for below, so use a different variable. | 
|---|
| 2616 | #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu. | 
|---|
| 2617 | AC_CHECK_LIB(ICE, IceConnectionNumber, | 
|---|
| 2618 | [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS) | 
|---|
| 2619 | LDFLAGS="$ac_save_LDFLAGS" | 
|---|
| 2620 |  | 
|---|
| 2621 | fi | 
|---|
| 2622 | AC_SUBST(X_CFLAGS)dnl | 
|---|
| 2623 | AC_SUBST(X_PRE_LIBS)dnl | 
|---|
| 2624 | AC_SUBST(X_LIBS)dnl | 
|---|
| 2625 | AC_SUBST(X_EXTRA_LIBS)dnl | 
|---|
| 2626 | ]) | 
|---|
| 2627 |  | 
|---|
| 2628 | dnl The old Cygwin32 macro is deprecated. | 
|---|
| 2629 | AC_DEFUN(AC_CYGWIN32, | 
|---|
| 2630 | [AC_OBSOLETE([$0], [; instead use AC_CYGWIN])dnl | 
|---|
| 2631 | AC_CYGWIN]) | 
|---|
| 2632 |  | 
|---|
| 2633 | dnl Check for Cygwin.  This is a way to set the right value for | 
|---|
| 2634 | dnl EXEEXT. | 
|---|
| 2635 | AC_DEFUN(AC_CYGWIN, | 
|---|
| 2636 | [AC_CACHE_CHECK(for Cygwin environment, ac_cv_cygwin, | 
|---|
| 2637 | [AC_TRY_COMPILE(,[ | 
|---|
| 2638 | #ifndef __CYGWIN__ | 
|---|
| 2639 | #define __CYGWIN__ __CYGWIN32__ | 
|---|
| 2640 | #endif | 
|---|
| 2641 | return __CYGWIN__;], | 
|---|
| 2642 | ac_cv_cygwin=yes, ac_cv_cygwin=no) | 
|---|
| 2643 | rm -f conftest*]) | 
|---|
| 2644 | CYGWIN= | 
|---|
| 2645 | test "$ac_cv_cygwin" = yes && CYGWIN=yes]) | 
|---|
| 2646 |  | 
|---|
| 2647 | dnl Check for mingw32.  This is another way to set the right value for | 
|---|
| 2648 | dnl EXEEXT. | 
|---|
| 2649 | AC_DEFUN(AC_MINGW32, | 
|---|
| 2650 | [AC_CACHE_CHECK(for mingw32 environment, ac_cv_mingw32, | 
|---|
| 2651 | [AC_TRY_COMPILE(,[return __MINGW32__;], | 
|---|
| 2652 | ac_cv_mingw32=yes, ac_cv_mingw32=no) | 
|---|
| 2653 | rm -f conftest*]) | 
|---|
| 2654 | MINGW32= | 
|---|
| 2655 | test "$ac_cv_mingw32" = yes && MINGW32=yes]) | 
|---|
| 2656 |  | 
|---|
| 2657 | dnl Check for EMX/OS2.  This is another way to set the right value for | 
|---|
| 2658 | dnl EXEEXT. | 
|---|
| 2659 | AC_DEFUN(AC_EMXOS2, | 
|---|
| 2660 | [AC_CACHE_CHECK(for EMX/OS2 environment, ac_cv_emxos2, | 
|---|
| 2661 | [: ${CC=gcc.exe} | 
|---|
| 2662 | AC_TRY_COMPILE(,[return __EMX__;], | 
|---|
| 2663 | ac_cv_emxos2=yes, ac_cv_emxos2=no) | 
|---|
| 2664 | rm -f conftest*]) | 
|---|
| 2665 | AC_CACHE_VAL(ac_cv_libpre, | 
|---|
| 2666 | if test "$ac_cv_emxos2" = yes ; then | 
|---|
| 2667 | ac_cv_libpre= | 
|---|
| 2668 | else | 
|---|
| 2669 | ac_cv_libpre=lib | 
|---|
| 2670 | fi | 
|---|
| 2671 | ) | 
|---|
| 2672 | EMXOS2= | 
|---|
| 2673 | test "$ac_cv_emxos2" = yes && EMXOS2=yes]) | 
|---|
| 2674 |  | 
|---|
| 2675 | dnl Check for the extension used for executables.  This knows that we | 
|---|
| 2676 | dnl add .exe for Cygwin or mingw32.  Otherwise, it compiles a test | 
|---|
| 2677 | dnl executable.  If this is called, the executable extensions will be | 
|---|
| 2678 | dnl automatically used by link commands run by the configure script. | 
|---|
| 2679 | AC_DEFUN(AC_EXEEXT, | 
|---|
| 2680 | [AC_REQUIRE([AC_CYGWIN]) | 
|---|
| 2681 | AC_REQUIRE([AC_MINGW32]) | 
|---|
| 2682 | AC_REQUIRE([AC_EMXOS2]) | 
|---|
| 2683 | AC_MSG_CHECKING([for executable suffix]) | 
|---|
| 2684 | AC_CACHE_VAL(ac_cv_exeext, | 
|---|
| 2685 | [if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = yes; then | 
|---|
| 2686 | ac_cv_exeext=.exe | 
|---|
| 2687 | else | 
|---|
| 2688 | rm -f conftest* | 
|---|
| 2689 | echo 'int main () { return 0; }' > conftest.$ac_ext | 
|---|
| 2690 | ac_cv_exeext= | 
|---|
| 2691 | if AC_TRY_EVAL(ac_link); then | 
|---|
| 2692 | for file in conftest.*; do | 
|---|
| 2693 | case $file in | 
|---|
| 2694 | *.c | *.o | *.obj) ;; | 
|---|
| 2695 | *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; | 
|---|
| 2696 | esac | 
|---|
| 2697 | done | 
|---|
| 2698 | else | 
|---|
| 2699 | AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.]) | 
|---|
| 2700 | fi | 
|---|
| 2701 | rm -f conftest* | 
|---|
| 2702 | test x"${ac_cv_exeext}" = x && ac_cv_exeext=no | 
|---|
| 2703 | fi]) | 
|---|
| 2704 | EXEEXT="" | 
|---|
| 2705 | test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} | 
|---|
| 2706 | AC_MSG_RESULT(${ac_cv_exeext}) | 
|---|
| 2707 | dnl Setting ac_exeext will implicitly change the ac_link command. | 
|---|
| 2708 | ac_exeext=$EXEEXT | 
|---|
| 2709 | AC_SUBST(EXEEXT)]) | 
|---|
| 2710 |  | 
|---|
| 2711 |  | 
|---|
| 2712 | dnl set PATH_IFS | 
|---|
| 2713 | AC_DEFUN(AC_PATHIFS, | 
|---|
| 2714 | [AC_MSG_CHECKING([for path separator]) | 
|---|
| 2715 | # Filter path to get backslahes into forwardslashes | 
|---|
| 2716 | case "`uname -s 2> /dev/null`" in | 
|---|
| 2717 | OS/2) | 
|---|
| 2718 | PATH=`echo -E "$PATH" | sed 's+\\\\+/+g'` | 
|---|
| 2719 | PATH_IFS=';' | 
|---|
| 2720 | ;; | 
|---|
| 2721 | *) | 
|---|
| 2722 | PATH_IFS=':' | 
|---|
| 2723 | ;; | 
|---|
| 2724 | esac | 
|---|
| 2725 | AC_MSG_RESULT(${PATH_IFS}) | 
|---|
| 2726 | AC_SUBST(PATH_IFS)]) | 
|---|
| 2727 |  | 
|---|
| 2728 | dnl Reformat a explicit path, so that it only shows '/' | 
|---|
| 2729 | dnl Care is needed: it cannot be used in a '...' expression. | 
|---|
| 2730 | define([AC_FORMAT_PATH],[`echo -E "$1" | sed 's+\\\\+/+g'`]) | 
|---|
| 2731 |  | 
|---|
| 2732 |  | 
|---|
| 2733 | dnl ### Checks for UNIX variants | 
|---|
| 2734 | dnl These are kludges which should be replaced by a single POSIX check. | 
|---|
| 2735 | dnl They aren't cached, to discourage their use. | 
|---|
| 2736 |  | 
|---|
| 2737 |  | 
|---|
| 2738 | AC_DEFUN(AC_AIX, | 
|---|
| 2739 | [AC_BEFORE([$0], [AC_TRY_COMPILE])dnl | 
|---|
| 2740 | AC_BEFORE([$0], [AC_TRY_RUN])dnl | 
|---|
| 2741 | AC_MSG_CHECKING(for AIX) | 
|---|
| 2742 | AC_EGREP_CPP(yes, | 
|---|
| 2743 | [#ifdef _AIX | 
|---|
| 2744 | yes | 
|---|
| 2745 | #endif | 
|---|
| 2746 | ], [AC_MSG_RESULT(yes); AC_DEFINE(_ALL_SOURCE)], AC_MSG_RESULT(no)) | 
|---|
| 2747 | ]) | 
|---|
| 2748 |  | 
|---|
| 2749 | AC_DEFUN(AC_MINIX, | 
|---|
| 2750 | [AC_BEFORE([$0], [AC_TRY_COMPILE])dnl | 
|---|
| 2751 | AC_BEFORE([$0], [AC_TRY_RUN])dnl | 
|---|
| 2752 | AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=) | 
|---|
| 2753 | if test "$MINIX" = yes; then | 
|---|
| 2754 | AC_DEFINE(_POSIX_SOURCE) | 
|---|
| 2755 | AC_DEFINE(_POSIX_1_SOURCE, 2) | 
|---|
| 2756 | AC_DEFINE(_MINIX) | 
|---|
| 2757 | fi | 
|---|
| 2758 | ]) | 
|---|
| 2759 |  | 
|---|
| 2760 | AC_DEFUN(AC_ISC_POSIX, | 
|---|
| 2761 | [AC_REQUIRE([AC_PROG_CC])dnl | 
|---|
| 2762 | AC_BEFORE([$0], [AC_TRY_COMPILE])dnl | 
|---|
| 2763 | AC_BEFORE([$0], [AC_TRY_RUN])dnl | 
|---|
| 2764 | AC_MSG_CHECKING(for POSIXized ISC) | 
|---|
| 2765 | if test -d /etc/conf/kconfig.d && | 
|---|
| 2766 | grep _POSIX_VERSION [/usr/include/sys/unistd.h] >/dev/null 2>&1 | 
|---|
| 2767 | then | 
|---|
| 2768 | AC_MSG_RESULT(yes) | 
|---|
| 2769 | ISC=yes # If later tests want to check for ISC. | 
|---|
| 2770 | AC_DEFINE(_POSIX_SOURCE) | 
|---|
| 2771 | if test "$GCC" = yes; then | 
|---|
| 2772 | CC="$CC -posix" | 
|---|
| 2773 | else | 
|---|
| 2774 | CC="$CC -Xp" | 
|---|
| 2775 | fi | 
|---|
| 2776 | else | 
|---|
| 2777 | AC_MSG_RESULT(no) | 
|---|
| 2778 | ISC= | 
|---|
| 2779 | fi | 
|---|
| 2780 | ]) | 
|---|
| 2781 |  | 
|---|
| 2782 | AC_DEFUN(AC_XENIX_DIR, | 
|---|
| 2783 | [AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl | 
|---|
| 2784 | AC_REQUIRE([AC_DIR_HEADER])dnl | 
|---|
| 2785 | AC_MSG_CHECKING(for Xenix) | 
|---|
| 2786 | AC_EGREP_CPP(yes, | 
|---|
| 2787 | [#if defined(M_XENIX) && !defined(M_UNIX) | 
|---|
| 2788 | yes | 
|---|
| 2789 | #endif | 
|---|
| 2790 | ], [AC_MSG_RESULT(yes); XENIX=yes], [AC_MSG_RESULT(no); XENIX=]) | 
|---|
| 2791 | if test "$XENIX" = yes; then | 
|---|
| 2792 | # Make sure -ldir precedes -lx. | 
|---|
| 2793 | test $ac_header_dirent = dirent.h && LIBS="-ldir $LIBS" | 
|---|
| 2794 | LIBS="$LIBS -lx" | 
|---|
| 2795 | fi | 
|---|
| 2796 | ]) | 
|---|
| 2797 |  | 
|---|
| 2798 | AC_DEFUN(AC_DYNIX_SEQ, | 
|---|
| 2799 | [AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT])dnl | 
|---|
| 2800 | AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS") | 
|---|
| 2801 | ]) | 
|---|
| 2802 |  | 
|---|
| 2803 | AC_DEFUN(AC_IRIX_SUN, | 
|---|
| 2804 | [AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT or AC_CHECK_LIB(sun, getpwnam)])dnl | 
|---|
| 2805 | AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS") | 
|---|
| 2806 | ]) | 
|---|
| 2807 |  | 
|---|
| 2808 | AC_DEFUN(AC_SCO_INTL, | 
|---|
| 2809 | [AC_OBSOLETE([$0], [; instead use AC_FUNC_STRFTIME])dnl | 
|---|
| 2810 | AC_CHECK_LIB(intl, strftime, LIBS="-lintl $LIBS") | 
|---|
| 2811 | ]) | 
|---|