📄 configure.ac
字号:
dnl ===================================================================dnl configure.acdnl Process this file with autogen.sh to produce configure filesdnl ===================================================================AC_INIT(Iperf,2.0)AC_CONFIG_HEADERS([config.h])AM_INIT_AUTOMAKEAC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [disable ipv6 support (default is autodetect)]), ac_cv_have_ipv6=$enable_ipv6,)AC_ARG_ENABLE(multicast, AC_HELP_STRING([--disable-multicast], [disable multicast support (default is autodetect)]), ac_cv_multicast=$enable_multicast,)AC_ARG_ENABLE(threads, AC_HELP_STRING([--disable-threads], [disable thread support (default is autodetect)]))AC_ARG_ENABLE(debuginfo, AC_HELP_STRING([--enable-debuginfo], [enable debugging info for sockets (default is no)]), enable_debuginfo=$enableval, enable_debuginfo=no)AC_ARG_ENABLE(web100, AC_HELP_STRING([--disable-web100], [disable web100 support (default is autodetect)]))dnl ===================================================================dnl Checks for programsdnl ===================================================================AC_PROG_CXXCXXFLAGS=`echo " $CXXFLAGS " | sed -e "s/ -g / /"` # do not want it implicitlyAC_PROG_CCCFLAGS=`echo " $CFLAGS " | sed -e "s/ -g / /"` # do not want it implicitlyAC_ISC_POSIXAC_PROG_INSTALLAC_PROG_MAKE_SETAC_PROG_RANLIBAC_CANONICAL_HOSTdnl ===================================================================dnl Checks for libraries.dnl ===================================================================dnl check for -lpthread if test "$enable_threads" != no; then ACX_PTHREAD() if test "$acx_pthread_ok" = yes; then AC_DEFINE([HAVE_POSIX_THREAD], 1,) AC_DEFINE([_REENTRANT], 1,) fifidnl check for -lnsl, -lsocketAC_CHECK_FUNC(gethostbyname,,AC_CHECK_LIB(nsl, gethostbyname))AC_CHECK_FUNC(socket,,AC_CHECK_LIB(socket, socket))dnl Checks for header files.AC_HEADER_STDCAC_CHECK_HEADERS([arpa/inet.h libintl.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h])dnl ===================================================================dnl Checks for typedefs, structuresdnl ===================================================================AC_C_CONSTAC_TYPE_SIZE_TAC_CHECK_TYPES(ssize_t,,AC_DEFINE_UNQUOTED(ssize_t, int))AC_HEADER_TIMEAC_STRUCT_TMdnl these intXX_t and u_intXX_t need to be defined to be the right size.AC_CHECK_SIZEOF(short)AC_CHECK_SIZEOF(int)AC_CHECK_SIZEOF(long)AC_CHECK_SIZEOF(long long)AC_CHECK_SIZEOF(unsigned short)AC_CHECK_SIZEOF(unsigned int)AC_CHECK_SIZEOF(unsigned long)AC_CHECK_SIZEOF(unsigned long long)AH_TEMPLATE(int16_t)AH_TEMPLATE(int32_t)AH_TEMPLATE(int64_t)AH_TEMPLATE(u_int16_t)AH_TEMPLATE(u_int32_t)AH_TEMPLATE(u_int64_t)DAST_REPLACE_TYPE(int16_t, 2)DAST_REPLACE_TYPE(int32_t, 4)DAST_REPLACE_TYPE(int64_t, 8)DAST_REPLACE_TYPE_UNSIGNED(u_int16_t, 2)DAST_REPLACE_TYPE_UNSIGNED(u_int32_t, 4)DAST_REPLACE_TYPE_UNSIGNED(u_int64_t, 8)AC_CACHE_CHECK(3rd argument of accept, ac_cv_accept_arg, [ dnl Try socklen_t (POSIX) DAST_ACCEPT_ARG(socklen_t) dnl Try int (original BSD) DAST_ACCEPT_ARG(int) dnl Try size_t (older standard; AIX) DAST_ACCEPT_ARG(size_t) dnl Try short (shouldn't be) DAST_ACCEPT_ARG(short) dnl Try long (shouldn't be) DAST_ACCEPT_ARG(long)])if test -z "$ac_cv_accept_arg" ; then ac_cv_accept_arg=intfiAC_DEFINE_UNQUOTED([Socklen_t], $ac_cv_accept_arg, [Define 3rd arg of accept])dnl Checks for library functions.AC_FUNC_FORKAC_FUNC_MALLOCAC_FUNC_MEMCMPAC_FUNC_SELECT_ARGTYPESAC_TYPE_SIGNALAC_FUNC_STRFTIMEAC_FUNC_VPRINTFAC_CHECK_FUNCS([atexit gettimeofday memset pthread_cancel select strchr strerror strtol usleep])AC_REPLACE_FUNCS(snprintf inet_pton inet_ntop gettimeofday)dnl Gotten from some NetBSD configure.indnl We assume that if sprintf() supports %lld or %qd,dnl then all of *printf() does. If not, disable long longdnl support because we don't know how to display it.AH_TEMPLATE(HAVE_QUAD_SUPPORT)AH_TEMPLATE(HAVE_PRINTF_QD)AC_MSG_CHECKING(*printf() support for %lld)can_printf_longlong=noAC_TRY_RUN([ #include <stdio.h> int main() { char buf[100]; sprintf(buf, "%lld", 21726587590LL); return (strcmp(buf, "21726587590")); } ], [ AC_MSG_RESULT(yes) can_printf_longlong=yes ], [ AC_MSG_RESULT(no) ], [ : ])if test $can_printf_longlong != yes; then AC_MSG_CHECKING(*printf() support for %qd) AC_TRY_RUN([ #include <stdio.h> int main() { char buf[100]; sprintf(buf, "%qd", 21726587590LL); return (strcmp(buf, "21726587590")); } ], [ AC_MSG_RESULT(yes) can_printf_longlong=yes AC_DEFINE(HAVE_PRINTF_QD, 1) ], [ AC_MSG_RESULT(no) ], [ : ])fiif test $can_printf_longlong = yes; then AC_DEFINE(HAVE_QUAD_SUPPORT, 1)fidnl ===================================================================dnl Check for compiler characteristicsDAST_CHECK_BOOLAC_C_BIGENDIANdnl ===================================================================dnl Check for system servicesdnl check for multicastif test "$ac_cv_multicast" != no; then AC_CHECK_TYPES(struct ip_mreq,,,[#include "include/headers_slim.h"]) AC_CHECK_DECLS(IP_ADD_MEMBERSHIP,,,[#include "include/headers_slim.h"]) AC_MSG_CHECKING(for multicast support) ac_cv_multicast=no if test "$ac_cv_have_decl_IP_ADD_MEMBERSHIP" = yes; then if test "$ac_cv_type_struct_ip_mreq" = yes; then ac_cv_multicast=yes fi fi AC_MSG_RESULT($ac_cv_multicast) if test "$ac_cv_multicast" = yes; then AC_DEFINE([HAVE_MULTICAST], 1, [Define to enable multicast support]) fifidnl check for IPv6if test "$ac_cv_have_ipv6" != no; then AC_CHECK_TYPES(struct sockaddr_storage,,,[#include "include/headers_slim.h"]) AC_CHECK_TYPES(struct sockaddr_in6,,,[#include "include/headers_slim.h"]) AC_CHECK_DECLS(AF_INET6,,,[#include "include/headers_slim.h"]) AC_MSG_CHECKING(for IPv6 headers and structures) ac_cv_have_ipv6=no if test "$ac_cv_type_struct_sockaddr_storage" = yes; then if test "$ac_cv_type_struct_sockaddr_in6" = yes; then if test "$ac_cv_have_decl_AF_INET6" = yes; then AC_DEFINE([HAVE_IPV6], 1, [Define to enable IPv6 support]) ac_cv_have_ipv6=yes fi fi fi AC_MSG_RESULT($ac_cv_have_ipv6)fiif test "$ac_cv_have_ipv6" = yes; then if test "$ac_cv_multicast" = yes; then AC_CHECK_TYPES(struct ipv6_mreq,,,[#include "include/headers_slim.h"]) AC_CHECK_DECLS(IPV6_ADD_MEMBERSHIP,,,[#include "include/headers_slim.h"]) AC_CHECK_DECLS(IPV6_MULTICAST_HOPS,,,[#include "include/headers_slim.h"]) AC_MSG_CHECKING(for IPv6 multicast support) ac_cv_have_ipv6_multicast=no if test "$ac_cv_type_struct_ipv6_mreq" = yes; then if test "$ac_cv_have_decl_IPV6_ADD_MEMBERSHIP" = yes; then if test "$ac_cv_have_decl_IPV6_MULTICAST_HOPS" = yes; then AC_DEFINE([HAVE_IPV6_MULTICAST], 1, [Define to enable IPv6 multicast support]) ac_cv_have_ipv6_multicast=yes fi fi fi AC_MSG_RESULT($ac_cv_have_ipv6_multicast) fifiif test "$enable_debuginfo" = yes; thenAC_DEFINE([DBG_MJZ], 1, [Define if debugging info is desired])fiif test "$enable_web100" != no; thenif test -e "/proc/web100"; thenif test -d "/proc/web100"; thenif test -e "/proc/web100/header"; thenif test -f "/proc/web100/header"; thenif test -r "/proc/web100/header"; thenAM_PATH_WEB100()if test "$web100_success" = yes; then AC_DEFINE([HAVE_WEB100], 1, [Define if Web100 is desired and available])fi fi fi fi fi fifidnl GNU make allows us to use the $(strip ...) builtin which eliminates adnl large amount of extra whitespace in compile lines.AC_MSG_CHECKING(whether make is GNU make)STRIP_BEGIN=STRIP_END=if $ac_make --version 2> /dev/null | grep '^GNU Make ' > /dev/null ; then STRIP_BEGIN='$(strip $(STRIP_DUMMY)' STRIP_END=')' AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fidnl some Make 3.79 $(strip ) versions are broken and require an empty argSTRIP_DUMMY=AC_SUBST(STRIP_DUMMY)AC_SUBST(STRIP_BEGIN)AC_SUBST(STRIP_END)AC_CONFIG_FILES([Makefile compat/Makefile doc/Makefile include/Makefile src/Makefile])AC_OUTPUT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -