1dnl Copyright (C) 1993-2003 Free Software Foundation, Inc. 2dnl This file is free software, distributed under the terms of the GNU 3dnl General Public License. As a special exception to the GNU General 4dnl Public License, this file may be distributed as part of a program 5dnl that contains a configuration script generated by Autoconf, under 6dnl the same distribution terms as the rest of that program. 7 8dnl From Bruno Haible, Marcus Daniels, Sam Steingold. 9 10AC_PREREQ(2.13) 11 12dnl without AC_MSG_...: with AC_MSG_... and caching: 13dnl AC_TRY_CPP CL_CPP_CHECK 14dnl AC_TRY_COMPILE CL_COMPILE_CHECK 15dnl AC_TRY_LINK CL_LINK_CHECK 16dnl AC_TRY_RUN CL_RUN_CHECK - would require cross-compiling support 17dnl Usage: 18dnl AC_TRY_CPP(INCLUDES, 19dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) 20dnl CL_CPP_CHECK(ECHO-TEXT, CACHE-ID, 21dnl INCLUDES, 22dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) 23dnl AC_TRY_xxx(INCLUDES, FUNCTION-BODY, 24dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) 25dnl CL_xxx_CHECK(ECHO-TEXT, CACHE-ID, 26dnl INCLUDES, FUNCTION-BODY, 27dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) 28 29AC_DEFUN([CL_CPP_CHECK], 30[AC_MSG_CHECKING(for $1) 31AC_CACHE_VAL($2,[ 32AC_TRY_CPP([$3], $2=yes, $2=no) 33]) 34AC_MSG_RESULT([$]$2) 35if test [$]$2 = yes; then 36 ifelse([$4], , :, [$4]) 37ifelse([$5], , , [else 38 $5 39])dnl 40fi 41]) 42 43AC_DEFUN([CL_COMPILE_CHECK], 44[AC_MSG_CHECKING(for $1) 45AC_CACHE_VAL($2,[ 46AC_TRY_COMPILE([$3],[$4], $2=yes, $2=no) 47]) 48AC_MSG_RESULT([$]$2) 49if test [$]$2 = yes; then 50 ifelse([$5], , :, [$5]) 51ifelse([$6], , , [else 52 $6 53])dnl 54fi 55]) 56 57AC_DEFUN([CL_LINK_CHECK], 58[AC_MSG_CHECKING(for $1) 59AC_CACHE_VAL($2,[ 60AC_TRY_LINK([$3],[$4], $2=yes, $2=no) 61]) 62AC_MSG_RESULT([$]$2) 63if test [$]$2 = yes; then 64 ifelse([$5], , :, [$5]) 65ifelse([$6], , , [else 66 $6 67])dnl 68fi 69]) 70 71dnl CL_SILENT(ACTION) 72dnl performs ACTION, with AC_MSG_CHECKING and AC_MSG_RESULT being defined away. 73AC_DEFUN([CL_SILENT], 74[pushdef([AC_MSG_CHECKING],[:])dnl 75pushdef([AC_CHECKING],[:])dnl 76pushdef([AC_MSG_RESULT],[:])dnl 77$1[]dnl 78popdef([AC_MSG_RESULT])dnl 79popdef([AC_CHECKING])dnl 80popdef([AC_MSG_CHECKING])dnl 81]) 82 83dnl Expands to the "extern ..." prefix used for system declarations. 84dnl AC_LANG_EXTERN() 85AC_DEFUN([AC_LANG_EXTERN], 86[extern 87#ifdef __cplusplus 88"C" 89#endif 90]) 91 92AC_DEFUN([CL_CC_WORKS], 93[AC_CACHE_CHECK(whether CC works at all, cl_cv_prog_cc_works, [ 94AC_LANG_SAVE() 95AC_LANG_C() 96AC_TRY_RUN([int main() { exit(0); }], 97cl_cv_prog_cc_works=yes, cl_cv_prog_cc_works=no, 98AC_TRY_LINK([], [], cl_cv_prog_cc_works=yes, cl_cv_prog_cc_works=no)) 99AC_LANG_RESTORE() 100]) 101case "$cl_cv_prog_cc_works" in 102 *no) echo "Installation or configuration problem: C compiler cannot create executables."; exit 1;; 103 *yes) ;; 104esac 105]) 106