]> git.sur5r.net Git - openldap/blob - aclocal.m4
bc90b3559824b134ea41afde04ed50183b7b8ab8
[openldap] / aclocal.m4
1 dnl --------------------------------------------------------------------
2 dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
3 dnl values.
4 dnl
5 dnl Parameters:
6 dnl $1 = option name
7 dnl $2 = help-string
8 dnl $3 = action to perform if option is not default
9 dnl $4 = action if perform if option is default
10 dnl $5 = default option value (either 'yes' or 'no')
11 AC_DEFUN([CF_ARG_OPTION],
12 [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
13   if test "$enableval" != "$5" ; then
14 ifelse($3,,[    :]dnl
15 ,[    $3]) ifelse($4,,,[
16   else
17     $4])
18   fi],[enableval=$5 ifelse($4,,,[
19   $4
20 ])dnl
21   ])])dnl
22 dnl --------------------------------------------------------------------
23 dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
24 dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
25 dnl Reported by Keith Bostic.
26 AC_DEFUN([CF_SYS_ERRLIST],
27 [
28 AC_MSG_CHECKING([declaration of sys_errlist])
29 AC_CACHE_VAL(cf_cv_dcl_sys_errlist,[
30         AC_TRY_COMPILE([
31 #include <stdio.h>
32 #include <sys/types.h>
33 #include <errno.h> ],
34         [char *c = (char *) *sys_errlist],
35         [cf_cv_dcl_sys_errlist=yes],
36         [cf_cv_dcl_sys_errlist=no])])
37 AC_MSG_RESULT($cf_cv_dcl_sys_errlist)
38
39 # It's possible (for near-UNIX clones) that sys_errlist doesn't exist
40 if test $cf_cv_dcl_sys_errlist = no ; then
41         AC_DEFINE(DECL_SYS_ERRLIST)
42         AC_MSG_CHECKING([existence of sys_errlist])
43         AC_CACHE_VAL(cf_cv_have_sys_errlist,[
44                 AC_TRY_LINK([#include <errno.h>],
45                         [char *c = (char *) *sys_errlist],
46                         [cf_cv_have_sys_errlist=yes],
47                         [cf_cv_have_sys_errlist=no])])
48         AC_MSG_RESULT($cf_cv_have_sys_errlist)
49 fi
50 ])dnl