Update.
[bpt/guile.git] / acinclude.m4
1 dnl On the NeXT, #including <utime.h> doesn't give you a definition for
2 dnl struct utime, unless you #define _POSIX_SOURCE.
3
4 AC_DEFUN(GUILE_STRUCT_UTIMBUF, [
5 AC_CACHE_CHECK([whether we need POSIX to get struct utimbuf],
6 guile_cv_struct_utimbuf_needs_posix,
7 [AC_TRY_CPP([
8 #ifdef __EMX__
9 #include <sys/utime.h>
10 #else
11 #include <utime.h>
12 #endif
13 struct utime blah;
14 ],
15 guile_cv_struct_utimbuf_needs_posix=no,
16 guile_cv_struct_utimbuf_needs_posix=yes)])
17 if test "$guile_cv_struct_utimbuf_needs_posix" = yes; then
18 AC_DEFINE([UTIMBUF_NEEDS_POSIX], 1,
19 [Define this if <utime.h> doesn't define struct utimbuf unless
20 _POSIX_SOURCE is defined. See GUILE_STRUCT_UTIMBUF in aclocal.m4.])
21 fi])
22
23
24
25
26 dnl
27 dnl Apparently, at CMU they have a weird version of libc.h that is
28 dnl installed in /usr/local/include and conflicts with unistd.h.
29 dnl In these situations, we should not #include libc.h.
30 dnl This test arranges to #define LIBC_H_WITH_UNISTD_H iff libc.h is
31 dnl present on the system, and is safe to #include.
32 dnl
33 AC_DEFUN([GUILE_HEADER_LIBC_WITH_UNISTD],
34 [
35 AC_CHECK_HEADERS(libc.h unistd.h)
36 AC_CACHE_CHECK(
37 [whether libc.h and unistd.h can be included together],
38 guile_cv_header_libc_with_unistd,
39 [
40 if test "$ac_cv_header_libc_h" = "no"; then
41 guile_cv_header_libc_with_unistd="no"
42 elif test "$ac_cv_header_unistd_h" = "no"; then
43 guile_cv_header_libc_with_unistd="yes"
44 else
45 AC_TRY_COMPILE(
46 [
47 # include <libc.h>
48 # include <unistd.h>
49 ],
50 [],
51 [guile_cv_header_libc_with_unistd=yes],
52 [guile_cv_header_libc_with_unistd=no]
53 )
54 fi
55 ]
56 )
57 if test "$guile_cv_header_libc_with_unistd" = yes; then
58 AC_DEFINE(LIBC_H_WITH_UNISTD_H, 1,
59 [Define this if we should include <libc.h> when we've already
60 included <unistd.h>. On some systems, they conflict, and libc.h
61 should be omitted. See GUILE_HEADER_LIBC_WITH_UNISTD in
62 aclocal.m4.])
63 fi
64 ]
65 )
66
67
68
69 dnl This is needed when we want to check for the same function repeatedly
70 dnl with other parameters, such as libraries, varying.
71 dnl
72 dnl GUILE_NAMED_CHECK_FUNC(FUNCTION, TESTNAME,
73 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
74 AC_DEFUN(GUILE_NAMED_CHECK_FUNC,
75 [AC_MSG_CHECKING([for $1])
76 AC_CACHE_VAL(ac_cv_func_$1_$2,
77 [AC_TRY_LINK(
78 dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
79 dnl which includes <sys/select.h> which contains a prototype for
80 dnl select. Similarly for bzero.
81 [/* System header to define __stub macros and hopefully few prototypes,
82 which can conflict with char $1(); below. */
83 #include <assert.h>
84 /* Override any gcc2 internal prototype to avoid an error. */
85 #ifdef __cplusplus
86 extern "C"
87 #endif
88 /* We use char because int might match the return type of a gcc2
89 builtin and then its argument prototype would still apply. */
90 char $1();
91 ], [
92 /* The GNU C library defines this for functions which it implements
93 to always fail with ENOSYS. Some functions are actually named
94 something starting with __ and the normal name is an alias. */
95 #if defined (__stub_$1) || defined (__stub___$1)
96 choke me
97 #else
98 $1();
99 #endif
100 ], eval "ac_cv_func_$1_$2=yes", eval "ac_cv_func_$1_$2=no")])
101 if eval "test \"`echo '$ac_cv_func_'$1'_'$2`\" = yes"; then
102 AC_MSG_RESULT(yes)
103 ifelse([$3], , :, [$3])
104 else
105 AC_MSG_RESULT(no)
106 ifelse([$4], , , [$4
107 ])dnl
108 fi
109 ])