aclocal.m4

来自「TCPDUMP的C语言源代码,是在数据链路层的应用」· M4 代码 · 共 1,288 行 · 第 1/3 页

M4
1,288
字号
dnl It has been argued that this test should be broken up into twodnl seperate tests, one for the resolver libraries, and one for thednl libraries necessary for using Sockets API. Unfortunately, the twodnl are carefully intertwined and allowing the autoconf user to usednl them independantly potentially results in unfortunate orderingdnl dependancies -- as such, such component macros would have todnl carefully use indirection and be aware if the other components werednl executed. Since other autoconf macros do not go to this trouble,dnl and almost no applications use sockets without the resolver, thisdnl complexity has not been implemented.dnldnl The check for libresolv is in case you are attempting to linkdnl statically and happen to have a libresolv.a lying around (and nodnl libnsl.a).dnlAC_DEFUN(AC_LBL_LIBRARY_NET, [    # Most operating systems have gethostbyname() in the default searched    # libraries (i.e. libc):    # Some OSes (eg. Solaris) place it in libnsl    # Some strange OSes (SINIX) have it in libsocket:    AC_SEARCH_LIBS(gethostbyname, nsl socket resolv)    # Unfortunately libsocket sometimes depends on libnsl and    # AC_SEARCH_LIBS isn't up to the task of handling dependencies like this.    if test "$ac_cv_search_gethostbyname" = "no"    then	AC_CHECK_LIB(socket, gethostbyname,                     LIBS="-lsocket -lnsl $LIBS", , -lnsl)    fi    AC_SEARCH_LIBS(socket, socket, ,	AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl))    # DLPI needs putmsg under HPUX so test for -lstr while we're at it    AC_SEARCH_LIBS(putmsg, str)    ])dnl Copyright (c) 1999 WIDE Project. All rights reserved.dnldnl Redistribution and use in source and binary forms, with or withoutdnl modification, are permitted provided that the following conditionsdnl are met:dnl 1. Redistributions of source code must retain the above copyrightdnl    notice, this list of conditions and the following disclaimer.dnl 2. Redistributions in binary form must reproduce the above copyrightdnl    notice, this list of conditions and the following disclaimer in thednl    documentation and/or other materials provided with the distribution.dnl 3. Neither the name of the project nor the names of its contributorsdnl    may be used to endorse or promote products derived from this softwarednl    without specific prior written permission.dnl dnl THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' ANDdnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEdnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEdnl ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLEdnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALdnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODSdnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTdnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAYdnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OFdnl SUCH DAMAGE.dnldnl Checks to see if AF_INET6 is definedAC_DEFUN(AC_CHECK_AF_INET6, [	AC_MSG_CHECKING(for AF_INET6)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <sys/socket.h>],		[int a = AF_INET6],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)		if test $$1 = yes ; then			AC_DEFINE(HAVE_AF_INET6)	fi])dnldnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len memberdnl borrowed from LBL libpcapAC_DEFUN(AC_CHECK_SA_LEN, [	AC_MSG_CHECKING(if sockaddr struct has sa_len member)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <sys/socket.h>],		[u_int i = sizeof(((struct sockaddr *)0)->sa_len)],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)		if test $$1 = yes ; then			AC_DEFINE(HAVE_SOCKADDR_SA_LEN)	fi])dnldnl Checks for portable prototype declaration macroAC_DEFUN(AC_CHECK_PORTABLE_PROTO,  [	AC_MSG_CHECKING(for __P)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <unistd.h>],		[int f __P(())],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 = yes; then		AC_DEFINE(HAVE_PORTABLE_PROTOTYPE)	fi])dnl checks for u_intXX_tAC_DEFUN(AC_CHECK_BITTYPES, [	$1=yesdnl check for u_int8_t	AC_MSG_CHECKING(for u_int8_t)	AC_CACHE_VAL(ac_cv_u_int8_t,	AC_TRY_COMPILE([#		include <sys/types.h>],		[u_int8_t i],		ac_cv_u_int8_t=yes,		ac_cv_u_int8_t=no))	AC_MSG_RESULT($ac_cv_u_int8_t)	if test $ac_cv_u_int8_t = yes; then		AC_DEFINE(HAVE_U_INT8_T)	else		$1=no	fidnl check for u_int16_t	AC_MSG_CHECKING(for u_int16_t)	AC_CACHE_VAL(ac_cv_u_int16_t,	AC_TRY_COMPILE([#		include <sys/types.h>],		[u_int16_t i],		ac_cv_u_int16_t=yes,		ac_cv_u_int16_t=no))	AC_MSG_RESULT($ac_cv_u_int16_t)	if test $ac_cv_u_int16_t = yes; then		AC_DEFINE(HAVE_U_INT16_T)	else		$1=no	fidnl check for u_int32_t	AC_MSG_CHECKING(for u_int32_t)	AC_CACHE_VAL(ac_cv_u_int32_t,	AC_TRY_COMPILE([#		include <sys/types.h>],		[u_int32_t i],		ac_cv_u_int32_t=yes,		ac_cv_u_int32_t=no))	AC_MSG_RESULT($ac_cv_u_int32_t)	if test $ac_cv_u_int32_t = yes; then		AC_DEFINE(HAVE_U_INT32_T)	else		$1=no	fidnl check for u_int64_t	AC_MSG_CHECKING(for u_int64_t)	AC_CACHE_VAL(ac_cv_u_int64_t,	AC_TRY_COMPILE([#		include <sys/types.h>],		[u_int64_t i],		ac_cv_u_int64_t=yes,		ac_cv_u_int64_t=no))	AC_MSG_RESULT($ac_cv_u_int64_t)	if test $ac_cv_u_int64_t = yes; then		AC_DEFINE(HAVE_U_INT64_T)	else		$1=no	fi])dnldnl Checks for addrinfo structureAC_DEFUN(AC_STRUCT_ADDRINFO, [	AC_MSG_CHECKING(for addrinfo)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <netdb.h>],		[struct addrinfo a],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 = yes; then		AC_DEFINE(HAVE_ADDRINFO)	else		AC_DEFINE(NEED_ADDRINFO_H)	fi])dnldnl Checks for NI_MAXSERVAC_DEFUN(AC_NI_MAXSERV, [	AC_MSG_CHECKING(for NI_MAXSERV)	AC_CACHE_VAL($1,	AC_EGREP_CPP(yes, [#include <netdb.h>#ifdef NI_MAXSERVyes#endif],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 != yes; then		AC_DEFINE(NEED_ADDRINFO_H)	fi])dnldnl Checks for NI_NAMEREQDAC_DEFUN(AC_NI_NAMEREQD, [	AC_MSG_CHECKING(for NI_NAMEREQD)	AC_CACHE_VAL($1,	AC_EGREP_CPP(yes, [#include <netdb.h>#ifdef NI_NOFQDNyes#endif],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 != yes; then		AC_DEFINE(NEED_ADDRINFO_H)	fi])dnldnl Checks for sockaddr_storage structureAC_DEFUN(AC_STRUCT_SA_STORAGE, [	AC_MSG_CHECKING(for sockaddr_storage)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <sys/socket.h>],		[struct sockaddr_storage s],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 = yes; then		AC_DEFINE(HAVE_SOCKADDR_STORAGE)	fi])dnldnl Checks for macro of IP address sizeAC_DEFUN(AC_CHECK_ADDRSZ, [	$1=yesdnl check for INADDRSZ	AC_MSG_CHECKING(for INADDRSZ)	AC_CACHE_VAL(ac_cv_inaddrsz,	AC_TRY_COMPILE([#		include <arpa/nameser.h>],		[int a = INADDRSZ],		ac_cv_inaddrsz=yes,		ac_cv_inaddrsz=no))	AC_MSG_RESULT($ac_cv_inaddrsz)	if test $ac_cv_inaddrsz = yes; then		AC_DEFINE(HAVE_INADDRSZ)	else		$1=no	fidnl check for IN6ADDRSZ	AC_MSG_CHECKING(for IN6ADDRSZ)	AC_CACHE_VAL(ac_cv_in6addrsz,	AC_TRY_COMPILE([#		include <arpa/nameser.h>],		[int a = IN6ADDRSZ],		ac_cv_in6addrsz=yes,		ac_cv_in6addrsz=no))	AC_MSG_RESULT($ac_cv_in6addrsz)	if test $ac_cv_in6addrsz = yes; then		AC_DEFINE(HAVE_IN6ADDRSZ)	else		$1=no	fi])dnldnl check for RES_USE_INET6AC_DEFUN(AC_CHECK_RES_USE_INET6, [	AC_MSG_CHECKING(for RES_USE_INET6)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <netinet/in.h>#		include <resolv.h>],		[int a = RES_USE_INET6],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 = yes; then		AC_DEFINE(HAVE_RES_USE_INET6)	fi])dnldnl check for AAAAAC_DEFUN(AC_CHECK_AAAA, [	AC_MSG_CHECKING(for AAAA)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <arpa/nameser.h>],		[int a = T_AAAA],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 = yes; then		AC_DEFINE(HAVE_AAAA)	fi])dnldnl check for struct res_state_extAC_DEFUN(AC_STRUCT_RES_STATE_EXT, [	AC_MSG_CHECKING(for res_state_ext)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <netinet/in.h>#		include <netinet6/in6.h>#		include <resolv.h>],		[struct __res_state_ext e],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 = yes; then		AC_DEFINE(HAVE_RES_STATE_EXT)	fi])dnldnl check for struct res_state_extAC_DEFUN(AC_STRUCT_RES_STATE, [	AC_MSG_CHECKING(for nsort in res_state)	AC_CACHE_VAL($1,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <netinet/in.h>#		include <netinet6/in6.h>#		include <resolv.h>],		[struct __res_state e; e.nsort = 0],		$1=yes,		$1=no))	AC_MSG_RESULT($$1)	if test $$1 = yes; then		AC_DEFINE(HAVE_NEW_RES_STATE)	fi])dnldnl check for h_errnoAC_DEFUN(AC_VAR_H_ERRNO, [	AC_MSG_CHECKING(for h_errno)	AC_CACHE_VAL(ac_cv_var_h_errno,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <netdb.h>],		[int foo = h_errno;],		ac_cv_var_h_errno=yes,		ac_cv_var_h_errno=no))	AC_MSG_RESULT($ac_cv_var_h_errno)	if test "$ac_cv_var_h_errno" = "yes"; then		AC_DEFINE(HAVE_H_ERRNO)	fi])dnldnl Test for __attribute__dnlAC_DEFUN(AC_C___ATTRIBUTE__, [AC_MSG_CHECKING(for __attribute__)AC_CACHE_VAL(ac_cv___attribute__, [AC_COMPILE_IFELSE(  AC_LANG_SOURCE([[#include <stdlib.h>static void foo(void) __attribute__ ((noreturn));static voidfoo(void){  exit(1);}intmain(int argc, char **argv){  foo();}  ]]),ac_cv___attribute__=yes,ac_cv___attribute__=no)])if test "$ac_cv___attribute__" = "yes"; then  AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])  V_DEFS="$V_DEFS -D_U_=\"__attribute__((unused))\""else  V_DEFS="$V_DEFS -D_U_=\"\""fiAC_MSG_RESULT($ac_cv___attribute__)])AC_DEFUN(AC_LBL_SSLEAY,    [	#	# XXX - is there a better way to check if a given library is	# in a given directory than checking each of the possible	# shared library suffixes?	#	# Are there any other suffixes we need to look for?  Do we	# have to worry about ".so.{version}"?	#	# Or should we just look for "libcrypto.*"?	#	if test -d "$1/lib" -a \( -f "$1/lib/libcrypto.a" -o \		          	    -f "$1/lib/libcrypto.so" -o \		          	    -f "$1/lib/libcrypto.sl" -o \			  	    -f "$1/lib/libcrypto.dylib" \); then		ac_cv_ssleay_path="$1"	fi	#	# Make sure we have the headers as well.	#	if test -d "$1/include/openssl" -a -f "$1/include/openssl/des.h"; then		incdir="-I$1/include"	fi])

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?