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