1*a53f50b9Schristosdnl ###################################################################### 2*a53f50b9Schristosdnl check for external definition for a function (not external variables) 3*a53f50b9Schristosdnl Usage AMU_CHECK_EXTERN(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], 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*a53f50b9Schristospattern="(extern)?.*[[^a-zA-Z0-9_]]$1[[^a-zA-Z0-9_]]?.*\(" 24*a53f50b9SchristosAC_EGREP_CPP(${pattern}, 25*a53f50b9Schristos[ 26*a53f50b9Schristos#ifdef HAVE_SYS_TYPES_H 27*a53f50b9Schristos# include <sys/types.h> 28*a53f50b9Schristos#endif /* HAVE_SYS_TYPES_H */ 29*a53f50b9Schristos#ifdef HAVE_SYS_WAIT_H 30*a53f50b9Schristos# include <sys/wait.h> 31*a53f50b9Schristos#endif /* HAVE_SYS_WAIT_H */ 32*a53f50b9Schristos#if TIME_WITH_SYS_TIME 33*a53f50b9Schristos# include <sys/time.h> 34*a53f50b9Schristos# include <time.h> 35*a53f50b9Schristos#else /* not TIME_WITH_SYS_TIME */ 36*a53f50b9Schristos# if HAVE_SYS_TIME_H 37*a53f50b9Schristos# include <sys/time.h> 38*a53f50b9Schristos# else /* not HAVE_SYS_TIME_H */ 39*a53f50b9Schristos# include <time.h> 40*a53f50b9Schristos# endif /* not HAVE_SYS_TIME_H */ 41*a53f50b9Schristos#endif /* not TIME_WITH_SYS_TIME */ 42*a53f50b9Schristos 43*a53f50b9Schristos#if defined(_AIX) && defined(HAVE_SYS_VMOUNT_H) 44*a53f50b9Schristos# include <sys/vmount.h> 45*a53f50b9Schristos#endif /* defined(_AIX) && defined(HAVE_SYS_VMOUNT_H) */ 46*a53f50b9Schristos 47*a53f50b9Schristos#ifdef HAVE_STDIO_H 48*a53f50b9Schristos# include <stdio.h> 49*a53f50b9Schristos#endif /* HAVE_STDIO_H */ 50*a53f50b9Schristos#ifdef HAVE_STDLIB_H 51*a53f50b9Schristos# include <stdlib.h> 52*a53f50b9Schristos#endif /* HAVE_STDLIB_H */ 53*a53f50b9Schristos#if HAVE_UNISTD_H 54*a53f50b9Schristos# include <unistd.h> 55*a53f50b9Schristos#endif /* HAVE_UNISTD_H */ 56*a53f50b9Schristos#if HAVE_STRING_H 57*a53f50b9Schristos# include <string.h> 58*a53f50b9Schristos#endif /* HAVE_STRING_H */ 59*a53f50b9Schristos#ifdef HAVE_STRINGS_H 60*a53f50b9Schristos# include <strings.h> 61*a53f50b9Schristos#endif /* HAVE_STRINGS_H */ 62*a53f50b9Schristos#ifdef HAVE_NETDB_H 63*a53f50b9Schristos# include <netdb.h> 64*a53f50b9Schristos#endif /* HAVE_NETDB_H */ 65*a53f50b9Schristos#ifdef HAVE_CLUSTER_H 66*a53f50b9Schristos# include <cluster.h> 67*a53f50b9Schristos#endif /* HAVE_CLUSTER_H */ 68*a53f50b9Schristos#ifdef HAVE_RPC_RPC_H 69*a53f50b9Schristos/* 70*a53f50b9Schristos * Turn on PORTMAP, so that additional header files would get included 71*a53f50b9Schristos * and the important definition for UDPMSGSIZE is included too. 72*a53f50b9Schristos */ 73*a53f50b9Schristos# ifndef PORTMAP 74*a53f50b9Schristos# define PORTMAP 75*a53f50b9Schristos# endif /* not PORTMAP */ 76*a53f50b9Schristos# include <rpc/rpc.h> 77*a53f50b9Schristos# ifndef XDRPROC_T_TYPE 78*a53f50b9Schristostypedef bool_t (*xdrproc_t) __P ((XDR *, __ptr_t, ...)); 79*a53f50b9Schristos# endif /* not XDRPROC_T_TYPE */ 80*a53f50b9Schristos#endif /* HAVE_RPC_RPC_H */ 81*a53f50b9Schristos 82*a53f50b9Schristos#if defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) 83*a53f50b9Schristos# include <tcpd.h> 84*a53f50b9Schristos#endif /* defined(HAVE_TCPD_H) && defined(HAVE_LIBWRAP) */ 85*a53f50b9Schristos 86*a53f50b9Schristos], eval "ac_cv_extern_$1=yes", eval "ac_cv_extern_$1=no") 87*a53f50b9Schristos]) 88*a53f50b9Schristos# check if need to define variable 89*a53f50b9Schristosif test "`eval echo '$''{ac_cv_extern_'$1'}'`" = yes 90*a53f50b9Schristosthen 91*a53f50b9Schristos AC_DEFINE_UNQUOTED($ac_safe) 92*a53f50b9Schristosfi 93*a53f50b9Schristos]) 94*a53f50b9Schristosdnl ====================================================================== 95*a53f50b9Schristos 96*a53f50b9Schristosdnl ###################################################################### 97*a53f50b9Schristosdnl run AMU_CHECK_EXTERN on each argument given 98*a53f50b9Schristosdnl Usage: AMU_CHECK_EXTERNS(arg arg arg ...) 99*a53f50b9SchristosAC_DEFUN([AMU_CHECK_EXTERNS], 100*a53f50b9Schristos[ 101*a53f50b9Schristosfor ac_tmp_arg in $1 102*a53f50b9Schristosdo 103*a53f50b9SchristosAMU_CHECK_EXTERN($ac_tmp_arg) 104*a53f50b9Schristosdone 105*a53f50b9Schristos]) 106*a53f50b9Schristosdnl ====================================================================== 107