加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
configure.in 23.34 KB
一键复制 编辑 原始数据 按行查看 历史
冷二公子闯天涯 提交于 2021-08-01 17:29 . wy:unix网络编程
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
dnl
dnl autoconf script for UNP 3/e Volume 1 source code.
dnl Process this file with autoconf to produce a configure script.
dnl
dnl The end result of running configure is the "config.h" file and the
dnl "Make.defines" file in the current directory. These two files are
dnl created from the "config.h.in" and "Make.defines.in" files in the
dnl current directory.
dnl
dnl The header "unp.h" that is in every source directory then does a
dnl #include "../config.h" and the Makefile in each source directory
dnl then does a include of ../Make.defines.
dnl
AC_REVISION($Revision: 1.13 $)
AC_INIT(lib/unp.h)
AC_CANONICAL_HOST
AC_CONFIG_HEADER(config.h)
dnl The following cpu_vendor_os string goes into config.h.
dnl
AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$host", [CPU, vendor, and operating system])
dnl ##################################################################
dnl Checks for programs.
dnl
dnl Some system-specific stuff ...
dnl Some operating systems require additional flags in order to get all
dnl 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" ;;
*osf*) CPPFLAGS="$CPPFLAGS -D_SOCKADDR_LEN" ;;
esac
AC_PROG_CC
AC_PROG_RANLIB
dnl ##################################################################
dnl Checks for libraries.
dnl The order of these tests is the *reverse* order of the libraries in
dnl the LIBS variable that is constructed: each new one gets prepended,
dnl not appended.
dnl
dnl 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"
dnl
dnl If a threads library is found, need to update CFLAGS too.
dnl
AC_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"
fi
fi
AC_CHECK_LIB(nsl, t_open)
AC_SEARCH_LIBS(socket, socket)
dnl Bind 8.1.1 places its library in /usr/local/bind/lib/libbind.a; we check
dnl 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 use
dnl that instead of -lresolv. Need this for people interested in building
dnl an IPv6-knowledgable resolver, instead of using the system provided
dnl resolver (which is often way out of date).
dnl
AC_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
fi
fi
dnl Now check for XTI library.
dnl
AC_CHECK_LIB(xti, t_open)
dnl We now need to check for our own libraries, but we cannot prepend
dnl them to the LIBS variable, as that variable is used when compiling
dnl programs later in this script, and that would mess things up.
dnl
dnl 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 various
dnl systems, but I have a unique home directory on each system.
dnl
AC_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.a
else
AC_MSG_RESULT(no, using ./libunp.a)
LIBUNP="../libunp.a"
LIBUNP_NAME=../libunp.a
fi
dnl 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.
dnl
AC_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.a
else
AC_MSG_RESULT(no, using ./libunpxti.a)
LIBUNPXTI="../libunpxti.a"
LIBUNPXTI_NAME=../libunpxti.a
fi
dnl ##################################################################
dnl Checks for header files.
dnl
dnl The list of headers in the AC_CHECK_HEADERS macro is the same as in
dnl our "unp.h" header, followed by our "unpxti.h" header.
dnl
AC_HEADER_STDC
dnl
dnl The includes (the 4th argument to AC_CHECK_HEADERS) here are
dnl the defeault set ($ac_includes_default) plus <sys/param.h>
dnl for <sys/sysctl.h> on NetBSD and OpenBSD.
AC_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/param.h sys/select.h sys/sysctl.h poll.h sys/event.h strings.h sys/ioctl.h sys/filio.h sys/sockio.h pthread.h net/if_dl.h xti.h xti_inet.h netconfig.h netdir.h stropts.h, [], [], [
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif])
dnl ##################################################################
dnl Checks for typedefs.
dnl
dnl 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".
dnl
AC_HEADER_TIME
AC_UNP_CHECK_TYPE(uint8_t, unsigned char, 8-bit unsigned type)
AC_UNP_CHECK_TYPE(int16_t, short, 16 bit signed type)
AC_UNP_CHECK_TYPE(uint16_t, unsigned short, 16 bit unsigned type)
AC_UNP_CHECK_TYPE(int32_t, int, 32 bit signed type)
AC_UNP_CHECK_TYPE(uint32_t, unsigned int, 32 bit unsigned type)
AC_UNP_CHECK_TYPE(size_t, unsigned int, unsigned integer type of the result of the sizeof operator)
AC_UNP_CHECK_TYPE(ssize_t, int, a signed type appropriate for a count of bytes or an error indication)
AC_UNP_CHECK_TYPE(socklen_t, unsigned int, a type appropriate for address, hostname, buffer, etc. lengths)
dnl
dnl The SA_FAMILY_T in the following is #defined later, as its definition
dnl depends on whether socket address structures have a length field or not.
dnl
AC_UNP_CHECK_TYPE(sa_family_t, SA_FAMILY_T, the type of the sa_family struct member)
dnl We also have our own macro to check for XTI definitions, that can
dnl be defined after #include of our "unpxti.h" header.
dnl
AC_UNPXTI_CHECK_TYPE(t_scalar_t, int32_t, scalar type)
AC_UNPXTI_CHECK_TYPE(t_uscalar_t, uint32_t, unsigned scalar type)
dnl ##################################################################
dnl Check if sockaddr{} has sa_len member.
dnl
AC_CHECK_MEMBER([struct sockaddr.sa_len],
AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, define if socket address structures have length fields),,[
#include <sys/types.h>
#include <sys/socket.h>])
dnl Now we can complete the definition for sa_family_t, if needed.
dnl The size of this datatype depends whether socket address structures
dnl have a length field or not.
dnl
if test $ac_cv_type_sa_family_t = no ; then
if test $ac_cv_member_struct_sockaddr_sa_len = yes ; then
AC_DEFINE(SA_FAMILY_T, uint8_t, the size of the sa_family field in a socket address structure)
else
AC_DEFINE(SA_FAMILY_T, uint16_t)
fi
fi
dnl
dnl Check for sockaddr_storage.
dnl If it's present, check for ss_family.
dnl If ss_family isn't there, check for __ss_family and
dnl #define ss_family __ss_family if so.
dnl If neither is there, I don't know what to do.
dnl
AC_CHECK_TYPES([struct sockaddr_storage],
AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],,
AC_CHECK_MEMBER([struct sockaddr_storage.__ss_family],
AC_DEFINE([ss_family],[__ss_family],[define to __ss_family if sockaddr_storage has that instead of ss_family]),
AC_MSG_ERROR([cannot find ss_family in sockaddr_storage]),[
#include <sys/types.h>
#include <sys/socket.h>]),[
#include <sys/types.h>
#include <sys/socket.h>]),,[
#include <sys/types.h>
#include <sys/socket.h>])
dnl Check if msghdr{} has msg_control member.
dnl
AC_CHECK_MEMBER([struct msghdr.msg_control],
AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL, 1, define if struct msghdr contains the msg_control member),,[
#include <sys/types.h>
#include <sys/socket.h>])
dnl
dnl Check for ifr_mtu in ifreq - some systems have SIOCGIFMTU
dnl but don't have ifr_mtu!!
AC_CHECK_MEMBERS([struct ifreq.ifr_mtu],,,
[#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>])
dnl ##################################################################
dnl Check for function prototypes in headers.
dnl AC_CHECK_FUNC_PROTO is our own macro in "aclocal.m4".
dnl
AC_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(pselect, sys/select.h)
AC_CHECK_FUNC_PROTO(snprintf, stdio.h)
AC_CHECK_FUNC_PROTO(sockatmark, sys/socket.h)
dnl
dnl autoheader doesn't know how to handle the above, so we have
dnl to help it out.
AH_TEMPLATE(HAVE_GETADDRINFO_PROTO, define if getaddrinfo prototype is in <netdb.h>)
AH_TEMPLATE(HAVE_GETNAMEINFO_PROTO, define if getnameinfo prototype is in <netdb.h>)
AH_TEMPLATE(HAVE_GETHOSTNAME_PROTO, define if gethostname prototype is in <unistd.h>)
AH_TEMPLATE(HAVE_GETRUSAGE_PROTO, define if getrusage prototype is in <sys/resource.h>)
AH_TEMPLATE(HAVE_HSTRERROR_PROTO, define if hstrerror prototype is in <netdb.h>)
AH_TEMPLATE(HAVE_IF_NAMETOINDEX_PROTO, define if if_nametoindex prototype is in <net/if.h>)
AH_TEMPLATE(HAVE_INET_ATON_PROTO, define if inet_aton prototype is in <arpa/inet.h>)
AH_TEMPLATE(HAVE_INET_PTON_PROTO, define if inet_pton prototype is in <arpa/inet.h>)
AH_TEMPLATE(HAVE_PSELECT_PROTO, define if pselect prototype is in <sys/stat.h>)
AH_TEMPLATE(HAVE_SNPRINTF_PROTO, define if snprintf prototype is in <stdio.h>)
AH_TEMPLATE(HAVE_SOCKATMARK_PROTO, define if sockatmark prototype is in <sys/socket.h>)
dnl ##################################################################
dnl Check for structure definitions.
dnl
AC_CHECK_TYPE(struct addrinfo,
AC_DEFINE(HAVE_ADDRINFO_STRUCT, 1, Define to 1 if <netdb.h> defines struct addrinfo),,[
#include <netdb.h>])
dnl
AC_CHECK_TYPE(struct if_nameindex,
AC_DEFINE(HAVE_IF_NAMEINDEX_STRUCT, 1, Define to 1 if <net/if.h> defines struct if_nameindex),,[
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>])
dnl
AC_CHECK_TYPE([struct sockaddr_dl],
AC_DEFINE(HAVE_SOCKADDR_DL_STRUCT, 1, Define to 1 if <net/if_dl.h> defines struct sockaddr_dl),,[
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>])
dnl OpenBSD puts struct timespec in <sys/time.h> instead of <time.h>,
dnl thus this complex test.
AC_CHECK_TYPE([struct timespec],
AC_DEFINE(HAVE_TIMESPEC_STRUCT, 1, Define to 1 if <time.h> or <sys/time.h> defines struct timespec),,[
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
])
dnl ##################################################################
dnl Check for XTI devices.
dnl
AC_MSG_CHECKING(for /dev/tcp)
if test -r /dev/tcp ; then
AC_DEFINE(HAVE_DEV_TCP, 1, Define to 1 if the /dev/tcp device exists)
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, 1, Define to 1 if the /dev/xti/tcp device exists)
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, 1, Define to 1 if the /dev/streams/xtiso/tcp device exists)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
fi
dnl ##################################################################
dnl Checks for library functions.
dnl
AC_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(inet6_rth_init)
AC_CHECK_FUNCS(kqueue kevent)
AC_CHECK_FUNCS(mkstemp)
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.
dnl
AC_MSG_CHECKING(for IPv4 support)
AC_CACHE_VAL(ac_cv_ipv4,
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
/* Make sure the definitions for AF_INET and struct sockaddr_in
* are defined, and that we can actually create an IPv4 TCP socket.
*/
main()
{
int fd;
struct sockaddr_in foo;
fd = socket(AF_INET, SOCK_STREAM, 0);
exit(fd >= 0 ? 0 : 1);
}],
ac_cv_ipv4=yes,
ac_cv_ipv4=no,
ac_cv_ipv4=no))
AC_MSG_RESULT($ac_cv_ipv4)
if test $ac_cv_ipv4 = yes ; then
AC_DEFINE(IPV4, 1, Define to 1 if the system supports IPv4)
AC_DEFINE(IPv4, 1, Define to 1 if the system supports IPv4)
fi
dnl Let's see if the system really supports IPv6.
dnl
AC_MSG_CHECKING(for IPv6 support)
AC_CACHE_VAL(ac_cv_ipv6,
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
/* Make sure the definitions for AF_INET6 and struct sockaddr_in6
* are defined, and that we can actually create an IPv6 TCP socket.
*/
main()
{
int fd;
struct sockaddr_in6 foo;
fd = socket(AF_INET6, SOCK_STREAM, 0);
exit(fd >= 0 ? 0 : 1);
}],
ac_cv_ipv6=yes,
ac_cv_ipv6=no,
ac_cv_ipv6=no))
AC_MSG_RESULT($ac_cv_ipv6)
if test $ac_cv_ipv6 = yes ; then
AC_DEFINE(IPV6, 1, Define to 1 if the system supports IPv6)
AC_DEFINE(IPv6, 1, Define to 1 if the system supports IPv6)
fi
dnl Let's see if the system really supports Unix domain sockets.
dnl
AC_MSG_CHECKING(for Unix domain sockets)
AC_CACHE_VAL(ac_cv_unixdomain,
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/socket.h>
# include <sys/un.h>
/* Make sure the definitions for AF_UNIX and struct sockaddr_un
* are defined, and that we can actually create an IPv4 TCP socket.
*/
main()
{
int fd;
struct sockaddr_un foo;
fd = socket(AF_UNIX, SOCK_STREAM, 0);
exit(fd >= 0 ? 0 : 1);
}],
ac_cv_unixdomain=yes,
ac_cv_unixdomain=no,
ac_cv_unixdomain=no))
AC_MSG_RESULT($ac_cv_unixdomain)
if test $ac_cv_unixdomain = yes ; then
AC_DEFINE(UNIXDOMAIN, 1, Define to 1 if the system supports UNIX domain sockets)
AC_DEFINE(UNIXdomain, 1, Define to 1 if the system supports UNIX domain sockets)
fi
dnl Let's see if the system really supports multicasting.
dnl
AC_MSG_CHECKING(for multicast support)
AC_CACHE_VAL(ac_cv_multicast,
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
main()
{
int fd;
unsigned char flag = 1;
struct sockaddr_in foo;
struct ip_mreq mreq;
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) exit(1);
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
(void*)&flag, sizeof(flag)) < 0)
exit(1);
exit(0);
}],
ac_cv_multicast=yes,
ac_cv_multicast=no,
ac_cv_multicast=no))
AC_MSG_RESULT($ac_cv_multicast)
if test $ac_cv_multicast = yes ; then
AC_DEFINE(MCAST, 1, Define to 1 if the system supports IP Multicast)
fi
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the lib/ directory.
dnl
LIB_OBJS=
LIB_OBJS="$LIB_OBJS connect_nonb.o"
LIB_OBJS="$LIB_OBJS connect_timeo.o"
LIB_OBJS="$LIB_OBJS daemon_inetd.o"
LIB_OBJS="$LIB_OBJS daemon_init.o"
LIB_OBJS="$LIB_OBJS dg_cli.o"
LIB_OBJS="$LIB_OBJS dg_echo.o"
LIB_OBJS="$LIB_OBJS error.o"
LIB_OBJS="$LIB_OBJS get_ifi_info.o"
LIB_OBJS="$LIB_OBJS gf_time.o"
LIB_OBJS="$LIB_OBJS host_serv.o"
if test "$ac_cv_func_hstrerror" = no ; then
LIBFREE_OBJS="$LIBFREE_OBJS hstrerror.o"
fi
if test "$ac_cv_func_if_nametoindex" = no ; then
LIB_OBJS="$LIB_OBJS if_nametoindex.o if_indextoname.o if_nameindex.o"
fi
if test "$ac_cv_multicast" = yes ; then
LIB_OBJS="$LIB_OBJS family_to_level.o"
LIB_OBJS="$LIB_OBJS mcast_leave.o mcast_join.o"
LIB_OBJS="$LIB_OBJS mcast_get_if.o mcast_get_loop.o mcast_get_ttl.o"
LIB_OBJS="$LIB_OBJS mcast_set_if.o mcast_set_loop.o mcast_set_ttl.o"
fi
LIB_OBJS="$LIB_OBJS my_addrs.o"
if test "$ac_cv_func_pselect" = no ; then
LIB_OBJS="$LIB_OBJS pselect.o"
fi
LIB_OBJS="$LIB_OBJS read_fd.o"
LIB_OBJS="$LIB_OBJS readline.o"
LIB_OBJS="$LIB_OBJS readn.o"
LIB_OBJS="$LIB_OBJS readable_timeo.o"
LIB_OBJS="$LIB_OBJS rtt.o"
LIB_OBJS="$LIB_OBJS signal.o"
LIB_OBJS="$LIB_OBJS signal_intr.o"
if test "$ac_cv_func_snprintf" = no ; then
LIB_OBJS="$LIB_OBJS snprintf.o"
fi
if test "$ac_cv_func_sockatmark" = no ; then
LIB_OBJS="$LIB_OBJS sockatmark.o"
fi
LIB_OBJS="$LIB_OBJS sock_bind_wild.o"
LIB_OBJS="$LIB_OBJS sock_cmp_addr.o"
LIB_OBJS="$LIB_OBJS sock_cmp_port.o"
LIB_OBJS="$LIB_OBJS sock_ntop.o"
LIB_OBJS="$LIB_OBJS sock_ntop_host.o"
LIB_OBJS="$LIB_OBJS sock_get_port.o"
LIB_OBJS="$LIB_OBJS sock_set_addr.o"
LIB_OBJS="$LIB_OBJS sock_set_port.o"
LIB_OBJS="$LIB_OBJS sock_set_wild.o"
LIB_OBJS="$LIB_OBJS sockfd_to_family.o"
LIB_OBJS="$LIB_OBJS str_cli.o"
LIB_OBJS="$LIB_OBJS str_echo.o"
LIB_OBJS="$LIB_OBJS tcp_connect.o"
LIB_OBJS="$LIB_OBJS tcp_listen.o"
LIB_OBJS="$LIB_OBJS tv_sub.o"
LIB_OBJS="$LIB_OBJS udp_client.o"
LIB_OBJS="$LIB_OBJS udp_connect.o"
LIB_OBJS="$LIB_OBJS udp_server.o"
LIB_OBJS="$LIB_OBJS wraplib.o"
LIB_OBJS="$LIB_OBJS wrapsock.o"
LIB_OBJS="$LIB_OBJS wrapstdio.o"
if test "$ac_cv_header_pthread_h" = yes ; then
LIB_OBJS="$LIB_OBJS wrappthread.o"
fi
LIB_OBJS="$LIB_OBJS wrapunix.o"
LIB_OBJS="$LIB_OBJS write_fd.o"
LIB_OBJS="$LIB_OBJS writen.o"
LIB_OBJS="$LIB_OBJS writable_timeo.o"
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the libfree/ directory.
dnl
LIBFREE_OBJS=
LIBFREE_OBJS="$LIBFREE_OBJS in_cksum.o"
if test "$ac_cv_func_inet_aton" = no ; then
LIBFREE_OBJS="$LIBFREE_OBJS inet_aton.o"
fi
dnl We always include both inet_ntop() and inet_pton() because some
dnl vendor's implementations are from the Internet Drafts leading to
dnl RFC 1323, and are wrong.
LIBFREE_OBJS="$LIBFREE_OBJS inet_ntop.o inet_pton.o"
dnl if test "$ac_cv_func_inet_pton" = no ; then
dnl LIBFREE_OBJS="$LIBFREE_OBJS inet_pton.o"
dnl fi
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the libgai/ directory (getaddrinfo() and friends).
dnl
dnl If the system has a getaddrinfo implementation, then
dnl there should be nothing here.
if test "$ac_cv_func_getaddrinfo" = no ; then
LIBGAI_OBJS="getaddrinfo.o getnameinfo.o freeaddrinfo.o gai_strerror.o"
LIBGAI_OBJS="$LIBGAI_OBJS ga_aistruct.o ga_clone.o ga_echeck.o ga_nsearch.o"
LIBGAI_OBJS="$LIBGAI_OBJS ga_port.o ga_serv.o ga_unix.o gn_ipv46.o"
else
LIBGAI_OBJS=""
fi
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the libroute/ directory (routing socket functions).
dnl
LIBROUTE_OBJS="get_rtaddrs.o"
LIBROUTE_OBJS="$LIBROUTE_OBJS if_indextoname.o if_nameindex.o if_nametoindex.o"
LIBROUTE_OBJS="$LIBROUTE_OBJS net_rt_iflist.o net_rt_dump.o"
LIBROUTE_OBJS="$LIBROUTE_OBJS sock_masktop.o"
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the libxti/ directory.
dnl Systems that do not provide <netdir.h> and <netconfig.h> do not
dnl support our tcp_XXX and udp_XXX functions.
dnl
LIBXTI_OBJS=
if test "$ac_cv_header_netdir_h" = yes ; then
LIBXTI_OBJS="$LIBXTI_OBJS tcp_connect.o"
LIBXTI_OBJS="$LIBXTI_OBJS tcp_listen.o"
LIBXTI_OBJS="$LIBXTI_OBJS udp_server.o"
LIBXTI_OBJS="$LIBXTI_OBJS udp_client.o"
fi
LIBXTI_OBJS="$LIBXTI_OBJS wrapxti.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_accept.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_flags_str.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_getopt.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_ntop.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_ntop_host.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_rdwr.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_setopt.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_str_opts.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_tlook_str.o"
dnl Now make certain that when configure is run, AC_OUTPUT replaces these
dnl strings that we built in shell variables in the output files that
dnl it generates.
dnl
AC_SUBST(LIB_OBJS)
AC_SUBST(LIBFREE_OBJS)
AC_SUBST(LIBGAI_OBJS)
AC_SUBST(LIBROUTE_OBJS)
AC_SUBST(LIBXTI_OBJS)
dnl We need our own variable LIBS_XTI for linking XTI programs,
dnl but do not want -lsocket in there.
dnl Ditto for -lxti in LIBS.
dnl
LIBS_XTI=`echo $LIBS | sed 's/-lsocket//'`
LIBS=`echo $LIBS | sed 's/-lxti//'`
AC_SUBST(LIBS_XTI)
AC_SUBST(LIBUNP)
AC_SUBST(LIBUNPXTI)
AC_SUBST(LIBUNP_NAME)
AC_SUBST(LIBUNPXTI_NAME)
dnl ##################################################################
dnl Now that we're doing compiling, modify CFLAGS.
dnl
dnl If the directory $HOME/doc/unp2ev1/src/include exists, the user can
dnl place modified copies of the system's headers in there, with the
dnl function prototypes corrected, as per Posix and X/Open. Lots of
dnl system headers today are missing const qualifiers, they have char*
dnl instead of void*, and so on.
dnl
AC_MSG_CHECKING(for -I$HOME/doc/unp2ev1/src/include)
if test -d $HOME/doc/unp2ev1/src/include ; then
CFLAGS="$CFLAGS -I$HOME/doc/unp2ev1/src/include"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl If the compiler is gcc, enable all warnings. Main purpose is to
dnl catch any function call where the function has not been prototyped.
dnl
if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -Wall"
dnl
dnl These warnings are useful during development, but not to deploy.
dnl CFLAGS="$CFLAGS -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wno-format-extra-args"
fi
dnl Some system-specific stuff ...
dnl Some operating systems require additional flags in order to get all
dnl the definitions that we're looking for in some system headers.
case "$host_os" in
*aix*) CFLAGS="$CFLAGS -D_ALL_SOURCE" ;;
*osf*) CFLAGS="$CFLAGS -D_SOCKADDR_LEN" ;;
*solaris*) if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -D__EXTENSIONS__"
else
CFLAGS="$CFLAGS -D__STDC__"
fi ;;
esac
dnl ##################################################################
dnl We also create a "Makefile" but it is not used for much.
dnl
AC_OUTPUT(Makefile Make.defines)
dnl
dnl If a directory exists whose name equals the host
dnl (e.g., sparc-sun-solaris2.5.1), then save the five files that we
dnl create in that directory also.
dnl Quick and dirty to be able to NFS mount this directory on different
dnl systems and move quickly between the systems, without having to
dnl rerun configure each time.
dnl The "myconfig" script in this directory does the move.
dnl
if test -d "$host" ; then
cp -p config.h config.cache config.status Makefile Make.defines $host
echo "saving copies in $host/"
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化