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