⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configure.in

📁 Unix网络编程 基于Socket的网络编程
💻 IN
📖 第 1 页 / 共 2 页
字号:
dnldnl autoconf script for UNP 2/e Volume 1 source code.dnl Process this file with autoconf to produce a configure script.dnldnl The end result of running configure is the "config.h" file and thednl "Make.defines" file in the current directory.  These two files arednl created from the "config.h.in" and "Make.defines.in" files in thednl current directory.dnldnl The header "unp.h" that is in every source directory then does adnl #include "../config.h" and the Makefile in each source directorydnl then does a include of ../Make.defines.dnlAC_INIT(lib/unp.h)AC_CANONICAL_HOSTAC_CONFIG_HEADER(config.h)dnl The following cpu_vendor_os string goes into config.h.dnlAC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$host")dnl ##################################################################dnl Checks for programs.dnldnl Some system-specific stuff ...dnl Some operating systems require additional flags in order to get alldnl the definitions that we're looking for in some system headers.dnl The configure script uses both CFLAGS and CPPFLAGS when compiling.case "$host_os" in*aix*)		CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE" ;;*hpux*)		CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" ;;*osf*)		CPPFLAGS="$CPPFLAGS -D_SOCKADDR_LEN" ;;esacAC_PROG_CCAC_PROG_RANLIBdnl ##################################################################dnl Checks for libraries.dnl The order of these tests is the *reverse* order of the libraries indnl the LIBS variable that is constructed: each new one gets prepended,dnl not appended.dnldnl We are building three strings here; something like:dnl	LIBS="-lresolv -lsocket -lnsl -lpthread"dnl	LIBS_XTI="-lxti -lresolv -lnsl -lpthread"dnl	LIBUNP="./libunp.a"dnl	LIBUNPXTI="./libunpxti.a"dnldnl If a threads library is found, need to update CFLAGS too.dnlAC_CHECK_LIB(pthread, pthread_create)if test "$ac_cv_lib_pthread_pthread_create" = yes ; then   CFLAGS="$CFLAGS -D_REENTRANT"else   AC_CHECK_LIB(pthreads, pthread_create)   if test "$ac_cv_lib_pthreads_pthread_create" = yes ; then      CFLAGS="$CFLAGS -D_REENTRANT"   fifiAC_CHECK_LIB(nsl, t_open)AC_CHECK_LIB(socket, socket)dnl Bind 8.1.1 places its library in /usr/local/bind/lib/libbind.a; we checkdnl for it first.  Also check for libbind.a in user's home directory.dnl If there is a libresolv.a in the user's HOME directory, we will usednl that instead of -lresolv.  Need this for people interested in buildingdnl an IPv6-knowledgable resolver, instead of using the system provideddnl resolver (which is often way out of date).dnlAC_MSG_CHECKING(for /usr/local/bind/lib/libbind.a)if test -f /usr/local/bind/lib/libbind.a ; then	AC_MSG_RESULT(yes)	LIBS="/usr/local/bind/lib/libbind.a  $LIBS"else	AC_MSG_RESULT(no)	AC_MSG_CHECKING(for $HOME/libbind.a)	if test -f $HOME/libbind.a ; then		AC_MSG_RESULT(yes)		LIBS="$HOME/libbind.a  $LIBS"	else		AC_MSG_RESULT(no)		AC_MSG_CHECKING(for $HOME/libresolv.a)		if test -f $HOME/libresolv.a ; then			AC_MSG_RESULT(yes)			LIBS="$HOME/libresolv.a  $LIBS"		else			AC_MSG_RESULT(no)			AC_CHECK_LIB(resolv, res_init)		fi	fifidnl Now check for XTI library.dnlAC_CHECK_LIB(xti, t_open)dnl We now need to check for our own libraries, but we cannot prependdnl them to the LIBS variable, as that variable is used when compilingdnl programs later in this script, and that would mess things up.dnldnl If the user has a file named $HOME/libunp.a, then use it.dnl Else store our library in current directory.dnl I use this because my source directory is NFS mounted from my variousdnl systems, but I have a unique home directory on each system.dnlAC_MSG_CHECKING(for $HOME/libunp.a)if test -f $HOME/libunp.a ; then	AC_MSG_RESULT(yes)	LIBUNP="$HOME/libunp.a"	LIBUNP_NAME=$HOME/libunp.aelse	AC_MSG_RESULT(no, using ./libunp.a)	LIBUNP="../libunp.a"	LIBUNP_NAME=../libunp.afidnl If the user has a file named $HOME/libunpxti.a, then use it.dnl Else store our library in current directory.dnl Same reasoning as above.dnlAC_MSG_CHECKING(for $HOME/libunpxti.a)if test -f $HOME/libunpxti.a ; then	AC_MSG_RESULT(yes)	LIBUNPXTI="$HOME/libunpxti.a"	LIBUNPXTI_NAME=$HOME/libunpxti.aelse	AC_MSG_RESULT(no, using ./libunpxti.a)	LIBUNPXTI="../libunpxti.a"	LIBUNPXTI_NAME=../libunpxti.afidnl ##################################################################dnl Checks for header files.dnldnl The list of headers in the AC_CHECK_HEADERS macro is the same as indnl our "unp.h" header, followed by our "unpxti.h" header.  <sys/sysctl.h>dnl is not #included by "unp.h", but used in "lib/wrapunix.c".dnlAC_HEADER_STDCAC_CHECK_HEADERS(sys/types.h sys/socket.h sys/time.h time.h netinet/in.h arpa/inet.h errno.h fcntl.h netdb.h signal.h stdio.h stdlib.h string.h sys/stat.h sys/uio.h unistd.h sys/wait.h sys/un.h sys/select.h poll.h strings.h sys/ioctl.h sys/filio.h sys/sockio.h pthread.h sys/sysctl.h poll.h xti.h xti_inet.h netconfig.h netdir.h stropts.h)dnl ##################################################################dnl Checks for typedefs.dnldnl We use our own AC_UNP_CHECK_TYPE macro, instead of AC_CHECK_TYPE,dnl to #include more headers.  Our macro is defined in "aclocal.m4".dnlAC_HEADER_TIMEAC_UNP_CHECK_TYPE(uint8_t, unsigned char)AC_UNP_CHECK_TYPE(int16_t, short)AC_UNP_CHECK_TYPE(uint16_t, unsigned short)AC_UNP_CHECK_TYPE(int32_t, int)AC_UNP_CHECK_TYPE(uint32_t, unsigned int)AC_UNP_CHECK_TYPE(size_t, unsigned int)AC_UNP_CHECK_TYPE(ssize_t, int)AC_UNP_CHECK_TYPE(socklen_t, unsigned int)dnldnl The SA_FAMILY_T in the following is #defined later, as its definitiondnl depends on whether socket address structures have a length field or not.dnlAC_UNP_CHECK_TYPE(sa_family_t, SA_FAMILY_T)dnl We also have our own macro to check for XTI definitions, that candnl be defined after #include of our "unpxti.h" header.dnlAC_UNPXTI_CHECK_TYPE(t_scalar_t, int32_t)AC_UNPXTI_CHECK_TYPE(t_uscalar_t, uint32_t)dnl ##################################################################dnl Check if sockaddr{} has sa_len member.dnlAC_CACHE_CHECK(if sockaddr{} has sa_len member, ac_cv_sockaddr_has_sa_len,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <sys/socket.h>],		[unsigned int i = sizeof(((struct sockaddr *)0)->sa_len)],	ac_cv_sockaddr_has_sa_len=yes,	ac_cv_sockaddr_has_sa_len=no))if test $ac_cv_sockaddr_has_sa_len = yes ; then	AC_DEFINE(HAVE_SOCKADDR_SA_LEN)fidnl Now we can complete the definition for sa_family_t, if needed.dnl The size of this datatype depends whether socket address structuresdnl have a length field or not.dnlif test $ac_cv_type_sa_family_t = no ; then   if test $ac_cv_sockaddr_has_sa_len = yes ; then      AC_DEFINE(SA_FAMILY_T, uint8_t)   else      AC_DEFINE(SA_FAMILY_T, uint16_t)   fifidnl Check if msghdr{} has msg_control member.dnlAC_CACHE_CHECK(if msghdr{} has msg_control member, ac_cv_msghdr_has_msg_control,	AC_TRY_COMPILE([#		include <sys/types.h>#		include <sys/socket.h>],		[unsigned int i = sizeof(((struct msghdr *)0)->msg_control)],	ac_cv_msghdr_has_msg_control=yes,	ac_cv_msghdr_has_msg_control=no))if test $ac_cv_msghdr_has_msg_control = yes ; then	AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL)fidnl ##################################################################dnl Check for function prototypes in headers.dnl AC_CHECK_FUNC_PROTO is our own macro in "aclocal.m4".dnlAC_CHECK_FUNC_PROTO(getaddrinfo, netdb.h)AC_CHECK_FUNC_PROTO(getnameinfo, netdb.h)AC_CHECK_FUNC_PROTO(gethostname, unistd.h)AC_CHECK_FUNC_PROTO(getrusage, sys/resource.h)AC_CHECK_FUNC_PROTO(hstrerror, netdb.h)AC_CHECK_FUNC_PROTO(if_nametoindex, net/if.h)AC_CHECK_FUNC_PROTO(inet_aton, arpa/inet.h)AC_CHECK_FUNC_PROTO(inet_pton, arpa/inet.h)AC_CHECK_FUNC_PROTO(isfdtype, sys/stat.h)AC_CHECK_FUNC_PROTO(pselect, sys/select.h)AC_CHECK_FUNC_PROTO(snprintf, stdio.h)AC_CHECK_FUNC_PROTO(sockatmark, sys/socket.h)dnl ##################################################################dnl Check for structure definitions.dnlAC_CACHE_CHECK(for addrinfo{}, ac_cv_have_addrinfo_struct,	AC_EGREP_HEADER(addrinfo, netdb.h,		ac_cv_have_addrinfo_struct=yes,		ac_cv_have_addrinfo_struct=no))if test $ac_cv_have_addrinfo_struct = yes ; then	AC_DEFINE(HAVE_ADDRINFO_STRUCT)fidnlAC_CACHE_CHECK(for if_nameindex{}, ac_cv_have_if_nameindex_struct,	AC_EGREP_HEADER(if_nameindex, net/if.h,		ac_cv_have_if_nameindex_struct=yes,		ac_cv_have_if_nameindex_struct=no))if test $ac_cv_have_if_nameindex_struct = yes ; then	AC_DEFINE(HAVE_IF_NAMEINDEX_STRUCT)fidnlAC_CACHE_CHECK(for sockaddr_dl{}, ac_cv_have_sockaddr_dl_struct,	AC_EGREP_HEADER(sockaddr_dl, net/if_dl.h,		ac_cv_have_sockaddr_dl_struct=yes,		ac_cv_have_sockaddr_dl_struct=no))if test $ac_cv_have_sockaddr_dl_struct = yes ; then	AC_DEFINE(HAVE_SOCKADDR_DL_STRUCT)fidnlAC_CACHE_CHECK(for timespec{}, ac_cv_have_timespec_struct,	AC_EGREP_HEADER(timespec, time.h,		ac_cv_have_timespec_struct=yes,		ac_cv_have_timespec_struct=no))if test $ac_cv_have_timespec_struct = yes ; then	AC_DEFINE(HAVE_TIMESPEC_STRUCT)fidnl ##################################################################dnl Check for XTI devices.dnlAC_MSG_CHECKING(for /dev/tcp)if test -r /dev/tcp ; then	AC_DEFINE(HAVE_DEV_TCP)	AC_MSG_RESULT(yes)else	AC_MSG_RESULT(no)	AC_MSG_CHECKING(for /dev/xti/tcp)	if test -r /dev/xti/tcp ; then		AC_DEFINE(HAVE_DEV_XTI_TCP)		AC_MSG_RESULT(yes)	else		AC_MSG_RESULT(no)		AC_MSG_CHECKING(for /dev/streams/xtiso/tcp)		if test -r /dev/streams/xtiso/tcp ; then			AC_DEFINE(HAVE_DEV_STREAMS_XTISO_TCP)			AC_MSG_RESULT(yes)		else			AC_MSG_RESULT(no)		fi	fifidnl ##################################################################dnl Checks for library functions.dnlAC_CHECK_FUNCS(bzero)AC_CHECK_FUNCS(getaddrinfo)AC_CHECK_FUNCS(gethostname)AC_CHECK_FUNCS(gethostbyname2)AC_CHECK_FUNCS(gethostbyname_r)AC_CHECK_FUNCS(getnameinfo)AC_CHECK_FUNCS(hstrerror)AC_CHECK_FUNCS(if_nametoindex)AC_CHECK_FUNCS(inet_aton)AC_CHECK_FUNCS(inet_pton)AC_CHECK_FUNCS(isfdtype)AC_CHECK_FUNCS(poll)AC_CHECK_FUNCS(pselect)AC_CHECK_FUNCS(snprintf)AC_CHECK_FUNCS(sockatmark)AC_CHECK_FUNCS(vsnprintf)dnl ##################################################################dnl Check for system services.dnl Let's see if the system really supports IPv4.dnlAC_MSG_CHECKING(for IPv4 support)AC_CACHE_VAL(ac_cv_ipv4,	AC_TRY_RUN([#	include <sys/types.h>

⌨️ 快捷键说明

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