1dnl ######################################################################
2dnl check for external definition for an LDAP function (not external variables)
3dnl Usage AMU_CHECK_EXTERN_LDAP(extern)
4dnl Checks for external definition for "extern" that is delimited on the
5dnl left and the right by a character that is not a valid symbol character.
6dnl
7dnl Note that $pattern below is very carefully crafted to match any system
8dnl external definition, with __P posix prototypes, with or without an extern
9dnl word, etc.  Think twice before changing this.
10AC_DEFUN([AMU_CHECK_EXTERN_LDAP],
11[
12# store variable name for external definition
13ac_upcase_extern_name=`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
14ac_safe=HAVE_EXTERN_$ac_upcase_extern_name
15# check for cached value and set it if needed
16AMU_CACHE_CHECK_DYNAMIC(external function definition for $1,
17ac_cv_extern_$1,
18[
19# the old pattern assumed that the complete external definition is on one
20# line but on some systems it is split over several lines, so only match
21# beginning of the extern definition including the opening parenthesis.
22#pattern="(extern)?.*[^a-zA-Z0-9_]$1[^a-zA-Z0-9_]?.*\(.*\).*;"
23dnl This expression is a bit different than check_extern.m4 because of the
24dnl way that openldap wrote their externs in <ldap.h>.
25pattern="(extern)?.*([[^a-zA-Z0-9_]])?$1[[^a-zA-Z0-9_]]?.*\("
26AC_EGREP_CPP(${pattern},
27[
28#ifdef HAVE_SYS_TYPES_H
29# include <sys/types.h>
30#endif /* HAVE_SYS_TYPES_H */
31#ifdef HAVE_SYS_WAIT_H
32# include <sys/wait.h>
33#endif /* HAVE_SYS_WAIT_H */
34#if TIME_WITH_SYS_TIME
35# include <sys/time.h>
36# include <time.h>
37#else /* not TIME_WITH_SYS_TIME */
38# if HAVE_SYS_TIME_H
39#  include <sys/time.h>
40# else /* not HAVE_SYS_TIME_H */
41#  include <time.h>
42# endif /* not HAVE_SYS_TIME_H */
43#endif /* not TIME_WITH_SYS_TIME */
44
45#ifdef HAVE_STDIO_H
46# include <stdio.h>
47#endif /* HAVE_STDIO_H */
48#ifdef HAVE_STDLIB_H
49# include <stdlib.h>
50#endif /* HAVE_STDLIB_H */
51#if HAVE_UNISTD_H
52# include <unistd.h>
53#endif /* HAVE_UNISTD_H */
54#if HAVE_STRING_H
55# include <string.h>
56#endif /* HAVE_STRING_H */
57#ifdef HAVE_STRINGS_H
58# include <strings.h>
59#endif /* HAVE_STRINGS_H */
60#ifdef HAVE_NETDB_H
61# include <netdb.h>
62#endif /* HAVE_NETDB_H */
63#ifdef HAVE_CLUSTER_H
64# include <cluster.h>
65#endif /* HAVE_CLUSTER_H */
66#ifdef HAVE_RPC_RPC_H
67/*
68 * Turn on PORTMAP, so that additional header files would get included
69 * and the important definition for UDPMSGSIZE is included too.
70 */
71# ifndef PORTMAP
72#  define PORTMAP
73# endif /* not PORTMAP */
74# include <rpc/rpc.h>
75# ifndef XDRPROC_T_TYPE
76typedef bool_t (*xdrproc_t) __P ((XDR *, __ptr_t, ...));
77# endif /* not XDRPROC_T_TYPE */
78#endif /* HAVE_RPC_RPC_H */
79
80#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP)
81# include <tcpd.h>
82#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */
83
84#ifdef HAVE_LDAP_H
85# include <ldap.h>
86#endif /* HAVE_LDAP_H */
87#ifdef HAVE_LBER_H
88# include <lber.h>
89#endif /* HAVE_LBER_H */
90
91], eval "ac_cv_extern_$1=yes", eval "ac_cv_extern_$1=no")
92])
93# check if need to define variable
94if test "`eval echo '$''{ac_cv_extern_'$1'}'`" = yes
95then
96  AC_DEFINE_UNQUOTED($ac_safe)
97fi
98])
99dnl ======================================================================
100