📄 configure.in
字号:
# 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) AC_DEFINE(IPv4)fidnl Let's see if the system really supports IPv6.dnlAC_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) AC_DEFINE(IPv6)fidnl Let's see if the system really supports Unix domain sockets.dnlAC_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) AC_DEFINE(UNIXdomain)fidnl Let's see if the system really supports multicasting.dnlAC_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)fidnl ##################################################################dnl Build the list of object files to build from the source files indnl the lib/ directory.dnlLIB_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"fiif test "$ac_cv_func_if_nametoindex" = no ; then LIB_OBJS="$LIB_OBJS if_nametoindex.o if_indextoname.o if_nameindex.o"fiif test "$ac_cv_func_isfdtype" = no ; then LIB_OBJS="$LIB_OBJS isfdtype.o"fiif test "$ac_cv_multicast" = yes ; then 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"fiLIB_OBJS="$LIB_OBJS my_addrs.o"if test "$ac_cv_func_pselect" = no ; then LIB_OBJS="$LIB_OBJS pselect.o"fiLIB_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"fiif test "$ac_cv_func_sockatmark" = no ; then LIB_OBJS="$LIB_OBJS sockatmark.o"fiLIB_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"fiLIB_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 indnl the libfree/ directory.dnlLIBFREE_OBJS=LIBFREE_OBJS="$LIBFREE_OBJS in_cksum.o"if test "$ac_cv_func_inet_aton" = no ; then LIBFREE_OBJS="$LIBFREE_OBJS inet_aton.o"fidnl We always include both inet_ntop() and inet_pton() because somednl vendor's implementations are from the Internet Drafts leading todnl RFC 1323, and are wrong.LIBFREE_OBJS="$LIBFREE_OBJS inet_ntop.o inet_pton.o"dnl if test "$ac_cv_func_inet_pton" = no ; thendnl LIBFREE_OBJS="$LIBFREE_OBJS inet_pton.o"dnl fidnl ##################################################################dnl Build the list of object files to build from the source files indnl the libgai/ directory (getaddrinfo() and friends).dnlLIBGAI_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"dnl ##################################################################dnl Build the list of object files to build from the source files indnl the libroute/ directory (routing socket functions).dnlLIBROUTE_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 indnl the libxti/ directory.dnl Systems that do not provide <netdir.h> and <netconfig.h> do notdnl support our tcp_XXX and udp_XXX functions.dnlLIBXTI_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"fiLIBXTI_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 thesednl strings that we built in shell variables in the output files thatdnl it generates.dnlAC_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.dnlLIBS_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.dnldnl If the directory $HOME/doc/unp2ev1/src/include exists, the user candnl place modified copies of the system's headers in there, with thednl function prototypes corrected, as per Posix and X/Open. Lots ofdnl system headers today are missing const qualifiers, they have char*dnl instead of void*, and so on.dnlAC_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)fidnl If the compiler is gcc, enable all warnings. Main purpose is todnl catch any function call where the function has not been prototyped.dnlif test "$ac_cv_prog_gcc" = yes; then CFLAGS="$CFLAGS -Wall"fidnl 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.case "$host_os" in*aix*) CFLAGS="$CFLAGS -D_ALL_SOURCE" ;;*hpux*) CFLAGS="$CFLAGS -D_HPUX_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 ;;esacdnl ##################################################################dnl We also create a "Makefile" but it is not used for much.dnlAC_OUTPUT(Makefile Make.defines)dnldnl If a directory exists whose name equals the hostdnl (e.g., sparc-sun-solaris2.5.1), then save the three files that wednl create in that directory also.dnl Quick and dirty to be able to NFS mount this directory on differentdnl systems and move quickly between the systems, without having todnl rerun configure each time.dnl The "myconfig" script in this directory does the move.dnlif test -d "$host" ; then cp -p config.h config.cache config.status Makefile Make.defines $host echo "saving copies in $host/"fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -