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