From c41a336f116661895151bdc2e04c4c4cfa7cdc2b Mon Sep 17 00:00:00 2001 From: Dojin Date: Fri, 5 Sep 2025 07:07:27 +0000 Subject: [PATCH 01/11] First Commit for mTCP pcap porting project Checked 20KB data transfer successfully need to work on large file transfer in mtcp/src ,, need to make with flags: "-DDISABLE_DPDK -DDISABLE_HWCSUM" --- apps/example/Makefile.in | 27 +- apps/example/epserver.c | 13 +- apps/example/epserver.conf | 15 +- apps/example/run_client.sh | 1 + apps/example/run_server.sh | 1 + apps/example/sample_client.c | 62 ++ apps/example/set_network_namespace.sh | 14 + configure.ac | 31 +- mtcp/src/Makefile.in | 11 +- mtcp/src/config.c | 26 +- mtcp/src/core.c | 951 ++++++++++++++++---------- mtcp/src/include/io_module.h | 5 + mtcp/src/io_module.c | 579 ++++++++++------ mtcp/src/pcap_module.c | 230 +++++++ mtcp/src/tcp_in.c | 17 +- util/include/netlib.h | 3 +- util/netlib.c | 3 + 17 files changed, 1354 insertions(+), 635 deletions(-) create mode 100755 apps/example/run_client.sh create mode 100755 apps/example/run_server.sh create mode 100644 apps/example/sample_client.c create mode 100755 apps/example/set_network_namespace.sh create mode 100644 mtcp/src/pcap_module.c diff --git a/apps/example/Makefile.in b/apps/example/Makefile.in index acfa6aea4..cbdda4225 100644 --- a/apps/example/Makefile.in +++ b/apps/example/Makefile.in @@ -7,6 +7,7 @@ PS=@PSIO@ NETMAP=@NETMAP@ ONVM=@ONVM@ CCP=@CCP@ +PCAP=@PCAP@ CFLAGS=@CFLAGS@ # Add arch-specific optimization @@ -25,35 +26,31 @@ UTIL_INC = -I${UTIL_FLD}/include UTIL_OBJ = ${UTIL_FLD}/http_parsing.o ${UTIL_FLD}/tdate_parse.o ${UTIL_FLD}/netlib.o # util library and header -INC = -I./include/ ${UTIL_INC} ${MTCP_INC} -I${UTIL_FLD}/include -LIBS = ${MTCP_LIB} +INC = -I./include/ ${UTIL_INC} ${MTCP_INC} +LIBS = ${MTCP_LIB} -lmtcp -lpthread -lnuma -lrt # psio-specific variables ifeq ($(PS),1) PS_DIR = ../../io_engine/ PS_INC = ${PS_DIR}/include -INC += -I{PS_INC} -LIBS += -lmtcp -L${PS_DIR}/lib -lps -lpthread -lnuma -lrt +INC += -I${PS_INC} +LIBS += -L${PS_DIR}/lib -lps endif # netmap-specific variables ifeq ($(NETMAP),1) -LIBS += -lmtcp -lpthread -lnuma -lrt +INC += -I../../io_engine/include endif # dpdk-specific variables ifeq ($(DPDK),1) DPDK_MACHINE_LINKER_FLAGS=$${RTE_SDK}/$${RTE_TARGET}/lib/ldflags.txt DPDK_MACHINE_LDFLAGS=$(shell cat ${DPDK_MACHINE_LINKER_FLAGS}) -LIBS += -g -O3 -pthread -lrt -march=native ${MTCP_FLD}/lib/libmtcp.a -lnuma -lmtcp -lpthread -lrt -ldl -lgmp -L${RTE_SDK}/${RTE_TARGET}/lib ${DPDK_MACHINE_LDFLAGS} +LIBS += -g -O3 -pthread -lrt -march=native -ldl -lgmp -L${RTE_SDK}/${RTE_TARGET}/lib ${DPDK_MACHINE_LDFLAGS} endif # onvm-specific variables ifeq ($(ONVM),1) -ifeq ($(RTE_TARGET),) -$(error "Please define RTE_TARGET environment variable") -endif - INC += -I@ONVMLIBPATH@/onvm_nflib INC += -I@ONVMLIBPATH@/lib INC += -DENABLE_ONVM @@ -61,6 +58,11 @@ LIBS += @ONVMLIBPATH@/onvm_nflib/$(RTE_TARGET)/libonvm.a LIBS += @ONVMLIBPATH@/lib/$(RTE_TARGET)/lib/libonvmhelper.a -lm endif +# pcap-specific variables +ifeq ($(PCAP),1) +LIBS += -lpcap +endif + ifeq ($V,) # no echo export MSG=@echo export HIDE=@ @@ -84,7 +86,7 @@ epserver.o: epserver.c epserver: epserver.o ${MTCP_FLD}/lib/libmtcp.a $(MSG) " LD $<" - $(HIDE) ${CC} $< ${LIBS} ${UTIL_OBJ} -o $@ + $(HIDE) ${CC} $< ${UTIL_OBJ} -L${MTCP_FLD}/lib -lmtcp -lpthread -lnuma -lrt ${LIBS} -o $@ epwget.o: epwget.c $(MSG) " CC $<" @@ -92,7 +94,8 @@ epwget.o: epwget.c epwget: epwget.o ${MTCP_FLD}/lib/libmtcp.a $(MSG) " LD $<" - $(HIDE) ${CC} $< ${LIBS} ${UTIL_OBJ} -o $@ + $(HIDE) ${CC} $< ${UTIL_OBJ} -L${MTCP_FLD}/lib -lmtcp -lpthread -lnuma -lrt ${LIBS} -o $@ + clean: $(MSG) " CLEAN $(TARGETS)" diff --git a/apps/example/epserver.c b/apps/example/epserver.c index 0ed0be770..624fb2a42 100644 --- a/apps/example/epserver.c +++ b/apps/example/epserver.c @@ -288,7 +288,7 @@ AcceptConnection(struct thread_context *ctx, int listener) struct mtcp_epoll_event ev; int c; - c = mtcp_accept(mctx, listener, NULL, NULL); + c = mtcp_accept(mctx, listener, NULL, NULL); // return connected socket file descriptor if (c >= 0) { if (c >= MAX_FLOW_NUM) { @@ -321,6 +321,7 @@ InitializeServerThread(int core) struct thread_context *ctx; /* affinitize application thread to a CPU core */ + #if HT_SUPPORT mtcp_core_affinitize(core + (num_cores / 2)); #else @@ -387,7 +388,7 @@ CreateListeningSocket(struct thread_context *ctx) /* bind to port 80 */ saddr.sin_family = AF_INET; saddr.sin_addr.s_addr = INADDR_ANY; - saddr.sin_port = htons(80); + saddr.sin_port = htons(8080); ret = mtcp_bind(ctx->mctx, listener, (struct sockaddr *)&saddr, sizeof(struct sockaddr_in)); if (ret < 0) { @@ -445,7 +446,10 @@ RunServerThread(void *arg) exit(-1); } + printf("listening socket created !! \n"); + while (!done[core]) { + printf("waiting\n"); nevents = mtcp_epoll_wait(mctx, ep, events, MAX_EVENTS, -1); if (nevents < 0) { if (errno != EINTR) @@ -457,9 +461,9 @@ RunServerThread(void *arg) for (i = 0; i < nevents; i++) { if (events[i].data.sockid == listener) { + printf("listener!! \n"); /* if the event is for the listener, accept connection */ do_accept = TRUE; - } else if (events[i].events & MTCP_EPOLLERR) { int err; socklen_t len = sizeof(err); @@ -479,7 +483,8 @@ RunServerThread(void *arg) CloseConnection(ctx, events[i].data.sockid, &ctx->svars[events[i].data.sockid]); - } else if (events[i].events & MTCP_EPOLLIN) { + }else if (events[i].events & MTCP_EPOLLIN) { + printf("epoll in event!! \n"); ret = HandleReadEvent(ctx, events[i].data.sockid, &ctx->svars[events[i].data.sockid]); diff --git a/apps/example/epserver.conf b/apps/example/epserver.conf index 0855eacb5..5bae61791 100644 --- a/apps/example/epserver.conf +++ b/apps/example/epserver.conf @@ -5,8 +5,8 @@ #io = psio #io = netmap #io = onvm -io = dpdk - +#io = dpdk +io = pcap # No. of cores setting (enabling this option will override # the `cpu' config for those applications that accept # num_cores as command line arguments) @@ -14,13 +14,13 @@ io = dpdk # e.g. in case ./epserver is executed with `-N 4', the # mtcp core will still invoke 8 mTCP threads if the # following line is uncommented. -#num_cores = 8 +num_cores = 1 # Core mask #core_mask = 0000000F0 # Number of memory channels per processor socket (dpdk-only) -num_mem_ch = 4 +#num_mem_ch = 4 #--- ONVM specific args ---# # Service id (required) @@ -48,10 +48,11 @@ num_mem_ch = 4 #port = xge0 xge1 #port = xge1 #------ DPDK ports -------# -port = dpdk0 +#port = dpdk0 #port = dpdk1 #port = dpdk0 dpdk1 - +#------ PCAP ports -------# +port = veth_host # Congestion control algorithm # (only available when configured with --enable-ccp) # cc = reno @@ -85,7 +86,7 @@ tcp_timewait = 0 #stat_print = xge0 #stat_print = xge1 #------ DPDK ports -------# -stat_print = dpdk0 +#stat_print = dpdk0 #stat_print = dpdk0 dpdk1 ####################################################### diff --git a/apps/example/run_client.sh b/apps/example/run_client.sh new file mode 100755 index 000000000..58d4999f8 --- /dev/null +++ b/apps/example/run_client.sh @@ -0,0 +1 @@ +sudo ip netns exec ns_client ./sample_client \ No newline at end of file diff --git a/apps/example/run_server.sh b/apps/example/run_server.sh new file mode 100755 index 000000000..17de20d9a --- /dev/null +++ b/apps/example/run_server.sh @@ -0,0 +1 @@ +sudo ./epserver -p www_home -f epserver.conf -N 1 \ No newline at end of file diff --git a/apps/example/sample_client.c b/apps/example/sample_client.c new file mode 100644 index 000000000..e1e166a99 --- /dev/null +++ b/apps/example/sample_client.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include + +#define SERVER_IP "10.200.1.1" // server IP +#define SERVER_PORT 8080 +#define BUF_SIZE 8192 + +int main() { + int sock; + struct sockaddr_in serv_addr; + char buffer[BUF_SIZE]; + int n; + + // create socket + if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + perror("socket"); + exit(1); + } + + // server address + memset(&serv_addr, 0, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_port = htons(SERVER_PORT); + inet_pton(AF_INET, SERVER_IP, &serv_addr.sin_addr); + + // connect + if (connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) { + perror("connect"); + exit(1); + } + + // send HTTP GET + char *req = "GET /sample_100MB.txt HTTP/1.0\r\nHost: 10.200.1.1\r\n\r\n"; + if (write(sock, req, strlen(req)) < 0) { + perror("write"); + close(sock); + exit(1); + } + + // open output file + FILE *fp = fopen("downloaded.txt", "wb"); + if (!fp) { + perror("fopen"); + close(sock); + exit(1); + } + + // receive and save + while ((n = read(sock, buffer, BUF_SIZE)) > 0) { + fwrite(buffer, 1, n, fp); + printf("received: %d\n",n); + } + + fclose(fp); + close(sock); + + printf("Download complete: saved to downloaded_100MB.txt\n"); + return 0; +} diff --git a/apps/example/set_network_namespace.sh b/apps/example/set_network_namespace.sh new file mode 100755 index 000000000..65ca3c2e8 --- /dev/null +++ b/apps/example/set_network_namespace.sh @@ -0,0 +1,14 @@ +# Clean up +sudo ip netns del ns_client 2>/dev/null +sudo ip link del veth_host 2>/dev/null + +# Create namespace + veth pair +sudo ip netns add ns_client +sudo ip link add veth_host type veth peer name veth_client +sudo ip link set veth_client netns ns_client + +# Assign IPs +sudo ip addr add 10.200.1.1/24 dev veth_host +sudo ip link set veth_host up +sudo ip netns exec ns_client ip addr add 10.200.1.2/24 dev veth_client +sudo ip netns exec ns_client ip link set veth_client up diff --git a/configure.ac b/configure.ac index fe30e6a4e..897c313df 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,7 @@ fi # Checks for header files. AC_HEADER_STDC +AC_CHECK_HEADER([pcap.h], [], [AC_MSG_ERROR([Could not find pcap.h. Please install libpcap-dev.])]) AC_CHECK_HEADER([linux/sched.h],,AC_MSG_ERROR([Could not find linux/sched.h])) AC_CHECK_HEADER([pthread.h],,AC_MSG_ERROR([Could not find pthread.h])) AC_CHECK_HEADER([numa.h],,AC_MSG_ERROR([Could not find numa.h])) @@ -79,6 +80,31 @@ AC_SUBST(NETMAP, 0) # Reset HWCSUM to 1 AC_SUBST(HWCSUM, 1) +# Check pcap path (lib & inc) +AC_ARG_WITH([pcap-lib], + [AS_HELP_STRING([--with-pcap-lib=PATH], [path to libpcap install root])], + [pcap_lib=$withval], [pcap_lib=""]) + +if test "x$pcap_lib" != "x"; then + AC_SUBST(PCAPLIBPATH, $pcap_lib) + AC_SUBST(PCAP, 1) + + CPPFLAGS="$CPPFLAGS -I$pcap_lib/include" + LDFLAGS="$LDFLAGS -L$pcap_lib/lib" +fi + +# Check presence of pcap headers and functions +AC_CHECK_HEADERS([pcap.h], + [], [AC_MSG_ERROR([Could not find pcap.h])]) + +AC_CHECK_LIB([pcap], [pcap_open_live], + [LIBS="$LIBS -lpcap"], + [AC_MSG_ERROR([Could not find libpcap. Please install libpcap-dev.])]) + +AC_DEFINE([HAVE_PCAP], [1], [Define if libpcap is available]) +AM_CONDITIONAL([PCAP], [test x$PCAP = x1]) + + # Check dpdk-17.08 path (lib & inc) AC_ARG_WITH(stuff, [ --with-dpdk-lib path to the dpdk-17.08 install root]) if test "$with_dpdk_lib" != "" @@ -148,11 +174,12 @@ then AC_SUBST(ONVM, 1) fi -if test "$with_psio_lib" == "" && test "$with_dpdk_lib" == "" && test "$enable_netmap" = "" +if test "$with_psio_lib" == "" && test "$with_dpdk_lib" == "" && test "$enable_netmap" = "" && test "x$pcap_lib" = "x" then - AC_MSG_ERROR([Packet I/O library is missing. Please set either dpdk or psio or netmap as your I/O lib.]) + AC_MSG_ERROR([Packet I/O library is missing. Please set either dpdk, psio, netmap, or pcap as your I/O lib.]) fi + if test "x$enable_ccp" = "xyes" then AC_CHECK_LIB(startccp, libstartccp_run_forever, [echo "Found CCP library"], [ diff --git a/mtcp/src/Makefile.in b/mtcp/src/Makefile.in index f81a0c8d7..6537f7a82 100644 --- a/mtcp/src/Makefile.in +++ b/mtcp/src/Makefile.in @@ -98,15 +98,20 @@ INC += -I$(PS_DIR)/include # CFLAGS for DPDK-related compilation ifeq ($(DPDK), 1) -include $(RTE_SDK)/mk/rte.vars.mk -CFLAGS+=@CFLAGS@ +PKGCONF = pkg-config +DPDK_CFLAGS = $(shell $(PKGCONF) --cflags libdpdk) +DPDK_LDFLAGS += $(shell $(PKGCONF) --libs libdpdk) +INC += $(DPDK_CFLAGS) +LDFLAGS += $(DPDK_LDFLAGS) +LDFLAGS += -lrte_net_bond ifeq ($(ENFORCE_RX_IDLE), 1) -INC += -DENFORCE_RX_IDLE -DRX_IDLE_THRESH=@RX_IDLE_THRESH@ +INC += -DENFORCE_RX_IDLE -DRX_IDLE_THRESH=0 endif else INC += -DDISABLE_DPDK endif + ifeq ($(CCP), 1) LIBCCP_PATH=./libccp CCP_LIBS = -L$(LIBCCP_PATH) -lccp diff --git a/mtcp/src/config.c b/mtcp/src/config.c index 38188bde4..ce93afe15 100644 --- a/mtcp/src/config.c +++ b/mtcp/src/config.c @@ -157,7 +157,14 @@ EnrollRouteTableEntry(char *optstr) break; } #endif - } + } else if (current_iomodule_func == &pcap_module_func) { + for (i = 0; i < num_devices; i++) { + if (strcmp(CONFIG.eths[i].dev_name, dev)) + continue; + ifidx = CONFIG.eths[i].ifindex; + break; + } + } ridx = CONFIG.routes++; if (ridx == MAX_ROUTE_ENTRY) { @@ -561,6 +568,7 @@ ParseConfiguration(char *line) char *saveptr; strncpy(optstr, line, MAX_OPTLINE_LEN - 1); + optstr[MAX_OPTLINE_LEN - 1] = '\0'; saveptr = NULL; p = strtok_r(optstr, " \t=", &saveptr); @@ -640,17 +648,11 @@ ParseConfiguration(char *line) } } else if (strcmp(p, "num_mem_ch") == 0) { CONFIG.num_mem_ch = mystrtol(q, 10); -#ifdef ENABLE_ONVM - } else if (strcmp(p, "onvm_inst") == 0) { - CONFIG.onvm_inst = mystrtol(q, 10); - } else if (strcmp(p, "onvm_serv") == 0) { - CONFIG.onvm_serv = mystrtol(q, 10); - } else if (strcmp(p, "onvm_dest") == 0) { - CONFIG.onvm_dest = mystrtol(q, 10); -#endif + } else if (strcmp(p, "multiprocess") == 0) { SetMultiProcessSupport(line + strlen(p) + 1); } else if (strcmp(p, "cc") == 0) { + #if USE_CCP // ignore the parsing done by the second strtok_r so that we can get the full param string *strchr(q, '\0') = ' '; @@ -684,7 +686,6 @@ LoadConfiguration(const char *fname) TRACE_CONFIG("Failed to load configuration file: %s\n", fname); return -1; } - #ifndef DISABLE_DPDK mpz_init(CONFIG._cpumask); #endif @@ -726,10 +727,9 @@ LoadConfiguration(const char *fname) /* if sndbuf & rcvbuf are not set, rcvbuf = sndbuf = 8192 */ if (CONFIG.rcvbuf_size == -1 && CONFIG.sndbuf_size == -1) CONFIG.sndbuf_size = CONFIG.rcvbuf_size = 8192; - + + return SetNetEnv(port_list, port_stat_list); - - return 0; } /*----------------------------------------------------------------------------*/ void diff --git a/mtcp/src/core.c b/mtcp/src/core.c index b06c4d73f..6bbe13abc 100644 --- a/mtcp/src/core.c +++ b/mtcp/src/core.c @@ -53,12 +53,12 @@ #define LOG_FILE_NAME "log" #define MAX_FILE_NAME 1024 -#define MAX(a, b) ((a)>(b)?(a):(b)) -#define MIN(a, b) ((a)<(b)?(a):(b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define PER_STREAM_SLICE 0.1 // in ms -#define PER_STREAM_TCHECK 1 // in ms -#define PS_SELECT_TIMEOUT 100 // in us +#define PER_STREAM_SLICE 0.1 // in ms +#define PER_STREAM_TCHECK 1 // in ms +#define PS_SELECT_TIMEOUT 100 // in us #define GBPS(bytes) (bytes * 8.0 / (1000 * 1000 * 1000)) @@ -68,10 +68,9 @@ struct mtcp_thread_context *g_pctx[MAX_CPUS] = {0}; struct log_thread_context *g_logctx[MAX_CPUS] = {0}; /*----------------------------------------------------------------------------*/ static pthread_t g_thread[MAX_CPUS] = {0}; -#if defined (PKTDUMP) || (DBGMSG) || (DBGFUNC) || \ - (STREAM) || (STATE) || (STAT) || (APP) || (EPOLL) \ - || (DUMP_STREAM) -static pthread_t log_thread[MAX_CPUS] = {0}; +#if defined(PKTDUMP) || (DBGMSG) || (DBGFUNC) || \ + (STREAM) || (STATE) || (STAT) || (APP) || (EPOLL) || (DUMP_STREAM) +static pthread_t log_thread[MAX_CPUS] = {0}; #endif #if USE_CCP static pthread_t ccp_run_thread = 0; @@ -86,15 +85,14 @@ static int sigint_cnt[MAX_CPUS] = {0}; static struct timespec sigint_ts[MAX_CPUS]; /*----------------------------------------------------------------------------*/ static int mtcp_master = -1; -void -mtcp_free_context(mctx_t mctx); +void mtcp_free_context(mctx_t mctx); /*----------------------------------------------------------------------------*/ -void -HandleSignal(int signal) +void HandleSignal(int signal) { int i = 0; - if (signal == SIGINT) { + if (signal == SIGINT) + { int core; struct timespec cur_ts; @@ -105,25 +103,37 @@ HandleSignal(int signal) core = sched_getcpu(); clock_gettime(CLOCK_REALTIME, &cur_ts); - if (CONFIG.multi_process) { + if (CONFIG.multi_process) + { for (i = 0; i < num_cpus; i++) if (running[i] == TRUE) g_pctx[i]->exit = TRUE; - } else { - if (sigint_cnt[core] > 0 && cur_ts.tv_sec > sigint_ts[core].tv_sec) { - for (i = 0; i < num_cpus; i++) { - if (running[i]) { + } + else + { + if (sigint_cnt[core] > 0 && cur_ts.tv_sec > sigint_ts[core].tv_sec) + { + for (i = 0; i < num_cpus; i++) + { + if (running[i]) + { g_pctx[i]->exit = TRUE; } } - } else { - for (i = 0; i < num_cpus; i++) { + } + else + { + for (i = 0; i < num_cpus; i++) + { if (running[i]) g_pctx[i]->interrupt = TRUE; } - if (!app_signal_handler) { - for (i = 0; i < num_cpus; i++) { - if (running[i]) { + if (!app_signal_handler) + { + for (i = 0; i < num_cpus; i++) + { + if (running[i]) + { g_pctx[i]->exit = TRUE; } } @@ -134,15 +144,17 @@ HandleSignal(int signal) } } - if (signal != SIGUSR1) { - if (app_signal_handler) { + if (signal != SIGUSR1) + { + if (app_signal_handler) + { app_signal_handler(signal); } } } /*----------------------------------------------------------------------------*/ -static int -AttachDevice(struct mtcp_thread_context* ctx) +static int +AttachDevice(struct mtcp_thread_context *ctx) { int working = -1; mtcp_manager_t mtcp = ctx->mtcp_manager; @@ -153,7 +165,7 @@ AttachDevice(struct mtcp_thread_context* ctx) } /*----------------------------------------------------------------------------*/ #ifdef NETSTAT -static inline void +static inline void InitStatCounter(struct stat_counter *counter) { counter->cnt = 0; @@ -162,7 +174,7 @@ InitStatCounter(struct stat_counter *counter) counter->min = 0; } /*----------------------------------------------------------------------------*/ -static inline void +static inline void UpdateStatCounter(struct stat_counter *counter, int64_t value) { counter->cnt++; @@ -173,25 +185,26 @@ UpdateStatCounter(struct stat_counter *counter, int64_t value) counter->min = value; } /*----------------------------------------------------------------------------*/ -static inline uint64_t +static inline uint64_t GetAverageStat(struct stat_counter *counter) { return counter->cnt ? (counter->sum / counter->cnt) : 0; } /*----------------------------------------------------------------------------*/ -static inline int64_t +static inline int64_t TimeDiffUs(struct timeval *t2, struct timeval *t1) { - return (t2->tv_sec - t1->tv_sec) * 1000000 + - (int64_t)(t2->tv_usec - t1->tv_usec); + return (t2->tv_sec - t1->tv_sec) * 1000000 + + (int64_t)(t2->tv_usec - t1->tv_usec); } /*----------------------------------------------------------------------------*/ -static inline void +static inline void PrintThreadNetworkStats(mtcp_manager_t mtcp, struct net_stat *ns) { int i; - for (i = 0; i < CONFIG.eths_num; i++) { + for (i = 0; i < CONFIG.eths_num; i++) + { ns->rx_packets[i] = mtcp->nstat.rx_packets[i] - mtcp->p_nstat.rx_packets[i]; ns->rx_errors[i] = mtcp->nstat.rx_errors[i] - mtcp->p_nstat.rx_errors[i]; ns->rx_bytes[i] = mtcp->nstat.rx_bytes[i] - mtcp->p_nstat.rx_bytes[i]; @@ -199,13 +212,14 @@ PrintThreadNetworkStats(mtcp_manager_t mtcp, struct net_stat *ns) ns->tx_drops[i] = mtcp->nstat.tx_drops[i] - mtcp->p_nstat.tx_drops[i]; ns->tx_bytes[i] = mtcp->nstat.tx_bytes[i] - mtcp->p_nstat.tx_bytes[i]; #if NETSTAT_PERTHREAD - if (CONFIG.eths[i].stat_print) { + if (CONFIG.eths[i].stat_print) + { fprintf(stderr, "[CPU%2d] %s flows: %6u, " - "RX: %7ld(pps) (err: %5ld), %5.2lf(Gbps), " - "TX: %7ld(pps), %5.2lf(Gbps)\n", - mtcp->ctx->cpu, CONFIG.eths[i].dev_name, mtcp->flow_cnt, - ns->rx_packets[i], ns->rx_errors[i], GBPS(ns->rx_bytes[i]), - ns->tx_packets[i], GBPS(ns->tx_bytes[i])); + "RX: %7ld(pps) (err: %5ld), %5.2lf(Gbps), " + "TX: %7ld(pps), %5.2lf(Gbps)\n", + mtcp->ctx->cpu, CONFIG.eths[i].dev_name, mtcp->flow_cnt, + ns->rx_packets[i], ns->rx_errors[i], GBPS(ns->rx_bytes[i]), + ns->tx_packets[i], GBPS(ns->tx_bytes[i])); } #endif } @@ -214,11 +228,10 @@ PrintThreadNetworkStats(mtcp_manager_t mtcp, struct net_stat *ns) ns->tx_gdptbytes = mtcp->nstat.tx_gdptbytes - mtcp->p_nstat.tx_gdptbytes; #endif mtcp->p_nstat = mtcp->nstat; - } /*----------------------------------------------------------------------------*/ #if ROUND_STAT -static inline void +static inline void PrintThreadRoundStats(mtcp_manager_t mtcp, struct run_stat *rs) { #define ROUND_DIV (1000) @@ -235,12 +248,12 @@ PrintThreadRoundStats(mtcp_manager_t mtcp, struct run_stat *rs) mtcp->p_runstat = mtcp->runstat; #if NETSTAT_PERTHREAD fprintf(stderr, "[CPU%2d] Rounds: %4ldK, " - "rx: %3ldK (try: %4ldK), tx: %3ldK (try: %4ldK), " - "ps_select: %4ld (rx: %4ld, tx: %4ld, intr: %3ld)\n", - mtcp->ctx->cpu, rs->rounds / ROUND_DIV, - rs->rounds_rx / ROUND_DIV, rs->rounds_rx_try / ROUND_DIV, - rs->rounds_tx / ROUND_DIV, rs->rounds_tx_try / ROUND_DIV, - rs->rounds_select, + "rx: %3ldK (try: %4ldK), tx: %3ldK (try: %4ldK), " + "ps_select: %4ld (rx: %4ld, tx: %4ld, intr: %3ld)\n", + mtcp->ctx->cpu, rs->rounds / ROUND_DIV, + rs->rounds_rx / ROUND_DIV, rs->rounds_rx_try / ROUND_DIV, + rs->rounds_tx / ROUND_DIV, rs->rounds_tx_try / ROUND_DIV, + rs->rounds_select, rs->rounds_select_rx, rs->rounds_select_tx, rs->rounds_select_intr); #endif } @@ -249,12 +262,12 @@ PrintThreadRoundStats(mtcp_manager_t mtcp, struct run_stat *rs) #endif /* NETSTAT */ /*----------------------------------------------------------------------------*/ #if EVENT_STAT -static inline void +static inline void PrintEventStat(int core, struct mtcp_epoll_stat *stat) { fprintf(stderr, "[CPU%2d] calls: %lu, waits: %lu, wakes: %lu, " - "issued: %lu, registered: %lu, invalidated: %lu, handled: %lu\n", - core, stat->calls, stat->waits, stat->wakes, + "issued: %lu, registered: %lu, invalidated: %lu, handled: %lu\n", + core, stat->calls, stat->waits, stat->wakes, stat->issued, stat->registered, stat->invalidated, stat->handled); memset(stat, 0, sizeof(struct mtcp_epoll_stat)); } @@ -279,19 +292,23 @@ PrintNetworkStats(mtcp_manager_t mtcp, uint32_t cur_ts) #endif /* ROUND_STAT */ #endif /* NETSTAT_TOTAL */ - if (TS_TO_MSEC(cur_ts - mtcp->p_nstat_ts) < SEC_TO_MSEC(TIMEOUT)) { + if (TS_TO_MSEC(cur_ts - mtcp->p_nstat_ts) < SEC_TO_MSEC(TIMEOUT)) + { return; } mtcp->p_nstat_ts = cur_ts; gflow_cnt = 0; memset(&g_nstat, 0, sizeof(struct net_stat)); - for (i = 0; i < CONFIG.num_cores; i++) { - if (running[i]) { + for (i = 0; i < CONFIG.num_cores; i++) + { + if (running[i]) + { PrintThreadNetworkStats(g_mtcp[i], &ns); #if NETSTAT_TOTAL gflow_cnt += g_mtcp[i]->flow_cnt; - for (j = 0; j < CONFIG.eths_num; j++) { + for (j = 0; j < CONFIG.eths_num; j++) + { g_nstat.rx_packets[j] += ns.rx_packets[j]; g_nstat.rx_errors[j] += ns.rx_errors[j]; g_nstat.rx_bytes[j] += ns.rx_bytes[j]; @@ -307,13 +324,16 @@ PrintNetworkStats(mtcp_manager_t mtcp, uint32_t cur_ts) } } #if NETSTAT_TOTAL - for (i = 0; i < CONFIG.eths_num; i++) { - if (CONFIG.eths[i].stat_print) { + for (i = 0; i < CONFIG.eths_num; i++) + { + if (CONFIG.eths[i].stat_print) + { fprintf(stderr, "[ ALL ] %s flows: %6u, " - "RX: %7ld(pps) (err: %5ld), %5.2lf(Gbps), " - "TX: %7ld(pps), %5.2lf(Gbps)\n", CONFIG.eths[i].dev_name, - gflow_cnt, g_nstat.rx_packets[i], g_nstat.rx_errors[i], - GBPS(g_nstat.rx_bytes[i]), g_nstat.tx_packets[i], + "RX: %7ld(pps) (err: %5ld), %5.2lf(Gbps), " + "TX: %7ld(pps), %5.2lf(Gbps)\n", + CONFIG.eths[i].dev_name, + gflow_cnt, g_nstat.rx_packets[i], g_nstat.rx_errors[i], + GBPS(g_nstat.rx_bytes[i]), g_nstat.tx_packets[i], GBPS(g_nstat.tx_bytes[i])); } } @@ -325,8 +345,10 @@ PrintNetworkStats(mtcp_manager_t mtcp, uint32_t cur_ts) #if ROUND_STAT memset(&g_runstat, 0, sizeof(struct run_stat)); - for (i = 0; i < CONFIG.num_cores; i++) { - if (running[i]) { + for (i = 0; i < CONFIG.num_cores; i++) + { + if (running[i]) + { PrintThreadRoundStats(g_mtcp[i], &rs); #if 0 g_runstat.rounds += rs.rounds; @@ -352,8 +374,10 @@ PrintNetworkStats(mtcp_manager_t mtcp, uint32_t cur_ts) #endif /* ROUND_STAT */ #if EVENT_STAT - for (i = 0; i < CONFIG.num_cores; i++) { - if (running[i] && g_mtcp[i]->ep) { + for (i = 0; i < CONFIG.num_cores; i++) + { + if (running[i] && g_mtcp[i]->ep) + { PrintEventStat(i, &g_mtcp[i]->ep->stat); } } @@ -364,13 +388,14 @@ PrintNetworkStats(mtcp_manager_t mtcp, uint32_t cur_ts) #endif /* NETSTAT */ /*----------------------------------------------------------------------------*/ #if BLOCKING_SUPPORT -static inline void +static inline void FlushAcceptEvents(mtcp_manager_t mtcp) { STAT_COUNT(mtcp->runstat.rounds_accept); pthread_mutex_lock(&mtcp->listener->accept_lock); - if (!StreamQueueIsEmpty(mtcp->listener->acceptq)) { + if (!StreamQueueIsEmpty(mtcp->listener->acceptq)) + { pthread_cond_signal(&mtcp->listener->accept_cond); } pthread_mutex_unlock(&mtcp->listener->accept_lock); @@ -389,7 +414,8 @@ FlushWriteEvents(mtcp_manager_t mtcp, int thresh) cnt = 0; walk = TAILQ_FIRST(&mtcp->snd_br_list); last = TAILQ_LAST(&mtcp->snd_br_list, snd_br_head); - while (walk) { + while (walk) + { if (++cnt > thresh) break; @@ -397,9 +423,11 @@ FlushWriteEvents(mtcp_manager_t mtcp, int thresh) TRACE_LOOP("Inside send broadcasting list. cnt: %u\n", cnt); TAILQ_REMOVE(&mtcp->snd_br_list, walk, sndvar->snd_br_link); mtcp->snd_br_list_cnt--; - if (walk->on_snd_br_list) { + if (walk->on_snd_br_list) + { TRACE_SNDBUF("Broadcasting available sending buffer!\n"); - if (!(walk->epoll & MTCP_EPOLLOUT)) { + if (!(walk->epoll & MTCP_EPOLLOUT)) + { pthread_cond_signal(&walk->write_cond); walk->on_snd_br_list = FALSE; } @@ -411,9 +439,9 @@ FlushWriteEvents(mtcp_manager_t mtcp, int thresh) } } /*----------------------------------------------------------------------------*/ -static inline void +static inline void FlushReadEvents(mtcp_manager_t mtcp, int thresh) -{ +{ tcp_stream *walk; tcp_stream *next, *last; int cnt; @@ -424,7 +452,8 @@ FlushReadEvents(mtcp_manager_t mtcp, int thresh) cnt = 0; walk = TAILQ_FIRST(&mtcp->rcv_br_list); last = TAILQ_LAST(&mtcp->rcv_br_list, rcv_br_head); - while (walk) { + while (walk) + { if (++cnt > thresh) break; @@ -432,14 +461,16 @@ FlushReadEvents(mtcp_manager_t mtcp, int thresh) TRACE_LOOP("Inside recv broadcasting list. cnt: %u\n", cnt); TAILQ_REMOVE(&mtcp->rcv_br_list, walk, rcvvar->rcv_br_link); mtcp->rcv_br_list_cnt--; - if (walk->on_rcv_br_list) { - if (!(walk->epoll & MTCP_EPOLLIN)) { + if (walk->on_rcv_br_list) + { + if (!(walk->epoll & MTCP_EPOLLIN)) + { TRACE_TEMP("Broadcasting read contition\n"); pthread_cond_signal(&walk->read_cond); walk->on_rcv_br_list = FALSE; } } - + if (walk == last) break; walk = next; @@ -447,7 +478,7 @@ FlushReadEvents(mtcp_manager_t mtcp, int thresh) } #endif /*----------------------------------------------------------------------------*/ -static inline void +static inline void FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) { struct mtcp_epoll *ep = mtcp->ep; @@ -455,10 +486,12 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) struct event_queue *mtcpq = ep->mtcp_queue; pthread_mutex_lock(&ep->epoll_lock); - if (ep->mtcp_queue->num_events > 0) { + if (ep->mtcp_queue->num_events > 0) + { /* while mtcp_queue have events */ /* and usr_queue is not full */ - while (mtcpq->num_events > 0 && usrq->num_events < usrq->size) { + while (mtcpq->num_events > 0 && usrq->num_events < usrq->size) + { /* copy the event from mtcp_queue to usr_queue */ usrq->events[usrq->end++] = mtcpq->events[mtcpq->start++]; @@ -473,11 +506,12 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) } /* if there are pending events, wake up user */ - if (ep->waiting && (ep->usr_queue->num_events > 0 || - ep->usr_shadow_queue->num_events > 0)) { + if (ep->waiting && (ep->usr_queue->num_events > 0 || + ep->usr_shadow_queue->num_events > 0)) + { STAT_COUNT(mtcp->runstat.rounds_epoll); - TRACE_EPOLL("Broadcasting events. num: %d, cur_ts: %u, prev_ts: %u\n", - ep->usr_queue->num_events, cur_ts, mtcp->ts_last_event); + TRACE_EPOLL("Broadcasting events. num: %d, cur_ts: %u, prev_ts: %u\n", + ep->usr_queue->num_events, cur_ts, mtcp->ts_last_event); mtcp->ts_last_event = cur_ts; ep->stat.wakes++; pthread_cond_signal(&ep->epoll_cond); @@ -485,7 +519,7 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) pthread_mutex_unlock(&ep->epoll_lock); } /*----------------------------------------------------------------------------*/ -static inline void +static inline void HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) { tcp_stream *stream; @@ -494,18 +528,21 @@ HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) int control, send, ack; /* connect handling */ - while ((stream = StreamDequeue(mtcp->connectq))) { + while ((stream = StreamDequeue(mtcp->connectq))) + { AddtoControlList(mtcp, stream, cur_ts); } /* send queue handling */ - while ((stream = StreamDequeue(mtcp->sendq))) { + while ((stream = StreamDequeue(mtcp->sendq))) + { stream->sndvar->on_sendq = FALSE; AddtoSendList(mtcp, stream); } - + /* ack queue handling */ - while ((stream = StreamDequeue(mtcp->ackq))) { + while ((stream = StreamDequeue(mtcp->ackq))) + { stream->sndvar->on_ackq = FALSE; EnqueueACK(mtcp, stream, cur_ts, ACK_OPT_AGGREGATE); } @@ -513,31 +550,40 @@ HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) /* close handling */ handled = delayed = 0; control = send = ack = 0; - while ((stream = StreamDequeue(mtcp->closeq))) { + while ((stream = StreamDequeue(mtcp->closeq))) + { struct tcp_send_vars *sndvar = stream->sndvar; sndvar->on_closeq = FALSE; - - if (sndvar->sndbuf) { + + if (sndvar->sndbuf) + { sndvar->fss = sndvar->sndbuf->head_seq + sndvar->sndbuf->len; - } else { + } + else + { sndvar->fss = stream->snd_nxt; } if (CONFIG.tcp_timeout > 0) RemoveFromTimeoutList(mtcp, stream); - if (stream->have_reset) { + if (stream->have_reset) + { handled++; - if (stream->state != TCP_ST_CLOSED) { + if (stream->state != TCP_ST_CLOSED) + { stream->close_reason = TCP_RESET; stream->state = TCP_ST_CLOSED; TRACE_STATE("Stream %d: TCP_ST_CLOSED\n", stream->id); DestroyTCPStream(mtcp, stream); - } else { + } + else + { TRACE_ERROR("Stream already closed.\n"); } - - } else if (sndvar->on_control_list) { + } + else if (sndvar->on_control_list) + { sndvar->on_closeq_int = TRUE; StreamInternalEnqueue(mtcp->closeq_int, stream); delayed++; @@ -547,33 +593,41 @@ HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) send++; if (sndvar->on_ack_list) ack++; - - } else if (sndvar->on_send_list || sndvar->on_ack_list) { + } + else if (sndvar->on_send_list || sndvar->on_ack_list) + { handled++; - if (stream->state == TCP_ST_ESTABLISHED) { + if (stream->state == TCP_ST_ESTABLISHED) + { stream->state = TCP_ST_FIN_WAIT_1; TRACE_STATE("Stream %d: TCP_ST_FIN_WAIT_1\n", stream->id); - - } else if (stream->state == TCP_ST_CLOSE_WAIT) { + } + else if (stream->state == TCP_ST_CLOSE_WAIT) + { stream->state = TCP_ST_LAST_ACK; TRACE_STATE("Stream %d: TCP_ST_LAST_ACK\n", stream->id); } stream->control_list_waiting = TRUE; - - } else if (stream->state != TCP_ST_CLOSED) { + } + else if (stream->state != TCP_ST_CLOSED) + { handled++; - if (stream->state == TCP_ST_ESTABLISHED) { + if (stream->state == TCP_ST_ESTABLISHED) + { stream->state = TCP_ST_FIN_WAIT_1; TRACE_STATE("Stream %d: TCP_ST_FIN_WAIT_1\n", stream->id); - - } else if (stream->state == TCP_ST_CLOSE_WAIT) { + } + else if (stream->state == TCP_ST_CLOSE_WAIT) + { stream->state = TCP_ST_LAST_ACK; TRACE_STATE("Stream %d: TCP_ST_LAST_ACK\n", stream->id); } - //sndvar->rto = TCP_FIN_RTO; - //UpdateRetransmissionTimer(mtcp, stream, mtcp->cur_ts); + // sndvar->rto = TCP_FIN_RTO; + // UpdateRetransmissionTimer(mtcp, stream, mtcp->cur_ts); AddtoControlList(mtcp, stream, cur_ts); - } else { + } + else + { TRACE_ERROR("Already closed connection!\n"); } } @@ -581,60 +635,77 @@ HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) cnt = 0; max_cnt = mtcp->closeq_int->count; - while (cnt++ < max_cnt) { + while (cnt++ < max_cnt) + { stream = StreamInternalDequeue(mtcp->closeq_int); - if (stream->sndvar->on_control_list) { + if (stream->sndvar->on_control_list) + { StreamInternalEnqueue(mtcp->closeq_int, stream); - - } else if (stream->state != TCP_ST_CLOSED) { + } + else if (stream->state != TCP_ST_CLOSED) + { handled++; stream->sndvar->on_closeq_int = FALSE; - if (stream->state == TCP_ST_ESTABLISHED) { + if (stream->state == TCP_ST_ESTABLISHED) + { stream->state = TCP_ST_FIN_WAIT_1; TRACE_STATE("Stream %d: TCP_ST_FIN_WAIT_1\n", stream->id); - - } else if (stream->state == TCP_ST_CLOSE_WAIT) { + } + else if (stream->state == TCP_ST_CLOSE_WAIT) + { stream->state = TCP_ST_LAST_ACK; TRACE_STATE("Stream %d: TCP_ST_LAST_ACK\n", stream->id); } AddtoControlList(mtcp, stream, cur_ts); - } else { + } + else + { stream->sndvar->on_closeq_int = FALSE; TRACE_ERROR("Already closed connection!\n"); } } /* reset handling */ - while ((stream = StreamDequeue(mtcp->resetq))) { + while ((stream = StreamDequeue(mtcp->resetq))) + { stream->sndvar->on_resetq = FALSE; - + if (CONFIG.tcp_timeout > 0) RemoveFromTimeoutList(mtcp, stream); - if (stream->have_reset) { - if (stream->state != TCP_ST_CLOSED) { + if (stream->have_reset) + { + if (stream->state != TCP_ST_CLOSED) + { stream->close_reason = TCP_RESET; stream->state = TCP_ST_CLOSED; TRACE_STATE("Stream %d: TCP_ST_CLOSED\n", stream->id); DestroyTCPStream(mtcp, stream); - } else { + } + else + { TRACE_ERROR("Stream already closed.\n"); } - - } else if (stream->sndvar->on_control_list || - stream->sndvar->on_send_list || stream->sndvar->on_ack_list) { + } + else if (stream->sndvar->on_control_list || + stream->sndvar->on_send_list || stream->sndvar->on_ack_list) + { /* wait until all the queues are flushed */ stream->sndvar->on_resetq_int = TRUE; StreamInternalEnqueue(mtcp->resetq_int, stream); - - } else { - if (stream->state != TCP_ST_CLOSED) { + } + else + { + if (stream->state != TCP_ST_CLOSED) + { stream->close_reason = TCP_ACTIVE_CLOSE; stream->state = TCP_ST_CLOSED; TRACE_STATE("Stream %d: TCP_ST_CLOSED\n", stream->id); AddtoControlList(mtcp, stream, cur_ts); - } else { + } + else + { TRACE_ERROR("Stream already closed.\n"); } } @@ -643,60 +714,91 @@ HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) cnt = 0; max_cnt = mtcp->resetq_int->count; - while (cnt++ < max_cnt) { + while (cnt++ < max_cnt) + { stream = StreamInternalDequeue(mtcp->resetq_int); - - if (stream->sndvar->on_control_list || - stream->sndvar->on_send_list || stream->sndvar->on_ack_list) { + + if (stream->sndvar->on_control_list || + stream->sndvar->on_send_list || stream->sndvar->on_ack_list) + { /* wait until all the queues are flushed */ StreamInternalEnqueue(mtcp->resetq_int, stream); - - } else { + } + else + { stream->sndvar->on_resetq_int = FALSE; - if (stream->state != TCP_ST_CLOSED) { + if (stream->state != TCP_ST_CLOSED) + { stream->close_reason = TCP_ACTIVE_CLOSE; stream->state = TCP_ST_CLOSED; TRACE_STATE("Stream %d: TCP_ST_CLOSED\n", stream->id); AddtoControlList(mtcp, stream, cur_ts); - } else { + } + else + { TRACE_ERROR("Stream already closed.\n"); } } } /* destroy streams in destroyq */ - while ((stream = StreamDequeue(mtcp->destroyq))) { + while ((stream = StreamDequeue(mtcp->destroyq))) + { DestroyTCPStream(mtcp, stream); } mtcp->wakeup_flag = FALSE; } /*----------------------------------------------------------------------------*/ -static inline void +static inline void WritePacketsToChunks(mtcp_manager_t mtcp, uint32_t cur_ts) { + TRACE_ERROR("here in write packet to chunks \n"); int thresh = CONFIG.max_concurrency; int i; /* Set the threshold to CONFIG.max_concurrency to send ACK immediately */ /* Otherwise, set to appropriate value (e.g. thresh) */ - assert(mtcp->g_sender != NULL); - if (mtcp->g_sender->control_list_cnt) - WriteTCPControlList(mtcp, mtcp->g_sender, cur_ts, thresh); - if (mtcp->g_sender->ack_list_cnt) - WriteTCPACKList(mtcp, mtcp->g_sender, cur_ts, thresh); - if (mtcp->g_sender->send_list_cnt) - WriteTCPDataList(mtcp, mtcp->g_sender, cur_ts, thresh); - - for (i = 0; i < CONFIG.eths_num; i++) { + // assert(mtcp->g_sender != NULL); + // if (mtcp->g_sender->control_list_cnt) + // { + // TRACE_ERROR("no 1\n"); + // WriteTCPControlList(mtcp, mtcp->g_sender, cur_ts, thresh); + // } + // if (mtcp->g_sender->ack_list_cnt) + // { + + // TRACE_ERROR("no 2\n"); + // WriteTCPACKList(mtcp, mtcp->g_sender, cur_ts, thresh); + // } + // if (mtcp->g_sender->send_list_cnt) + // { + + // TRACE_ERROR("no 3\n"); + // WriteTCPDataList(mtcp, mtcp->g_sender, cur_ts, thresh); + // } + for (i = 0; i < CONFIG.eths_num; i++) + { + + TRACE_ERROR("no 4\n") assert(mtcp->n_sender[i] != NULL); if (mtcp->n_sender[i]->control_list_cnt) + { + TRACE_ERROR("no 11\n"); WriteTCPControlList(mtcp, mtcp->n_sender[i], cur_ts, thresh); + } if (mtcp->n_sender[i]->ack_list_cnt) + { + TRACE_ERROR("no 12\n"); WriteTCPACKList(mtcp, mtcp->n_sender[i], cur_ts, thresh); + } if (mtcp->n_sender[i]->send_list_cnt) + { + TRACE_ERROR("no 13\n"); WriteTCPDataList(mtcp, mtcp->n_sender[i], cur_ts, thresh); + } + TRACE_ERROR("no 99\n") } } /*----------------------------------------------------------------------------*/ @@ -713,11 +815,13 @@ DestroyRemainingFlows(mtcp_manager_t mtcp) thread_printf(mtcp, mtcp->log_fp, "CPU %d: Flushing remaining flows.\n", mtcp->ctx->cpu); #endif - for (i = 0; i < NUM_BINS; i++) { - TAILQ_FOREACH(walk, &ht->ht_table[i], rcvvar->he_link) { + for (i = 0; i < NUM_BINS; i++) + { + TAILQ_FOREACH(walk, &ht->ht_table[i], rcvvar->he_link) + { #ifdef DUMP_STREAM - thread_printf(mtcp, mtcp->log_fp, - "CPU %d: Destroying stream %d\n", mtcp->ctx->cpu, walk->id); + thread_printf(mtcp, mtcp->log_fp, + "CPU %d: Destroying stream %d\n", mtcp->ctx->cpu, walk->id); DumpStream(mtcp, walk); #endif DestroyTCPStream(mtcp, walk); @@ -729,16 +833,18 @@ DestroyRemainingFlows(mtcp_manager_t mtcp) } #endif /*----------------------------------------------------------------------------*/ -static void +static void InterruptApplication(mtcp_manager_t mtcp) { int i; struct tcp_listener *listener = NULL; /* interrupt if the mtcp_epoll_wait() is waiting */ - if (mtcp->ep) { + if (mtcp->ep) + { pthread_mutex_lock(&mtcp->ep->epoll_lock); - if (mtcp->ep->waiting) { + if (mtcp->ep->waiting) + { pthread_cond_signal(&mtcp->ep->epoll_cond); } pthread_mutex_unlock(&mtcp->ep->epoll_lock); @@ -746,19 +852,22 @@ InterruptApplication(mtcp_manager_t mtcp) /* interrupt if the accept() is waiting */ /* this may be a looong loop but this is called only on exit */ - for (i = 0; i < MAX_PORT; i++) { + for (i = 0; i < MAX_PORT; i++) + { listener = ListenerHTSearch(mtcp->listeners, &i); - if (listener != NULL) { + if (listener != NULL) + { pthread_mutex_lock(&listener->accept_lock); - if (!(listener->socket->opts & MTCP_NONBLOCK)) { + if (!(listener->socket->opts & MTCP_NONBLOCK)) + { pthread_cond_signal(&listener->accept_cond); } - pthread_mutex_unlock(&listener->accept_lock); + pthread_mutex_unlock(&listener->accept_lock); } } } /*----------------------------------------------------------------------------*/ -static void +static void RunMainLoop(struct mtcp_thread_context *ctx) { mtcp_manager_t mtcp = ctx->mtcp_manager; @@ -773,23 +882,27 @@ RunMainLoop(struct mtcp_thread_context *ctx) TRACE_DBG("CPU %d: mtcp thread running.\n", ctx->cpu); ts = ts_prev = 0; - while ((!ctx->done || mtcp->flow_cnt) && !ctx->exit) { - + while ((!ctx->done || mtcp->flow_cnt) && !ctx->exit) + { + STAT_COUNT(mtcp->runstat.rounds); recv_cnt = 0; - + gettimeofday(&cur_ts, NULL); ts = TIMEVAL_TO_TS(&cur_ts); mtcp->cur_ts = ts; - - for (rx_inf = 0; rx_inf < CONFIG.eths_num; rx_inf++) { - + printf("eths_num: %d\n", CONFIG.eths_num); + for (rx_inf = 0; rx_inf < CONFIG.eths_num; rx_inf++) + { + static uint16_t len; static uint8_t *pktbuf; recv_cnt = mtcp->iom->recv_pkts(ctx, rx_inf); + printf("recv_vnt: %d \n", recv_cnt); STAT_COUNT(mtcp->runstat.rounds_rx_try); - for (i = 0; i < recv_cnt; i++) { + for (i = 0; i < recv_cnt; i++) + { pktbuf = mtcp->iom->get_rptr(mtcp->ctx, rx_inf, i, &len); if (pktbuf != NULL) ProcessPacket(mtcp, rx_inf, ts, pktbuf, len); @@ -802,8 +915,9 @@ RunMainLoop(struct mtcp_thread_context *ctx) STAT_COUNT(mtcp->runstat.rounds_rx); /* interaction with application */ - if (mtcp->flow_cnt > 0) { - + if (mtcp->flow_cnt > 0) + { + printf("flow_cnt: %d\n", mtcp->flow_cnt); /* check retransmission timeout and timewait expire */ #if 0 thresh = (int)mtcp->flow_cnt / (TS_TO_USEC(PER_STREAM_TCHECK)); @@ -815,7 +929,7 @@ RunMainLoop(struct mtcp_thread_context *ctx) #endif thresh = CONFIG.max_concurrency; - /* Eunyoung, you may fix this later + /* Eunyoung, you may fix this later * if there is no rcv packet, we will send as much as possible */ if (thresh == -1) @@ -824,18 +938,24 @@ RunMainLoop(struct mtcp_thread_context *ctx) CheckRtmTimeout(mtcp, ts, thresh); CheckTimewaitExpire(mtcp, ts, CONFIG.max_concurrency); - if (CONFIG.tcp_timeout > 0 && ts != ts_prev) { + if (CONFIG.tcp_timeout > 0 && ts != ts_prev) + { + TRACE_ERROR("CheckConnectionTimeout Start\n"); CheckConnectionTimeout(mtcp, ts, thresh); } } /* if epoll is in use, flush all the queued events */ - if (mtcp->ep) { + if (mtcp->ep) + { + TRACE_ERROR("epoll in use \n"); FlushEpollEvents(mtcp, ts); } - if (mtcp->flow_cnt > 0) { + if (mtcp->flow_cnt > 0) + { /* hadnle stream queues */ + TRACE_ERROR("Handle Application Calls\n"); HandleApplicationCalls(mtcp, ts); } @@ -843,13 +963,16 @@ RunMainLoop(struct mtcp_thread_context *ctx) /* send packets from write buffer */ /* send until tx is available */ - for (tx_inf = 0; tx_inf < CONFIG.eths_num; tx_inf++) { + for (tx_inf = 0; tx_inf < CONFIG.eths_num; tx_inf++) + { mtcp->iom->send_pkts(ctx, tx_inf); } - if (ts != ts_prev) { + if (ts != ts_prev) + { ts_prev = ts; - if (ctx->cpu == mtcp_master) { + if (ctx->cpu == mtcp_master) + { ARPTimer(mtcp, ts); #ifdef NETSTAT PrintNetworkStats(mtcp, ts); @@ -859,7 +982,8 @@ RunMainLoop(struct mtcp_thread_context *ctx) mtcp->iom->select(ctx); - if (ctx->interrupt) { + if (ctx->interrupt) + { InterruptApplication(mtcp); } } @@ -882,7 +1006,8 @@ CreateMTCPSender(int ifidx) struct mtcp_sender *sender; sender = (struct mtcp_sender *)calloc(1, sizeof(struct mtcp_sender)); - if (!sender) { + if (!sender) + { return NULL; } @@ -899,21 +1024,21 @@ CreateMTCPSender(int ifidx) return sender; } /*----------------------------------------------------------------------------*/ -void -DestroyMTCPSender(struct mtcp_sender *sender) +void DestroyMTCPSender(struct mtcp_sender *sender) { free(sender); } /*----------------------------------------------------------------------------*/ -static mtcp_manager_t -InitializeMTCPManager(struct mtcp_thread_context* ctx) +static mtcp_manager_t +InitializeMTCPManager(struct mtcp_thread_context *ctx) { mtcp_manager_t mtcp; char log_name[MAX_FILE_NAME]; int i; mtcp = (mtcp_manager_t)calloc(1, sizeof(struct mtcp_manager)); - if (!mtcp) { + if (!mtcp) + { perror("malloc"); fprintf(stderr, "Failed to allocate mtcp_manager.\n"); return NULL; @@ -921,77 +1046,92 @@ InitializeMTCPManager(struct mtcp_thread_context* ctx) g_mtcp[ctx->cpu] = mtcp; mtcp->tcp_flow_table = CreateHashtable(HashFlow, EqualFlow, NUM_BINS_FLOWS); - if (!mtcp->tcp_flow_table) { + if (!mtcp->tcp_flow_table) + { CTRACE_ERROR("Falied to allocate tcp flow table.\n"); return NULL; } +#define USE_CCP 0 #if USE_CCP mtcp->tcp_sid_table = CreateHashtable(HashSID, EqualSID, NUM_BINS_FLOWS); - if (!mtcp->tcp_sid_table) { + if (!mtcp->tcp_sid_table) + { CTRACE_ERROR("Failed to allocate tcp sid lookup table.\n"); return NULL; } #endif mtcp->listeners = CreateHashtable(HashListener, EqualListener, NUM_BINS_LISTENERS); - if (!mtcp->listeners) { + if (!mtcp->listeners) + { CTRACE_ERROR("Failed to allocate listener table.\n"); return NULL; } mtcp->ctx = ctx; + #if !defined(DISABLE_DPDK) && !ENABLE_ONVM char pool_name[RTE_MEMPOOL_NAMESIZE]; sprintf(pool_name, "flow_pool_%d", ctx->cpu); mtcp->flow_pool = MPCreate(pool_name, sizeof(tcp_stream), - sizeof(tcp_stream) * CONFIG.max_concurrency); - if (!mtcp->flow_pool) { + sizeof(tcp_stream) * CONFIG.max_concurrency); + if (!mtcp->flow_pool) + { CTRACE_ERROR("Failed to allocate tcp flow pool.\n"); return NULL; } - sprintf(pool_name, "rv_pool_%d", ctx->cpu); - mtcp->rv_pool = MPCreate(pool_name, sizeof(struct tcp_recv_vars), - sizeof(struct tcp_recv_vars) * CONFIG.max_concurrency); - if (!mtcp->rv_pool) { + sprintf(pool_name, "rv_pool_%d", ctx->cpu); + mtcp->rv_pool = MPCreate(pool_name, sizeof(struct tcp_recv_vars), + sizeof(struct tcp_recv_vars) * CONFIG.max_concurrency); + if (!mtcp->rv_pool) + { CTRACE_ERROR("Failed to allocate tcp recv variable pool.\n"); return NULL; } sprintf(pool_name, "sv_pool_%d", ctx->cpu); - mtcp->sv_pool = MPCreate(pool_name, sizeof(struct tcp_send_vars), - sizeof(struct tcp_send_vars) * CONFIG.max_concurrency); - if (!mtcp->sv_pool) { + mtcp->sv_pool = MPCreate(pool_name, sizeof(struct tcp_send_vars), + sizeof(struct tcp_send_vars) * CONFIG.max_concurrency); + if (!mtcp->sv_pool) + { CTRACE_ERROR("Failed to allocate tcp send variable pool.\n"); return NULL; } + #else mtcp->flow_pool = MPCreate(sizeof(tcp_stream), - sizeof(tcp_stream) * CONFIG.max_concurrency); - if (!mtcp->flow_pool) { + sizeof(tcp_stream) * CONFIG.max_concurrency); + if (!mtcp->flow_pool) + { CTRACE_ERROR("Failed to allocate tcp flow pool.\n"); return NULL; } - mtcp->rv_pool = MPCreate(sizeof(struct tcp_recv_vars), - sizeof(struct tcp_recv_vars) * CONFIG.max_concurrency); - if (!mtcp->rv_pool) { + mtcp->rv_pool = MPCreate(sizeof(struct tcp_recv_vars), + sizeof(struct tcp_recv_vars) * CONFIG.max_concurrency); + if (!mtcp->rv_pool) + { CTRACE_ERROR("Failed to allocate tcp recv variable pool.\n"); return NULL; } - mtcp->sv_pool = MPCreate(sizeof(struct tcp_send_vars), - sizeof(struct tcp_send_vars) * CONFIG.max_concurrency); - if (!mtcp->sv_pool) { + mtcp->sv_pool = MPCreate(sizeof(struct tcp_send_vars), + sizeof(struct tcp_send_vars) * CONFIG.max_concurrency); + if (!mtcp->sv_pool) + { CTRACE_ERROR("Failed to allocate tcp send variable pool.\n"); return NULL; - } + } #endif + mtcp->rbm_snd = SBManagerCreate(mtcp, CONFIG.sndbuf_size, CONFIG.max_num_buffers); - if (!mtcp->rbm_snd) { + if (!mtcp->rbm_snd) + { CTRACE_ERROR("Failed to create send ring buffer.\n"); return NULL; } mtcp->rbm_rcv = RBManagerCreate(mtcp, CONFIG.rcvbuf_size, CONFIG.max_num_buffers); - if (!mtcp->rbm_rcv) { + if (!mtcp->rbm_rcv) + { CTRACE_ERROR("Failed to create recv ring buffer.\n"); return NULL; } @@ -999,13 +1139,15 @@ InitializeMTCPManager(struct mtcp_thread_context* ctx) InitializeTCPStreamManager(); mtcp->smap = (socket_map_t)calloc(CONFIG.max_concurrency, sizeof(struct socket_map)); - if (!mtcp->smap) { + if (!mtcp->smap) + { perror("calloc"); CTRACE_ERROR("Failed to allocate memory for stream map.\n"); return NULL; } TAILQ_INIT(&mtcp->free_smap); - for (i = 0; i < CONFIG.max_concurrency; i++) { + for (i = 0; i < CONFIG.max_concurrency; i++) + { mtcp->smap[i].id = i; mtcp->smap[i].socktype = MTCP_SOCK_UNUSED; memset(&mtcp->smap[i].saddr, 0, sizeof(struct sockaddr_in)); @@ -1015,70 +1157,82 @@ InitializeMTCPManager(struct mtcp_thread_context* ctx) mtcp->ep = NULL; - snprintf(log_name, MAX_FILE_NAME, LOG_FILE_NAME"_%d", ctx->cpu); + snprintf(log_name, MAX_FILE_NAME, LOG_FILE_NAME "_%d", ctx->cpu); mtcp->log_fp = fopen(log_name, "w"); - if (!mtcp->log_fp) { + if (!mtcp->log_fp) + { perror("fopen"); CTRACE_ERROR("Failed to create file for logging.\n"); return NULL; } mtcp->sp_fd = g_logctx[ctx->cpu]->pair_sp_fd; mtcp->logger = g_logctx[ctx->cpu]; - + mtcp->connectq = CreateStreamQueue(BACKLOG_SIZE); - if (!mtcp->connectq) { + if (!mtcp->connectq) + { CTRACE_ERROR("Failed to create connect queue.\n"); return NULL; } mtcp->sendq = CreateStreamQueue(CONFIG.max_concurrency); - if (!mtcp->sendq) { + if (!mtcp->sendq) + { CTRACE_ERROR("Failed to create send queue.\n"); return NULL; } mtcp->ackq = CreateStreamQueue(CONFIG.max_concurrency); - if (!mtcp->ackq) { + if (!mtcp->ackq) + { CTRACE_ERROR("Failed to create ack queue.\n"); return NULL; } mtcp->closeq = CreateStreamQueue(CONFIG.max_concurrency); - if (!mtcp->closeq) { + if (!mtcp->closeq) + { CTRACE_ERROR("Failed to create close queue.\n"); return NULL; } mtcp->closeq_int = CreateInternalStreamQueue(CONFIG.max_concurrency); - if (!mtcp->closeq_int) { + if (!mtcp->closeq_int) + { CTRACE_ERROR("Failed to create close queue.\n"); return NULL; } mtcp->resetq = CreateStreamQueue(CONFIG.max_concurrency); - if (!mtcp->resetq) { + if (!mtcp->resetq) + { CTRACE_ERROR("Failed to create reset queue.\n"); return NULL; } mtcp->resetq_int = CreateInternalStreamQueue(CONFIG.max_concurrency); - if (!mtcp->resetq_int) { + if (!mtcp->resetq_int) + { CTRACE_ERROR("Failed to create reset queue.\n"); return NULL; } mtcp->destroyq = CreateStreamQueue(CONFIG.max_concurrency); - if (!mtcp->destroyq) { + if (!mtcp->destroyq) + { CTRACE_ERROR("Failed to create destroy queue.\n"); return NULL; } mtcp->g_sender = CreateMTCPSender(-1); - if (!mtcp->g_sender) { + if (!mtcp->g_sender) + { CTRACE_ERROR("Failed to create global sender structure.\n"); return NULL; } - for (i = 0; i < CONFIG.eths_num; i++) { + for (i = 0; i < CONFIG.eths_num; i++) + { mtcp->n_sender[i] = CreateMTCPSender(i); - if (!mtcp->n_sender[i]) { + if (!mtcp->n_sender[i]) + { CTRACE_ERROR("Failed to create per-nic sender structure.\n"); return NULL; } } - + mtcp->rto_store = InitRTOHashstore(); TAILQ_INIT(&mtcp->timewait_list); TAILQ_INIT(&mtcp->timeout_list); @@ -1096,31 +1250,34 @@ InitializeMTCPManager(struct mtcp_thread_context* ctx) uint32_t libstartccp_run_forever(const char *alg_to_run, uint32_t log_fd); static void * -CCPRunThread(void *arg) { - // Add ipc argument (always unix, so no need for user to provide manually) - char args[1024] = {0}; - int arglen = strlen(CONFIG.cc)-1; - strncpy(args, CONFIG.cc, arglen); - strncpy(args+arglen, " --ipc=unix", 11); - args[arglen+11] = '\0'; - - // Open fd for log file +CCPRunThread(void *arg) +{ + // Add ipc argument (always unix, so no need for user to provide manually) + char args[1024] = {0}; + int arglen = strlen(CONFIG.cc) - 1; + strncpy(args, CONFIG.cc, arglen); + strncpy(args + arglen, " --ipc=unix", 11); + args[arglen + 11] = '\0'; + + // Open fd for log file FILE *ccp_log = fopen("cc.log", "w"); - if (ccp_log == NULL) { + if (ccp_log == NULL) + { perror("fopen cc.log"); return 0; } - TRACE_CCP("starting ccp thread with args: %s\n", args); - TRACE_CCP("printing output to ./cc.log\n"); - libstartccp_run_forever(args, fileno(ccp_log)); + TRACE_CCP("starting ccp thread with args: %s\n", args); + TRACE_CCP("printing output to ./cc.log\n"); + libstartccp_run_forever(args, fileno(ccp_log)); - fclose(ccp_log); + fclose(ccp_log); - return 0; + return 0; } static void * -CCPRecvLoopThread(void *arg) { +CCPRecvLoopThread(void *arg) +{ mtcp_manager_t mtcp = (mtcp_manager_t)arg; mtcp_thread_context_t ctx = mtcp->ctx; @@ -1131,20 +1288,25 @@ CCPRecvLoopThread(void *arg) { char recvBuf[CCP_MAX_MSG_SIZE]; int bytes_recvd; - while (!ctx->done && !ctx->exit) { - do { + while (!ctx->done && !ctx->exit) + { + do + { bytes_recvd = recvfrom(mtcp->from_ccp, recvBuf, CCP_MAX_MSG_SIZE, 0, NULL, NULL); - if (bytes_recvd <= 0) { - if (bytes_recvd < 0) { + if (bytes_recvd <= 0) + { + if (bytes_recvd < 0) + { TRACE_ERROR("recv returned %d\n", bytes_recvd); } break; } - if (!mtcp->to_ccp) { + if (!mtcp->to_ccp) + { setup_ccp_send_socket(mtcp); } ccp_read_msg(recvBuf, bytes_recvd); - } while(1); + } while (1); } return 0; } @@ -1160,17 +1322,18 @@ MTCPRunThread(void *arg) struct mtcp_thread_context *ctx; /* affinitize the thread to this core first */ -#ifndef DISABLE_DPDK +#ifdef DISABLE_PCAP if (rte_lcore_id() == LCORE_ID_ANY) -#endif { mtcp_core_affinitize(cpu); } +#endif /* memory alloc after core affinitization would use local memory most time */ ctx = calloc(1, sizeof(*ctx)); - if (!ctx) { + if (!ctx) + { perror("calloc"); TRACE_ERROR("Failed to calloc mtcp context.\n"); exit(-1); @@ -1178,7 +1341,8 @@ MTCPRunThread(void *arg) ctx->thread = pthread_self(); ctx->cpu = cpu; mtcp = ctx->mtcp_manager = InitializeMTCPManager(ctx); - if (!mtcp) { + if (!mtcp) + { TRACE_ERROR("Failed to initialize mtcp manager.\n"); exit(-1); } @@ -1189,17 +1353,20 @@ MTCPRunThread(void *arg) /* I/O initializing */ mtcp->iom->init_handle(ctx); - if (pthread_mutex_init(&ctx->smap_lock, NULL)) { + if (pthread_mutex_init(&ctx->smap_lock, NULL)) + { perror("pthread_mutex_init of ctx->smap_lock\n"); exit(-1); } - if (pthread_mutex_init(&ctx->flow_pool_lock, NULL)) { + if (pthread_mutex_init(&ctx->flow_pool_lock, NULL)) + { perror("pthread_mutex_init of ctx->flow_pool_lock\n"); exit(-1); } - - if (pthread_mutex_init(&ctx->socket_pool_lock, NULL)) { + + if (pthread_mutex_init(&ctx->socket_pool_lock, NULL)) + { perror("pthread_mutex_init of ctx->socket_pool_lock\n"); exit(-1); } @@ -1218,19 +1385,21 @@ MTCPRunThread(void *arg) #if USE_CCP setup_ccp_connection(mtcp); - if (cpu == 0 && pthread_create(&ccp_run_thread, NULL, CCPRunThread, (void *)mtcp) != 0) { - TRACE_ERROR("Failed to create thread running CCP on cpu 0"); - } - if (pthread_create(&ccp_recv_thread[cpu], NULL, CCPRecvLoopThread, (void *)mtcp) != 0) - { - TRACE_ERROR("Failed to create thread for CCP receive loop on cpu %d\n", cpu); - return NULL; - } + if (cpu == 0 && pthread_create(&ccp_run_thread, NULL, CCPRunThread, (void *)mtcp) != 0) + { + TRACE_ERROR("Failed to create thread running CCP on cpu 0"); + } + if (pthread_create(&ccp_recv_thread[cpu], NULL, CCPRecvLoopThread, (void *)mtcp) != 0) + { + TRACE_ERROR("Failed to create thread for CCP receive loop on cpu %d\n", cpu); + return NULL; + } #endif // attach (nic device, queue) working = AttachDevice(ctx); - if (working != 0) { + if (working != 0) + { perror("attach"); return NULL; } @@ -1238,7 +1407,7 @@ MTCPRunThread(void *arg) TRACE_DBG("CPU %d: initialization finished.\n", cpu); fprintf(stderr, "CPU %d: initialization finished.\n", cpu); - + sem_post(&g_init_sem[ctx->cpu]); /* start the main loop */ @@ -1253,9 +1422,9 @@ MTCPRunThread(void *arg) DestroyHashtable(g_mtcp[cpu]->tcp_sid_table); #endif DestroyHashtable(g_mtcp[cpu]->listeners); - + TRACE_DBG("MTCP thread %d finished.\n", ctx->cpu); - + return 0; } /*----------------------------------------------------------------------------*/ @@ -1267,34 +1436,39 @@ int MTCPDPDKRunThread(void *arg) } #endif /*----------------------------------------------------------------------------*/ -mctx_t +mctx_t mtcp_create_context(int cpu) { mctx_t mctx; int ret; - if (cpu >= CONFIG.num_cores) { + if (cpu >= CONFIG.num_cores) + { TRACE_ERROR("Failed initialize new mtcp context. " - "Requested cpu id %d exceed the number of cores %d configured to use.\n", - cpu, CONFIG.num_cores); + "Requested cpu id %d exceed the number of cores %d configured to use.\n", + cpu, CONFIG.num_cores); return NULL; } - /* check if mtcp_create_context() was already initialized */ - if (g_logctx[cpu] != NULL) { - TRACE_ERROR("%s was already initialized before!\n", - __FUNCTION__); - return NULL; - } + /* check if mtcp_create_context() was already initialized */ + if (g_logctx[cpu] != NULL) + { + TRACE_ERROR("%s was already initialized before!\n", + __FUNCTION__); + return NULL; + } ret = sem_init(&g_init_sem[cpu], 0, 0); - if (ret) { + // semaphore is shared across all threads of process + if (ret) + { TRACE_ERROR("Failed initialize init_sem.\n"); return NULL; } mctx = (mctx_t)calloc(1, sizeof(struct mtcp_context)); - if (!mctx) { + if (!mctx) + { TRACE_ERROR("Failed to allocate memory for mtcp_context.\n"); return NULL; } @@ -1302,19 +1476,22 @@ mtcp_create_context(int cpu) /* initialize logger */ g_logctx[cpu] = (struct log_thread_context *) - calloc(1, sizeof(struct log_thread_context)); - if (!g_logctx[cpu]) { + calloc(1, sizeof(struct log_thread_context)); + if (!g_logctx[cpu]) + { perror("calloc"); TRACE_ERROR("Failed to allocate memory for log thread context.\n"); free(mctx); return NULL; } InitLogThreadContext(g_logctx[cpu], cpu); -#if defined (PKTDUMP) || (DBGMSG) || (DBGFUNC) || \ - (STREAM) || (STATE) || (STAT) || (APP) || \ + +#if defined(PKTDUMP) || (DBGMSG) || (DBGFUNC) || \ + (STREAM) || (STATE) || (STAT) || (APP) || \ (EPOLL) || (DUMP_STREAM) - if (pthread_create(&log_thread[cpu], - NULL, ThreadLogMain, (void *)g_logctx[cpu])) { + if (pthread_create(&log_thread[cpu], + NULL, ThreadLogMain, (void *)g_logctx[cpu])) + { perror("pthread_create"); TRACE_ERROR("Failed to create log thread\n"); free(g_logctx[cpu]); @@ -1324,37 +1501,44 @@ mtcp_create_context(int cpu) #endif #ifndef DISABLE_DPDK /* Wake up mTCP threads (wake up I/O threads) */ - if (current_iomodule_func == &dpdk_module_func) { + if (current_iomodule_func == &dpdk_module_func) + { int master; - master = rte_get_master_lcore(); - - if (master == whichCoreID(cpu)) { - lcore_config[master].ret = 0; - lcore_config[master].state = FINISHED; - - if (pthread_create(&g_thread[cpu], - NULL, MTCPRunThread, (void *)mctx) != 0) { + master = rte_get_main_lcore(); + + if (master == whichCoreID(cpu)) + { + // lcore_config[master].ret = 0; + // lcore_config[master].state = FINISHED; + + if (pthread_create(&g_thread[cpu], + NULL, MTCPRunThread, (void *)mctx) != 0) + { TRACE_ERROR("pthread_create of mtcp thread failed!\n"); return NULL; } - } else + } + else rte_eal_remote_launch(MTCPDPDKRunThread, mctx, whichCoreID(cpu)); - } else + } + else #endif + { + if (pthread_create(&g_thread[cpu], + NULL, MTCPRunThread, (void *)mctx) != 0) { - if (pthread_create(&g_thread[cpu], - NULL, MTCPRunThread, (void *)mctx) != 0) { - TRACE_ERROR("pthread_create of mtcp thread failed!\n"); - return NULL; - } + TRACE_ERROR("pthread_create of mtcp thread failed!\n"); + return NULL; } + } sem_wait(&g_init_sem[cpu]); sem_destroy(&g_init_sem[cpu]); running[cpu] = TRUE; - if (mtcp_master < 0) { + if (mtcp_master < 0) + { mtcp_master = cpu; TRACE_INFO("CPU %d is now the master thread.\n", mtcp_master); } @@ -1362,35 +1546,37 @@ mtcp_create_context(int cpu) return mctx; } /*----------------------------------------------------------------------------*/ -void -mtcp_destroy_context(mctx_t mctx) +void mtcp_destroy_context(mctx_t mctx) { - struct mtcp_thread_context *ctx = g_pctx[mctx->cpu]; - if (ctx != NULL) - ctx->done = 1; + struct mtcp_thread_context *ctx = g_pctx[mctx->cpu]; + if (ctx != NULL) + ctx->done = 1; free(mctx); } /*----------------------------------------------------------------------------*/ -void -mtcp_free_context(mctx_t mctx) +void mtcp_free_context(mctx_t mctx) { struct mtcp_thread_context *ctx = g_pctx[mctx->cpu]; struct mtcp_manager *mtcp = ctx->mtcp_manager; struct log_thread_context *log_ctx = mtcp->logger; int ret, i; - if (g_pctx[mctx->cpu] == NULL) return; + if (g_pctx[mctx->cpu] == NULL) + return; flush_log_data(mtcp); - + TRACE_DBG("CPU %d: mtcp_destroy_context()\n", mctx->cpu); /* close all stream sockets that are still open */ - if (!ctx->exit) { - for (i = 0; i < CONFIG.max_concurrency; i++) { - if (mtcp->smap[i].socktype == MTCP_SOCK_STREAM) { - TRACE_DBG("Closing remaining socket %d (%s)\n", - i, TCPStateToString(mtcp->smap[i].stream)); + if (!ctx->exit) + { + for (i = 0; i < CONFIG.max_concurrency; i++) + { + if (mtcp->smap[i].socktype == MTCP_SOCK_STREAM) + { + TRACE_DBG("Closing remaining socket %d (%s)\n", + i, TCPStateToString(mtcp->smap[i].stream)); #ifdef DUMP_STREAM DumpStream(mtcp, mtcp->smap[i].stream); #endif @@ -1401,13 +1587,16 @@ mtcp_free_context(mctx_t mctx) ctx->done = 1; - //pthread_kill(g_thread[mctx->cpu], SIGINT); + // pthread_kill(g_thread[mctx->cpu], SIGINT); TRACE_INFO("MTCP thread %d joined.\n", mctx->cpu); running[mctx->cpu] = FALSE; - if (mtcp_master == mctx->cpu) { - for (i = 0; i < num_cpus; i++) { - if (i != mctx->cpu && running[i]) { + if (mtcp_master == mctx->cpu) + { + for (i = 0; i < num_cpus; i++) + { + if (i != mctx->cpu && running[i]) + { mtcp_master = i; break; } @@ -1418,8 +1607,7 @@ mtcp_free_context(mctx_t mctx) ret = write(log_ctx->pair_sp_fd, "F", 1); assert(ret == 1); UNUSED(ret); -#if defined (PKTDUMP) || (DBGMSG) || (DBGFUNC) || (STREAM)\ - || (STATE) || (STAT) || (APP) || (EPOLL) || (DUMP_STREAM) +#if defined(PKTDUMP) || (DBGMSG) || (DBGFUNC) || (STREAM) || (STATE) || (STAT) || (APP) || (EPOLL) || (DUMP_STREAM) pthread_join(log_thread[ctx->cpu], NULL); #endif fclose(mtcp->log_fp); @@ -1432,49 +1620,59 @@ mtcp_free_context(mctx_t mctx) TRACE_CCP("CCP thread %d joined.\n", mctx->cpu); #endif - if (mtcp->connectq) { + if (mtcp->connectq) + { DestroyStreamQueue(mtcp->connectq); mtcp->connectq = NULL; } - if (mtcp->sendq) { + if (mtcp->sendq) + { DestroyStreamQueue(mtcp->sendq); mtcp->sendq = NULL; } - if (mtcp->ackq) { + if (mtcp->ackq) + { DestroyStreamQueue(mtcp->ackq); mtcp->ackq = NULL; } - if (mtcp->closeq) { + if (mtcp->closeq) + { DestroyStreamQueue(mtcp->closeq); mtcp->closeq = NULL; } - if (mtcp->closeq_int) { + if (mtcp->closeq_int) + { DestroyInternalStreamQueue(mtcp->closeq_int); mtcp->closeq_int = NULL; } - if (mtcp->resetq) { + if (mtcp->resetq) + { DestroyStreamQueue(mtcp->resetq); mtcp->resetq = NULL; } - if (mtcp->resetq_int) { + if (mtcp->resetq_int) + { DestroyInternalStreamQueue(mtcp->resetq_int); mtcp->resetq_int = NULL; } - if (mtcp->destroyq) { + if (mtcp->destroyq) + { DestroyStreamQueue(mtcp->destroyq); mtcp->destroyq = NULL; } DestroyMTCPSender(mtcp->g_sender); - for (i = 0; i < CONFIG.eths_num; i++) { + for (i = 0; i < CONFIG.eths_num; i++) + { DestroyMTCPSender(mtcp->n_sender[i]); } MPDestroy(mtcp->rv_pool); MPDestroy(mtcp->sv_pool); MPDestroy(mtcp->flow_pool); - - if (mtcp->ap) { + + if (mtcp->ap) + { DestroyAddressPool(mtcp->ap); mtcp->ap = NULL; } @@ -1486,26 +1684,31 @@ mtcp_free_context(mctx_t mctx) SQ_LOCK_DESTROY(&ctx->ackq_lock); SQ_LOCK_DESTROY(&ctx->destroyq_lock); - //TRACE_INFO("MTCP thread %d destroyed.\n", mctx->cpu); + // TRACE_INFO("MTCP thread %d destroyed.\n", mctx->cpu); mtcp->iom->destroy_handle(ctx); free(ctx); - if (g_logctx[mctx->cpu]) { + if (g_logctx[mctx->cpu]) + { free(g_logctx[mctx->cpu]); g_logctx[mctx->cpu] = NULL; } g_pctx[mctx->cpu] = NULL; } /*----------------------------------------------------------------------------*/ -mtcp_sighandler_t +mtcp_sighandler_t mtcp_register_signal(int signum, mtcp_sighandler_t handler) { mtcp_sighandler_t prev; - if (signum == SIGINT) { + if (signum == SIGINT) + { prev = app_signal_handler; app_signal_handler = handler; - } else { - if ((prev = signal(signum, handler)) == SIG_ERR) { + } + else + { + if ((prev = signal(signum, handler)) == SIG_ERR) + { perror("signal"); return SIG_ERR; } @@ -1514,8 +1717,7 @@ mtcp_register_signal(int signum, mtcp_sighandler_t handler) return prev; } /*----------------------------------------------------------------------------*/ -int -mtcp_getconf(struct mtcp_conf *conf) +int mtcp_getconf(struct mtcp_conf *conf) { if (!conf) return -1; @@ -1533,8 +1735,7 @@ mtcp_getconf(struct mtcp_conf *conf) return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_setconf(const struct mtcp_conf *conf) +int mtcp_setconf(const struct mtcp_conf *conf) { if (!conf) return -1; @@ -1556,14 +1757,13 @@ mtcp_setconf(const struct mtcp_conf *conf) CONFIG.tcp_timeout = conf->tcp_timeout; TRACE_CONFIG("Configuration updated by mtcp_setconf().\n"); - //PrintConfiguration(); + // PrintConfiguration(); return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_init(const char *config_file) +int mtcp_init(const char *config_file) { int i; int ret; @@ -1571,52 +1771,50 @@ mtcp_init(const char *config_file) /* getting cpu and NIC */ /* set to max cpus only if user has not arbitrarily set it to lower # */ num_cpus = (CONFIG.num_cores == 0) ? GetNumCPUs() : CONFIG.num_cores; - + assert(num_cpus >= 1); - if (num_cpus > MAX_CPUS) { + if (num_cpus > MAX_CPUS) + { TRACE_ERROR("You cannot run mTCP with more than %d cores due " - "to your static mTCP configuration. Please disable " - "the last %d cores in your system.\n", - MAX_CPUS, num_cpus - MAX_CPUS); + "to your static mTCP configuration. Please disable " + "the last %d cores in your system.\n", + MAX_CPUS, num_cpus - MAX_CPUS); exit(EXIT_FAILURE); } -#if 0 - /* TODO: Enable this macro if cross-machine comm. with onvm client/server fails */ - if (num_cpus > 1) { - TRACE_ERROR("You cannot run mTCP application with more than 1 " - "core when you are using ONVM driver\n"); - exit(EXIT_FAILURE); - } -#endif - - for (i = 0; i < num_cpus; i++) { + for (i = 0; i < num_cpus; i++) + { g_mtcp[i] = NULL; running[i] = FALSE; sigint_cnt[i] = 0; } ret = LoadConfiguration(config_file); - if (ret) { + if (ret) + { TRACE_CONFIG("Error occured while loading configuration.\n"); return -1; } PrintConfiguration(); - for (i = 0; i < CONFIG.eths_num; i++) { + for (i = 0; i < CONFIG.eths_num; i++) + { + // in case of pcap, ip_address of veth_host is passed as argument ap[i] = CreateAddressPool(CONFIG.eths[i].ip_addr, 1); - if (!ap[i]) { + if (!ap[i]) + { TRACE_CONFIG("Error occured while create address pool[%d]\n", - i); + i); return -1; } } - + PrintInterfaceInfo(); ret = SetRoutingTable(); - if (ret) { + if (ret) + { TRACE_CONFIG("Error occured while loading routing table.\n"); return -1; } @@ -1625,11 +1823,13 @@ mtcp_init(const char *config_file) LoadARPTable(); PrintARPTable(); - if (signal(SIGUSR1, HandleSignal) == SIG_ERR) { + if (signal(SIGUSR1, HandleSignal) == SIG_ERR) + { perror("signal, SIGUSR1"); return -1; } - if (signal(SIGINT, HandleSignal) == SIG_ERR) { + if (signal(SIGINT, HandleSignal) == SIG_ERR) + { perror("signal, SIGINT"); return -1; } @@ -1641,16 +1841,17 @@ mtcp_init(const char *config_file) return 0; } /*----------------------------------------------------------------------------*/ -void -mtcp_destroy() +void mtcp_destroy() { int i; #ifndef DISABLE_DPDK - int master = rte_get_master_lcore(); + int master = rte_get_main_lcore(); #endif /* wait until all threads are closed */ - for (i = 0; i < num_cpus; i++) { - if (running[i]) { + for (i = 0; i < num_cpus; i++) + { + if (running[i]) + { #ifndef DISABLE_DPDK if (master != i) rte_eal_wait_lcore(i); diff --git a/mtcp/src/include/io_module.h b/mtcp/src/include/io_module.h index 52bb9369c..238f5dfcd 100644 --- a/mtcp/src/include/io_module.h +++ b/mtcp/src/include/io_module.h @@ -106,6 +106,9 @@ extern io_module_func netmap_module_func; /* registered onvm context */ extern io_module_func onvm_module_func; +/* registered pcap module*/ +extern io_module_func pcap_module_func; + /* check I/O module access permissions */ int CheckIOModuleAccessPermissions(); @@ -120,6 +123,8 @@ CheckIOModuleAccessPermissions(); current_iomodule_func = &netmap_module_func; \ else if (!strcmp(m, "onvm")) \ current_iomodule_func = &onvm_module_func; \ + else if (!strcmp(m, "pcap")) \ + current_iomodule_func = &pcap_module_func; \ else \ assert(0); \ } diff --git a/mtcp/src/io_module.c b/mtcp/src/io_module.c index 198a98874..856c65e4a 100644 --- a/mtcp/src/io_module.c +++ b/mtcp/src/io_module.c @@ -1,3 +1,4 @@ + /* for I/O module def'ns */ #include "io_module.h" /* for num_devices decl */ @@ -13,7 +14,7 @@ /* for ioctl */ #include #ifndef DISABLE_DPDK -#define RTE_ARGC_MAX (RTE_MAX_ETHPORTS << 1) + 9 +#define RTE_ARGC_MAX (RTE_MAX_ETHPORTS << 1) + 9 /* for dpdk ethernet functions (get mac addresses) */ #include #include @@ -46,22 +47,22 @@ /* for netmap macros */ #include "netmap_user.h" /*----------------------------------------------------------------------------*/ -io_module_func *current_iomodule_func = &dpdk_module_func; +io_module_func *current_iomodule_func = &pcap_module_func; #ifndef DISABLE_DPDK -enum rte_proc_type_t eal_proc_type_detect(void); +enum rte_proc_type_t rte_eal_process_type(void); /** * DPDK's RTE consumes some huge pages for internal bookkeeping. * Therefore, it is not always safe to reserve the exact amount * of pages for our stack (e.g. dividing requested mem, in MB, by * (1<<20) would be insufficient). Hence, the following value. */ -#define RTE_SOCKET_MEM_SHIFT ((1<<19)|(1<<18)) +#define RTE_SOCKET_MEM_SHIFT ((1 << 19) | (1 << 18)) #endif /*----------------------------------------------------------------------------*/ -#define ALL_STRING "all" -#define MAX_PROCLINE_LEN 1024 -#define MAX(a, b) ((a)>(b)?(a):(b)) -#define MIN(a, b) ((a)<(b)?(a):(b)) +#define ALL_STRING "all" +#define MAX_PROCLINE_LEN 1024 +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) /*----------------------------------------------------------------------------*/ /* onvm struct for port info lookup */ @@ -76,19 +77,22 @@ GetNumQueues() int queue_cnt; fp = fopen("/proc/interrupts", "r"); - if (!fp) { + if (!fp) + { TRACE_CONFIG("Failed to read data from /proc/interrupts!\n"); return -1; } /* count number of NIC queues from /proc/interrupts */ queue_cnt = 0; - while (!feof(fp)) { + while (!feof(fp)) + { if (fgets(buf, MAX_PROCLINE_LEN, fp) == NULL) break; /* "xge0-rx" is the keyword for counting queues */ - if (strstr(buf, "xge0-rx")) { + if (strstr(buf, "xge0-rx")) + { queue_cnt++; } } @@ -102,102 +106,203 @@ GetNumQueues() /** * returns max numa ID while probing for rte devices */ -static int -probe_all_rte_devices(char **argv, int *argc, char *dev_name_list) -{ - PciDevice pd; - int fd, numa_id = -1; - static char end[] = ""; - static const char delim[] = " \t"; - static char *dev_tokenizer; - char *dev_token, *saveptr; - - dev_tokenizer = strdup(dev_name_list); - if (dev_tokenizer == NULL) { - TRACE_ERROR("Can't allocate memory for dev_tokenizer!\n"); - exit(EXIT_FAILURE); - } - fd = open(DEV_PATH, O_RDONLY); - if (fd != -1) { - dev_token = strtok_r(dev_tokenizer, delim, &saveptr); - while (dev_token != NULL) { - strcpy(pd.ifname, dev_token); - if (ioctl(fd, FETCH_PCI_ADDRESS, &pd) == -1) { - TRACE_DBG("Could not find pci info on dpdk " - "device: %s. Is it a dpdk-attached " - "interface?\n", dev_token); - goto loop_over; - } - argv[*argc] = strdup("-w"); - argv[*argc + 1] = calloc(PCI_LENGTH, 1); - if (argv[*argc] == NULL || - argv[*argc + 1] == NULL) { - TRACE_ERROR("Memory allocation error!\n"); - exit(EXIT_FAILURE); - } - sprintf(argv[*argc + 1], PCI_DOM":"PCI_BUS":" - PCI_DEVICE"."PCI_FUNC, - pd.pa.domain, pd.pa.bus, pd.pa.device, - pd.pa.function); - *argc += 2; - if (pd.numa_socket > numa_id) numa_id = pd.numa_socket; - loop_over: - dev_token = strtok_r(NULL, delim, &saveptr); - } - close(fd); - free(dev_tokenizer); - } else { - TRACE_ERROR("Error opening dpdk-face!\n"); - exit(EXIT_FAILURE); - } - /* add the terminating "" sequence */ - argv[*argc] = end; - - return numa_id; -} +// static int +// probe_all_rte_devices(char **argv, int *argc, char *dev_name_list) +// { +// PciDevice pd; +// int fd, numa_id = -1; +// static char end[] = ""; +// static const char delim[] = " \t"; +// static char *dev_tokenizer; +// char *dev_token, *saveptr; + +// dev_tokenizer = strdup(dev_name_list); +// if (dev_tokenizer == NULL) +// { +// TRACE_ERROR("Can't allocate memory for dev_tokenizer!\n"); +// exit(EXIT_FAILURE); +// } +// fd = open(DEV_PATH, O_RDONLY); +// if (fd != -1) +// { +// dev_token = strtok_r(dev_tokenizer, delim, &saveptr); +// while (dev_token != NULL) +// { +// strcpy(pd.ifname, dev_token); +// if (ioctl(fd, FETCH_PCI_ADDRESS, &pd) == -1) +// { +// TRACE_DBG("Could not find pci info on dpdk " +// "device: %s. Is it a dpdk-attached " +// "interface?\n", +// dev_token); +// goto loop_over; +// } +// argv[*argc] = strdup("-w"); +// argv[*argc + 1] = calloc(PCI_LENGTH, 1); +// if (argv[*argc] == NULL || +// argv[*argc + 1] == NULL) +// { +// TRACE_ERROR("Memory allocation error!\n"); +// exit(EXIT_FAILURE); +// } +// sprintf(argv[*argc + 1], PCI_DOM ":" PCI_BUS ":" PCI_DEVICE "." PCI_FUNC, +// pd.pa.domain, pd.pa.bus, pd.pa.device, +// pd.pa.function); +// *argc += 2; +// if (pd.numa_socket > numa_id) +// numa_id = pd.numa_socket; +// loop_over: +// dev_token = strtok_r(NULL, delim, &saveptr); +// } +// close(fd); +// free(dev_tokenizer); +// } +// else +// { +// TRACE_ERROR("Error opening dpdk-face!\n"); +// exit(EXIT_FAILURE); +// } + +// /* add the terminating "" sequence */ +// argv[*argc] = end; + +// return numa_id; +// } #endif /* !DISABLE_DPDK */ /*----------------------------------------------------------------------------*/ -int -SetNetEnv(char *dev_name_list, char *port_stat_list) +int SetNetEnv(char *dev_name_list, char *port_stat_list) { int eidx = 0; int i, j; - - int set_all_inf = (strncmp(dev_name_list, ALL_STRING, sizeof(ALL_STRING))==0); - + int set_all_inf = (strncmp(dev_name_list, ALL_STRING, sizeof(ALL_STRING)) == 0); TRACE_CONFIG("Loading interface setting\n"); CONFIG.eths = (struct eth_table *) - calloc(MAX_DEVICES, sizeof(struct eth_table)); - if (!CONFIG.eths) { + calloc(MAX_DEVICES, sizeof(struct eth_table)); + if (!CONFIG.eths) + { TRACE_ERROR("Can't allocate space for CONFIG.eths\n"); exit(EXIT_FAILURE); } + + if (current_iomodule_func == &pcap_module_func) + { + if (!CONFIG.eths) + { + TRACE_ERROR("Can't allocate space for CONFIG.eths\n"); + exit(EXIT_FAILURE); + } + + struct ifaddrs *ifap; + struct ifaddrs *iter_if; + char *seek; + if (getifaddrs(&ifap) != 0) + { + perror("getifaddrs: "); + exit(EXIT_FAILURE); + } + iter_if = ifap; + do + { + if (iter_if->ifa_addr && iter_if->ifa_addr->sa_family == AF_INET && + !set_all_inf && + (seek = strstr(dev_name_list, iter_if->ifa_name)) != NULL && + /* check if the interface was not aliased */ + *(seek + strlen(iter_if->ifa_name)) != ':') + { + struct ifreq ifr; + /* Setting informations */ + eidx = CONFIG.eths_num++; + strcpy(CONFIG.eths[eidx].dev_name, iter_if->ifa_name); + strcpy(ifr.ifr_name, iter_if->ifa_name); + + /* Create socket */ + int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); + if (sock == -1) + { + perror("socket"); + exit(EXIT_FAILURE); + } + + /* getting address */ + if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) + { + struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; + CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; + } + + if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0) + { + for (j = 0; j < ETH_ALEN; j++) + { + CONFIG.eths[eidx].haddr[j] = ifr.ifr_addr.sa_data[j]; + } + } + + /* Net MASK */ + if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) + { + struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; + CONFIG.eths[eidx].netmask = *(uint32_t *)&sin; + } + close(sock); - if (current_iomodule_func == &ps_module_func) { + for (j = 0; j < num_devices; j++) + { + + CONFIG.eths[eidx].ifindex = j; + } + + /* add to attached devices */ + for (j = 0; j < num_devices_attached; j++) + { + if (devices_attached[j] == CONFIG.eths[eidx].ifindex) + { + break; + } + } + devices_attached[num_devices_attached] = CONFIG.eths[eidx].ifindex; + num_devices_attached++; + fprintf(stderr, "Total number of attached devices: %d\n", + num_devices_attached); + fprintf(stderr, "Interface name: %s\n", + iter_if->ifa_name); + } + iter_if = iter_if->ifa_next; + } while (iter_if != NULL); + + freeifaddrs(ifap); + } + + if (current_iomodule_func == &ps_module_func) + { #ifndef DISABLE_PSIO - struct ifreq ifr; + struct ifreq ifr; /* calculate num_devices now! */ num_devices = ps_list_devices(devices); - if (num_devices == -1) { + if (num_devices == -1) + { perror("ps_list_devices"); exit(EXIT_FAILURE); } /* Create socket */ int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sock == -1) { + if (sock == -1) + { TRACE_ERROR("socket"); exit(EXIT_FAILURE); } /* To Do: Parse dev_name_list rather than use strstr */ - for (i = 0; i < num_devices; i++) { + for (i = 0; i < num_devices; i++) + { strcpy(ifr.ifr_name, devices[i].name); /* getting interface information */ - if (ioctl(sock, SIOCGIFFLAGS, &ifr) == 0) { + if (ioctl(sock, SIOCGIFFLAGS, &ifr) == 0) + { if (!set_all_inf && strstr(dev_name_list, ifr.ifr_name) == NULL) continue; @@ -208,50 +313,61 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) CONFIG.eths[eidx].ifindex = devices[i].ifindex; /* getting address */ - if (ioctl(sock, SIOCGIFADDR, &ifr) == 0 ) { + if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) + { struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; } - if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0 ) { - for (j = 0; j < ETH_ALEN; j ++) { + if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0) + { + for (j = 0; j < ETH_ALEN; j++) + { CONFIG.eths[eidx].haddr[j] = ifr.ifr_addr.sa_data[j]; } } /* Net MASK */ - if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) { + if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) + { struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; CONFIG.eths[eidx].netmask = *(uint32_t *)&sin; } /* add to attached devices */ - for (j = 0; j < num_devices_attached; j++) { - if (devices_attached[j] == devices[i].ifindex) { + for (j = 0; j < num_devices_attached; j++) + { + if (devices_attached[j] == devices[i].ifindex) + { break; } } devices_attached[num_devices_attached] = devices[i].ifindex; num_devices_attached++; - - } else { + } + else + { perror("SIOCGIFFLAGS"); } } num_queues = GetNumQueues(); - if (num_queues <= 0) { + if (num_queues <= 0) + { TRACE_CONFIG("Failed to find NIC queues!\n"); close(sock); return -1; } - if (num_queues > num_cpus) { + if (num_queues > num_cpus) + { TRACE_CONFIG("Too many NIC queues available.\n"); close(sock); return -1; } close(sock); #endif /* !PSIO_MODULE */ - } else if (current_iomodule_func == &dpdk_module_func) { + } + else if (current_iomodule_func == &dpdk_module_func) + { #ifndef DISABLE_DPDK int cpu = CONFIG.num_cores; mpz_t _cpumask; @@ -263,60 +379,62 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) #if RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0) static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #else - static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; + static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #endif /* STEP 1: first determine CPU mask */ mpz_init(_cpumask); - if (!mpz_cmp(_cpumask, CONFIG._cpumask)) { + if (!mpz_cmp(_cpumask, CONFIG._cpumask)) + { /* get the cpu mask */ for (ret = 0; ret < cpu; ret++) mpz_setbit(_cpumask, ret); - + gmp_sprintf(cpumaskbuf, "%ZX", _cpumask); - } else + } + else gmp_sprintf(cpumaskbuf, "%ZX", CONFIG._cpumask); - + mpz_clear(_cpumask); /* STEP 2: determine memory channels per socket */ /* get the mem channels per socket */ - if (CONFIG.num_mem_ch == 0) { + if (CONFIG.num_mem_ch == 0) + { TRACE_ERROR("DPDK module requires # of memory channels " - "per socket parameter!\n"); + "per socket parameter!\n"); exit(EXIT_FAILURE); } sprintf(mem_channels, "%d", CONFIG.num_mem_ch); /* STEP 3: determine socket memory */ /* get socket memory threshold (in MB) */ - socket_mem = + socket_mem = RTE_ALIGN_CEIL((unsigned long)ceil((CONFIG.num_cores * - (CONFIG.rcvbuf_size + - CONFIG.sndbuf_size + - sizeof(struct tcp_stream) + - sizeof(struct tcp_recv_vars) + - sizeof(struct tcp_send_vars) + - sizeof(struct fragment_ctx)) * - CONFIG.max_concurrency)/RTE_SOCKET_MEM_SHIFT), - RTE_CACHE_LINE_SIZE); - + (CONFIG.rcvbuf_size + + CONFIG.sndbuf_size + + sizeof(struct tcp_stream) + + sizeof(struct tcp_recv_vars) + + sizeof(struct tcp_send_vars) + + sizeof(struct fragment_ctx)) * + CONFIG.max_concurrency) / + RTE_SOCKET_MEM_SHIFT), + RTE_CACHE_LINE_SIZE); + /* initialize the rte env, what a waste of implementation effort! */ - int argc = 6;//8; + int argc = 6; // 8; char *argv[RTE_ARGC_MAX] = {"", - "-c", - cpumaskbuf, - "-n", - mem_channels, + "-c", + cpumaskbuf, + "-n", + mem_channels, #if 0 "--socket-mem", socket_mem_str, #endif - "--proc-type=auto" - }; - ret = probe_all_rte_devices(argv, &argc, dev_name_list); - + "--proc-type=auto"}; + // ret = probe_all_rte_devices(argv, &argc, dev_name_list); /* STEP 4: build up socket mem parameter */ sprintf(socket_mem_str, "%d", socket_mem); @@ -346,7 +464,8 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) #endif /* initialize the dpdk eal env */ ret = rte_eal_init(argc, argv); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("Invalid EAL args!\n"); exit(EXIT_FAILURE); } @@ -356,7 +475,8 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) #else num_devices = rte_eth_dev_count_avail(); #endif - if (num_devices == 0) { + if (num_devices == 0) + { TRACE_ERROR("No Ethernet port!\n"); exit(EXIT_FAILURE); } @@ -371,18 +491,21 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) struct ifaddrs *iter_if; char *seek; - if (getifaddrs(&ifap) != 0) { + if (getifaddrs(&ifap) != 0) + { perror("getifaddrs: "); exit(EXIT_FAILURE); } iter_if = ifap; - do { + do + { if (iter_if->ifa_addr && iter_if->ifa_addr->sa_family == AF_INET && - !set_all_inf && - (seek=strstr(dev_name_list, iter_if->ifa_name)) != NULL && - /* check if the interface was not aliased */ - *(seek + strlen(iter_if->ifa_name)) != ':') { + !set_all_inf && + (seek = strstr(dev_name_list, iter_if->ifa_name)) != NULL && + /* check if the interface was not aliased */ + *(seek + strlen(iter_if->ifa_name)) != ':') + { struct ifreq ifr; /* Setting informations */ @@ -392,48 +515,56 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) /* Create socket */ int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sock == -1) { + if (sock == -1) + { perror("socket"); exit(EXIT_FAILURE); } /* getting address */ - if (ioctl(sock, SIOCGIFADDR, &ifr) == 0 ) { + if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) + { struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; } - if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0 ) { - for (j = 0; j < ETH_ALEN; j ++) { + if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0) + { + for (j = 0; j < ETH_ALEN; j++) + { CONFIG.eths[eidx].haddr[j] = ifr.ifr_addr.sa_data[j]; } } /* Net MASK */ - if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) { + if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) + { struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; CONFIG.eths[eidx].netmask = *(uint32_t *)&sin; } close(sock); - for (j = 0; j < num_devices; j++) { + for (j = 0; j < num_devices; j++) + { if (!memcmp(&CONFIG.eths[eidx].haddr[0], &ports_eth_addr[j], - ETH_ALEN)) + ETH_ALEN)) CONFIG.eths[eidx].ifindex = j; } /* add to attached devices */ - for (j = 0; j < num_devices_attached; j++) { - if (devices_attached[j] == CONFIG.eths[eidx].ifindex) { + for (j = 0; j < num_devices_attached; j++) + { + if (devices_attached[j] == CONFIG.eths[eidx].ifindex) + { break; } } devices_attached[num_devices_attached] = CONFIG.eths[eidx].ifindex; num_devices_attached++; fprintf(stderr, "Total number of attached devices: %d\n", - num_devices_attached); + num_devices_attached); fprintf(stderr, "Interface name: %s\n", - iter_if->ifa_name); + iter_if->ifa_name); } iter_if = iter_if->ifa_next; } while (iter_if != NULL); @@ -458,11 +589,12 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) } #endif /* check if process is primary or secondary */ - CONFIG.multi_process_is_master = (eal_proc_type_detect() == RTE_PROC_PRIMARY) ? - 1 : 0; - + CONFIG.multi_process_is_master = (rte_eal_process_type() == RTE_PROC_PRIMARY) ? 1 : 0; + #endif /* !DISABLE_DPDK */ - } else if (current_iomodule_func == &netmap_module_func) { + } + else if (current_iomodule_func == &netmap_module_func) + { #ifndef DISABLE_NETMAP struct ifaddrs *ifap; struct ifaddrs *iter_if; @@ -470,18 +602,21 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) num_queues = MIN(CONFIG.num_cores, MAX_CPUS); - if (getifaddrs(&ifap) != 0) { + if (getifaddrs(&ifap) != 0) + { perror("getifaddrs: "); exit(EXIT_FAILURE); } iter_if = ifap; - do { + do + { if (iter_if->ifa_addr && iter_if->ifa_addr->sa_family == AF_INET && - !set_all_inf && - (seek=strstr(dev_name_list, iter_if->ifa_name)) != NULL && - /* check if the interface was not aliased */ - *(seek + strlen(iter_if->ifa_name)) != ':') { + !set_all_inf && + (seek = strstr(dev_name_list, iter_if->ifa_name)) != NULL && + /* check if the interface was not aliased */ + *(seek + strlen(iter_if->ifa_name)) != ':') + { struct ifreq ifr; /* Setting informations */ @@ -491,25 +626,30 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) /* Create socket */ int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sock == -1) { + if (sock == -1) + { perror("socket"); exit(EXIT_FAILURE); } /* getting address */ - if (ioctl(sock, SIOCGIFADDR, &ifr) == 0 ) { + if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) + { struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; } - if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0 ) { - for (j = 0; j < ETH_ALEN; j ++) { + if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0) + { + for (j = 0; j < ETH_ALEN; j++) + { CONFIG.eths[eidx].haddr[j] = ifr.ifr_addr.sa_data[j]; } } /* Net MASK */ - if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) { + if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) + { struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; CONFIG.eths[eidx].netmask = *(uint32_t *)&sin; } @@ -522,30 +662,34 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) #endif CONFIG.eths[eidx].ifindex = eidx; TRACE_INFO("Ifindex of interface %s is: %d\n", - ifr.ifr_name, CONFIG.eths[eidx].ifindex); + ifr.ifr_name, CONFIG.eths[eidx].ifindex); #if 0 } #endif /* add to attached devices */ - for (j = 0; j < num_devices_attached; j++) { - if (devices_attached[j] == CONFIG.eths[eidx].ifindex) { + for (j = 0; j < num_devices_attached; j++) + { + if (devices_attached[j] == CONFIG.eths[eidx].ifindex) + { break; } } devices_attached[num_devices_attached] = if_nametoindex(ifr.ifr_name); num_devices_attached++; fprintf(stderr, "Total number of attached devices: %d\n", - num_devices_attached); + num_devices_attached); fprintf(stderr, "Interface name: %s\n", - iter_if->ifa_name); + iter_if->ifa_name); } iter_if = iter_if->ifa_next; } while (iter_if != NULL); freeifaddrs(ifap); #endif /* !DISABLE_NETMAP */ - } else if (current_iomodule_func == &onvm_module_func) { + } + else if (current_iomodule_func == &onvm_module_func) + { #ifdef ENABLE_ONVM int cpu = CONFIG.num_cores; mpz_t cpumask; @@ -556,18 +700,19 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) int ret; mpz_init(cpumask); - + /* get the cpu mask */ for (ret = 0; ret < cpu; ret++) mpz_setbit(cpumask, ret); gmp_sprintf(cpumaskbuf, "%ZX", cpumask); mpz_clear(cpumask); - + /* get the mem channels per socket */ - if (CONFIG.num_mem_ch == 0) { + if (CONFIG.num_mem_ch == 0) + { TRACE_ERROR("DPDK module requires # of memory channels " - "per socket parameter!\n"); + "per socket parameter!\n"); exit(EXIT_FAILURE); } sprintf(mem_channels, "%d", CONFIG.num_mem_ch); @@ -575,22 +720,21 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) sprintf(instance, "%d", CONFIG.onvm_inst); /* initialize the rte env first, what a waste of implementation effort! */ - char *argv[] = {"", - "-c", - cpumaskbuf, - "-n", - mem_channels, - "--proc-type=secondary", - "--", - "-r", - service, - instance, - "" - }; - - const int argc = 10; + char *argv[] = {"", + "-c", + cpumaskbuf, + "-n", + mem_channels, + "--proc-type=secondary", + "--", + "-r", + service, + instance, + ""}; + + const int argc = 10; - /* + /* * re-set getopt extern variable optind. * this issue was a bitch to debug * rte_eal_init() internally uses getopt() syscall @@ -604,37 +748,42 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) /* Initialize onvm */ CONFIG.nf_local_ctx = onvm_nflib_init_nf_local_ctx(); ret = onvm_nflib_init(argc, argv, "mtcp_nf", CONFIG.nf_local_ctx, NULL); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("Invalid EAL args!\n"); exit(EXIT_FAILURE); } /* give me the count of 'detected' ethernet ports */ num_devices = ports->num_ports; - if (num_devices == 0) { + if (num_devices == 0) + { TRACE_ERROR("No Ethernet port!\n"); exit(EXIT_FAILURE); } num_queues = MIN(CONFIG.num_cores, MAX_CPUS); - + struct ifaddrs *ifap; struct ifaddrs *iter_if; char *seek; - if (getifaddrs(&ifap) != 0) { + if (getifaddrs(&ifap) != 0) + { perror("getifaddrs: "); exit(EXIT_FAILURE); } - + iter_if = ifap; - do { + do + { if (iter_if->ifa_addr && iter_if->ifa_addr->sa_family == AF_INET && - !set_all_inf && - (seek=strstr(dev_name_list, iter_if->ifa_name)) != NULL && - /* check if the interface was not aliased */ - *(seek + strlen(iter_if->ifa_name)) != ':') { + !set_all_inf && + (seek = strstr(dev_name_list, iter_if->ifa_name)) != NULL && + /* check if the interface was not aliased */ + *(seek + strlen(iter_if->ifa_name)) != ':') + { struct ifreq ifr; - + /* Setting informations */ eidx = CONFIG.eths_num++; strcpy(CONFIG.eths[eidx].dev_name, iter_if->ifa_name); @@ -642,34 +791,38 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) /* Create socket */ int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP); - if (sock == -1) { + if (sock == -1) + { perror("socket"); - } - + } + /* getting address */ - if (ioctl(sock, SIOCGIFADDR, &ifr) == 0 ) { + if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) + { struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; } - for (j = 0; j < ETH_ALEN; j ++) { + for (j = 0; j < ETH_ALEN; j++) + { CONFIG.eths[eidx].haddr[j] = ports->mac[eidx].addr_bytes[j]; - }; + }; /* Net MASK */ - if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) { + if (ioctl(sock, SIOCGIFNETMASK, &ifr) == 0) + { struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; CONFIG.eths[eidx].netmask = *(uint32_t *)&sin; } close(sock); - - CONFIG.eths[eidx].ifindex = ports->id[eidx]; + + CONFIG.eths[eidx].ifindex = ports->id[eidx]; devices_attached[num_devices_attached] = CONFIG.eths[eidx].ifindex; num_devices_attached++; fprintf(stderr, "Total number of attached devices: %d\n", - num_devices_attached); - fprintf(stderr, "Interface name: %s\n", - iter_if->ifa_name); + num_devices_attached); + fprintf(stderr, "Interface name: %s\n", + iter_if->ifa_name); } iter_if = iter_if->ifa_next; } while (iter_if != NULL); @@ -678,22 +831,26 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) #endif /* ENABLE_ONVM */ } - CONFIG.nif_to_eidx = (int*)calloc(MAX_DEVICES, sizeof(int)); + CONFIG.nif_to_eidx = (int *)calloc(MAX_DEVICES, sizeof(int)); - if (!CONFIG.nif_to_eidx) { - exit(EXIT_FAILURE); + if (!CONFIG.nif_to_eidx) + { + exit(EXIT_FAILURE); } - for (i = 0; i < MAX_DEVICES; ++i) { - CONFIG.nif_to_eidx[i] = -1; + for (i = 0; i < MAX_DEVICES; ++i) + { + CONFIG.nif_to_eidx[i] = -1; } - for (i = 0; i < CONFIG.eths_num; ++i) { + for (i = 0; i < CONFIG.eths_num; ++i) + { j = CONFIG.eths[i].ifindex; - if (j >= MAX_DEVICES) { - TRACE_ERROR("ifindex of eths_%d exceed the limit: %d\n", i, j); - exit(EXIT_FAILURE); + if (j >= MAX_DEVICES) + { + TRACE_ERROR("ifindex of eths_%d exceed the limit: %d\n", i, j); + exit(EXIT_FAILURE); } /* the physic port index of the i-th port listed in the config file is j*/ @@ -707,14 +864,14 @@ SetNetEnv(char *dev_name_list, char *port_stat_list) return 0; } /*----------------------------------------------------------------------------*/ -int -FetchEndianType() +int FetchEndianType() { #ifndef DISABLE_DPDK char *argv; char **argp = &argv; /* dpdk_module_func/onvm_module_func logic down below */ - if (current_iomodule_func == &dpdk_module_func) { + if (current_iomodule_func == &dpdk_module_func) + { (*current_iomodule_func).dev_ioctl(NULL, CONFIG.eths[0].ifindex, DRV_NAME, (void *)argp); if (!strcmp(*argp, "net_i40e")) return 1; @@ -723,12 +880,12 @@ FetchEndianType() return 0; } /*----------------------------------------------------------------------------*/ -int -CheckIOModuleAccessPermissions() +int CheckIOModuleAccessPermissions() { int fd; /* check if netmap module can access I/O with sudo privileges */ - if (current_iomodule_func == &netmap_module_func) { + if (current_iomodule_func == &netmap_module_func) + { fd = open(NETMAP_DEVICE_NAME, O_RDONLY); if (fd != -1) close(fd); diff --git a/mtcp/src/pcap_module.c b/mtcp/src/pcap_module.c new file mode 100644 index 000000000..a3aeef0e6 --- /dev/null +++ b/mtcp/src/pcap_module.c @@ -0,0 +1,230 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include // htons/ntohs +#include +#include +#include +#include "debug.h" +#include "io_module.h" +#include "mtcp.h" +#include "config.h" +#define CHUNK_SIZE 64 + +// assume single core (x need to RSS packets to multiple cores) +// x concept of core affinity +// x concept of specific NIC queue +// think of just one NIC interface(here may use virtual ethernet interface) + +// struct pcap_pkthdr defintion +// --> struct timeval ts(time info when the packet was captured), uint32 len(length of packet), uint32 caplen(length of portion present) +/*----------------------------------------------------------------------------*/ +#define MAX_TX_BURST 1024 // you can tune this + +struct tx_pkt +{ + uint8_t *buf; + int len; +}; + +struct tx_buf +{ + struct tx_pkt pkts[MAX_TX_BURST]; + int cnt; +}; + +struct pcap_private_context +{ + pcap_t *handle; + struct tx_buf w_buf; + struct pcap_pkthdr *hdrs[CHUNK_SIZE]; // this contains metatdata for each packet captured + // metadata includes time it was captured and total length of this packet + const u_char *pkts[CHUNK_SIZE]; + int num_pkts_in_chunk; +} __attribute__((aligned(__WORDSIZE))); +/*----------------------------------------------------------------------------*/ +void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) +{ + char errbuf[PCAP_ERRBUF_SIZE]; + struct pcap_private_context *ppc; + + ctxt->io_private_context = calloc(1, sizeof(struct pcap_private_context)); + if (!ctxt->io_private_context) + { + TRACE_ERROR("Failed to allocate pcap_private_context\n"); + exit(EXIT_FAILURE); + } + ppc = (struct pcap_private_context *)ctxt->io_private_context; + + // Open the device (assume CONFIG.eths[0].dev_name set in config) + ppc->handle = pcap_open_live(CONFIG.eths[0].dev_name, + 65535, 1, 1, errbuf); + + // enlarge pcap buffer + pcap_set_buffer_size(ppc->handle, 64 * 1024 * 1024); + // promiscuous mode and timeout info may be modified + + if (!ppc->handle) + { + TRACE_ERROR("pcap_open_live failed: %s\n", errbuf); + exit(EXIT_FAILURE); + } +} +/*----------------------------------------------------------------------------*/ +void pcap_release_pkt(struct mtcp_thread_context *ctxt, int ifidx, unsigned char *pkt_data, int len) +{ + return; // useless since I use filter that only allows TCP packet +} +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +int32_t +pcap_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) +{ + TRACE_ERROR("ENTER PCAP_SEND_PKTS\n"); + struct pcap_private_context *ppc = + (struct pcap_private_context *)ctxt->io_private_context; + int sent = 0; + + for (int i = 0; i < ppc->w_buf.cnt; i++) + { + uint8_t *buf = ppc->w_buf.pkts[i].buf; + int len = ppc->w_buf.pkts[i].len; + + if (pcap_sendpacket(ppc->handle, buf, len) == 0) + { + sent++; + } + else + { + TRACE_ERROR("pcap_sendpacket failed: %s\n", pcap_geterr(ppc->handle)); + } + free(buf); // free after sending + } + + ppc->w_buf.cnt = 0; // reset buffer + return sent; +} + +uint8_t * +pcap_get_wptr(struct mtcp_thread_context *ctxt, int ifidx, uint16_t len) // used when mtcp wants to transmit packet. get a buffer for outgoing packet +{ + struct pcap_private_context *ppc = + (struct pcap_private_context *)ctxt->io_private_context; + + if (ppc->w_buf.cnt >= MAX_TX_BURST) + { + pcap_send_pkts(ctxt, ifidx); + } + + // allocate buffer (heap ) + uint8_t *buf = malloc(len); //!! neeed free logic in the code!! + if (!buf) + return NULL; + + ppc->w_buf.pkts[ppc->w_buf.cnt].buf = buf; + ppc->w_buf.pkts[ppc->w_buf.cnt].len = len; + ppc->w_buf.cnt++; + + return buf; // caller fills this buffer +} +/*----------------------------------------------------------------------------*/ +uint8_t * +pcap_get_rptr(struct mtcp_thread_context *ctxt, int ifidx, int index, uint16_t *len) +{ + struct pcap_private_context *ppc; + uint8_t *pktbuf; + ppc = (struct pcap_private_context *)ctxt->io_private_context; + pktbuf = (uint8_t *)ppc->pkts[index]; + *len = ppc->hdrs[index]->caplen; + return pktbuf; +} +/*----------------------------------------------------------------------------*/ +static void +pcap_packet_handler(u_char *user, + const struct pcap_pkthdr *h, + const u_char *bytes) +{ + struct pcap_private_context *ppc = + (struct pcap_private_context *)user; + + if (ppc->num_pkts_in_chunk < 64) + { // safety guard + ppc->hdrs[ppc->num_pkts_in_chunk] = (struct pcap_pkthdr *)h; + ppc->pkts[ppc->num_pkts_in_chunk] = bytes; + ppc->num_pkts_in_chunk++; + } +} +/*----------------------------------------------------------------------------*/ +int32_t +pcap_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) +{ + struct pcap_private_context *ppc = ctxt->io_private_context; + // use pcap_dipatch(); + ppc->num_pkts_in_chunk = 0; + int ret = pcap_dispatch(ppc->handle, CHUNK_SIZE, pcap_packet_handler, (u_char *)ppc); + // receive up to max CHUNK_SIZE packets + // packets in socket's receive buffers are copied to user application buffer + if (ret < 0) // error + { + TRACE_ERROR("pcap_dispatch failed: %s\n", pcap_geterr(ppc->handle)); + return -1; + } + if (ret == 0) + { + printf("timeout expired on live caputure\n"); + } + return ret; +} +/*----------------------------------------------------------------------------*/ +int32_t +pcap_select(struct mtcp_thread_context *ctxt) // useless +{ + return 0; +} +/*----------------------------------------------------------------------------*/ +int pcap_link_devices(struct mtcp_thread_context *ctxt) // no cnocept of NIC RX queue affinity +{ + return 0; +} +/*----------------------------------------------------------------------------*/ +void pcap_destroy_handle(struct mtcp_thread_context *ctxt) +{ + struct pcap_private_context *ppc = ctxt->io_private_context; + if (ppc) + { + if (ppc->handle) + pcap_close(ppc->handle); + free(ppc); + } +} +/*----------------------------------------------------------------------------*/ +void pcap_load_module() // useless,, just a guard +{ + + if (CONFIG.multi_process) + { + TRACE_LOG("pcap module does not support multi-process.\n"); + exit(EXIT_FAILURE); + } +} +/*----------------------------------------------------------------------------*/ +io_module_func pcap_module_func = { + .load_module = pcap_load_module, + .init_handle = pcap_init_handle, + .link_devices = pcap_link_devices, + .release_pkt = pcap_release_pkt, + .send_pkts = pcap_send_pkts, + .get_wptr = pcap_get_wptr, + .recv_pkts = pcap_recv_pkts, + .get_rptr = pcap_get_rptr, + .select = pcap_select, + .destroy_handle = pcap_destroy_handle, + .dev_ioctl = NULL}; +/*----------------------------------------------------------------------------*/ \ No newline at end of file diff --git a/mtcp/src/tcp_in.c b/mtcp/src/tcp_in.c index 5d984a7e4..b74d407e1 100644 --- a/mtcp/src/tcp_in.c +++ b/mtcp/src/tcp_in.c @@ -18,7 +18,7 @@ #define MAX(a, b) ((a)>(b)?(a):(b)) #define MIN(a, b) ((a)<(b)?(a):(b)) -#define VERIFY_RX_CHECKSUM TRUE +#define VERIFY_RX_CHECKSUM FALSE #define RECOVERY_AFTER_LOSS TRUE #define SELECTIVE_WRITE_EVENT_NOTIFY TRUE @@ -1213,9 +1213,9 @@ ProcessTCPPacket(mtcp_manager_t mtcp, uint32_t seq = ntohl(tcph->seq); uint32_t ack_seq = ntohl(tcph->ack_seq); uint16_t window = ntohs(tcph->window); - uint16_t check; - int ret; - int rc = -1; + //uint16_t check; + // int ret; + // int rc = -1; /* Check ip packet invalidation */ if (ip_len < ((iph->ihl + tcph->doff) << 2)) @@ -1231,7 +1231,7 @@ ProcessTCPPacket(mtcp_manager_t mtcp, check = TCPCalcChecksum((uint16_t *)tcph, (tcph->doff << 2) + payloadlen, iph->saddr, iph->daddr); if (check) { - TRACE_DBG("Checksum Error: Original: 0x%04x, calculated: 0x%04x\n", + TRACE_ERROR("Checksum Error: Original: 0x%04x, calculated: 0x%04x\n", tcph->check, TCPCalcChecksum((uint16_t *)tcph, (tcph->doff << 2) + payloadlen, iph->saddr, iph->daddr)); tcph->check = 0; @@ -1251,6 +1251,7 @@ ProcessTCPPacket(mtcp_manager_t mtcp, if (!(cur_stream = StreamHTSearch(mtcp->tcp_flow_table, &s_stream))) { /* not found in flow table */ + TRACE_ERROR("not found in flow table\n"); cur_stream = CreateNewFlowHTEntry(mtcp, cur_ts, iph, ip_len, tcph, seq, ack_seq, payloadlen, window); if (!cur_stream) @@ -1259,10 +1260,10 @@ ProcessTCPPacket(mtcp_manager_t mtcp, /* Validate sequence. if not valid, ignore the packet */ if (cur_stream->state > TCP_ST_SYN_RCVD) { - ret = ValidateSequence(mtcp, cur_stream, + int ret = ValidateSequence(mtcp, cur_stream, cur_ts, tcph, seq, ack_seq, payloadlen); if (!ret) { - TRACE_DBG("Stream %d: Unexpected sequence: %u, expected: %u\n", + TRACE_ERROR("Stream %d: Unexpected sequence: %u, expected: %u\n", cur_stream->id, seq, cur_stream->rcv_nxt); #ifdef DBGMSG DumpIPPacket(mtcp, iph, ip_len); @@ -1287,6 +1288,7 @@ ProcessTCPPacket(mtcp_manager_t mtcp, /* Process RST: process here only if state > TCP_ST_SYN_SENT */ if (tcph->rst) { + TRACE_ERROR("RST packet Received!!! \n"); cur_stream->have_reset = TRUE; if (cur_stream->state > TCP_ST_SYN_SENT) { if (ProcessRST(mtcp, cur_stream, ack_seq)) { @@ -1296,6 +1298,7 @@ ProcessTCPPacket(mtcp_manager_t mtcp, } switch (cur_stream->state) { + // based on current state , process packets case TCP_ST_LISTEN: Handle_TCP_ST_LISTEN(mtcp, cur_ts, cur_stream, tcph); break; diff --git a/util/include/netlib.h b/util/include/netlib.h index 6ec42f76e..d6c49aeac 100644 --- a/util/include/netlib.h +++ b/util/include/netlib.h @@ -38,7 +38,8 @@ struct Options { char *op_name; char **op_varptr; char *op_comment; -} Options; +}; +extern struct Options Options[]; void ParseOptions(int argc, const char** argv, struct Options* ops); void PrintOptions(const struct Options* ops, int printVal); diff --git a/util/netlib.c b/util/netlib.c index 9256fe3f1..f8ae56cf3 100644 --- a/util/netlib.c +++ b/util/netlib.c @@ -16,6 +16,9 @@ #include "netlib.h" +struct Options Options[] = { + { NULL, NULL, NULL } /* initialize empty; can be filled later */ +}; /*----------------------------------------------------------------------------*/ int GetNumCPUCores(void) From 6384f5fa6bd6768affd6816b22b2dbc4ac6247b9 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 11 Sep 2025 00:22:00 +0000 Subject: [PATCH 02/11] The 100 MB test passes about 6 out of 10 times Problem Found: - in mtcp_epoll_wait, stuck at pthread_cond_wait(&ep->epoll_cond,..) - usr_q is empty so app thread keeps waiting - seems like concurrency timing issue --- apps/example/epserver.c | 444 ++++++++------ apps/example/sample_client.c | 39 +- mtcp/src/api.c | 1055 +++++++++++++++++++++------------- mtcp/src/core.c | 29 +- mtcp/src/eventpoll.c | 388 ++++++++----- mtcp/src/pcap_module.c | 126 +++- mtcp/src/tcp_in.c | 990 ++++++++++++++++++------------- 7 files changed, 1868 insertions(+), 1203 deletions(-) diff --git a/apps/example/epserver.c b/apps/example/epserver.c index 624fb2a42..578769019 100644 --- a/apps/example/epserver.c +++ b/apps/example/epserver.c @@ -24,10 +24,10 @@ #include "netlib.h" #include "debug.h" -#define MAX_FLOW_NUM (10000) +#define MAX_FLOW_NUM (10000) -#define RCVBUF_SIZE (2*1024) -#define SNDBUF_SIZE (8*1024) +#define RCVBUF_SIZE (64 * 1024) +#define SNDBUF_SIZE (64 * 1024) // set buffer size large enough #define MAX_EVENTS (MAX_FLOW_NUM * 3) @@ -54,7 +54,7 @@ #define HT_SUPPORT FALSE #ifndef MAX_CPUS -#define MAX_CPUS 16 +#define MAX_CPUS 16 #endif /*----------------------------------------------------------------------------*/ struct file_cache @@ -75,9 +75,9 @@ struct server_vars uint8_t rspheader_sent; uint8_t keep_alive; - int fidx; // file cache index - char fname[NAME_LIMIT]; // file name - long int fsize; // file size + int fidx; // file cache index + char fname[NAME_LIMIT]; // file name + long int fsize; // file size }; /*----------------------------------------------------------------------------*/ struct thread_context @@ -103,21 +103,21 @@ static int finished; static char * StatusCodeToString(int scode) { - switch (scode) { - case 200: - return "OK"; - break; + switch (scode) + { + case 200: + return "OK"; + break; - case 404: - return "Not Found"; - break; + case 404: + return "Not Found"; + break; } return NULL; } /*----------------------------------------------------------------------------*/ -void -CleanServerVariable(struct server_vars *sv) +void CleanServerVariable(struct server_vars *sv) { sv->recv_len = 0; sv->request_len = 0; @@ -128,55 +128,77 @@ CleanServerVariable(struct server_vars *sv) sv->keep_alive = 0; } /*----------------------------------------------------------------------------*/ -void -CloseConnection(struct thread_context *ctx, int sockid, struct server_vars *sv) +void CloseConnection(struct thread_context *ctx, int sockid, struct server_vars *sv) { mtcp_epoll_ctl(ctx->mctx, ctx->ep, MTCP_EPOLL_CTL_DEL, sockid, NULL); mtcp_close(ctx->mctx, sockid); } /*----------------------------------------------------------------------------*/ -static int +static int SendUntilAvailable(struct thread_context *ctx, int sockid, struct server_vars *sv) { + printf("SEND UNTIL AVAILABLE Inside\n\n"); int ret; int sent; int len; - if (sv->done || !sv->rspheader_sent) { + if (sv->done || !sv->rspheader_sent) + { return 0; } sent = 0; ret = 1; - while (ret > 0) { + while (ret > 0) + { len = MIN(SNDBUF_SIZE, sv->fsize - sv->total_sent); - if (len <= 0) { + if (len <= 0) + { break; } - ret = mtcp_write(ctx->mctx, sockid, - fcache[sv->fidx].file + sv->total_sent, len); - if (ret < 0) { - TRACE_APP("Connection closed with client.\n"); - break; + ret = mtcp_write(ctx->mctx, sockid, + fcache[sv->fidx].file + sv->total_sent, len); + + printf("ret sent: %d\n", ret); + if (ret < 0) + { + if (errno == EAGAIN) + { + struct mtcp_epoll_event ev; + ev.events = MTCP_EPOLLIN | MTCP_EPOLLOUT; + ev.data.sockid = sockid; + mtcp_epoll_ctl(ctx->mctx, ctx->ep, MTCP_EPOLL_CTL_MOD, + sockid, &ev); + break; + } + else + { + TRACE_APP("Connection closed with client.\n"); + break; + } } - TRACE_APP("Socket %d: mtcp_write try: %d, ret: %d\n", sockid, len, ret); + printf("Socket %d: mtcp_write try: %d, ret: %d\n", sockid, len, ret); sent += ret; sv->total_sent += ret; } - if (sv->total_sent >= fcache[sv->fidx].size) { + if (sv->total_sent >= fcache[sv->fidx].size) + { struct mtcp_epoll_event ev; sv->done = TRUE; finished++; - if (sv->keep_alive) { + if (sv->keep_alive) + { /* if keep-alive connection, wait for the incoming request */ ev.events = MTCP_EPOLLIN; ev.data.sockid = sockid; mtcp_epoll_ctl(ctx->mctx, ctx->ep, MTCP_EPOLL_CTL_MOD, sockid, &ev); CleanServerVariable(sv); - } else { + } + else + { /* else, close connection */ CloseConnection(ctx, sockid, sv); } @@ -185,14 +207,14 @@ SendUntilAvailable(struct thread_context *ctx, int sockid, struct server_vars *s return sent; } /*----------------------------------------------------------------------------*/ -static int +static int HandleReadEvent(struct thread_context *ctx, int sockid, struct server_vars *sv) { struct mtcp_epoll_event ev; char buf[HTTP_HEADER_LEN]; char url[URL_LEN]; char response[HTTP_HEADER_LEN]; - int scode; // status code + int scode; // status code time_t t_now; char t_str[128]; char keepalive_str[128]; @@ -203,21 +225,23 @@ HandleReadEvent(struct thread_context *ctx, int sockid, struct server_vars *sv) /* HTTP request handling */ rd = mtcp_read(ctx->mctx, sockid, buf, HTTP_HEADER_LEN); - if (rd <= 0) { + if (rd <= 0) + { return rd; } - memcpy(sv->request + sv->recv_len, - (char *)buf, MIN(rd, HTTP_HEADER_LEN - sv->recv_len)); + memcpy(sv->request + sv->recv_len, + (char *)buf, MIN(rd, HTTP_HEADER_LEN - sv->recv_len)); sv->recv_len += rd; - //sv->request[rd] = '\0'; - //fprintf(stderr, "HTTP Request: \n%s", request); + // sv->request[rd] = '\0'; + // fprintf(stderr, "HTTP Request: \n%s", request); sv->request_len = find_http_header(sv->request, sv->recv_len); - if (sv->request_len <= 0) { + if (sv->request_len <= 0) + { TRACE_ERROR("Socket %d: Failed to parse HTTP request header.\n" - "read bytes: %d, recv_len: %d, " - "request_len: %d, strlen: %ld, request: \n%s\n", - sockid, rd, sv->recv_len, - sv->request_len, strlen(sv->request), sv->request); + "read bytes: %d, recv_len: %d, " + "request_len: %d, strlen: %ld, request: \n%s\n", + sockid, rd, sv->recv_len, + sv->request_len, strlen(sv->request), sv->request); return rd; } @@ -227,27 +251,33 @@ HandleReadEvent(struct thread_context *ctx, int sockid, struct server_vars *sv) TRACE_APP("Socket %d File name: %s\n", sockid, sv->fname); sv->keep_alive = FALSE; - if (http_header_str_val(sv->request, "Connection: ", - strlen("Connection: "), keepalive_str, 128)) { - if (strstr(keepalive_str, "Keep-Alive")) { + if (http_header_str_val(sv->request, "Connection: ", + strlen("Connection: "), keepalive_str, 128)) + { + if (strstr(keepalive_str, "Keep-Alive")) + { sv->keep_alive = TRUE; - } else if (strstr(keepalive_str, "Close")) { + } + else if (strstr(keepalive_str, "Close")) + { sv->keep_alive = FALSE; } } /* Find file in cache */ scode = 404; - for (i = 0; i < nfiles; i++) { - if (strcmp(sv->fname, fcache[i].fullname) == 0) { + for (i = 0; i < nfiles; i++) + { + if (strcmp(sv->fname, fcache[i].fullname) == 0) + { sv->fsize = fcache[i].size; sv->fidx = i; scode = 200; break; } } - TRACE_APP("Socket %d File size: %ld (%ldMB)\n", - sockid, sv->fsize, sv->fsize / 1024 / 1024); + TRACE_APP("Socket %d File size: %ld (%ldMB)\n", + sockid, sv->fsize, sv->fsize / 1024 / 1024); /* Response header handling */ time(&t_now); @@ -258,16 +288,16 @@ HandleReadEvent(struct thread_context *ctx, int sockid, struct server_vars *sv) sprintf(keepalive_str, "Close"); sprintf(response, "HTTP/1.1 %d %s\r\n" - "Date: %s\r\n" - "Server: Webserver on Middlebox TCP (Ubuntu)\r\n" - "Content-Length: %ld\r\n" - "Connection: %s\r\n\r\n", + "Date: %s\r\n" + "Server: Webserver on Middlebox TCP (Ubuntu)\r\n" + "Content-Length: %ld\r\n" + "Connection: %s\r\n\r\n", scode, StatusCodeToString(scode), t_str, sv->fsize, keepalive_str); len = strlen(response); TRACE_APP("Socket %d HTTP Response: \n%s", sockid, response); sent = mtcp_write(ctx->mctx, sockid, response, len); - TRACE_APP("Socket %d Sent response header: try: %d, sent: %d\n", - sockid, len, sent); + TRACE_APP("Socket %d Sent response header: try: %d, sent: %d\n", + sockid, len, sent); assert(sent == len); sv->rspheader_sent = TRUE; @@ -280,8 +310,7 @@ HandleReadEvent(struct thread_context *ctx, int sockid, struct server_vars *sv) return rd; } /*----------------------------------------------------------------------------*/ -int -AcceptConnection(struct thread_context *ctx, int listener) +int AcceptConnection(struct thread_context *ctx, int listener) { mctx_t mctx = ctx->mctx; struct server_vars *sv; @@ -290,8 +319,10 @@ AcceptConnection(struct thread_context *ctx, int listener) c = mtcp_accept(mctx, listener, NULL, NULL); // return connected socket file descriptor - if (c >= 0) { - if (c >= MAX_FLOW_NUM) { + if (c >= 0) + { + if (c >= MAX_FLOW_NUM) + { TRACE_ERROR("Invalid socket id %d.\n", c); return -1; } @@ -304,11 +335,13 @@ AcceptConnection(struct thread_context *ctx, int listener) mtcp_setsock_nonblock(ctx->mctx, c); mtcp_epoll_ctl(mctx, ctx->ep, MTCP_EPOLL_CTL_ADD, c, &ev); TRACE_APP("Socket %d registered.\n", c); - - } else { - if (errno != EAGAIN) { - TRACE_ERROR("mtcp_accept() error %s\n", - strerror(errno)); + } + else + { + if (errno != EAGAIN) + { + TRACE_ERROR("mtcp_accept() error %s\n", + strerror(errno)); } } @@ -329,14 +362,16 @@ InitializeServerThread(int core) #endif /* HT_SUPPORT */ ctx = (struct thread_context *)calloc(1, sizeof(struct thread_context)); - if (!ctx) { + if (!ctx) + { TRACE_ERROR("Failed to create thread context!\n"); return NULL; } /* create mtcp context: this will spawn an mtcp thread */ ctx->mctx = mtcp_create_context(core); - if (!ctx->mctx) { + if (!ctx->mctx) + { TRACE_ERROR("Failed to create mtcp context!\n"); free(ctx); return NULL; @@ -344,7 +379,8 @@ InitializeServerThread(int core) /* create epoll descriptor */ ctx->ep = mtcp_epoll_create(ctx->mctx, MAX_EVENTS); - if (ctx->ep < 0) { + if (ctx->ep < 0) + { mtcp_destroy_context(ctx->mctx); free(ctx); TRACE_ERROR("Failed to create epoll descriptor!\n"); @@ -353,8 +389,9 @@ InitializeServerThread(int core) /* allocate memory for server variables */ ctx->svars = (struct server_vars *) - calloc(MAX_FLOW_NUM, sizeof(struct server_vars)); - if (!ctx->svars) { + calloc(MAX_FLOW_NUM, sizeof(struct server_vars)); + if (!ctx->svars) + { mtcp_close(ctx->mctx, ctx->ep); mtcp_destroy_context(ctx->mctx); free(ctx); @@ -365,8 +402,7 @@ InitializeServerThread(int core) return ctx; } /*----------------------------------------------------------------------------*/ -int -CreateListeningSocket(struct thread_context *ctx) +int CreateListeningSocket(struct thread_context *ctx) { int listener; struct mtcp_epoll_event ev; @@ -375,12 +411,14 @@ CreateListeningSocket(struct thread_context *ctx) /* create socket and set it as nonblocking */ listener = mtcp_socket(ctx->mctx, AF_INET, SOCK_STREAM, 0); - if (listener < 0) { + if (listener < 0) + { TRACE_ERROR("Failed to create listening socket!\n"); return -1; } ret = mtcp_setsock_nonblock(ctx->mctx, listener); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("Failed to set socket in nonblocking mode.\n"); return -1; } @@ -389,20 +427,22 @@ CreateListeningSocket(struct thread_context *ctx) saddr.sin_family = AF_INET; saddr.sin_addr.s_addr = INADDR_ANY; saddr.sin_port = htons(8080); - ret = mtcp_bind(ctx->mctx, listener, - (struct sockaddr *)&saddr, sizeof(struct sockaddr_in)); - if (ret < 0) { + ret = mtcp_bind(ctx->mctx, listener, + (struct sockaddr *)&saddr, sizeof(struct sockaddr_in)); + if (ret < 0) + { TRACE_ERROR("Failed to bind to the listening socket!\n"); return -1; } /* listen (backlog: can be configured) */ ret = mtcp_listen(ctx->mctx, listener, backlog); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("mtcp_listen() failed!\n"); return -1; } - + /* wait for incoming accept events */ ev.events = MTCP_EPOLLIN; ev.data.sockid = listener; @@ -423,10 +463,11 @@ RunServerThread(void *arg) int nevents; int i, ret; int do_accept; - + /* initialization */ ctx = InitializeServerThread(core); - if (!ctx) { + if (!ctx) + { TRACE_ERROR("Failed to initialize server thread.\n"); return NULL; } @@ -434,95 +475,120 @@ RunServerThread(void *arg) ep = ctx->ep; events = (struct mtcp_epoll_event *) - calloc(MAX_EVENTS, sizeof(struct mtcp_epoll_event)); - if (!events) { + calloc(MAX_EVENTS, sizeof(struct mtcp_epoll_event)); + if (!events) + { TRACE_ERROR("Failed to create event struct!\n"); exit(-1); } listener = CreateListeningSocket(ctx); - if (listener < 0) { + if (listener < 0) + { TRACE_ERROR("Failed to create listening socket.\n"); exit(-1); } printf("listening socket created !! \n"); - while (!done[core]) { - printf("waiting\n"); + while (!done[core]) + { + printf("\nwaiting\n"); nevents = mtcp_epoll_wait(mctx, ep, events, MAX_EVENTS, -1); - if (nevents < 0) { + printf("[RUNServerThread: Epoll wait returned %d\n", nevents); + if (nevents < 0) + { if (errno != EINTR) perror("mtcp_epoll_wait"); break; } do_accept = FALSE; - for (i = 0; i < nevents; i++) { + for (i = 0; i < nevents; i++) + { - if (events[i].data.sockid == listener) { - printf("listener!! \n"); + if (events[i].data.sockid == listener) + { + TRACE_ERROR("listener!! \n"); /* if the event is for the listener, accept connection */ do_accept = TRUE; - } else if (events[i].events & MTCP_EPOLLERR) { + } + else if (events[i].events & MTCP_EPOLLERR) + { int err; socklen_t len = sizeof(err); /* error on the connection */ - TRACE_APP("[CPU %d] Error on socket %d\n", - core, events[i].data.sockid); - if (mtcp_getsockopt(mctx, events[i].data.sockid, - SOL_SOCKET, SO_ERROR, (void *)&err, &len) == 0) { - if (err != ETIMEDOUT) { - fprintf(stderr, "Error on socket %d: %s\n", + TRACE_APP("[CPU %d] Error on socket %d\n", + core, events[i].data.sockid); + if (mtcp_getsockopt(mctx, events[i].data.sockid, + SOL_SOCKET, SO_ERROR, (void *)&err, &len) == 0) + { + if (err != ETIMEDOUT) + { + fprintf(stderr, "Error on socket %d: %s\n", events[i].data.sockid, strerror(err)); } - } else { + } + else + { perror("mtcp_getsockopt"); } - CloseConnection(ctx, events[i].data.sockid, - &ctx->svars[events[i].data.sockid]); - - }else if (events[i].events & MTCP_EPOLLIN) { - printf("epoll in event!! \n"); - ret = HandleReadEvent(ctx, events[i].data.sockid, - &ctx->svars[events[i].data.sockid]); - - if (ret == 0) { + CloseConnection(ctx, events[i].data.sockid, + &ctx->svars[events[i].data.sockid]); + } + else if (events[i].events & MTCP_EPOLLIN) + { + TRACE_ERROR("epoll in event!! \n"); + ret = HandleReadEvent(ctx, events[i].data.sockid, + &ctx->svars[events[i].data.sockid]); + + if (ret == 0) + { /* connection closed by remote host */ - CloseConnection(ctx, events[i].data.sockid, - &ctx->svars[events[i].data.sockid]); - } else if (ret < 0) { + CloseConnection(ctx, events[i].data.sockid, + &ctx->svars[events[i].data.sockid]); + } + else if (ret < 0) + { /* if not EAGAIN, it's an error */ - if (errno != EAGAIN) { - CloseConnection(ctx, events[i].data.sockid, - &ctx->svars[events[i].data.sockid]); + if (errno != EAGAIN) + { + CloseConnection(ctx, events[i].data.sockid, + &ctx->svars[events[i].data.sockid]); } } - - } else if (events[i].events & MTCP_EPOLLOUT) { + } + else if (events[i].events & MTCP_EPOLLOUT) + { + TRACE_ERROR("epoll out event!! \n"); struct server_vars *sv = &ctx->svars[events[i].data.sockid]; - if (sv->rspheader_sent) { + if (sv->rspheader_sent) + { SendUntilAvailable(ctx, events[i].data.sockid, sv); - } else { - TRACE_APP("Socket %d: Response header not sent yet.\n", - events[i].data.sockid); } - - } else { + else + { + TRACE_APP("Socket %d: Response header not sent yet.\n", + events[i].data.sockid); + } + } + else + { assert(0); } } /* if do_accept flag is set, accept connections */ - if (do_accept) { - while (1) { + if (do_accept) + { + while (1) + { ret = AcceptConnection(ctx, listener); if (ret < 0) break; } } - } /* destroy mtcp context: this will kill the mtcp thread */ @@ -532,17 +598,21 @@ RunServerThread(void *arg) return NULL; } /*----------------------------------------------------------------------------*/ -void -SignalHandler(int signum) +void SignalHandler(int signum) { int i; - for (i = 0; i < core_limit; i++) { - if (app_thread[i] == pthread_self()) { - //TRACE_INFO("Server thread %d got SIGINT\n", i); + for (i = 0; i < core_limit; i++) + { + if (app_thread[i] == pthread_self()) + { + // TRACE_INFO("Server thread %d got SIGINT\n", i); done[i] = TRUE; - } else { - if (!done[i]) { + } + else + { + if (!done[i]) + { pthread_kill(app_thread[i], signum); } } @@ -553,13 +623,12 @@ static void printHelp(const char *prog_name) { TRACE_CONFIG("%s -p -f " - "[-N num_cores] [-c ] [-h]\n", - prog_name); + "[-N num_cores] [-c ] [-h]\n", + prog_name); exit(EXIT_SUCCESS); } /*----------------------------------------------------------------------------*/ -int -main(int argc, char **argv) +int main(int argc, char **argv) { DIR *dir; struct dirent *ent; @@ -576,18 +645,22 @@ main(int argc, char **argv) process_cpu = -1; dir = NULL; - if (argc < 2) { + if (argc < 2) + { TRACE_CONFIG("$%s directory_to_service\n", argv[0]); return FALSE; } - while (-1 != (o = getopt(argc, argv, "N:f:p:c:b:h"))) { - switch (o) { + while (-1 != (o = getopt(argc, argv, "N:f:p:c:b:h"))) + { + switch (o) + { case 'p': /* open the directory to serve */ www_main = optarg; dir = opendir(www_main); - if (!dir) { + if (!dir) + { TRACE_CONFIG("Failed to open %s.\n", www_main); perror("opendir"); return FALSE; @@ -595,13 +668,15 @@ main(int argc, char **argv) break; case 'N': core_limit = mystrtol(optarg, 10); - if (core_limit > num_cores) { + if (core_limit > num_cores) + { TRACE_CONFIG("CPU limit should be smaller than the " - "number of CPUs: %d\n", num_cores); + "number of CPUs: %d\n", + num_cores); return FALSE; } - /** - * it is important that core limit is set + /** + * it is important that core limit is set * before mtcp_init() is called. You can * not set core_limit after mtcp_init() */ @@ -614,7 +689,8 @@ main(int argc, char **argv) break; case 'c': process_cpu = mystrtol(optarg, 10); - if (process_cpu > core_limit) { + if (process_cpu > core_limit) + { TRACE_CONFIG("Starting CPU is way off limits!\n"); return FALSE; } @@ -627,14 +703,16 @@ main(int argc, char **argv) break; } } - - if (dir == NULL) { + + if (dir == NULL) + { TRACE_CONFIG("You did not pass a valid www_path!\n"); exit(EXIT_FAILURE); } nfiles = 0; - while ((ent = readdir(dir)) != NULL) { + while ((ent = readdir(dir)) != NULL) + { if (strcmp(ent->d_name, ".") == 0) continue; else if (strcmp(ent->d_name, "..") == 0) @@ -642,38 +720,47 @@ main(int argc, char **argv) snprintf(fcache[nfiles].name, NAME_LIMIT, "%s", ent->d_name); snprintf(fcache[nfiles].fullname, FULLNAME_LIMIT, "%s/%s", - www_main, ent->d_name); + www_main, ent->d_name); fd = open(fcache[nfiles].fullname, O_RDONLY); - if (fd < 0) { + if (fd < 0) + { perror("open"); continue; - } else { + } + else + { fcache[nfiles].size = lseek64(fd, 0, SEEK_END); lseek64(fd, 0, SEEK_SET); } fcache[nfiles].file = (char *)malloc(fcache[nfiles].size); - if (!fcache[nfiles].file) { - TRACE_CONFIG("Failed to allocate memory for file %s\n", - fcache[nfiles].name); + if (!fcache[nfiles].file) + { + TRACE_CONFIG("Failed to allocate memory for file %s\n", + fcache[nfiles].name); perror("malloc"); continue; } - TRACE_INFO("Reading %s (%lu bytes)\n", - fcache[nfiles].name, fcache[nfiles].size); + TRACE_INFO("Reading %s (%lu bytes)\n", + fcache[nfiles].name, fcache[nfiles].size); total_read = 0; - while (1) { - ret = read(fd, fcache[nfiles].file + total_read, - fcache[nfiles].size - total_read); - if (ret < 0) { + while (1) + { + ret = read(fd, fcache[nfiles].file + total_read, + fcache[nfiles].size - total_read); + if (ret < 0) + { break; - } else if (ret == 0) { + } + else if (ret == 0) + { break; } total_read += ret; } - if (total_read < fcache[nfiles].size) { + if (total_read < fcache[nfiles].size) + { free(fcache[nfiles].file); continue; } @@ -687,54 +774,61 @@ main(int argc, char **argv) finished = 0; /* initialize mtcp */ - if (conf_file == NULL) { + if (conf_file == NULL) + { TRACE_CONFIG("You forgot to pass the mTCP startup config file!\n"); exit(EXIT_FAILURE); } ret = mtcp_init(conf_file); - if (ret) { + if (ret) + { TRACE_CONFIG("Failed to initialize mtcp\n"); exit(EXIT_FAILURE); } mtcp_getconf(&mcfg); - if (backlog > mcfg.max_concurrency) { + if (backlog > mcfg.max_concurrency) + { TRACE_CONFIG("backlog can not be set larger than CONFIG.max_concurrency\n"); return FALSE; } /* if backlog is not specified, set it to 4K */ - if (backlog == -1) { + if (backlog == -1) + { backlog = 4096; } - + /* register signal handler to mtcp */ mtcp_register_signal(SIGINT, SignalHandler); TRACE_INFO("Application initialization finished.\n"); - for (i = ((process_cpu == -1) ? 0 : process_cpu); i < core_limit; i++) { + for (i = ((process_cpu == -1) ? 0 : process_cpu); i < core_limit; i++) + { cores[i] = i; done[i] = FALSE; - - if (pthread_create(&app_thread[i], - NULL, RunServerThread, (void *)&cores[i])) { + + if (pthread_create(&app_thread[i], + NULL, RunServerThread, (void *)&cores[i])) + { perror("pthread_create"); TRACE_CONFIG("Failed to create server thread.\n"); - exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } if (process_cpu != -1) break; } - - for (i = ((process_cpu == -1) ? 0 : process_cpu); i < core_limit; i++) { + + for (i = ((process_cpu == -1) ? 0 : process_cpu); i < core_limit; i++) + { pthread_join(app_thread[i], NULL); if (process_cpu != -1) break; } - + mtcp_destroy(); closedir(dir); return 0; diff --git a/apps/example/sample_client.c b/apps/example/sample_client.c index e1e166a99..8b119d0b1 100644 --- a/apps/example/sample_client.c +++ b/apps/example/sample_client.c @@ -4,18 +4,20 @@ #include #include -#define SERVER_IP "10.200.1.1" // server IP +#define SERVER_IP "10.200.1.1" // server IP #define SERVER_PORT 8080 -#define BUF_SIZE 8192 +#define BUF_SIZE (64*1024) -int main() { +int main() +{ int sock; struct sockaddr_in serv_addr; char buffer[BUF_SIZE]; int n; // create socket - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) + { perror("socket"); exit(1); } @@ -26,15 +28,29 @@ int main() { serv_addr.sin_port = htons(SERVER_PORT); inet_pton(AF_INET, SERVER_IP, &serv_addr.sin_addr); + int size = 1 << 20; // 1 MB + if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) < 0) + { + perror("setsockopt SO_RCVBUF"); + } + if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0) + { + perror("setsockopt SO_SNDBUF"); + } + // connect - if (connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) { + if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) + { perror("connect"); exit(1); } // send HTTP GET - char *req = "GET /sample_100MB.txt HTTP/1.0\r\nHost: 10.200.1.1\r\n\r\n"; - if (write(sock, req, strlen(req)) < 0) { + //char *req = "GET /random_10MB.txt HTTP/1.0\r\nHost: 10.200.1.1\r\n\r\n"; + char *req = "GET /random_100MB.txt HTTP/1.0\r\nHost: 10.200.1.1\r\n\r\n"; + + if (write(sock, req, strlen(req)) < 0) + { perror("write"); close(sock); exit(1); @@ -42,16 +58,19 @@ int main() { // open output file FILE *fp = fopen("downloaded.txt", "wb"); - if (!fp) { + if (!fp) + { perror("fopen"); close(sock); exit(1); } // receive and save - while ((n = read(sock, buffer, BUF_SIZE)) > 0) { + while ((n = read(sock, buffer, BUF_SIZE)) > 0) + { fwrite(buffer, 1, n, fp); - printf("received: %d\n",n); + printf("received: %d\n", n); + fflush(fp); } fclose(fp); diff --git a/mtcp/src/api.c b/mtcp/src/api.c index c53714bcf..540ad09c2 100644 --- a/mtcp/src/api.c +++ b/mtcp/src/api.c @@ -18,40 +18,45 @@ #include "config.h" #include "debug.h" -#define MAX(a, b) ((a)>(b)?(a):(b)) -#define MIN(a, b) ((a)<(b)?(a):(b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) /*----------------------------------------------------------------------------*/ -static inline int +static inline int mtcp_is_connected(mtcp_manager_t mtcp, tcp_stream *cur_stream) { - if (!cur_stream) { + if (!cur_stream) + { TRACE_API("Stream does not exist\n"); return FALSE; } - if (cur_stream->state != TCP_ST_ESTABLISHED) { - TRACE_API("Stream %d not ESTABLISHED. state: %s\n", - cur_stream->id, TCPStateToString(cur_stream)); + if (cur_stream->state != TCP_ST_ESTABLISHED) + { + TRACE_API("Stream %d not ESTABLISHED. state: %s\n", + cur_stream->id, TCPStateToString(cur_stream)); return FALSE; } return TRUE; } /*----------------------------------------------------------------------------*/ -inline mtcp_manager_t +inline mtcp_manager_t GetMTCPManager(mctx_t mctx) { - if (!mctx) { + if (!mctx) + { errno = EINVAL; return NULL; } - if (mctx->cpu < 0 || mctx->cpu >= num_cpus) { + if (mctx->cpu < 0 || mctx->cpu >= num_cpus) + { errno = EINVAL; return NULL; } - if (g_mtcp[mctx->cpu]->ctx->done || g_mtcp[mctx->cpu]->ctx->exit) { + if (g_mtcp[mctx->cpu]->ctx->done || g_mtcp[mctx->cpu]->ctx->exit) + { errno = EPERM; return NULL; } @@ -59,21 +64,24 @@ GetMTCPManager(mctx_t mctx) return g_mtcp[mctx->cpu]; } /*----------------------------------------------------------------------------*/ -static inline int +static inline int GetSocketError(socket_map_t socket, void *optval, socklen_t *optlen) { tcp_stream *cur_stream; - if (!socket->stream) { + if (!socket->stream) + { errno = EBADF; return -1; } cur_stream = socket->stream; - if (cur_stream->state == TCP_ST_CLOSED) { - if (cur_stream->close_reason == TCP_TIMEDOUT || - cur_stream->close_reason == TCP_CONN_FAIL || - cur_stream->close_reason == TCP_CONN_LOST) { + if (cur_stream->state == TCP_ST_CLOSED) + { + if (cur_stream->close_reason == TCP_TIMEDOUT || + cur_stream->close_reason == TCP_CONN_FAIL || + cur_stream->close_reason == TCP_CONN_LOST) + { *(int *)optval = ETIMEDOUT; *optlen = sizeof(int); @@ -81,9 +89,11 @@ GetSocketError(socket_map_t socket, void *optval, socklen_t *optlen) } } - if (cur_stream->state == TCP_ST_CLOSE_WAIT || - cur_stream->state == TCP_ST_CLOSED) { - if (cur_stream->close_reason == TCP_RESET) { + if (cur_stream->state == TCP_ST_CLOSE_WAIT || + cur_stream->state == TCP_ST_CLOSED) + { + if (cur_stream->close_reason == TCP_RESET) + { *(int *)optval = ECONNRESET; *optlen = sizeof(int); @@ -92,7 +102,8 @@ GetSocketError(socket_map_t socket, void *optval, socklen_t *optlen) } if (cur_stream->state == TCP_ST_SYN_SENT && - errno == EINPROGRESS) { + errno == EINPROGRESS) + { *(int *)optval = errno; *optlen = sizeof(int); return -1; @@ -101,12 +112,13 @@ GetSocketError(socket_map_t socket, void *optval, socklen_t *optlen) /* * `base case`: If socket sees no so_error, then * this also means close_reason will always be - * TCP_NOT_CLOSED. + * TCP_NOT_CLOSED. */ - if (cur_stream->close_reason == TCP_NOT_CLOSED) { + if (cur_stream->close_reason == TCP_NOT_CLOSED) + { *(int *)optval = 0; - *optlen = sizeof(int); - + *optlen = sizeof(int); + return 0; } @@ -114,53 +126,56 @@ GetSocketError(socket_map_t socket, void *optval, socklen_t *optlen) return -1; } /*----------------------------------------------------------------------------*/ -int -mtcp_getsockname(mctx_t mctx, int sockid, struct sockaddr *addr, - socklen_t *addrlen) +int mtcp_getsockname(mctx_t mctx, int sockid, struct sockaddr *addr, + socklen_t *addrlen) { mtcp_manager_t mtcp; socket_map_t socket; - + mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - + socket = &mtcp->smap[sockid]; - if (socket->socktype == MTCP_SOCK_UNUSED) { + if (socket->socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - if (*addrlen <= 0) { + if (*addrlen <= 0) + { TRACE_API("Invalid addrlen: %d\n", *addrlen); errno = EINVAL; return -1; } - - if (socket->socktype != MTCP_SOCK_LISTENER && - socket->socktype != MTCP_SOCK_STREAM) { + + if (socket->socktype != MTCP_SOCK_LISTENER && + socket->socktype != MTCP_SOCK_STREAM) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = ENOTSOCK; return -1; } *(struct sockaddr_in *)addr = socket->saddr; - *addrlen = sizeof(socket->saddr); + *addrlen = sizeof(socket->saddr); return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_getpeername(mctx_t mctx, int sockid, struct sockaddr *addr, - socklen_t *addrlen) +int mtcp_getpeername(mctx_t mctx, int sockid, struct sockaddr *addr, + socklen_t *addrlen) { mtcp_manager_t mtcp; socket_map_t socket; @@ -168,86 +183,98 @@ mtcp_getpeername(mctx_t mctx, int sockid, struct sockaddr *addr, tcp_stream *stream; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } socket = &mtcp->smap[sockid]; - if (socket->socktype == MTCP_SOCK_UNUSED) { + if (socket->socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - - if (*addrlen <= 0) { + + if (*addrlen <= 0) + { TRACE_API("Invalid addrlen: %d\n", *addrlen); errno = EINVAL; return -1; } - - if (socket->socktype != MTCP_SOCK_LISTENER && - socket->socktype != MTCP_SOCK_STREAM) { + + if (socket->socktype != MTCP_SOCK_LISTENER && + socket->socktype != MTCP_SOCK_STREAM) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = ENOTSOCK; return -1; } - + stream = socket->stream; - if (!mtcp_is_connected(mtcp, stream)) { + if (!mtcp_is_connected(mtcp, stream)) + { errno = ENOTCONN; return -1; } - + addr_in = (struct sockaddr_in *)addr; - addr_in->sin_family = AF_INET; - addr_in->sin_port = stream->dport; - addr_in->sin_addr.s_addr = stream->daddr; - *addrlen = sizeof(*addr_in); - + addr_in->sin_family = AF_INET; + addr_in->sin_port = stream->dport; + addr_in->sin_addr.s_addr = stream->daddr; + *addrlen = sizeof(*addr_in); + return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_getsockopt(mctx_t mctx, int sockid, int level, - int optname, void *optval, socklen_t *optlen) +int mtcp_getsockopt(mctx_t mctx, int sockid, int level, + int optname, void *optval, socklen_t *optlen) { mtcp_manager_t mtcp; socket_map_t socket; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } socket = &mtcp->smap[sockid]; - if (socket->socktype == MTCP_SOCK_UNUSED) { + if (socket->socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - if (socket->socktype != MTCP_SOCK_LISTENER && - socket->socktype != MTCP_SOCK_STREAM) { + if (socket->socktype != MTCP_SOCK_LISTENER && + socket->socktype != MTCP_SOCK_STREAM) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = ENOTSOCK; return -1; } - if (level == SOL_SOCKET) { - if (optname == SO_ERROR) { - if (socket->socktype == MTCP_SOCK_STREAM) { + if (level == SOL_SOCKET) + { + if (optname == SO_ERROR) + { + if (socket->socktype == MTCP_SOCK_STREAM) + { return GetSocketError(socket, optval, optlen); } } @@ -257,33 +284,36 @@ mtcp_getsockopt(mctx_t mctx, int sockid, int level, return -1; } /*----------------------------------------------------------------------------*/ -int -mtcp_setsockopt(mctx_t mctx, int sockid, int level, - int optname, const void *optval, socklen_t optlen) +int mtcp_setsockopt(mctx_t mctx, int sockid, int level, + int optname, const void *optval, socklen_t optlen) { mtcp_manager_t mtcp; socket_map_t socket; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } socket = &mtcp->smap[sockid]; - if (socket->socktype == MTCP_SOCK_UNUSED) { + if (socket->socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - if (socket->socktype != MTCP_SOCK_LISTENER && - socket->socktype != MTCP_SOCK_STREAM) { + if (socket->socktype != MTCP_SOCK_LISTENER && + socket->socktype != MTCP_SOCK_STREAM) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = ENOTSOCK; return -1; @@ -292,23 +322,25 @@ mtcp_setsockopt(mctx_t mctx, int sockid, int level, return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_setsock_nonblock(mctx_t mctx, int sockid) +int mtcp_setsock_nonblock(mctx_t mctx, int sockid) { mtcp_manager_t mtcp; - + mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) { + if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; @@ -319,18 +351,19 @@ mtcp_setsock_nonblock(mctx_t mctx, int sockid) return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_socket_ioctl(mctx_t mctx, int sockid, int request, void *argp) +int mtcp_socket_ioctl(mctx_t mctx, int sockid, int request, void *argp) { mtcp_manager_t mtcp; socket_map_t socket; - + mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; @@ -339,38 +372,48 @@ mtcp_socket_ioctl(mctx_t mctx, int sockid, int request, void *argp) /* only support stream socket */ socket = &mtcp->smap[sockid]; if (socket->socktype != MTCP_SOCK_STREAM && - socket->socktype != MTCP_SOCK_LISTENER) { + socket->socktype != MTCP_SOCK_LISTENER) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - if (!argp) { + if (!argp) + { errno = EFAULT; return -1; } - if (request == FIONREAD) { + if (request == FIONREAD) + { tcp_stream *cur_stream; struct tcp_ring_buffer *rbuf; cur_stream = socket->stream; - if (!cur_stream) { + if (!cur_stream) + { errno = EBADF; return -1; } rbuf = cur_stream->rcvvar->rcvbuf; - if (rbuf) { - *(int *)argp = rbuf->merged_len; - } else { + if (rbuf) + { + *(int *)argp = rbuf->merged_len; + } + else + { *(int *)argp = 0; } - - } else if (request == FIONBIO) { + } + else if (request == FIONBIO) + { int32_t arg = *(int32_t *)argp; if (arg != 0) return mtcp_setsock_nonblock(mctx, sockid); - } else { + } + else + { errno = EINVAL; return -1; } @@ -378,31 +421,36 @@ mtcp_socket_ioctl(mctx_t mctx, int sockid, int request, void *argp) return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_socket(mctx_t mctx, int domain, int type, int protocol) +int mtcp_socket(mctx_t mctx, int domain, int type, int protocol) { mtcp_manager_t mtcp; socket_map_t socket; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (domain != AF_INET) { + if (domain != AF_INET) + { errno = EAFNOSUPPORT; return -1; } - if (type == SOCK_STREAM) { + if (type == SOCK_STREAM) + { type = (int)MTCP_SOCK_STREAM; - } else { + } + else + { errno = EINVAL; return -1; } socket = AllocateSocket(mctx, type, FALSE); - if (!socket) { + if (!socket) + { errno = ENFILE; return -1; } @@ -410,51 +458,57 @@ mtcp_socket(mctx_t mctx, int domain, int type, int protocol) return socket->id; } /*----------------------------------------------------------------------------*/ -int -mtcp_bind(mctx_t mctx, int sockid, - const struct sockaddr *addr, socklen_t addrlen) +int mtcp_bind(mctx_t mctx, int sockid, + const struct sockaddr *addr, socklen_t addrlen) { mtcp_manager_t mtcp; struct sockaddr_in *addr_in; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) { + if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - - if (mtcp->smap[sockid].socktype != MTCP_SOCK_STREAM && - mtcp->smap[sockid].socktype != MTCP_SOCK_LISTENER) { + + if (mtcp->smap[sockid].socktype != MTCP_SOCK_STREAM && + mtcp->smap[sockid].socktype != MTCP_SOCK_LISTENER) + { TRACE_API("Not a stream socket id: %d\n", sockid); errno = ENOTSOCK; return -1; } - if (!addr) { + if (!addr) + { TRACE_API("Socket %d: empty address!\n", sockid); errno = EINVAL; return -1; } - if (mtcp->smap[sockid].opts & MTCP_ADDR_BIND) { + if (mtcp->smap[sockid].opts & MTCP_ADDR_BIND) + { TRACE_API("Socket %d: adress already bind for this socket.\n", sockid); errno = EINVAL; return -1; } /* we only allow bind() for AF_INET address */ - if (addr->sa_family != AF_INET || addrlen < sizeof(struct sockaddr_in)) { + if (addr->sa_family != AF_INET || addrlen < sizeof(struct sockaddr_in)) + { TRACE_API("Socket %d: invalid argument!\n", sockid); errno = EINVAL; return -1; @@ -469,53 +523,60 @@ mtcp_bind(mctx_t mctx, int sockid, return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_listen(mctx_t mctx, int sockid, int backlog) +int mtcp_listen(mctx_t mctx, int sockid, int backlog) { mtcp_manager_t mtcp; struct tcp_listener *listener; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) { + if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - if (mtcp->smap[sockid].socktype == MTCP_SOCK_STREAM) { + if (mtcp->smap[sockid].socktype == MTCP_SOCK_STREAM) + { mtcp->smap[sockid].socktype = MTCP_SOCK_LISTENER; } - - if (mtcp->smap[sockid].socktype != MTCP_SOCK_LISTENER) { + + if (mtcp->smap[sockid].socktype != MTCP_SOCK_LISTENER) + { TRACE_API("Not a listening socket. id: %d\n", sockid); errno = ENOTSOCK; return -1; } - if (backlog <= 0 || backlog > CONFIG.max_concurrency) { + if (backlog <= 0 || backlog > CONFIG.max_concurrency) + { errno = EINVAL; return -1; } /* check whether we are not already listening on the same port */ - if (ListenerHTSearch(mtcp->listeners, - &mtcp->smap[sockid].saddr.sin_port)) { + if (ListenerHTSearch(mtcp->listeners, + &mtcp->smap[sockid].saddr.sin_port)) + { errno = EADDRINUSE; return -1; } listener = (struct tcp_listener *)calloc(1, sizeof(struct tcp_listener)); - if (!listener) { + if (!listener) + { /* errno set from the malloc() */ return -1; } @@ -524,13 +585,15 @@ mtcp_listen(mctx_t mctx, int sockid, int backlog) listener->backlog = backlog; listener->socket = &mtcp->smap[sockid]; - if (pthread_cond_init(&listener->accept_cond, NULL)) { + if (pthread_cond_init(&listener->accept_cond, NULL)) + { /* errno set internally */ perror("pthread_cond_init of ctx->accept_cond\n"); free(listener); return -1; } - if (pthread_mutex_init(&listener->accept_lock, NULL)) { + if (pthread_mutex_init(&listener->accept_lock, NULL)) + { /* errno set internally */ perror("pthread_mutex_init of ctx->accept_lock\n"); free(listener); @@ -538,20 +601,20 @@ mtcp_listen(mctx_t mctx, int sockid, int backlog) } listener->acceptq = CreateStreamQueue(backlog); - if (!listener->acceptq) { + if (!listener->acceptq) + { free(listener); errno = ENOMEM; return -1; } - + mtcp->smap[sockid].listener = listener; ListenerHTInsert(mtcp->listeners, listener); return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_accept(mctx_t mctx, int sockid, struct sockaddr *addr, socklen_t *addrlen) +int mtcp_accept(mctx_t mctx, int sockid, struct sockaddr *addr, socklen_t *addrlen) { mtcp_manager_t mtcp; struct tcp_listener *listener; @@ -559,18 +622,21 @@ mtcp_accept(mctx_t mctx, int sockid, struct sockaddr *addr, socklen_t *addrlen) tcp_stream *accepted = NULL; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } /* requires listening socket */ - if (mtcp->smap[sockid].socktype != MTCP_SOCK_LISTENER) { + if (mtcp->smap[sockid].socktype != MTCP_SOCK_LISTENER) + { errno = EINVAL; return -1; } @@ -580,17 +646,22 @@ mtcp_accept(mctx_t mctx, int sockid, struct sockaddr *addr, socklen_t *addrlen) /* dequeue from the acceptq without lock first */ /* if nothing there, acquire lock and cond_wait */ accepted = StreamDequeue(listener->acceptq); - if (!accepted) { - if (listener->socket->opts & MTCP_NONBLOCK) { + if (!accepted) + { + if (listener->socket->opts & MTCP_NONBLOCK) + { errno = EAGAIN; return -1; - - } else { + } + else + { pthread_mutex_lock(&listener->accept_lock); - while ((accepted = StreamDequeue(listener->acceptq)) == NULL) { + while ((accepted = StreamDequeue(listener->acceptq)) == NULL) + { pthread_cond_wait(&listener->accept_cond, &listener->accept_lock); - - if (mtcp->ctx->done || mtcp->ctx->exit) { + + if (mtcp->ctx->done || mtcp->ctx->exit) + { pthread_mutex_unlock(&listener->accept_lock); errno = EINTR; return -1; @@ -600,13 +671,16 @@ mtcp_accept(mctx_t mctx, int sockid, struct sockaddr *addr, socklen_t *addrlen) } } - if (!accepted) { + if (!accepted) + { TRACE_ERROR("[NEVER HAPPEN] Empty accept queue!\n"); } - if (!accepted->socket) { + if (!accepted->socket) + { socket = AllocateSocket(mctx, MTCP_SOCK_STREAM, FALSE); - if (!socket) { + if (!socket) + { TRACE_ERROR("Failed to create new socket!\n"); /* TODO: destroy the stream */ errno = ENFILE; @@ -622,14 +696,15 @@ mtcp_accept(mctx_t mctx, int sockid, struct sockaddr *addr, socklen_t *addrlen) } if (!(listener->socket->epoll & MTCP_EPOLLET) && - !StreamQueueIsEmpty(listener->acceptq)) - AddEpollEvent(mtcp->ep, - USR_SHADOW_EVENT_QUEUE, - listener->socket, MTCP_EPOLLIN); + !StreamQueueIsEmpty(listener->acceptq)) + AddEpollEvent(mtcp->ep, + USR_SHADOW_EVENT_QUEUE, + listener->socket, MTCP_EPOLLIN); TRACE_API("Stream %d accepted.\n", accepted->id); - if (addr && addrlen) { + if (addr && addrlen) + { struct sockaddr_in *addr_in = (struct sockaddr_in *)addr; addr_in->sin_family = AF_INET; addr_in->sin_port = accepted->dport; @@ -640,34 +715,37 @@ mtcp_accept(mctx_t mctx, int sockid, struct sockaddr *addr, socklen_t *addrlen) return accepted->socket->id; } /*----------------------------------------------------------------------------*/ -int -mtcp_init_rss(mctx_t mctx, in_addr_t saddr_base, int num_addr, - in_addr_t daddr, in_addr_t dport) +int mtcp_init_rss(mctx_t mctx, in_addr_t saddr_base, int num_addr, + in_addr_t daddr, in_addr_t dport) { mtcp_manager_t mtcp; addr_pool_t ap; uint8_t is_external; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { errno = EACCES; return -1; } - if (mtcp->ap) { + if (mtcp->ap) + { TRACE_DBG("Destroying already exsiting address pool.\n" - "Are you calling mtcp_init_rss() multiple times?\n"); + "Are you calling mtcp_init_rss() multiple times?\n"); DestroyAddressPool(mtcp->ap); mtcp->ap = NULL; } - if (saddr_base == INADDR_ANY) { + if (saddr_base == INADDR_ANY) + { int nif_out, eidx; /* for the INADDR_ANY, find the output interface for the destination and set the saddr_base as the ip address of the output interface */ nif_out = GetOutputInterface(daddr, &is_external); - if (nif_out < 0) { + if (nif_out < 0) + { errno = EINVAL; TRACE_DBG("Could not determine nif idx!\n"); return -1; @@ -676,22 +754,22 @@ mtcp_init_rss(mctx_t mctx, in_addr_t saddr_base, int num_addr, saddr_base = CONFIG.eths[eidx].ip_addr; } - ap = CreateAddressPoolPerCore(mctx->cpu, num_cpus, - saddr_base, num_addr, daddr, dport); - if (!ap) { + ap = CreateAddressPoolPerCore(mctx->cpu, num_cpus, + saddr_base, num_addr, daddr, dport); + if (!ap) + { errno = ENOMEM; return -1; } mtcp->ap = ap; UNUSED(is_external); - + return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_connect(mctx_t mctx, int sockid, - const struct sockaddr *addr, socklen_t addrlen) +int mtcp_connect(mctx_t mctx, int sockid, + const struct sockaddr *addr, socklen_t addrlen) { mtcp_manager_t mtcp; socket_map_t socket; @@ -703,47 +781,57 @@ mtcp_connect(mctx_t mctx, int sockid, int ret, nif; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) { + if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - - if (mtcp->smap[sockid].socktype != MTCP_SOCK_STREAM) { + + if (mtcp->smap[sockid].socktype != MTCP_SOCK_STREAM) + { TRACE_API("Not an end socket. id: %d\n", sockid); errno = ENOTSOCK; return -1; } - if (!addr) { + if (!addr) + { TRACE_API("Socket %d: empty address!\n", sockid); errno = EFAULT; return -1; } /* we only allow bind() for AF_INET address */ - if (addr->sa_family != AF_INET || addrlen < sizeof(struct sockaddr_in)) { + if (addr->sa_family != AF_INET || addrlen < sizeof(struct sockaddr_in)) + { TRACE_API("Socket %d: invalid argument!\n", sockid); errno = EAFNOSUPPORT; return -1; } socket = &mtcp->smap[sockid]; - if (socket->stream) { + if (socket->stream) + { TRACE_API("Socket %d: stream already exist!\n", sockid); - if (socket->stream->state >= TCP_ST_ESTABLISHED) { + if (socket->stream->state >= TCP_ST_ESTABLISHED) + { errno = EISCONN; - } else { + } + else + { errno = EALREADY; } return -1; @@ -754,35 +842,44 @@ mtcp_connect(mctx_t mctx, int sockid, dport = addr_in->sin_port; /* address binding */ - if ((socket->opts & MTCP_ADDR_BIND) && - socket->saddr.sin_port != INPORT_ANY && - socket->saddr.sin_addr.s_addr != INADDR_ANY) { + if ((socket->opts & MTCP_ADDR_BIND) && + socket->saddr.sin_port != INPORT_ANY && + socket->saddr.sin_addr.s_addr != INADDR_ANY) + { int rss_core; uint8_t endian_check = FetchEndianType(); - - rss_core = GetRSSCPUCore(socket->saddr.sin_addr.s_addr, dip, - socket->saddr.sin_port, dport, num_queues, endian_check); - - if (rss_core != mctx->cpu) { + + rss_core = GetRSSCPUCore(socket->saddr.sin_addr.s_addr, dip, + socket->saddr.sin_port, dport, num_queues, endian_check); + + if (rss_core != mctx->cpu) + { errno = EINVAL; return -1; } - } else { - if (mtcp->ap) { - ret = FetchAddressPerCore(mtcp->ap, - mctx->cpu, num_queues, addr_in, &socket->saddr); - } else { + } + else + { + if (mtcp->ap) + { + ret = FetchAddressPerCore(mtcp->ap, + mctx->cpu, num_queues, addr_in, &socket->saddr); + } + else + { uint8_t is_external; nif = GetOutputInterface(dip, &is_external); - if (nif < 0) { + if (nif < 0) + { errno = EINVAL; return -1; } - ret = FetchAddress(ap[nif], - mctx->cpu, num_queues, addr_in, &socket->saddr); + ret = FetchAddress(ap[nif], + mctx->cpu, num_queues, addr_in, &socket->saddr); UNUSED(is_external); } - if (ret < 0) { + if (ret < 0) + { errno = EAGAIN; return -1; } @@ -790,9 +887,10 @@ mtcp_connect(mctx_t mctx, int sockid, is_dyn_bound = TRUE; } - cur_stream = CreateTCPStream(mtcp, socket, socket->socktype, - socket->saddr.sin_addr.s_addr, socket->saddr.sin_port, dip, dport); - if (!cur_stream) { + cur_stream = CreateTCPStream(mtcp, socket, socket->socktype, + socket->saddr.sin_addr.s_addr, socket->saddr.sin_port, dip, dport); + if (!cur_stream) + { TRACE_ERROR("Socket %d: failed to create tcp_stream!\n", sockid); errno = ENOMEM; return -1; @@ -810,7 +908,8 @@ mtcp_connect(mctx_t mctx, int sockid, ret = StreamEnqueue(mtcp->connectq, cur_stream); SQ_UNLOCK(&mtcp->ctx->connect_lock); mtcp->wakeup_flag = TRUE; - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("Socket %d: failed to enqueue to conenct queue!\n", sockid); SQ_LOCK(&mtcp->ctx->destroyq_lock); StreamEnqueue(mtcp->destroyq, cur_stream); @@ -820,26 +919,32 @@ mtcp_connect(mctx_t mctx, int sockid, } /* if nonblocking socket, return EINPROGRESS */ - if (socket->opts & MTCP_NONBLOCK) { + if (socket->opts & MTCP_NONBLOCK) + { errno = EINPROGRESS; return -1; - - } else { - while (1) { - if (!cur_stream) { + } + else + { + while (1) + { + if (!cur_stream) + { TRACE_ERROR("STREAM DESTROYED\n"); errno = ETIMEDOUT; return -1; } - if (cur_stream->state > TCP_ST_ESTABLISHED) { - TRACE_ERROR("Socket %d: weird state %s\n", - sockid, TCPStateToString(cur_stream)); + if (cur_stream->state > TCP_ST_ESTABLISHED) + { + TRACE_ERROR("Socket %d: weird state %s\n", + sockid, TCPStateToString(cur_stream)); // TODO: how to handle this? errno = ENOSYS; return -1; } - if (cur_stream->state == TCP_ST_ESTABLISHED) { + if (cur_stream->state == TCP_ST_ESTABLISHED) + { break; } usleep(1000); @@ -849,7 +954,7 @@ mtcp_connect(mctx_t mctx, int sockid, return 0; } /*----------------------------------------------------------------------------*/ -static inline int +static inline int CloseStreamSocket(mctx_t mctx, int sockid) { mtcp_manager_t mtcp; @@ -857,38 +962,43 @@ CloseStreamSocket(mctx_t mctx, int sockid) int ret; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } cur_stream = mtcp->smap[sockid].stream; - if (!cur_stream) { + if (!cur_stream) + { TRACE_API("Socket %d: stream does not exist.\n", sockid); errno = ENOTCONN; return -1; } - if (cur_stream->closed) { - TRACE_API("Socket %d (Stream %u): already closed stream\n", - sockid, cur_stream->id); + if (cur_stream->closed) + { + TRACE_API("Socket %d (Stream %u): already closed stream\n", + sockid, cur_stream->id); return 0; } cur_stream->closed = TRUE; - + TRACE_API("Stream %d: closing the stream.\n", cur_stream->id); cur_stream->socket = NULL; - if (cur_stream->state == TCP_ST_CLOSED) { - TRACE_API("Stream %d at TCP_ST_CLOSED. destroying the stream.\n", - cur_stream->id); + if (cur_stream->state == TCP_ST_CLOSED) + { + TRACE_API("Stream %d at TCP_ST_CLOSED. destroying the stream.\n", + cur_stream->id); SQ_LOCK(&mtcp->ctx->destroyq_lock); StreamEnqueue(mtcp->destroyq, cur_stream); mtcp->wakeup_flag = TRUE; SQ_UNLOCK(&mtcp->ctx->destroyq_lock); return 0; - - } else if (cur_stream->state == TCP_ST_SYN_SENT) { + } + else if (cur_stream->state == TCP_ST_SYN_SENT) + { #if 1 SQ_LOCK(&mtcp->ctx->destroyq_lock); StreamEnqueue(mtcp->destroyq, cur_stream); @@ -896,22 +1006,24 @@ CloseStreamSocket(mctx_t mctx, int sockid) mtcp->wakeup_flag = TRUE; #endif return -1; - - } else if (cur_stream->state != TCP_ST_ESTABLISHED && - cur_stream->state != TCP_ST_CLOSE_WAIT) { - TRACE_API("Stream %d at state %s\n", - cur_stream->id, TCPStateToString(cur_stream)); + } + else if (cur_stream->state != TCP_ST_ESTABLISHED && + cur_stream->state != TCP_ST_CLOSE_WAIT) + { + TRACE_API("Stream %d at state %s\n", + cur_stream->id, TCPStateToString(cur_stream)); errno = EBADF; return -1; } - + SQ_LOCK(&mtcp->ctx->close_lock); cur_stream->sndvar->on_closeq = TRUE; ret = StreamEnqueue(mtcp->closeq, cur_stream); mtcp->wakeup_flag = TRUE; SQ_UNLOCK(&mtcp->ctx->close_lock); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("(NEVER HAPPEN) Failed to enqueue the stream to close.\n"); errno = EAGAIN; return -1; @@ -920,24 +1032,27 @@ CloseStreamSocket(mctx_t mctx, int sockid) return 0; } /*----------------------------------------------------------------------------*/ -static inline int +static inline int CloseListeningSocket(mctx_t mctx, int sockid) { mtcp_manager_t mtcp; struct tcp_listener *listener; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } listener = mtcp->smap[sockid].listener; - if (!listener) { + if (!listener) + { errno = EINVAL; return -1; } - if (listener->acceptq) { + if (listener->acceptq) + { DestroyStreamQueue(listener->acceptq); listener->acceptq = NULL; } @@ -955,24 +1070,26 @@ CloseListeningSocket(mctx_t mctx, int sockid) return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_close(mctx_t mctx, int sockid) +int mtcp_close(mctx_t mctx, int sockid) { mtcp_manager_t mtcp; int ret; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) { + if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; @@ -980,7 +1097,8 @@ mtcp_close(mctx_t mctx, int sockid) TRACE_API("Socket %d: mtcp_close called.\n", sockid); - switch (mtcp->smap[sockid].socktype) { + switch (mtcp->smap[sockid].socktype) + { case MTCP_SOCK_STREAM: ret = CloseStreamSocket(mctx, sockid); break; @@ -1002,60 +1120,66 @@ mtcp_close(mctx_t mctx, int sockid) ret = -1; break; } - + FreeSocket(mctx, sockid, FALSE); return ret; } /*----------------------------------------------------------------------------*/ -int -mtcp_abort(mctx_t mctx, int sockid) +int mtcp_abort(mctx_t mctx, int sockid) { mtcp_manager_t mtcp; tcp_stream *cur_stream; int ret; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) { + if (mtcp->smap[sockid].socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - - if (mtcp->smap[sockid].socktype != MTCP_SOCK_STREAM) { + + if (mtcp->smap[sockid].socktype != MTCP_SOCK_STREAM) + { TRACE_API("Not an end socket. id: %d\n", sockid); errno = ENOTSOCK; return -1; } cur_stream = mtcp->smap[sockid].stream; - if (!cur_stream) { + if (!cur_stream) + { TRACE_API("Stream %d: does not exist.\n", sockid); errno = ENOTCONN; return -1; } TRACE_API("Socket %d: mtcp_abort()\n", sockid); - + FreeSocket(mctx, sockid, FALSE); cur_stream->socket = NULL; - if (cur_stream->state == TCP_ST_CLOSED) { + if (cur_stream->state == TCP_ST_CLOSED) + { TRACE_API("Stream %d: connection already reset.\n", sockid); return ERROR; - - } else if (cur_stream->state == TCP_ST_SYN_SENT) { - /* TODO: this should notify event failure to all + } + else if (cur_stream->state == TCP_ST_SYN_SENT) + { + /* TODO: this should notify event failure to all previous read() or write() calls */ cur_stream->state = TCP_ST_CLOSED; cur_stream->close_reason = TCP_ACTIVE_CLOSE; @@ -1064,10 +1188,11 @@ mtcp_abort(mctx_t mctx, int sockid) SQ_UNLOCK(&mtcp->ctx->destroyq_lock); mtcp->wakeup_flag = TRUE; return 0; - - } else if (cur_stream->state == TCP_ST_CLOSING || - cur_stream->state == TCP_ST_LAST_ACK || - cur_stream->state == TCP_ST_TIME_WAIT) { + } + else if (cur_stream->state == TCP_ST_CLOSING || + cur_stream->state == TCP_ST_LAST_ACK || + cur_stream->state == TCP_ST_TIME_WAIT) + { cur_stream->state = TCP_ST_CLOSED; cur_stream->close_reason = TCP_ACTIVE_CLOSE; SQ_LOCK(&mtcp->ctx->destroyq_lock); @@ -1078,9 +1203,11 @@ mtcp_abort(mctx_t mctx, int sockid) } /* the stream structure will be destroyed after sending RST */ - if (cur_stream->sndvar->on_resetq) { + if (cur_stream->sndvar->on_resetq) + { TRACE_ERROR("Stream %d: calling mtcp_abort() " - "when in reset queue.\n", sockid); + "when in reset queue.\n", + sockid); errno = ECONNRESET; return -1; } @@ -1090,7 +1217,8 @@ mtcp_abort(mctx_t mctx, int sockid) SQ_UNLOCK(&mtcp->ctx->reset_lock); mtcp->wakeup_flag = TRUE; - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("(NEVER HAPPEN) Failed to enqueue the stream to close.\n"); errno = EAGAIN; return -1; @@ -1104,16 +1232,17 @@ PeekForUser(mtcp_manager_t mtcp, tcp_stream *cur_stream, char *buf, int len) { struct tcp_recv_vars *rcvvar = cur_stream->rcvvar; int copylen; - + copylen = MIN(rcvvar->rcvbuf->merged_len, len); - if (copylen <= 0) { + if (copylen <= 0) + { errno = EAGAIN; return -1; } /* Only copy data to user buffer */ memcpy(buf, rcvvar->rcvbuf->head, copylen); - + return copylen; } /*----------------------------------------------------------------------------*/ @@ -1125,7 +1254,8 @@ CopyToUser(mtcp_manager_t mtcp, tcp_stream *cur_stream, char *buf, int len) int copylen; copylen = MIN(rcvvar->rcvbuf->merged_len, len); - if (copylen <= 0) { + if (copylen <= 0) + { errno = EAGAIN; return -1; } @@ -1137,9 +1267,12 @@ CopyToUser(mtcp_manager_t mtcp, tcp_stream *cur_stream, char *buf, int len) rcvvar->rcv_wnd = rcvvar->rcvbuf->size - rcvvar->rcvbuf->merged_len; /* Advertise newly freed receive buffer */ - if (cur_stream->need_wnd_adv) { - if (rcvvar->rcv_wnd > cur_stream->sndvar->eff_mss) { - if (!cur_stream->sndvar->on_ackq) { + if (cur_stream->need_wnd_adv) + { + if (rcvvar->rcv_wnd > cur_stream->sndvar->eff_mss) + { + if (!cur_stream->sndvar->on_ackq) + { SQ_LOCK(&mtcp->ctx->ackq_lock); cur_stream->sndvar->on_ackq = TRUE; StreamEnqueue(mtcp->ackq, cur_stream); /* this always success */ @@ -1163,68 +1296,80 @@ mtcp_recv(mctx_t mctx, int sockid, char *buf, size_t len, int flags) struct tcp_recv_vars *rcvvar; int event_remaining; int ret; - + mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - + socket = &mtcp->smap[sockid]; - if (socket->socktype == MTCP_SOCK_UNUSED) { + if (socket->socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - - if (socket->socktype == MTCP_SOCK_PIPE) { + + if (socket->socktype == MTCP_SOCK_PIPE) + { return PipeRead(mctx, sockid, buf, len); } - - if (socket->socktype != MTCP_SOCK_STREAM) { + + if (socket->socktype != MTCP_SOCK_STREAM) + { TRACE_API("Not an end socket. id: %d\n", sockid); errno = ENOTSOCK; return -1; } - + /* stream should be in ESTABLISHED, FIN_WAIT_1, FIN_WAIT_2, CLOSE_WAIT */ cur_stream = socket->stream; - if (!cur_stream || - !(cur_stream->state >= TCP_ST_ESTABLISHED && - cur_stream->state <= TCP_ST_CLOSE_WAIT)) { + if (!cur_stream || + !(cur_stream->state >= TCP_ST_ESTABLISHED && + cur_stream->state <= TCP_ST_CLOSE_WAIT)) + { errno = ENOTCONN; return -1; } rcvvar = cur_stream->rcvvar; - + /* if CLOSE_WAIT, return 0 if there is no payload */ - if (cur_stream->state == TCP_ST_CLOSE_WAIT) { + if (cur_stream->state == TCP_ST_CLOSE_WAIT) + { if (!rcvvar->rcvbuf) return 0; - + if (rcvvar->rcvbuf->merged_len == 0) return 0; - } - + } + /* return EAGAIN if no receive buffer */ - if (socket->opts & MTCP_NONBLOCK) { - if (!rcvvar->rcvbuf || rcvvar->rcvbuf->merged_len == 0) { + if (socket->opts & MTCP_NONBLOCK) + { + if (!rcvvar->rcvbuf || rcvvar->rcvbuf->merged_len == 0) + { errno = EAGAIN; return -1; } } - + SBUF_LOCK(&rcvvar->read_lock); #if BLOCKING_SUPPORT - if (!(socket->opts & MTCP_NONBLOCK)) { - while (rcvvar->rcvbuf->merged_len == 0) { - if (!cur_stream || cur_stream->state != TCP_ST_ESTABLISHED) { + if (!(socket->opts & MTCP_NONBLOCK)) + { + while (rcvvar->rcvbuf->merged_len == 0) + { + if (!cur_stream || cur_stream->state != TCP_ST_ESTABLISHED) + { SBUF_UNLOCK(&rcvvar->read_lock); errno = EINTR; return -1; @@ -1234,7 +1379,8 @@ mtcp_recv(mctx_t mctx, int sockid, char *buf, size_t len, int flags) } #endif - switch (flags) { + switch (flags) + { case 0: ret = CopyToUser(mtcp, cur_stream, buf, len); break; @@ -1247,41 +1393,49 @@ mtcp_recv(mctx_t mctx, int sockid, char *buf, size_t len, int flags) errno = EINVAL; return ret; } - + event_remaining = FALSE; - /* if there are remaining payload, generate EPOLLIN */ + /* if there are remaining payload, generate EPOLLIN */ /* (may due to insufficient user buffer) */ - if (socket->epoll & MTCP_EPOLLIN) { - if (!(socket->epoll & MTCP_EPOLLET) && rcvvar->rcvbuf->merged_len > 0) { + if (socket->epoll & MTCP_EPOLLIN) + { + if (!(socket->epoll & MTCP_EPOLLET) && rcvvar->rcvbuf->merged_len > 0) + { event_remaining = TRUE; } } - /* if waiting for close, notify it if no remaining data */ - if (cur_stream->state == TCP_ST_CLOSE_WAIT && - rcvvar->rcvbuf->merged_len == 0 && ret > 0) { + /* if waiting for close, notify it if no remaining data */ + if (cur_stream->state == TCP_ST_CLOSE_WAIT && + rcvvar->rcvbuf->merged_len == 0 && ret > 0) + { event_remaining = TRUE; } - + SBUF_UNLOCK(&rcvvar->read_lock); - - if (event_remaining) { - if (socket->epoll) { - AddEpollEvent(mtcp->ep, - USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLIN); + + if (event_remaining) + { + if (socket->epoll) + { + AddEpollEvent(mtcp->ep, + USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLIN); #if BLOCKING_SUPPORT - } else if (!(socket->opts & MTCP_NONBLOCK)) { - if (!cur_stream->on_rcv_br_list) { + } + else if (!(socket->opts & MTCP_NONBLOCK)) + { + if (!cur_stream->on_rcv_br_list) + { cur_stream->on_rcv_br_list = TRUE; - TAILQ_INSERT_TAIL(&mtcp->rcv_br_list, - cur_stream, rcvvar->rcv_br_link); + TAILQ_INSERT_TAIL(&mtcp->rcv_br_list, + cur_stream, rcvvar->rcv_br_link); mtcp->rcv_br_list_cnt++; } #endif } } - + TRACE_API("Stream %d: mtcp_recv() returning %d\n", cur_stream->id, ret); - return ret; + return ret; } /*----------------------------------------------------------------------------*/ inline ssize_t @@ -1290,8 +1444,7 @@ mtcp_read(mctx_t mctx, int sockid, char *buf, size_t len) return mtcp_recv(mctx, sockid, buf, len, 0); } /*----------------------------------------------------------------------------*/ -int -mtcp_readv(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) +int mtcp_readv(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) { mtcp_manager_t mtcp; socket_map_t socket; @@ -1301,24 +1454,28 @@ mtcp_readv(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) int event_remaining; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } socket = &mtcp->smap[sockid]; - if (socket->socktype == MTCP_SOCK_UNUSED) { + if (socket->socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - - if (socket->socktype != MTCP_SOCK_STREAM) { + + if (socket->socktype != MTCP_SOCK_STREAM) + { TRACE_API("Not an end socket. id: %d\n", sockid); errno = ENOTSOCK; return -1; @@ -1326,9 +1483,10 @@ mtcp_readv(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) /* stream should be in ESTABLISHED, FIN_WAIT_1, FIN_WAIT_2, CLOSE_WAIT */ cur_stream = socket->stream; - if (!cur_stream || - !(cur_stream->state >= TCP_ST_ESTABLISHED && - cur_stream->state <= TCP_ST_CLOSE_WAIT)) { + if (!cur_stream || + !(cur_stream->state >= TCP_ST_ESTABLISHED && + cur_stream->state <= TCP_ST_CLOSE_WAIT)) + { errno = ENOTCONN; return -1; } @@ -1336,27 +1494,33 @@ mtcp_readv(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) rcvvar = cur_stream->rcvvar; /* if CLOSE_WAIT, return 0 if there is no payload */ - if (cur_stream->state == TCP_ST_CLOSE_WAIT) { + if (cur_stream->state == TCP_ST_CLOSE_WAIT) + { if (!rcvvar->rcvbuf) return 0; - + if (rcvvar->rcvbuf->merged_len == 0) return 0; } /* return EAGAIN if no receive buffer */ - if (socket->opts & MTCP_NONBLOCK) { - if (!rcvvar->rcvbuf || rcvvar->rcvbuf->merged_len == 0) { + if (socket->opts & MTCP_NONBLOCK) + { + if (!rcvvar->rcvbuf || rcvvar->rcvbuf->merged_len == 0) + { errno = EAGAIN; return -1; } } - + SBUF_LOCK(&rcvvar->read_lock); #if BLOCKING_SUPPORT - if (!(socket->opts & MTCP_NONBLOCK)) { - while (rcvvar->rcvbuf->merged_len == 0) { - if (!cur_stream || cur_stream->state != TCP_ST_ESTABLISHED) { + if (!(socket->opts & MTCP_NONBLOCK)) + { + while (rcvvar->rcvbuf->merged_len == 0) + { + if (!cur_stream || cur_stream->state != TCP_ST_ESTABLISHED) + { SBUF_UNLOCK(&rcvvar->read_lock); errno = EINTR; return -1; @@ -1366,9 +1530,10 @@ mtcp_readv(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) } #endif - /* read and store the contents to the vectored buffers */ + /* read and store the contents to the vectored buffers */ bytes_read = 0; - for (i = 0; i < numIOV; i++) { + for (i = 0; i < numIOV; i++) + { if (iov[i].iov_len <= 0) continue; @@ -1385,60 +1550,74 @@ mtcp_readv(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) event_remaining = FALSE; /* if there are remaining payload, generate read event */ /* (may due to insufficient user buffer) */ - if (socket->epoll & MTCP_EPOLLIN) { - if (!(socket->epoll & MTCP_EPOLLET) && rcvvar->rcvbuf->merged_len > 0) { + if (socket->epoll & MTCP_EPOLLIN) + { + if (!(socket->epoll & MTCP_EPOLLET) && rcvvar->rcvbuf->merged_len > 0) + { event_remaining = TRUE; } } /* if waiting for close, notify it if no remaining data */ - if (cur_stream->state == TCP_ST_CLOSE_WAIT && - rcvvar->rcvbuf->merged_len == 0 && bytes_read > 0) { + if (cur_stream->state == TCP_ST_CLOSE_WAIT && + rcvvar->rcvbuf->merged_len == 0 && bytes_read > 0) + { event_remaining = TRUE; } SBUF_UNLOCK(&rcvvar->read_lock); - if(event_remaining) { - if ((socket->epoll & MTCP_EPOLLIN) && !(socket->epoll & MTCP_EPOLLET)) { - AddEpollEvent(mtcp->ep, - USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLIN); + if (event_remaining) + { + if ((socket->epoll & MTCP_EPOLLIN) && !(socket->epoll & MTCP_EPOLLET)) + { + AddEpollEvent(mtcp->ep, + USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLIN); #if BLOCKING_SUPPORT - } else if (!(socket->opts & MTCP_NONBLOCK)) { - if (!cur_stream->on_rcv_br_list) { + } + else if (!(socket->opts & MTCP_NONBLOCK)) + { + if (!cur_stream->on_rcv_br_list) + { cur_stream->on_rcv_br_list = TRUE; - TAILQ_INSERT_TAIL(&mtcp->rcv_br_list, - cur_stream, rcvvar->rcv_br_link); + TAILQ_INSERT_TAIL(&mtcp->rcv_br_list, + cur_stream, rcvvar->rcv_br_link); mtcp->rcv_br_list_cnt++; } #endif } } - TRACE_API("Stream %d: mtcp_readv() returning %d\n", - cur_stream->id, bytes_read); + TRACE_API("Stream %d: mtcp_readv() returning %d\n", + cur_stream->id, bytes_read); return bytes_read; } /*----------------------------------------------------------------------------*/ -static inline int +static inline int CopyFromUser(mtcp_manager_t mtcp, tcp_stream *cur_stream, const char *buf, int len) { + TRACE_ERROR("DEBUG: CopyFromUser inside\n"); struct tcp_send_vars *sndvar = cur_stream->sndvar; int sndlen; int ret; sndlen = MIN((int)sndvar->snd_wnd, len); - if (sndlen <= 0) { + if (sndlen <= 0) + { errno = EAGAIN; return -1; } /* allocate send buffer if not exist */ - if (!sndvar->sndbuf) { + if (!sndvar->sndbuf) + { sndvar->sndbuf = SBInit(mtcp->rbm_snd, sndvar->iss + 1); - if (!sndvar->sndbuf) { + if (!sndvar->sndbuf) + { cur_stream->close_reason = TCP_NO_MEM; /* notification may not required due to -1 return */ errno = ENOMEM; + TRACE_ERROR("DEBUG: SBInit failed\n "); + return -1; } } @@ -1446,16 +1625,18 @@ CopyFromUser(mtcp_manager_t mtcp, tcp_stream *cur_stream, const char *buf, int l ret = SBPut(mtcp->rbm_snd, sndvar->sndbuf, buf, sndlen); assert(ret == sndlen); sndvar->snd_wnd = sndvar->sndbuf->size - sndvar->sndbuf->len; - if (ret <= 0) { - TRACE_ERROR("SBPut failed. reason: %d (sndlen: %u, len: %u\n", - ret, sndlen, sndvar->sndbuf->len); + if (ret <= 0) + { + TRACE_ERROR("SBPut failed. reason: %d (sndlen: %u, len: %u\n", + ret, sndlen, sndvar->sndbuf->len); errno = EAGAIN; return -1; } - - if (sndvar->snd_wnd <= 0) { - TRACE_SNDBUF("%u Sending buffer became full!! snd_wnd: %u\n", - cur_stream->id, sndvar->snd_wnd); + + if (sndvar->snd_wnd <= 0) + { + TRACE_SNDBUF("%u Sending buffer became full!! snd_wnd: %u\n", + cur_stream->id, sndvar->snd_wnd); } return ret; @@ -1464,6 +1645,8 @@ CopyFromUser(mtcp_manager_t mtcp, tcp_stream *cur_stream, const char *buf, int l ssize_t mtcp_write(mctx_t mctx, int sockid, const char *buf, size_t len) { + + TRACE_ERROR("DEBUG: mtcp_write inside\n"); mtcp_manager_t mtcp; socket_map_t socket; tcp_stream *cur_stream; @@ -1471,65 +1654,82 @@ mtcp_write(mctx_t mctx, int sockid, const char *buf, size_t len) int ret; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } socket = &mtcp->smap[sockid]; - if (socket->socktype == MTCP_SOCK_UNUSED) { + if (socket->socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - if (socket->socktype == MTCP_SOCK_PIPE) { + if (socket->socktype == MTCP_SOCK_PIPE) + { return PipeWrite(mctx, sockid, buf, len); } - if (socket->socktype != MTCP_SOCK_STREAM) { + if (socket->socktype != MTCP_SOCK_STREAM) + { TRACE_API("Not an end socket. id: %d\n", sockid); errno = ENOTSOCK; return -1; } - + cur_stream = socket->stream; - if (!cur_stream || - !(cur_stream->state == TCP_ST_ESTABLISHED || - cur_stream->state == TCP_ST_CLOSE_WAIT)) { + if (!cur_stream || + !(cur_stream->state == TCP_ST_ESTABLISHED || + cur_stream->state == TCP_ST_CLOSE_WAIT)) + { errno = ENOTCONN; return -1; } - if (len <= 0) { - if (socket->opts & MTCP_NONBLOCK) { + if (len <= 0) + { + if (socket->opts & MTCP_NONBLOCK) + { errno = EAGAIN; return -1; - } else { + } + else + { return 0; } } sndvar = cur_stream->sndvar; + // TRACE_ERROR("[mtcp_write entry] head_seq=%u tail_off=%u len=%u size=%u snd_wnd=%u\n", + // sndvar->sndbuf->head_seq, sndvar->sndbuf->tail_off, + // sndvar->sndbuf->len, sndvar->sndbuf->size, sndvar->snd_wnd); + SBUF_LOCK(&sndvar->write_lock); #if BLOCKING_SUPPORT - if (!(socket->opts & MTCP_NONBLOCK)) { - while (sndvar->snd_wnd <= 0) { - TRACE_SNDBUF("Waiting for available sending window...\n"); - if (!cur_stream || cur_stream->state != TCP_ST_ESTABLISHED) { + if (!(socket->opts & MTCP_NONBLOCK)) + { + while (sndvar->snd_wnd <= 0) + { + TRACE_ERROR("Waiting for available sending window...\n"); + if (!cur_stream || cur_stream->state != TCP_ST_ESTABLISHED) + { SBUF_UNLOCK(&sndvar->write_lock); errno = EINTR; return -1; } pthread_cond_wait(&sndvar->write_cond, &sndvar->write_lock); - TRACE_SNDBUF("Sending buffer became ready! snd_wnd: %u\n", - sndvar->snd_wnd); + TRACE_ERROR("Sending buffer became ready! snd_wnd: %u\n", + sndvar->snd_wnd); } } #endif @@ -1538,42 +1738,53 @@ mtcp_write(mctx_t mctx, int sockid, const char *buf, size_t len) SBUF_UNLOCK(&sndvar->write_lock); - if (ret > 0 && !(sndvar->on_sendq || sndvar->on_send_list)) { + if (ret > 0 && !(sndvar->on_sendq || sndvar->on_send_list)) + { SQ_LOCK(&mtcp->ctx->sendq_lock); sndvar->on_sendq = TRUE; - StreamEnqueue(mtcp->sendq, cur_stream); /* this always success */ + StreamEnqueue(mtcp->sendq, cur_stream); /* this always success */ SQ_UNLOCK(&mtcp->ctx->sendq_lock); mtcp->wakeup_flag = TRUE; } - if (ret == 0 && (socket->opts & MTCP_NONBLOCK)) { + if (ret == 0 && (socket->opts & MTCP_NONBLOCK)) + { + TRACE_ERROR("mtcp_write returning EAGAIN\n"); ret = -1; errno = EAGAIN; } /* if there are remaining sending buffer, generate write event */ - if (sndvar->snd_wnd > 0) { - if ((socket->epoll & MTCP_EPOLLOUT) && !(socket->epoll & MTCP_EPOLLET)) { - AddEpollEvent(mtcp->ep, - USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLOUT); + if (sndvar->snd_wnd > 0) + { + if ((socket->epoll & MTCP_EPOLLOUT) && !(socket->epoll & MTCP_EPOLLET)) + { + AddEpollEvent(mtcp->ep, + USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLOUT); #if BLOCKING_SUPPORT - } else if (!(socket->opts & MTCP_NONBLOCK)) { - if (!cur_stream->on_snd_br_list) { + } + else if (!(socket->opts & MTCP_NONBLOCK)) + { + if (!cur_stream->on_snd_br_list) + { cur_stream->on_snd_br_list = TRUE; - TAILQ_INSERT_TAIL(&mtcp->snd_br_list, - cur_stream, sndvar->snd_br_link); + TAILQ_INSERT_TAIL(&mtcp->snd_br_list, + cur_stream, sndvar->snd_br_link); mtcp->snd_br_list_cnt++; } #endif } } - TRACE_API("Stream %d: mtcp_write() returning %d\n", cur_stream->id, ret); + TRACE_ERROR("Stream %d: mtcp_write() returning %d\n", cur_stream->id, ret); + if (ret == -1) + { + perror("mtcp_write: "); + } return ret; } /*----------------------------------------------------------------------------*/ -int -mtcp_writev(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) +int mtcp_writev(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) { mtcp_manager_t mtcp; socket_map_t socket; @@ -1582,33 +1793,38 @@ mtcp_writev(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) int ret, to_write, i; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } socket = &mtcp->smap[sockid]; - if (socket->socktype == MTCP_SOCK_UNUSED) { + if (socket->socktype == MTCP_SOCK_UNUSED) + { TRACE_API("Invalid socket id: %d\n", sockid); errno = EBADF; return -1; } - if (socket->socktype != MTCP_SOCK_STREAM) { + if (socket->socktype != MTCP_SOCK_STREAM) + { TRACE_API("Not an end socket. id: %d\n", sockid); errno = ENOTSOCK; return -1; } - + cur_stream = socket->stream; - if (!cur_stream || - !(cur_stream->state == TCP_ST_ESTABLISHED || - cur_stream->state == TCP_ST_CLOSE_WAIT)) { + if (!cur_stream || + !(cur_stream->state == TCP_ST_ESTABLISHED || + cur_stream->state == TCP_ST_CLOSE_WAIT)) + { errno = ENOTCONN; return -1; } @@ -1616,24 +1832,28 @@ mtcp_writev(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) sndvar = cur_stream->sndvar; SBUF_LOCK(&sndvar->write_lock); #if BLOCKING_SUPPORT - if (!(socket->opts & MTCP_NONBLOCK)) { - while (sndvar->snd_wnd <= 0) { + if (!(socket->opts & MTCP_NONBLOCK)) + { + while (sndvar->snd_wnd <= 0) + { TRACE_SNDBUF("Waiting for available sending window...\n"); - if (!cur_stream || cur_stream->state != TCP_ST_ESTABLISHED) { + if (!cur_stream || cur_stream->state != TCP_ST_ESTABLISHED) + { SBUF_UNLOCK(&sndvar->write_lock); errno = EINTR; return -1; } pthread_cond_wait(&sndvar->write_cond, &sndvar->write_lock); - TRACE_SNDBUF("Sending buffer became ready! snd_wnd: %u\n", - sndvar->snd_wnd); + TRACE_SNDBUF("Sending buffer became ready! snd_wnd: %u\n", + sndvar->snd_wnd); } } #endif - /* write from the vectored buffers */ + /* write from the vectored buffers */ to_write = 0; - for (i = 0; i < numIOV; i++) { + for (i = 0; i < numIOV; i++) + { if (iov[i].iov_len <= 0) continue; @@ -1648,38 +1868,45 @@ mtcp_writev(mctx_t mctx, int sockid, const struct iovec *iov, int numIOV) } SBUF_UNLOCK(&sndvar->write_lock); - if (to_write > 0 && !(sndvar->on_sendq || sndvar->on_send_list)) { + if (to_write > 0 && !(sndvar->on_sendq || sndvar->on_send_list)) + { SQ_LOCK(&mtcp->ctx->sendq_lock); sndvar->on_sendq = TRUE; - StreamEnqueue(mtcp->sendq, cur_stream); /* this always success */ + StreamEnqueue(mtcp->sendq, cur_stream); /* this always success */ SQ_UNLOCK(&mtcp->ctx->sendq_lock); mtcp->wakeup_flag = TRUE; } - if (to_write == 0 && (socket->opts & MTCP_NONBLOCK)) { + if (to_write == 0 && (socket->opts & MTCP_NONBLOCK)) + { to_write = -1; errno = EAGAIN; } /* if there are remaining sending buffer, generate write event */ - if (sndvar->snd_wnd > 0) { - if ((socket->epoll & MTCP_EPOLLOUT) && !(socket->epoll & MTCP_EPOLLET)) { - AddEpollEvent(mtcp->ep, - USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLOUT); + if (sndvar->snd_wnd > 0) + { + if ((socket->epoll & MTCP_EPOLLOUT) && !(socket->epoll & MTCP_EPOLLET)) + { + AddEpollEvent(mtcp->ep, + USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLOUT); #if BLOCKING_SUPPORT - } else if (!(socket->opts & MTCP_NONBLOCK)) { - if (!cur_stream->on_snd_br_list) { + } + else if (!(socket->opts & MTCP_NONBLOCK)) + { + if (!cur_stream->on_snd_br_list) + { cur_stream->on_snd_br_list = TRUE; - TAILQ_INSERT_TAIL(&mtcp->snd_br_list, - cur_stream, sndvar->snd_br_link); + TAILQ_INSERT_TAIL(&mtcp->snd_br_list, + cur_stream, sndvar->snd_br_link); mtcp->snd_br_list_cnt++; } #endif } } - TRACE_API("Stream %d: mtcp_writev() returning %d\n", - cur_stream->id, to_write); + TRACE_API("Stream %d: mtcp_writev() returning %d\n", + cur_stream->id, to_write); return to_write; } /*----------------------------------------------------------------------------*/ diff --git a/mtcp/src/core.c b/mtcp/src/core.c index 6bbe13abc..479ec876b 100644 --- a/mtcp/src/core.c +++ b/mtcp/src/core.c @@ -481,11 +481,22 @@ FlushReadEvents(mtcp_manager_t mtcp, int thresh) static inline void FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) { + TRACE_ERROR("FlushEpollEvents: Inside\n"); struct mtcp_epoll *ep = mtcp->ep; struct event_queue *usrq = ep->usr_queue; struct event_queue *mtcpq = ep->mtcp_queue; pthread_mutex_lock(&ep->epoll_lock); + /*************************************************** */ + // debugging purpose + struct mtcp_epoll_event_int *ev_i = mtcpq->events; + int start = mtcpq->start; + for (int i = start; i < start + mtcpq->num_events; i++) + { + TRACE_ERROR("mtcp_queue event %d: sockid %d, events %u\n", i, ev_i[i].sockid, ev_i[i].ev.events); + } + + /*************************************************** */ if (ep->mtcp_queue->num_events > 0) { /* while mtcp_queue have events */ @@ -515,6 +526,7 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) mtcp->ts_last_event = cur_ts; ep->stat.wakes++; pthread_cond_signal(&ep->epoll_cond); + TRACE_ERROR("MTCP_THREAD: Wake Up application thread\n\n"); } pthread_mutex_unlock(&ep->epoll_lock); } @@ -522,6 +534,7 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) static inline void HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) { + TRACE_ERROR("HandleApplicationCalls: Inside\n"); tcp_stream *stream; int cnt, max_cnt; int handled, delayed; @@ -780,8 +793,6 @@ WritePacketsToChunks(mtcp_manager_t mtcp, uint32_t cur_ts) // } for (i = 0; i < CONFIG.eths_num; i++) { - - TRACE_ERROR("no 4\n") assert(mtcp->n_sender[i] != NULL); if (mtcp->n_sender[i]->control_list_cnt) { @@ -894,7 +905,7 @@ RunMainLoop(struct mtcp_thread_context *ctx) printf("eths_num: %d\n", CONFIG.eths_num); for (rx_inf = 0; rx_inf < CONFIG.eths_num; rx_inf++) { - + static uint16_t len; static uint8_t *pktbuf; recv_cnt = mtcp->iom->recv_pkts(ctx, rx_inf); @@ -940,15 +951,17 @@ RunMainLoop(struct mtcp_thread_context *ctx) if (CONFIG.tcp_timeout > 0 && ts != ts_prev) { - TRACE_ERROR("CheckConnectionTimeout Start\n"); + TRACE_ERROR("\nCheckConnectionTimeout Start\n"); CheckConnectionTimeout(mtcp, ts, thresh); } } - + unsigned char *dummy = 0; + int dummy_len = 0; + mtcp->iom->release_pkt(ctx, rx_inf, dummy,dummy_len); /* if epoll is in use, flush all the queued events */ if (mtcp->ep) { - TRACE_ERROR("epoll in use \n"); + TRACE_ERROR("epoll is in use \n"); FlushEpollEvents(mtcp, ts); } @@ -988,6 +1001,10 @@ RunMainLoop(struct mtcp_thread_context *ctx) } } + + TRACE_ERROR("while loop ended: done %d, flow_cnt %d, exit %d\n", + ctx->done, mtcp->flow_cnt, ctx->exit); + #if TESTING DestroyRemainingFlows(mtcp); #endif diff --git a/mtcp/src/eventpoll.c b/mtcp/src/eventpoll.c index ded10a01c..4a07d1068 100644 --- a/mtcp/src/eventpoll.c +++ b/mtcp/src/eventpoll.c @@ -12,8 +12,8 @@ #include "pipe.h" #include "debug.h" -#define MAX(a, b) ((a)>(b)?(a):(b)) -#define MIN(a, b) ((a)<(b)?(a):(b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) #define SPIN_BEFORE_SLEEP FALSE #define SPIN_THRESH 10000000 @@ -21,35 +21,36 @@ /*----------------------------------------------------------------------------*/ char *event_str[] = {"NONE", "IN", "PRI", "OUT", "ERR", "HUP", "RDHUP"}; /*----------------------------------------------------------------------------*/ -char * +char * EventToString(uint32_t event) { - switch (event) { - case MTCP_EPOLLNONE: - return event_str[0]; - break; - case MTCP_EPOLLIN: - return event_str[1]; - break; - case MTCP_EPOLLPRI: - return event_str[2]; - break; - case MTCP_EPOLLOUT: - return event_str[3]; - break; - case MTCP_EPOLLERR: - return event_str[4]; - break; - case MTCP_EPOLLHUP: - return event_str[5]; - break; - case MTCP_EPOLLRDHUP: - return event_str[6]; - break; - default: - assert(0); - } - + switch (event) + { + case MTCP_EPOLLNONE: + return event_str[0]; + break; + case MTCP_EPOLLIN: + return event_str[1]; + break; + case MTCP_EPOLLPRI: + return event_str[2]; + break; + case MTCP_EPOLLOUT: + return event_str[3]; + break; + case MTCP_EPOLLERR: + return event_str[4]; + break; + case MTCP_EPOLLHUP: + return event_str[5]; + break; + case MTCP_EPOLLRDHUP: + return event_str[6]; + break; + default: + assert(0); + } + assert(0); return NULL; } @@ -67,8 +68,9 @@ CreateEventQueue(int size) eq->end = 0; eq->size = size; eq->events = (struct mtcp_epoll_event_int *) - calloc(size, sizeof(struct mtcp_epoll_event_int)); - if (!eq->events) { + calloc(size, sizeof(struct mtcp_epoll_event_int)); + if (!eq->events) + { free(eq); return NULL; } @@ -77,8 +79,7 @@ CreateEventQueue(int size) return eq; } /*----------------------------------------------------------------------------*/ -void -DestroyEventQueue(struct event_queue *eq) +void DestroyEventQueue(struct event_queue *eq) { if (eq->events) free(eq->events); @@ -86,70 +87,74 @@ DestroyEventQueue(struct event_queue *eq) free(eq); } /*----------------------------------------------------------------------------*/ -int -mtcp_epoll_create1(mctx_t mctx, int flags) +int mtcp_epoll_create1(mctx_t mctx, int flags) { int rc; struct mtcp_conf mcfg; rc = 0; mtcp_getconf(&mcfg); - - switch (flags) { + + switch (flags) + { case 0: /* do nothing */ case O_CLOEXEC: /* - * this won't work since mTCP apps + * this won't work since mTCP apps * assume that user does not fork/exec */ rc = mtcp_epoll_create(mctx, mcfg.max_concurrency * 3); break; default: TRACE_ERROR("[CPU %d] Invalid flags for %s set!\n", - mctx->cpu, __FUNCTION__); + mctx->cpu, __FUNCTION__); errno = EINVAL; rc = -1; break; } - + return rc; } /*----------------------------------------------------------------------------*/ -int -mtcp_epoll_create(mctx_t mctx, int size) +int mtcp_epoll_create(mctx_t mctx, int size) { mtcp_manager_t mtcp = g_mtcp[mctx->cpu]; struct mtcp_epoll *ep; socket_map_t epsocket; - if (size <= 0) { + if (size <= 0) + { errno = EINVAL; return -1; } epsocket = AllocateSocket(mctx, MTCP_SOCK_EPOLL, FALSE); - if (!epsocket) { + if (!epsocket) + { errno = ENFILE; return -1; } ep = (struct mtcp_epoll *)calloc(1, sizeof(struct mtcp_epoll)); - if (!ep) { + if (!ep) + { FreeSocket(mctx, epsocket->id, FALSE); return -1; } /* create event queues */ ep->usr_queue = CreateEventQueue(size); - if (!ep->usr_queue) { + if (!ep->usr_queue) + { FreeSocket(mctx, epsocket->id, FALSE); free(ep); return -1; } ep->usr_shadow_queue = CreateEventQueue(size); - if (!ep->usr_shadow_queue) { + if (!ep->usr_shadow_queue) + { DestroyEventQueue(ep->usr_queue); FreeSocket(mctx, epsocket->id, FALSE); free(ep); @@ -157,7 +162,8 @@ mtcp_epoll_create(mctx_t mctx, int size) } ep->mtcp_queue = CreateEventQueue(size); - if (!ep->mtcp_queue) { + if (!ep->mtcp_queue) + { DestroyEventQueue(ep->usr_shadow_queue); DestroyEventQueue(ep->usr_queue); FreeSocket(mctx, epsocket->id, FALSE); @@ -170,7 +176,8 @@ mtcp_epoll_create(mctx_t mctx, int size) mtcp->ep = ep; epsocket->ep = ep; - if (pthread_mutex_init(&ep->epoll_lock, NULL)) { + if (pthread_mutex_init(&ep->epoll_lock, NULL)) + { DestroyEventQueue(ep->mtcp_queue); DestroyEventQueue(ep->usr_shadow_queue); DestroyEventQueue(ep->usr_queue); @@ -178,7 +185,8 @@ mtcp_epoll_create(mctx_t mctx, int size) free(ep); return -1; } - if (pthread_cond_init(&ep->epoll_cond, NULL)) { + if (pthread_cond_init(&ep->epoll_cond, NULL)) + { DestroyEventQueue(ep->mtcp_queue); DestroyEventQueue(ep->usr_shadow_queue); DestroyEventQueue(ep->usr_queue); @@ -190,19 +198,20 @@ mtcp_epoll_create(mctx_t mctx, int size) return epsocket->id; } /*----------------------------------------------------------------------------*/ -int -CloseEpollSocket(mctx_t mctx, int epid) +int CloseEpollSocket(mctx_t mctx, int epid) { mtcp_manager_t mtcp; struct mtcp_epoll *ep; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } ep = mtcp->smap[epid].ep; - if (!ep) { + if (!ep) + { errno = EINVAL; return -1; } @@ -224,9 +233,9 @@ CloseEpollSocket(mctx_t mctx, int epid) return 0; } /*----------------------------------------------------------------------------*/ -static int -RaisePendingStreamEvents(mtcp_manager_t mtcp, - struct mtcp_epoll *ep, socket_map_t socket) +static int +RaisePendingStreamEvents(mtcp_manager_t mtcp, + struct mtcp_epoll *ep, socket_map_t socket) { tcp_stream *stream = socket->stream; @@ -235,26 +244,33 @@ RaisePendingStreamEvents(mtcp_manager_t mtcp, if (stream->state < TCP_ST_ESTABLISHED) return -1; - TRACE_EPOLL("Stream %d at state %s\n", - stream->id, TCPStateToString(stream)); + TRACE_EPOLL("Stream %d at state %s\n", + stream->id, TCPStateToString(stream)); /* if there are payloads already read before epoll registration */ /* generate read event */ - if (socket->epoll & MTCP_EPOLLIN) { + if (socket->epoll & MTCP_EPOLLIN) + { struct tcp_recv_vars *rcvvar = stream->rcvvar; - if (rcvvar->rcvbuf && rcvvar->rcvbuf->merged_len > 0) { + if (rcvvar->rcvbuf && rcvvar->rcvbuf->merged_len > 0) + { TRACE_EPOLL("Socket %d: Has existing payloads\n", socket->id); AddEpollEvent(ep, USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLIN); - } else if (stream->state == TCP_ST_CLOSE_WAIT) { + } + else if (stream->state == TCP_ST_CLOSE_WAIT) + { TRACE_EPOLL("Socket %d: Waiting for close\n", socket->id); AddEpollEvent(ep, USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLIN); } } /* same thing to the write event */ - if (socket->epoll & MTCP_EPOLLOUT) { + if (socket->epoll & MTCP_EPOLLOUT) + { struct tcp_send_vars *sndvar = stream->sndvar; - if (!sndvar->sndbuf || (sndvar->sndbuf && sndvar->snd_wnd > 0)) { - if (!(socket->events & MTCP_EPOLLOUT)) { + if (!sndvar->sndbuf || (sndvar->sndbuf && sndvar->snd_wnd > 0)) + { + if (!(socket->events & MTCP_EPOLLOUT)) + { TRACE_EPOLL("Socket %d: Adding write event\n", socket->id); AddEpollEvent(ep, USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLOUT); } @@ -264,9 +280,8 @@ RaisePendingStreamEvents(mtcp_manager_t mtcp, return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_epoll_ctl(mctx_t mctx, int epid, - int op, int sockid, struct mtcp_epoll_event *event) +int mtcp_epoll_ctl(mctx_t mctx, int epid, + int op, int sockid, struct mtcp_epoll_event *event) { mtcp_manager_t mtcp; struct mtcp_epoll *ep; @@ -274,41 +289,49 @@ mtcp_epoll_ctl(mctx_t mctx, int epid, uint32_t events; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { return -1; } - if (epid < 0 || epid >= CONFIG.max_concurrency) { + if (epid < 0 || epid >= CONFIG.max_concurrency) + { TRACE_API("Epoll id %d out of range.\n", epid); errno = EBADF; return -1; } - if (sockid < 0 || sockid >= CONFIG.max_concurrency) { + if (sockid < 0 || sockid >= CONFIG.max_concurrency) + { TRACE_API("Socket id %d out of range.\n", sockid); errno = EBADF; return -1; } - if (mtcp->smap[epid].socktype == MTCP_SOCK_UNUSED) { + if (mtcp->smap[epid].socktype == MTCP_SOCK_UNUSED) + { errno = EBADF; return -1; } - if (mtcp->smap[epid].socktype != MTCP_SOCK_EPOLL) { + if (mtcp->smap[epid].socktype != MTCP_SOCK_EPOLL) + { errno = EINVAL; return -1; } ep = mtcp->smap[epid].ep; - if (!ep || (!event && op != MTCP_EPOLL_CTL_DEL)) { + if (!ep || (!event && op != MTCP_EPOLL_CTL_DEL)) + { errno = EINVAL; return -1; } socket = &mtcp->smap[sockid]; - if (op == MTCP_EPOLL_CTL_ADD) { - if (socket->epoll) { + if (op == MTCP_EPOLL_CTL_ADD) + { + if (socket->epoll) + { errno = EEXIST; return -1; } @@ -319,18 +342,23 @@ mtcp_epoll_ctl(mctx_t mctx, int epid, socket->ep_data = event->data; socket->epoll = events; - TRACE_EPOLL("Adding epoll socket %d(type %d) ET: %u, IN: %u, OUT: %u\n", - socket->id, socket->socktype, socket->epoll & MTCP_EPOLLET, - socket->epoll & MTCP_EPOLLIN, socket->epoll & MTCP_EPOLLOUT); + TRACE_EPOLL("Adding epoll socket %d(type %d) ET: %u, IN: %u, OUT: %u\n", + socket->id, socket->socktype, socket->epoll & MTCP_EPOLLET, + socket->epoll & MTCP_EPOLLIN, socket->epoll & MTCP_EPOLLOUT); - if (socket->socktype == MTCP_SOCK_STREAM) { + if (socket->socktype == MTCP_SOCK_STREAM) + { RaisePendingStreamEvents(mtcp, ep, socket); - } else if (socket->socktype == MTCP_SOCK_PIPE) { + } + else if (socket->socktype == MTCP_SOCK_PIPE) + { RaisePendingPipeEvents(mctx, epid, sockid); } - - } else if (op == MTCP_EPOLL_CTL_MOD) { - if (!socket->epoll) { + } + else if (op == MTCP_EPOLL_CTL_MOD) + { + if (!socket->epoll) + { pthread_mutex_unlock(&ep->epoll_lock); errno = ENOENT; return -1; @@ -341,14 +369,19 @@ mtcp_epoll_ctl(mctx_t mctx, int epid, socket->ep_data = event->data; socket->epoll = events; - if (socket->socktype == MTCP_SOCK_STREAM) { + if (socket->socktype == MTCP_SOCK_STREAM) + { RaisePendingStreamEvents(mtcp, ep, socket); - } else if (socket->socktype == MTCP_SOCK_PIPE) { + } + else if (socket->socktype == MTCP_SOCK_PIPE) + { RaisePendingPipeEvents(mctx, epid, sockid); } - - } else if (op == MTCP_EPOLL_CTL_DEL) { - if (!socket->epoll) { + } + else if (op == MTCP_EPOLL_CTL_DEL) + { + if (!socket->epoll) + { errno = ENOENT; return -1; } @@ -359,9 +392,8 @@ mtcp_epoll_ctl(mctx_t mctx, int epid, return 0; } /*----------------------------------------------------------------------------*/ -int -mtcp_epoll_wait(mctx_t mctx, int epid, - struct mtcp_epoll_event *events, int maxevents, int timeout) +int mtcp_epoll_wait(mctx_t mctx, int epid, + struct mtcp_epoll_event *events, int maxevents, int timeout) { mtcp_manager_t mtcp; struct mtcp_epoll *ep; @@ -373,29 +405,39 @@ mtcp_epoll_wait(mctx_t mctx, int epid, int num_events; mtcp = GetMTCPManager(mctx); - if (!mtcp) { + if (!mtcp) + { + TRACE_ERROR("\nError 1\n"); return -1; } - if (epid < 0 || epid >= CONFIG.max_concurrency) { + if (epid < 0 || epid >= CONFIG.max_concurrency) + { TRACE_API("Epoll id %d out of range.\n", epid); errno = EBADF; + TRACE_ERROR("\nError 2\n"); return -1; } - if (mtcp->smap[epid].socktype == MTCP_SOCK_UNUSED) { + if (mtcp->smap[epid].socktype == MTCP_SOCK_UNUSED) + { errno = EBADF; + TRACE_ERROR("\nError 3\n"); return -1; } - if (mtcp->smap[epid].socktype != MTCP_SOCK_EPOLL) { + if (mtcp->smap[epid].socktype != MTCP_SOCK_EPOLL) + { errno = EINVAL; + TRACE_ERROR("\nError 4\n"); return -1; } ep = mtcp->smap[epid].ep; - if (!ep || !events || maxevents <= 0) { + if (!ep || !events || maxevents <= 0) + { errno = EINVAL; + TRACE_ERROR("\nError 5\n"); return -1; } @@ -403,37 +445,44 @@ mtcp_epoll_wait(mctx_t mctx, int epid, #if SPIN_BEFORE_SLEEP int spin = 0; - while (ep->num_events == 0 && spin < SPIN_THRESH) { + while (ep->num_events == 0 && spin < SPIN_THRESH) + { spin++; } #endif /* SPIN_BEFORE_SLEEP */ - - if (pthread_mutex_lock(&ep->epoll_lock)) { + if (pthread_mutex_lock(&ep->epoll_lock)) + { if (errno == EDEADLK) perror("mtcp_epoll_wait: epoll_lock blocked\n"); assert(0); } - + TRACE_ERROR("Woke up\n\n"); wait: eq = ep->usr_queue; eq_shadow = ep->usr_shadow_queue; /* wait until event occurs */ - while (eq->num_events == 0 && eq_shadow->num_events == 0 && timeout != 0) { + while (eq->num_events == 0 && eq_shadow->num_events == 0 && timeout != 0) + { #if INTR_SLEEPING_MTCP /* signal to mtcp thread if it is sleeping */ - if (mtcp->wakeup_flag && mtcp->is_sleeping) { + if (mtcp->wakeup_flag && mtcp->is_sleeping) + { + TRACE_ERROR("SERVER_THREAD: Killing mtcp thread\n\n"); pthread_kill(mtcp->ctx->thread, SIGUSR1); } #endif ep->stat.waits++; ep->waiting = TRUE; - if (timeout > 0) { + + if (timeout > 0) + { struct timespec deadline; clock_gettime(CLOCK_REALTIME, &deadline); - if (timeout >= 1000) { + if (timeout >= 1000) + { int sec; sec = timeout / 1000; deadline.tv_sec += sec; @@ -442,49 +491,59 @@ mtcp_epoll_wait(mctx_t mctx, int epid, deadline.tv_nsec += timeout * 1000000; - if (deadline.tv_nsec >= 1000000000) { + if (deadline.tv_nsec >= 1000000000) + { deadline.tv_sec++; deadline.tv_nsec -= 1000000000; } - //deadline.tv_sec = mtcp->cur_tv.tv_sec; - //deadline.tv_nsec = (mtcp->cur_tv.tv_usec + timeout * 1000) * 1000; - ret = pthread_cond_timedwait(&ep->epoll_cond, - &ep->epoll_lock, &deadline); - if (ret && ret != ETIMEDOUT) { + // deadline.tv_sec = mtcp->cur_tv.tv_sec; + // deadline.tv_nsec = (mtcp->cur_tv.tv_usec + timeout * 1000) * 1000; + TRACE_ERROR("waiting for epoll_cond\n\n"); + ret = pthread_cond_timedwait(&ep->epoll_cond, + &ep->epoll_lock, &deadline); + if (ret && ret != ETIMEDOUT) + { /* errno set by pthread_cond_timedwait() */ pthread_mutex_unlock(&ep->epoll_lock); - TRACE_ERROR("pthread_cond_timedwait failed. ret: %d, error: %s\n", - ret, strerror(errno)); + TRACE_ERROR("pthread_cond_timedwait failed. ret: %d, error: %s\n", + ret, strerror(errno)); return -1; } timeout = 0; - } else if (timeout < 0) { + } + else if (timeout < 0) + { + TRACE_ERROR("[epoll_wait] usr_q=%d shadow_q=%d timeout=%d\n", + eq->num_events, eq_shadow->num_events, timeout); ret = pthread_cond_wait(&ep->epoll_cond, &ep->epoll_lock); - if (ret) { + if (ret) + { /* errno set by pthread_cond_wait() */ pthread_mutex_unlock(&ep->epoll_lock); - TRACE_ERROR("pthread_cond_wait failed. ret: %d, error: %s\n", - ret, strerror(errno)); + TRACE_ERROR("pthread_cond_wait failed. ret: %d, error: %s\n", + ret, strerror(errno)); return -1; } } + TRACE_ERROR("SERVER_THREAD: Wake Up!!\n\n"); ep->waiting = FALSE; - if (mtcp->ctx->done || mtcp->ctx->exit || mtcp->ctx->interrupt) { + if (mtcp->ctx->done || mtcp->ctx->exit || mtcp->ctx->interrupt) + { mtcp->ctx->interrupt = FALSE; //ret = pthread_cond_signal(&ep->epoll_cond); pthread_mutex_unlock(&ep->epoll_lock); errno = EINTR; return -1; } - } - + /* fetch events from the user event queue */ cnt = 0; num_events = eq->num_events; - for (i = 0; i < num_events && cnt < maxevents; i++) { + for (i = 0; i < num_events && cnt < maxevents; i++) + { event_socket = &mtcp->smap[eq->events[eq->start].sockid]; validity = TRUE; if (event_socket->socktype == MTCP_SOCK_UNUSED) @@ -494,27 +553,31 @@ mtcp_epoll_wait(mctx_t mctx, int epid, if (!(event_socket->events & eq->events[eq->start].ev.events)) validity = FALSE; - if (validity) { + if (validity) + { events[cnt++] = eq->events[eq->start].ev; assert(eq->events[eq->start].sockid >= 0); TRACE_EPOLL("Socket %d: Handled event. event: %s, " - "start: %u, end: %u, num: %u\n", - event_socket->id, - EventToString(eq->events[eq->start].ev.events), - eq->start, eq->end, eq->num_events); + "start: %u, end: %u, num: %u\n", + event_socket->id, + EventToString(eq->events[eq->start].ev.events), + eq->start, eq->end, eq->num_events); ep->stat.handled++; - } else { - TRACE_EPOLL("Socket %d: event %s invalidated.\n", - eq->events[eq->start].sockid, - EventToString(eq->events[eq->start].ev.events)); + } + else + { + TRACE_EPOLL("Socket %d: event %s invalidated.\n", + eq->events[eq->start].sockid, + EventToString(eq->events[eq->start].ev.events)); ep->stat.invalidated++; } event_socket->events &= (~eq->events[eq->start].ev.events); eq->start++; eq->num_events--; - if (eq->start >= eq->size) { + if (eq->start >= eq->size) + { eq->start = 0; } } @@ -522,7 +585,8 @@ mtcp_epoll_wait(mctx_t mctx, int epid, /* fetch eventes from user shadow event queue */ eq = ep->usr_shadow_queue; num_events = eq->num_events; - for (i = 0; i < num_events && cnt < maxevents; i++) { + for (i = 0; i < num_events && cnt < maxevents; i++) + { event_socket = &mtcp->smap[eq->events[eq->start].sockid]; validity = TRUE; if (event_socket->socktype == MTCP_SOCK_UNUSED) @@ -532,27 +596,31 @@ mtcp_epoll_wait(mctx_t mctx, int epid, if (!(event_socket->events & eq->events[eq->start].ev.events)) validity = FALSE; - if (validity) { + if (validity) + { events[cnt++] = eq->events[eq->start].ev; assert(eq->events[eq->start].sockid >= 0); TRACE_EPOLL("Socket %d: Handled event. event: %s, " - "start: %u, end: %u, num: %u\n", - event_socket->id, - EventToString(eq->events[eq->start].ev.events), - eq->start, eq->end, eq->num_events); + "start: %u, end: %u, num: %u\n", + event_socket->id, + EventToString(eq->events[eq->start].ev.events), + eq->start, eq->end, eq->num_events); ep->stat.handled++; - } else { - TRACE_EPOLL("Socket %d: event %s invalidated.\n", - eq->events[eq->start].sockid, - EventToString(eq->events[eq->start].ev.events)); + } + else + { + TRACE_EPOLL("Socket %d: event %s invalidated.\n", + eq->events[eq->start].sockid, + EventToString(eq->events[eq->start].ev.events)); ep->stat.invalidated++; } event_socket->events &= (~eq->events[eq->start].ev.events); eq->start++; eq->num_events--; - if (eq->start >= eq->size) { + if (eq->start >= eq->size) + { eq->start = 0; } } @@ -565,37 +633,46 @@ mtcp_epoll_wait(mctx_t mctx, int epid, return cnt; } /*----------------------------------------------------------------------------*/ -inline int -AddEpollEvent(struct mtcp_epoll *ep, - int queue_type, socket_map_t socket, uint32_t event) +inline int +AddEpollEvent(struct mtcp_epoll *ep, + int queue_type, socket_map_t socket, uint32_t event) { struct event_queue *eq; int index; if (!ep || !socket || !event) return -1; - + ep->stat.issued++; - if (socket->events & event) { + if (socket->events & event) + { return 0; } - if (queue_type == MTCP_EVENT_QUEUE) { + if (queue_type == MTCP_EVENT_QUEUE) + { eq = ep->mtcp_queue; - } else if (queue_type == USR_EVENT_QUEUE) { + } + else if (queue_type == USR_EVENT_QUEUE) + { eq = ep->usr_queue; pthread_mutex_lock(&ep->epoll_lock); - } else if (queue_type == USR_SHADOW_EVENT_QUEUE) { + } + else if (queue_type == USR_SHADOW_EVENT_QUEUE) + { eq = ep->usr_shadow_queue; - } else { + } + else + { TRACE_ERROR("Non-existing event queue type!\n"); return -1; } - if (eq->num_events >= eq->size) { - TRACE_ERROR("Exceeded epoll event queue! num_events: %d, size: %d\n", - eq->num_events, eq->size); + if (eq->num_events >= eq->size) + { + TRACE_ERROR("Exceeded epoll event queue! num_events: %d, size: %d\n", + eq->num_events, eq->size); if (queue_type == USR_EVENT_QUEUE) pthread_mutex_unlock(&ep->epoll_lock); return -1; @@ -608,7 +685,8 @@ AddEpollEvent(struct mtcp_epoll *ep, eq->events[index].ev.events = event; eq->events[index].ev.data = socket->ep_data; - if (eq->end >= eq->size) { + if (eq->end >= eq->size) + { eq->end = 0; } eq->num_events++; diff --git a/mtcp/src/pcap_module.c b/mtcp/src/pcap_module.c index a3aeef0e6..bdeefdb78 100644 --- a/mtcp/src/pcap_module.c +++ b/mtcp/src/pcap_module.c @@ -7,16 +7,21 @@ #include #include #include -#include // htons/ntohs +#include #include #include -#include +#include +#include #include "debug.h" #include "io_module.h" #include "mtcp.h" #include "config.h" -#define CHUNK_SIZE 64 +#define CHUNK_SIZE 64 +#define BUF_SIZE (64 * 1024 * 1024) +#define SNAPLEN 65535 +#define TIMEOUT_MS 1 +#define MAX_TX_BURST 1024 // assume single core (x need to RSS packets to multiple cores) // x concept of core affinity // x concept of specific NIC queue @@ -25,7 +30,6 @@ // struct pcap_pkthdr defintion // --> struct timeval ts(time info when the packet was captured), uint32 len(length of packet), uint32 caplen(length of portion present) /*----------------------------------------------------------------------------*/ -#define MAX_TX_BURST 1024 // you can tune this struct tx_pkt { @@ -48,6 +52,7 @@ struct pcap_private_context const u_char *pkts[CHUNK_SIZE]; int num_pkts_in_chunk; } __attribute__((aligned(__WORDSIZE))); + /*----------------------------------------------------------------------------*/ void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) { @@ -62,27 +67,54 @@ void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) } ppc = (struct pcap_private_context *)ctxt->io_private_context; - // Open the device (assume CONFIG.eths[0].dev_name set in config) - ppc->handle = pcap_open_live(CONFIG.eths[0].dev_name, - 65535, 1, 1, errbuf); - - // enlarge pcap buffer - pcap_set_buffer_size(ppc->handle, 64 * 1024 * 1024); - // promiscuous mode and timeout info may be modified + pcap_t *temp = pcap_create(CONFIG.eths[0].dev_name, errbuf); + if (!temp) + { + TRACE_ERROR("pcap_create failed: %s\n", errbuf); + exit(EXIT_FAILURE); + } + if (pcap_set_snaplen(temp, SNAPLEN) != 0) + TRACE_ERROR("pcap_set_snaplen failed\n"); + if (pcap_set_promisc(temp, 1) != 0) + TRACE_ERROR("pcap_set_promisc failed\n"); + if (pcap_set_timeout(temp, TIMEOUT_MS) != 0) + TRACE_ERROR("pcap_set_timeout failed\n"); + if (pcap_set_buffer_size(temp, BUF_SIZE) != 0) + TRACE_ERROR("pcap_set_buffer_size failed\n"); - if (!ppc->handle) + if (pcap_activate(temp) < 0) { - TRACE_ERROR("pcap_open_live failed: %s\n", errbuf); + TRACE_ERROR("pcap_activate failed: %s\n", pcap_geterr(temp)); exit(EXIT_FAILURE); } + + ppc->handle = temp; } /*----------------------------------------------------------------------------*/ void pcap_release_pkt(struct mtcp_thread_context *ctxt, int ifidx, unsigned char *pkt_data, int len) { - return; // useless since I use filter that only allows TCP packet -} -/*----------------------------------------------------------------------------*/ + /**************************************************************** */ + // free received packets here all after processing packets + struct pcap_private_context *ppc = + (struct pcap_private_context *)ctxt->io_private_context; + for (int k = 0; k < ppc->num_pkts_in_chunk; k++) + { + if (ppc->hdrs[k]) + { + free(ppc->hdrs[k]); + ppc->hdrs[k] = NULL; + } + if (ppc->pkts[k]) + { + free((void *)ppc->pkts[k]); + ppc->pkts[k] = NULL; + } + } + ppc->num_pkts_in_chunk = 0; + /**************************************************************** */ + return; +} /*----------------------------------------------------------------------------*/ int32_t pcap_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) @@ -97,20 +129,34 @@ pcap_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) uint8_t *buf = ppc->w_buf.pkts[i].buf; int len = ppc->w_buf.pkts[i].len; - if (pcap_sendpacket(ppc->handle, buf, len) == 0) + if (pcap_inject(ppc->handle, buf, len) == len) { sent++; } else { - TRACE_ERROR("pcap_sendpacket failed: %s\n", pcap_geterr(ppc->handle)); + TRACE_ERROR("pcap_inject failed: %s\n", pcap_geterr(ppc->handle)); } - free(buf); // free after sending + free(buf); + } + TRACE_ERROR("[pcap_send_pkts] flushing %d packets\n", ppc->w_buf.cnt); + + // Check pcap statistics after flushing + struct pcap_stat ps; + if (pcap_stats(ppc->handle, &ps) == 0) + { + TRACE_ERROR("[pcap_stats] recv=%u drop=%u ifdrop=%u\n", + ps.ps_recv, ps.ps_drop, ps.ps_ifdrop); + } + else + { + TRACE_ERROR("[pcap_stats] failed: %s\n", pcap_geterr(ppc->handle)); } ppc->w_buf.cnt = 0; // reset buffer return sent; } +/*----------------------------------------------------------------------------*/ uint8_t * pcap_get_wptr(struct mtcp_thread_context *ctxt, int ifidx, uint16_t len) // used when mtcp wants to transmit packet. get a buffer for outgoing packet @@ -118,7 +164,7 @@ pcap_get_wptr(struct mtcp_thread_context *ctxt, int ifidx, uint16_t len) // used struct pcap_private_context *ppc = (struct pcap_private_context *)ctxt->io_private_context; - if (ppc->w_buf.cnt >= MAX_TX_BURST) + if (ppc->w_buf.cnt >0) { pcap_send_pkts(ctxt, ifidx); } @@ -142,22 +188,36 @@ pcap_get_rptr(struct mtcp_thread_context *ctxt, int ifidx, int index, uint16_t * uint8_t *pktbuf; ppc = (struct pcap_private_context *)ctxt->io_private_context; pktbuf = (uint8_t *)ppc->pkts[index]; - *len = ppc->hdrs[index]->caplen; + if(!ppc->hdrs[index]) + *len = ppc->hdrs[index]->caplen; return pktbuf; } /*----------------------------------------------------------------------------*/ static void pcap_packet_handler(u_char *user, - const struct pcap_pkthdr *h, - const u_char *bytes) + const struct pcap_pkthdr *h, + const u_char *bytes) { struct pcap_private_context *ppc = (struct pcap_private_context *)user; - - if (ppc->num_pkts_in_chunk < 64) + /************************************************************ */ + struct iphdr *iph = (struct iphdr *)(bytes + sizeof(struct ether_header)); + struct tcphdr *tcph = (struct tcphdr *)((uint8_t *)iph + (iph->ihl << 2)); + if (tcph->ack) + { + printf("Captured ACK: ack_seq=%u win=%u\n", + ntohl(tcph->ack_seq), ntohs(tcph->window)); + } + /************************************************************ */ + if (ppc->num_pkts_in_chunk < CHUNK_SIZE) { // safety guard - ppc->hdrs[ppc->num_pkts_in_chunk] = (struct pcap_pkthdr *)h; - ppc->pkts[ppc->num_pkts_in_chunk] = bytes; + // deep copy pkthdr and buf + struct pcap_pkthdr *hdr = (struct pcap_pkthdr *)malloc(sizeof(struct pcap_pkthdr)); + memcpy(hdr, h, sizeof(struct pcap_pkthdr)); + ppc->hdrs[ppc->num_pkts_in_chunk] = hdr; + u_char *bts = malloc(hdr->caplen); + memcpy(bts, bytes, hdr->caplen); + ppc->pkts[ppc->num_pkts_in_chunk] = bts; ppc->num_pkts_in_chunk++; } } @@ -165,10 +225,18 @@ pcap_packet_handler(u_char *user, int32_t pcap_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) { + TRACE_ERROR("ENTER PCAP_RECV_PKTS\n"); struct pcap_private_context *ppc = ctxt->io_private_context; - // use pcap_dipatch(); + // for (int i = 0; i < ppc->num_pkts_in_chunk; i++) + // { + // if (ppc->hdrs[i]) + // free(ppc->hdrs[i]); + // if (ppc->pkts[i]) + // free((void *)ppc->pkts[i]); + // } ppc->num_pkts_in_chunk = 0; int ret = pcap_dispatch(ppc->handle, CHUNK_SIZE, pcap_packet_handler, (u_char *)ppc); + TRACE_ERROR("pcap dispatch returned %d\n\n", ret); // receive up to max CHUNK_SIZE packets // packets in socket's receive buffers are copied to user application buffer if (ret < 0) // error @@ -180,7 +248,7 @@ pcap_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) { printf("timeout expired on live caputure\n"); } - return ret; + return ppc->num_pkts_in_chunk; } /*----------------------------------------------------------------------------*/ int32_t diff --git a/mtcp/src/tcp_in.c b/mtcp/src/tcp_in.c index b74d407e1..d8ce722a1 100644 --- a/mtcp/src/tcp_in.c +++ b/mtcp/src/tcp_in.c @@ -15,15 +15,15 @@ #include "ccp.h" #endif -#define MAX(a, b) ((a)>(b)?(a):(b)) -#define MIN(a, b) ((a)<(b)?(a):(b)) +// #define MAX(a, b) ((a) > (b) ? (a) : (b)) +// #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define VERIFY_RX_CHECKSUM FALSE #define RECOVERY_AFTER_LOSS TRUE #define SELECTIVE_WRITE_EVENT_NOTIFY TRUE /*----------------------------------------------------------------------------*/ -static inline int +static inline int FilterSYNPacket(mtcp_manager_t mtcp, uint32_t ip, uint16_t port) { struct sockaddr_in *addr; @@ -59,14 +59,14 @@ FilterSYNPacket(mtcp_manager_t mtcp, uint32_t ip, uint16_t port) } /*----------------------------------------------------------------------------*/ static inline tcp_stream * -HandlePassiveOpen(mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr *iph, - const struct tcphdr *tcph, uint32_t seq, uint16_t window) +HandlePassiveOpen(mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr *iph, + const struct tcphdr *tcph, uint32_t seq, uint16_t window) { tcp_stream *cur_stream = NULL; /* create new stream and add to flow hash table */ - cur_stream = CreateTCPStream(mtcp, NULL, MTCP_SOCK_STREAM, - iph->daddr, tcph->dest, iph->saddr, tcph->source); + cur_stream = CreateTCPStream(mtcp, NULL, MTCP_SOCK_STREAM, + iph->daddr, tcph->dest, iph->saddr, tcph->source); if (!cur_stream) { TRACE_ERROR("INFO: Could not allocate tcp_stream!\n"); return FALSE; @@ -75,15 +75,15 @@ HandlePassiveOpen(mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr *iph, cur_stream->sndvar->peer_wnd = window; cur_stream->rcv_nxt = cur_stream->rcvvar->irs; cur_stream->sndvar->cwnd = 1; - ParseTCPOptions(cur_stream, cur_ts, (uint8_t *)tcph + TCP_HEADER_LEN, - (tcph->doff << 2) - TCP_HEADER_LEN); + ParseTCPOptions(cur_stream, cur_ts, (uint8_t *)tcph + TCP_HEADER_LEN, + (tcph->doff << 2) - TCP_HEADER_LEN); return cur_stream; } /*----------------------------------------------------------------------------*/ static inline int -HandleActiveOpen(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, - struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, uint16_t window) +HandleActiveOpen(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, + struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, uint16_t window) { cur_stream->rcvvar->irs = seq; cur_stream->snd_nxt = ack_seq; @@ -91,8 +91,8 @@ HandleActiveOpen(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, cur_stream->rcvvar->snd_wl1 = cur_stream->rcvvar->irs - 1; cur_stream->rcv_nxt = cur_stream->rcvvar->irs + 1; cur_stream->rcvvar->last_ack_seq = ack_seq; - ParseTCPOptions(cur_stream, cur_ts, (uint8_t *)tcph + TCP_HEADER_LEN, - (tcph->doff << 2) - TCP_HEADER_LEN); + ParseTCPOptions(cur_stream, cur_ts, (uint8_t *)tcph + TCP_HEADER_LEN, + (tcph->doff << 2) - TCP_HEADER_LEN); cur_stream->sndvar->cwnd = ((cur_stream->sndvar->cwnd == 1)? (cur_stream->sndvar->mss * TCP_INIT_CWND): cur_stream->sndvar->mss); cur_stream->sndvar->ssthresh = cur_stream->sndvar->mss * 10; @@ -105,16 +105,18 @@ HandleActiveOpen(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, /* Return: TRUE if acceptable, FALSE if not acceptable */ /*----------------------------------------------------------------------------*/ static inline int -ValidateSequence(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, - struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, int payloadlen) +ValidateSequence(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, + struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, int payloadlen) { /* Protect Against Wrapped Sequence number (PAWS) */ - if (!tcph->rst && cur_stream->saw_timestamp) { + if (!tcph->rst && cur_stream->saw_timestamp) + { struct tcp_timestamp ts; - - if (!ParseTCPTimestamp(cur_stream, &ts, - (uint8_t *)tcph + TCP_HEADER_LEN, - (tcph->doff << 2) - TCP_HEADER_LEN)) { + + if (!ParseTCPTimestamp(cur_stream, &ts, + (uint8_t *)tcph + TCP_HEADER_LEN, + (tcph->doff << 2) - TCP_HEADER_LEN)) + { /* if there is no timestamp */ /* TODO: implement here */ TRACE_DBG("No timestamp found.\n"); @@ -122,21 +124,25 @@ ValidateSequence(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, } /* RFC1323: if SEG.TSval < TS.Recent, drop and send ack */ - if (TCP_SEQ_LT(ts.ts_val, cur_stream->rcvvar->ts_recent)) { - /* TODO: ts_recent should be invalidated + if (TCP_SEQ_LT(ts.ts_val, cur_stream->rcvvar->ts_recent)) + { + /* TODO: ts_recent should be invalidated before timestamp wraparound for long idle flow */ TRACE_DBG("PAWS Detect wrong timestamp. " - "seq: %u, ts_val: %u, prev: %u\n", - seq, ts.ts_val, cur_stream->rcvvar->ts_recent); + "seq: %u, ts_val: %u, prev: %u\n", + seq, ts.ts_val, cur_stream->rcvvar->ts_recent); EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_NOW); return FALSE; - } else { + } + else + { /* valid timestamp */ - if (TCP_SEQ_GT(ts.ts_val, cur_stream->rcvvar->ts_recent)) { + if (TCP_SEQ_GT(ts.ts_val, cur_stream->rcvvar->ts_recent)) + { TRACE_TSTAMP("Timestamp update. cur: %u, prior: %u " - "(time diff: %uus)\n", - ts.ts_val, cur_stream->rcvvar->ts_recent, - TS_TO_USEC(cur_ts - cur_stream->rcvvar->ts_last_ts_upd)); + "(time diff: %uus)\n", + ts.ts_val, cur_stream->rcvvar->ts_recent, + TS_TO_USEC(cur_ts - cur_stream->rcvvar->ts_last_ts_upd)); cur_stream->rcvvar->ts_last_ts_upd = cur_ts; } @@ -146,34 +152,42 @@ ValidateSequence(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, } /* TCP sequence validation */ - if (!TCP_SEQ_BETWEEN(seq + payloadlen, cur_stream->rcv_nxt, - cur_stream->rcv_nxt + cur_stream->rcvvar->rcv_wnd)) { + if (!TCP_SEQ_BETWEEN(seq + payloadlen, cur_stream->rcv_nxt, + cur_stream->rcv_nxt + cur_stream->rcvvar->rcv_wnd)) + { /* if RST bit is set, ignore the segment */ if (tcph->rst) return FALSE; - if (cur_stream->state == TCP_ST_ESTABLISHED) { + if (cur_stream->state == TCP_ST_ESTABLISHED) + { /* check if it is to get window advertisement */ - if (seq + 1 == cur_stream->rcv_nxt) { + if (seq + 1 == cur_stream->rcv_nxt) + { #if 0 TRACE_DBG("Window update request. (seq: %u, rcv_wnd: %u)\n", seq, cur_stream->rcvvar->rcv_wnd); #endif EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_AGGREGATE); return FALSE; - } - if (TCP_SEQ_LEQ(seq, cur_stream->rcv_nxt)) { + if (TCP_SEQ_LEQ(seq, cur_stream->rcv_nxt)) + { EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_AGGREGATE); - } else { + } + else + { EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_NOW); } - } else { - if (cur_stream->state == TCP_ST_TIME_WAIT) { - TRACE_DBG("Stream %d: tw expire update to %u\n", - cur_stream->id, cur_stream->rcvvar->ts_tw_expire); + } + else + { + if (cur_stream->state == TCP_ST_TIME_WAIT) + { + TRACE_DBG("Stream %d: tw expire update to %u\n", + cur_stream->id, cur_stream->rcvvar->ts_tw_expire); AddtoTimewaitList(mtcp, cur_stream, cur_ts); } AddtoControlList(mtcp, cur_stream, cur_ts); @@ -184,7 +198,7 @@ ValidateSequence(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, return TRUE; } /*----------------------------------------------------------------------------*/ -static inline void +static inline void NotifyConnectionReset(mtcp_manager_t mtcp, tcp_stream *cur_stream) { TRACE_DBG("Stream %d: Notifying connection reset.\n", cur_stream->id); @@ -192,26 +206,29 @@ NotifyConnectionReset(mtcp_manager_t mtcp, tcp_stream *cur_stream) /* signal to user "connection reset" */ } /*----------------------------------------------------------------------------*/ -static inline int +static inline int ProcessRST(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t ack_seq) { /* TODO: we need reset validation logic */ /* the sequence number of a RST should be inside window */ /* (in SYN_SENT state, it should ack the previous SYN */ - TRACE_DBG("Stream %d: TCP RESET (%s)\n", - cur_stream->id, TCPStateToString(cur_stream)); + TRACE_DBG("Stream %d: TCP RESET (%s)\n", + cur_stream->id, TCPStateToString(cur_stream)); #if DUMP_STREAM DumpStream(mtcp, cur_stream); #endif - - if (cur_stream->state <= TCP_ST_SYN_SENT) { + + if (cur_stream->state <= TCP_ST_SYN_SENT) + { /* not handled here */ return FALSE; } - if (cur_stream->state == TCP_ST_SYN_RCVD) { - if (ack_seq == cur_stream->snd_nxt) { + if (cur_stream->state == TCP_ST_SYN_RCVD) + { + if (ack_seq == cur_stream->snd_nxt) + { cur_stream->state = TCP_ST_CLOSED; cur_stream->close_reason = TCP_RESET; DestroyTCPStream(mtcp, cur_stream); @@ -219,30 +236,33 @@ ProcessRST(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t ack_seq) return TRUE; } - /* if the application is already closed the connection, + /* if the application is already closed the connection, just destroy the it */ - if (cur_stream->state == TCP_ST_FIN_WAIT_1 || - cur_stream->state == TCP_ST_FIN_WAIT_2 || - cur_stream->state == TCP_ST_LAST_ACK || - cur_stream->state == TCP_ST_CLOSING || - cur_stream->state == TCP_ST_TIME_WAIT) { + if (cur_stream->state == TCP_ST_FIN_WAIT_1 || + cur_stream->state == TCP_ST_FIN_WAIT_2 || + cur_stream->state == TCP_ST_LAST_ACK || + cur_stream->state == TCP_ST_CLOSING || + cur_stream->state == TCP_ST_TIME_WAIT) + { cur_stream->state = TCP_ST_CLOSED; cur_stream->close_reason = TCP_ACTIVE_CLOSE; DestroyTCPStream(mtcp, cur_stream); return TRUE; } - if (cur_stream->state >= TCP_ST_ESTABLISHED && - cur_stream->state <= TCP_ST_CLOSE_WAIT) { + if (cur_stream->state >= TCP_ST_ESTABLISHED && + cur_stream->state <= TCP_ST_CLOSE_WAIT) + { /* ESTABLISHED, FIN_WAIT_1, FIN_WAIT_2, CLOSE_WAIT */ /* TODO: flush all the segment queues */ - //NotifyConnectionReset(mtcp, cur_stream); + // NotifyConnectionReset(mtcp, cur_stream); } - if (!(cur_stream->sndvar->on_closeq || cur_stream->sndvar->on_closeq_int || - cur_stream->sndvar->on_resetq || cur_stream->sndvar->on_resetq_int)) { - //cur_stream->state = TCP_ST_CLOSED; - //DestroyTCPStream(mtcp, cur_stream); + if (!(cur_stream->sndvar->on_closeq || cur_stream->sndvar->on_closeq_int || + cur_stream->sndvar->on_resetq || cur_stream->sndvar->on_resetq_int)) + { + // cur_stream->state = TCP_ST_CLOSED; + // DestroyTCPStream(mtcp, cur_stream); cur_stream->state = TCP_ST_CLOSE_WAIT; cur_stream->close_reason = TCP_RESET; RaiseCloseEvent(mtcp, cur_stream); @@ -251,7 +271,7 @@ ProcessRST(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t ack_seq) return TRUE; } /*----------------------------------------------------------------------------*/ -inline void +inline void EstimateRTT(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t mrtt) { /* This function should be called for not retransmitted packets */ @@ -261,37 +281,49 @@ EstimateRTT(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t mrtt) uint32_t tcp_rto_min = TCP_RTO_MIN; struct tcp_recv_vars *rcvvar = cur_stream->rcvvar; - if (m == 0) { + if (m == 0) + { m = 1; } - if (rcvvar->srtt != 0) { + if (rcvvar->srtt != 0) + { /* rtt = 7/8 rtt + 1/8 new */ m -= (rcvvar->srtt >> 3); rcvvar->srtt += m; - if (m < 0) { + if (m < 0) + { m = -m; m -= (rcvvar->mdev >> 2); - if (m > 0) { + if (m > 0) + { m >>= 3; } - } else { + } + else + { m -= (rcvvar->mdev >> 2); } rcvvar->mdev += m; - if (rcvvar->mdev > rcvvar->mdev_max) { + if (rcvvar->mdev > rcvvar->mdev_max) + { rcvvar->mdev_max = rcvvar->mdev; - if (rcvvar->mdev_max > rcvvar->rttvar) { + if (rcvvar->mdev_max > rcvvar->rttvar) + { rcvvar->rttvar = rcvvar->mdev_max; } } - if (TCP_SEQ_GT(cur_stream->sndvar->snd_una, rcvvar->rtt_seq)) { - if (rcvvar->mdev_max < rcvvar->rttvar) { + if (TCP_SEQ_GT(cur_stream->sndvar->snd_una, rcvvar->rtt_seq)) + { + if (rcvvar->mdev_max < rcvvar->rttvar) + { rcvvar->rttvar -= (rcvvar->rttvar - rcvvar->mdev_max) >> 2; } rcvvar->rtt_seq = cur_stream->snd_nxt; rcvvar->mdev_max = tcp_rto_min; } - } else { + } + else + { /* fresh measurement */ rcvvar->srtt = m << 3; rcvvar->mdev = m << 1; @@ -300,17 +332,20 @@ EstimateRTT(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t mrtt) } TRACE_RTT("mrtt: %u (%uus), srtt: %u (%ums), mdev: %u, mdev_max: %u, " - "rttvar: %u, rtt_seq: %u\n", mrtt, mrtt * TIME_TICK, - rcvvar->srtt, TS_TO_MSEC((rcvvar->srtt) >> 3), rcvvar->mdev, - rcvvar->mdev_max, rcvvar->rttvar, rcvvar->rtt_seq); + "rttvar: %u, rtt_seq: %u\n", + mrtt, mrtt * TIME_TICK, + rcvvar->srtt, TS_TO_MSEC((rcvvar->srtt) >> 3), rcvvar->mdev, + rcvvar->mdev_max, rcvvar->rttvar, rcvvar->rtt_seq); } /*----------------------------------------------------------------------------*/ + static inline void -ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, - struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, - uint16_t window, int payloadlen) +ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, + struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, + uint16_t window, int payloadlen) { + TRACE_ERROR("ProcessACK Inside\n\n"); struct tcp_send_vars *sndvar = cur_stream->sndvar; uint32_t cwindow, cwindow_prev; uint32_t rmlen; @@ -326,29 +361,29 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, right_wnd_edge = sndvar->peer_wnd + cur_stream->rcvvar->snd_wl2; /* If ack overs the sending buffer, return */ - if (cur_stream->state == TCP_ST_FIN_WAIT_1 || - cur_stream->state == TCP_ST_FIN_WAIT_2 || - cur_stream->state == TCP_ST_CLOSING || - cur_stream->state == TCP_ST_CLOSE_WAIT || + if (cur_stream->state == TCP_ST_FIN_WAIT_1 || + cur_stream->state == TCP_ST_FIN_WAIT_2 || + cur_stream->state == TCP_ST_CLOSING || + cur_stream->state == TCP_ST_CLOSE_WAIT || cur_stream->state == TCP_ST_LAST_ACK) { if (sndvar->is_fin_sent && ack_seq == sndvar->fss + 1) { ack_seq--; } } - + if (TCP_SEQ_GT(ack_seq, sndvar->sndbuf->head_seq + sndvar->sndbuf->len)) { TRACE_DBG("Stream %d (%s): invalid acknologement. " "ack_seq: %u, possible max_ack_seq: %u\n", cur_stream->id, - TCPStateToString(cur_stream), ack_seq, - sndvar->sndbuf->head_seq + sndvar->sndbuf->len); + TCPStateToString(cur_stream), ack_seq, + sndvar->sndbuf->head_seq + sndvar->sndbuf->len); return; } /* Update window */ if (TCP_SEQ_LT(cur_stream->rcvvar->snd_wl1, seq) || - (cur_stream->rcvvar->snd_wl1 == seq && - TCP_SEQ_LT(cur_stream->rcvvar->snd_wl2, ack_seq)) || - (cur_stream->rcvvar->snd_wl2 == ack_seq && + (cur_stream->rcvvar->snd_wl1 == seq && + TCP_SEQ_LT(cur_stream->rcvvar->snd_wl2, ack_seq)) || + (cur_stream->rcvvar->snd_wl2 == ack_seq && cwindow > sndvar->peer_wnd)) { cwindow_prev = sndvar->peer_wnd; sndvar->peer_wnd = cwindow; @@ -371,7 +406,7 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, } /* Check duplicated ack count */ - /* Duplicated ack if + /* Duplicated ack if 1) ack_seq is old 2) payload length is 0. 3) advertised window not changed. @@ -387,7 +422,7 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, cur_stream->rcvvar->dup_acks++; #if USE_CCP ccp_record_event(mtcp, cur_stream, EVENT_DUPACK, - (cur_stream->snd_nxt - ack_seq)); + (cur_stream->snd_nxt - ack_seq)); #endif } dup = TRUE; @@ -400,7 +435,7 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, TRACE_DBG("passed dup_acks, ack=%u, snd_nxt=%u, last_ack=%u len=%u wl2=%u peer_wnd=%u right=%u\n", ack_seq-sndvar->iss, cur_stream->snd_nxt-sndvar->iss, cur_stream->rcvvar->last_ack_seq-sndvar->iss, payloadlen, cur_stream->rcvvar->snd_wl2-sndvar->iss, sndvar->peer_wnd / sndvar->mss, - right_wnd_edge - sndvar->iss); + right_wnd_edge - sndvar->iss); } #endif cur_stream->rcvvar->dup_acks = 0; @@ -408,19 +443,19 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, } #if USE_CCP if(cur_stream->wait_for_acks) { - TRACE_DBG("got ack, but waiting to send... ack=%u, snd_next=%u cwnd=%u\n", + TRACE_ERROR("got ack, but waiting to send... ack=%u, snd_next=%u cwnd=%u\n", ack_seq-sndvar->iss, cur_stream->snd_nxt-sndvar->iss, - sndvar->cwnd / sndvar->mss); + sndvar->cwnd / sndvar->mss); } #endif /* Fast retransmission */ if (dup && cur_stream->rcvvar->dup_acks == 3) { - TRACE_LOSS("Triple duplicated ACKs!! ack_seq: %u\n", ack_seq); + TRACE_ERROR("Triple duplicated ACKs!! ack_seq: %u\n", ack_seq); TRACE_CCP("tridup ack %u (%u)!\n", ack_seq - cur_stream->sndvar->iss, ack_seq); if (TCP_SEQ_LT(ack_seq, cur_stream->snd_nxt)) { TRACE_LOSS("Reducing snd_nxt from %u to %u\n", cur_stream->snd_nxt-sndvar->iss, - ack_seq - cur_stream->sndvar->iss); + ack_seq - cur_stream->sndvar->iss); #if RTM_STAT sndvar->rstat.tdp_ack_cnt++; @@ -432,8 +467,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, #endif if (ack_seq != sndvar->snd_una) { TRACE_DBG("ack_seq and snd_una mismatch on tdp ack. " - "ack_seq: %u, snd_una: %u\n", - ack_seq, sndvar->snd_una); + "ack_seq: %u, snd_una: %u\n", + ack_seq, sndvar->snd_una); } #if USE_CCP sndvar->missing_seq = ack_seq; @@ -451,8 +486,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, sndvar->cwnd = sndvar->ssthresh + 3 * sndvar->mss; TRACE_CONG("fast retrans: cwnd = ssthresh(%u)+3*mss = %u\n", - sndvar->ssthresh / sndvar->mss, - sndvar->cwnd / sndvar->mss); + sndvar->ssthresh / sndvar->mss, + sndvar->cwnd / sndvar->mss); /* count number of retransmissions */ if (sndvar->nrtx < TCP_MAX_RTX) { @@ -467,27 +502,27 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, /* Inflate congestion window until before overflow */ if ((uint32_t)(sndvar->cwnd + sndvar->mss) > sndvar->cwnd) { sndvar->cwnd += sndvar->mss; - TRACE_CONG("Dupack cwnd inflate. cwnd: %u, ssthresh: %u\n", - sndvar->cwnd, sndvar->ssthresh); + TRACE_CONG("Dupack cwnd inflate. cwnd: %u, ssthresh: %u\n", + sndvar->cwnd, sndvar->ssthresh); } } #if TCP_OPT_SACK_ENABLED - ParseSACKOption(cur_stream, ack_seq, (uint8_t *)tcph + TCP_HEADER_LEN, - (tcph->doff << 2) - TCP_HEADER_LEN); + ParseSACKOption(cur_stream, ack_seq, (uint8_t *)tcph + TCP_HEADER_LEN, + (tcph->doff << 2) - TCP_HEADER_LEN); #endif /* TCP_OPT_SACK_ENABLED */ #if RECOVERY_AFTER_LOSS #if USE_CCP /* updating snd_nxt (when recovered from loss) */ if (TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt) || - (cur_stream->wait_for_acks && TCP_SEQ_GT(ack_seq, cur_stream->seq_at_last_loss) -#if TCP_OPT_SACK_ENABLED - && cur_stream->rcvvar->sacked_pkts == 0 + (cur_stream->wait_for_acks && TCP_SEQ_GT(ack_seq, cur_stream->seq_at_last_loss) +#if TCP_OPT_SACK_ENABLED + && cur_stream->rcvvar->sacked_pkts == 0 #endif - )) + )) #else - if (TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt)) + if (TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt)) #endif /* USE_CCP */ { #if RTM_STAT @@ -504,8 +539,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, cur_stream->snd_nxt = ack_seq; TRACE_DBG("Sending again..., ack_seq=%u sndlen=%u cwnd=%u\n", ack_seq-sndvar->iss, - sndvar->sndbuf->len, - sndvar->cwnd / sndvar->mss); + sndvar->sndbuf->len, + sndvar->cwnd / sndvar->mss); if (sndvar->sndbuf->len == 0) { RemoveFromSendList(mtcp, cur_stream); } else { @@ -534,11 +569,11 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, /* Remove acked sequence from send buffer */ if (rmlen > 0) { /* Routine goes here only if there is new payload (not retransmitted) */ - + /* Estimate RTT and calculate rto */ if (cur_stream->saw_timestamp) { - EstimateRTT(mtcp, cur_stream, - cur_ts - cur_stream->rcvvar->ts_lastack_rcvd); + EstimateRTT(mtcp, cur_stream, + cur_ts - cur_stream->rcvvar->ts_lastack_rcvd); sndvar->rto = (cur_stream->rcvvar->srtt >> 3) + cur_stream->rcvvar->rttvar; assert(sndvar->rto > 0); } else { @@ -546,23 +581,23 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, TRACE_RTT("NOT IMPLEMENTED.\n"); } - // TODO CCP should comment this out? + // TODO CCP should comment this out? /* Update congestion control variables */ if (cur_stream->state >= TCP_ST_ESTABLISHED) { if (sndvar->cwnd < sndvar->ssthresh) { if ((sndvar->cwnd + sndvar->mss) > sndvar->cwnd) { sndvar->cwnd += (sndvar->mss * packets); } - TRACE_CONG("slow start cwnd: %u, ssthresh: %u\n", - sndvar->cwnd, sndvar->ssthresh); + TRACE_CONG("slow start cwnd: %u, ssthresh: %u\n", + sndvar->cwnd, sndvar->ssthresh); } else { - uint32_t new_cwnd = sndvar->cwnd + - packets * sndvar->mss * sndvar->mss / - sndvar->cwnd; + uint32_t new_cwnd = sndvar->cwnd + + packets * sndvar->mss * sndvar->mss / + sndvar->cwnd; if (new_cwnd > sndvar->cwnd) { sndvar->cwnd = new_cwnd; } - //TRACE_CONG("congestion avoidance cwnd: %u, ssthresh: %u\n", + // TRACE_CONG("congestion avoidance cwnd: %u, ssthresh: %u\n", // sndvar->cwnd, sndvar->ssthresh); } } @@ -573,6 +608,17 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, assert(0); } ret = SBRemove(mtcp->rbm_snd, sndvar->sndbuf, rmlen); + + TRACE_ERROR("[ProcessACK] post-SBRemove: " + "snd_una=%u snd_nxt=%u snd_wnd=%u " + "peer_wnd=%u buf->len=%u buf->head_seq=%u\n", + sndvar->snd_una, + cur_stream->snd_nxt, + sndvar->snd_wnd, + sndvar->peer_wnd, + sndvar->sndbuf->len, + sndvar->sndbuf->head_seq); + sndvar->snd_una = ack_seq; snd_wnd_prev = sndvar->snd_wnd; sndvar->snd_wnd = sndvar->sndbuf->size - sndvar->sndbuf->len; @@ -580,7 +626,7 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, /* If there was no available sending window */ /* notify the newly available window to application */ #if SELECTIVE_WRITE_EVENT_NOTIFY - if (snd_wnd_prev <= 0) { + if (snd_wnd_prev <= 0 || sndvar->sndbuf->len == 0 ) { #endif /* SELECTIVE_WRITE_EVENT_NOTIFY */ RaiseWriteEvent(mtcp, cur_stream); #if SELECTIVE_WRITE_EVENT_NOTIFY @@ -590,7 +636,15 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, SBUF_UNLOCK(&sndvar->write_lock); UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); } - + TRACE_ERROR("[ProcessACK] " + "ack_seq=%u | snd_una=%u | snd_wnd=%u | peer_wnd=%u | iss=%u | fss=%u\n", + ack_seq, + sndvar->snd_una, + sndvar->snd_wnd, + sndvar->peer_wnd, + sndvar->iss, + sndvar->fss); + UNUSED(ret); } /*----------------------------------------------------------------------------*/ @@ -598,29 +652,33 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, /* Return: TRUE (1) in normal case, FALSE (0) if immediate ACK is required */ /* CAUTION: should only be called at ESTABLISHED, FIN_WAIT_1, FIN_WAIT_2 */ /*----------------------------------------------------------------------------*/ -static inline int -ProcessTCPPayload(mtcp_manager_t mtcp, tcp_stream *cur_stream, - uint32_t cur_ts, uint8_t *payload, uint32_t seq, int payloadlen) +static inline int +ProcessTCPPayload(mtcp_manager_t mtcp, tcp_stream *cur_stream, + uint32_t cur_ts, uint8_t *payload, uint32_t seq, int payloadlen) { struct tcp_recv_vars *rcvvar = cur_stream->rcvvar; uint32_t prev_rcv_nxt; int ret; /* if seq and segment length is lower than rcv_nxt, ignore and send ack */ - if (TCP_SEQ_LT(seq + payloadlen, cur_stream->rcv_nxt)) { + if (TCP_SEQ_LT(seq + payloadlen, cur_stream->rcv_nxt)) + { return FALSE; } /* if payload exceeds receiving buffer, drop and send ack */ - if (TCP_SEQ_GT(seq + payloadlen, cur_stream->rcv_nxt + rcvvar->rcv_wnd)) { + if (TCP_SEQ_GT(seq + payloadlen, cur_stream->rcv_nxt + rcvvar->rcv_wnd)) + { return FALSE; } /* allocate receive buffer if not exist */ - if (!rcvvar->rcvbuf) { + if (!rcvvar->rcvbuf) + { rcvvar->rcvbuf = RBInit(mtcp->rbm_rcv, rcvvar->irs + 1); - if (!rcvvar->rcvbuf) { - TRACE_ERROR("Stream %d: Failed to allocate receive buffer.\n", - cur_stream->id); + if (!rcvvar->rcvbuf) + { + TRACE_ERROR("Stream %d: Failed to allocate receive buffer.\n", + cur_stream->id); cur_stream->state = TCP_ST_CLOSED; cur_stream->close_reason = TCP_NO_MEM; RaiseErrorEvent(mtcp, cur_stream); @@ -629,44 +687,49 @@ ProcessTCPPayload(mtcp_manager_t mtcp, tcp_stream *cur_stream, } } - if (SBUF_LOCK(&rcvvar->read_lock)) { + if (SBUF_LOCK(&rcvvar->read_lock)) + { if (errno == EDEADLK) perror("ProcessTCPPayload: read_lock blocked\n"); assert(0); } prev_rcv_nxt = cur_stream->rcv_nxt; - ret = RBPut(mtcp->rbm_rcv, - rcvvar->rcvbuf, payload, (uint32_t)payloadlen, seq); - if (ret < 0) { + ret = RBPut(mtcp->rbm_rcv, + rcvvar->rcvbuf, payload, (uint32_t)payloadlen, seq); + if (ret < 0) + { TRACE_ERROR("Cannot merge payload. reason: %d\n", ret); } - /* discard the buffer if the state is FIN_WAIT_1 or FIN_WAIT_2, + /* discard the buffer if the state is FIN_WAIT_1 or FIN_WAIT_2, meaning that the connection is already closed by the application */ - if (cur_stream->state == TCP_ST_FIN_WAIT_1 || - cur_stream->state == TCP_ST_FIN_WAIT_2) { - RBRemove(mtcp->rbm_rcv, - rcvvar->rcvbuf, rcvvar->rcvbuf->merged_len, AT_MTCP); + if (cur_stream->state == TCP_ST_FIN_WAIT_1 || + cur_stream->state == TCP_ST_FIN_WAIT_2) + { + RBRemove(mtcp->rbm_rcv, + rcvvar->rcvbuf, rcvvar->rcvbuf->merged_len, AT_MTCP); } cur_stream->rcv_nxt = rcvvar->rcvbuf->head_seq + rcvvar->rcvbuf->merged_len; rcvvar->rcv_wnd = rcvvar->rcvbuf->size - rcvvar->rcvbuf->merged_len; SBUF_UNLOCK(&rcvvar->read_lock); - if (TCP_SEQ_LEQ(cur_stream->rcv_nxt, prev_rcv_nxt)) { + if (TCP_SEQ_LEQ(cur_stream->rcv_nxt, prev_rcv_nxt)) + { /* There are some lost packets */ return FALSE; } TRACE_EPOLL("Stream %d data arrived. " - "len: %d, ET: %u, IN: %u, OUT: %u\n", - cur_stream->id, payloadlen, - cur_stream->socket? cur_stream->socket->epoll & MTCP_EPOLLET : 0, - cur_stream->socket? cur_stream->socket->epoll & MTCP_EPOLLIN : 0, - cur_stream->socket? cur_stream->socket->epoll & MTCP_EPOLLOUT : 0); + "len: %d, ET: %u, IN: %u, OUT: %u\n", + cur_stream->id, payloadlen, + cur_stream->socket ? cur_stream->socket->epoll & MTCP_EPOLLET : 0, + cur_stream->socket ? cur_stream->socket->epoll & MTCP_EPOLLIN : 0, + cur_stream->socket ? cur_stream->socket->epoll & MTCP_EPOLLOUT : 0); - if (cur_stream->state == TCP_ST_ESTABLISHED) { + if (cur_stream->state == TCP_ST_ESTABLISHED) + { RaiseReadEvent(mtcp, cur_stream); } @@ -674,151 +737,179 @@ ProcessTCPPayload(mtcp_manager_t mtcp, tcp_stream *cur_stream, } /*----------------------------------------------------------------------------*/ static inline tcp_stream * -CreateNewFlowHTEntry(mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr *iph, - int ip_len, const struct tcphdr* tcph, uint32_t seq, uint32_t ack_seq, - int payloadlen, uint16_t window) +CreateNewFlowHTEntry(mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr *iph, + int ip_len, const struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, + int payloadlen, uint16_t window) { tcp_stream *cur_stream; - int ret; - - if (tcph->syn && !tcph->ack) { + int ret; + + if (tcph->syn && !tcph->ack) + { /* handle the SYN */ ret = FilterSYNPacket(mtcp, iph->daddr, tcph->dest); - if (!ret) { + if (!ret) + { TRACE_DBG("Refusing SYN packet.\n"); #ifdef DBGMSG DumpIPPacket(mtcp, iph, ip_len); #endif - SendTCPPacketStandalone(mtcp, - iph->daddr, tcph->dest, iph->saddr, tcph->source, - 0, seq + payloadlen + 1, 0, TCP_FLAG_RST | TCP_FLAG_ACK, - NULL, 0, cur_ts, 0); + SendTCPPacketStandalone(mtcp, + iph->daddr, tcph->dest, iph->saddr, tcph->source, + 0, seq + payloadlen + 1, 0, TCP_FLAG_RST | TCP_FLAG_ACK, + NULL, 0, cur_ts, 0); return NULL; } /* now accept the connection */ - cur_stream = HandlePassiveOpen(mtcp, - cur_ts, iph, tcph, seq, window); - if (!cur_stream) { + cur_stream = HandlePassiveOpen(mtcp, + cur_ts, iph, tcph, seq, window); + if (!cur_stream) + { TRACE_DBG("Not available space in flow pool.\n"); #ifdef DBGMSG DumpIPPacket(mtcp, iph, ip_len); #endif - SendTCPPacketStandalone(mtcp, - iph->daddr, tcph->dest, iph->saddr, tcph->source, - 0, seq + payloadlen + 1, 0, TCP_FLAG_RST | TCP_FLAG_ACK, - NULL, 0, cur_ts, 0); + SendTCPPacketStandalone(mtcp, + iph->daddr, tcph->dest, iph->saddr, tcph->source, + 0, seq + payloadlen + 1, 0, TCP_FLAG_RST | TCP_FLAG_ACK, + NULL, 0, cur_ts, 0); return NULL; } return cur_stream; - } else if (tcph->rst) { + } + else if (tcph->rst) + { TRACE_DBG("Reset packet comes\n"); #ifdef DBGMSG DumpIPPacket(mtcp, iph, ip_len); #endif /* for the reset packet, just discard */ return NULL; - } else { + } + else + { TRACE_DBG("Weird packet comes.\n"); #ifdef DBGMSG DumpIPPacket(mtcp, iph, ip_len); #endif /* TODO: for else, discard and send a RST */ - /* if the ACK bit is off, respond with seq 0: + /* if the ACK bit is off, respond with seq 0: else (ACK bit is on): */ - if (tcph->ack) { - SendTCPPacketStandalone(mtcp, - iph->daddr, tcph->dest, iph->saddr, tcph->source, - ack_seq, 0, 0, TCP_FLAG_RST, NULL, 0, cur_ts, 0); - } else { - SendTCPPacketStandalone(mtcp, - iph->daddr, tcph->dest, iph->saddr, tcph->source, - 0, seq + payloadlen, 0, TCP_FLAG_RST | TCP_FLAG_ACK, - NULL, 0, cur_ts, 0); + if (tcph->ack) + { + SendTCPPacketStandalone(mtcp, + iph->daddr, tcph->dest, iph->saddr, tcph->source, + ack_seq, 0, 0, TCP_FLAG_RST, NULL, 0, cur_ts, 0); + } + else + { + SendTCPPacketStandalone(mtcp, + iph->daddr, tcph->dest, iph->saddr, tcph->source, + 0, seq + payloadlen, 0, TCP_FLAG_RST | TCP_FLAG_ACK, + NULL, 0, cur_ts, 0); } return NULL; } } /*----------------------------------------------------------------------------*/ -static inline void -Handle_TCP_ST_LISTEN (mtcp_manager_t mtcp, uint32_t cur_ts, - tcp_stream* cur_stream, struct tcphdr* tcph) { - - if (tcph->syn) { +static inline void +Handle_TCP_ST_LISTEN(mtcp_manager_t mtcp, uint32_t cur_ts, + tcp_stream *cur_stream, struct tcphdr *tcph) +{ + + if (tcph->syn) + { if (cur_stream->state == TCP_ST_LISTEN) cur_stream->rcv_nxt++; cur_stream->state = TCP_ST_SYN_RCVD; TRACE_STATE("Stream %d: TCP_ST_SYN_RCVD\n", cur_stream->id); AddtoControlList(mtcp, cur_stream, cur_ts); - } else { + } + else + { CTRACE_ERROR("Stream %d (TCP_ST_LISTEN): " - "Packet without SYN.\n", cur_stream->id); + "Packet without SYN.\n", + cur_stream->id); } - } /*----------------------------------------------------------------------------*/ -static inline void -Handle_TCP_ST_SYN_SENT (mtcp_manager_t mtcp, uint32_t cur_ts, - tcp_stream* cur_stream, const struct iphdr* iph, struct tcphdr* tcph, - uint32_t seq, uint32_t ack_seq, int payloadlen, uint16_t window) +static inline void +Handle_TCP_ST_SYN_SENT(mtcp_manager_t mtcp, uint32_t cur_ts, + tcp_stream *cur_stream, const struct iphdr *iph, struct tcphdr *tcph, + uint32_t seq, uint32_t ack_seq, int payloadlen, uint16_t window) { /* when active open */ - if (tcph->ack) { + if (tcph->ack) + { /* filter the unacceptable acks */ - if (TCP_SEQ_LEQ(ack_seq, cur_stream->sndvar->iss) || - TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt)) { - if (!tcph->rst) { - SendTCPPacketStandalone(mtcp, - iph->daddr, tcph->dest, iph->saddr, tcph->source, - ack_seq, 0, 0, TCP_FLAG_RST, NULL, 0, cur_ts, 0); + if (TCP_SEQ_LEQ(ack_seq, cur_stream->sndvar->iss) || + TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt)) + { + if (!tcph->rst) + { + SendTCPPacketStandalone(mtcp, + iph->daddr, tcph->dest, iph->saddr, tcph->source, + ack_seq, 0, 0, TCP_FLAG_RST, NULL, 0, cur_ts, 0); } return; } /* accept the ack */ cur_stream->sndvar->snd_una++; } - - if (tcph->rst) { - if (tcph->ack) { + + if (tcph->rst) + { + if (tcph->ack) + { cur_stream->state = TCP_ST_CLOSE_WAIT; cur_stream->close_reason = TCP_RESET; - if (cur_stream->socket) { + if (cur_stream->socket) + { RaiseErrorEvent(mtcp, cur_stream); - } else { + } + else + { DestroyTCPStream(mtcp, cur_stream); } } return; } - if (tcph->syn) { - if (tcph->ack) { - int ret = HandleActiveOpen(mtcp, - cur_stream, cur_ts, tcph, seq, ack_seq, window); - if (!ret) { + if (tcph->syn) + { + if (tcph->ack) + { + int ret = HandleActiveOpen(mtcp, + cur_stream, cur_ts, tcph, seq, ack_seq, window); + if (!ret) + { return; } - + cur_stream->sndvar->nrtx = 0; cur_stream->rcv_nxt = cur_stream->rcvvar->irs + 1; RemoveFromRTOList(mtcp, cur_stream); cur_stream->state = TCP_ST_ESTABLISHED; TRACE_STATE("Stream %d: TCP_ST_ESTABLISHED\n", cur_stream->id); - if (cur_stream->socket) { + if (cur_stream->socket) + { RaiseWriteEvent(mtcp, cur_stream); - } else { + } + else + { TRACE_STATE("Stream %d: ESTABLISHED, but no socket\n", cur_stream->id); - SendTCPPacketStandalone(mtcp, - iph->daddr, tcph->dest, iph->saddr, tcph->source, - 0, seq + payloadlen + 1, 0, TCP_FLAG_RST | TCP_FLAG_ACK, - NULL, 0, cur_ts, 0); + SendTCPPacketStandalone(mtcp, + iph->daddr, tcph->dest, iph->saddr, tcph->source, + 0, seq + payloadlen + 1, 0, TCP_FLAG_RST | TCP_FLAG_ACK, + NULL, 0, cur_ts, 0); cur_stream->close_reason = TCP_ACTIVE_CLOSE; DestroyTCPStream(mtcp, cur_stream); return; @@ -826,8 +917,9 @@ Handle_TCP_ST_SYN_SENT (mtcp_manager_t mtcp, uint32_t cur_ts, AddtoControlList(mtcp, cur_stream, cur_ts); if (CONFIG.tcp_timeout > 0) AddtoTimeoutList(mtcp, cur_stream); - - } else { + } + else + { cur_stream->state = TCP_ST_SYN_RCVD; TRACE_STATE("Stream %d: TCP_ST_SYN_RCVD\n", cur_stream->id); cur_stream->snd_nxt = cur_stream->sndvar->iss; @@ -836,34 +928,35 @@ Handle_TCP_ST_SYN_SENT (mtcp_manager_t mtcp, uint32_t cur_ts, } } /*----------------------------------------------------------------------------*/ -static inline void -Handle_TCP_ST_SYN_RCVD (mtcp_manager_t mtcp, uint32_t cur_ts, - tcp_stream* cur_stream, struct tcphdr* tcph, uint32_t ack_seq) +static inline void +Handle_TCP_ST_SYN_RCVD(mtcp_manager_t mtcp, uint32_t cur_ts, + tcp_stream *cur_stream, struct tcphdr *tcph, uint32_t ack_seq) { struct tcp_send_vars *sndvar = cur_stream->sndvar; int ret; - if (tcph->ack) { + if (tcph->ack) + { struct tcp_listener *listener; uint32_t prior_cwnd; /* check if ACK of SYN */ - if (ack_seq != sndvar->iss + 1) { + if (ack_seq != sndvar->iss + 1) + { CTRACE_ERROR("Stream %d (TCP_ST_SYN_RCVD): " - "weird ack_seq: %u, iss: %u\n", - cur_stream->id, ack_seq, sndvar->iss); + "weird ack_seq: %u, iss: %u\n", + cur_stream->id, ack_seq, sndvar->iss); TRACE_DBG("Stream %d (TCP_ST_SYN_RCVD): " - "weird ack_seq: %u, iss: %u\n", - cur_stream->id, ack_seq, sndvar->iss); + "weird ack_seq: %u, iss: %u\n", + cur_stream->id, ack_seq, sndvar->iss); return; } sndvar->snd_una++; cur_stream->snd_nxt = ack_seq; prior_cwnd = sndvar->cwnd; - sndvar->cwnd = ((prior_cwnd == 1)? - (sndvar->mss * TCP_INIT_CWND): sndvar->mss); + sndvar->cwnd = ((prior_cwnd == 1) ? (sndvar->mss * TCP_INIT_CWND) : sndvar->mss); TRACE_DBG("sync_recvd: updating cwnd from %u to %u\n", prior_cwnd, sndvar->cwnd); - - //UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); + + // UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); sndvar->nrtx = 0; cur_stream->rcv_nxt = cur_stream->rcvvar->irs + 1; RemoveFromRTOList(mtcp, cur_stream); @@ -875,69 +968,82 @@ Handle_TCP_ST_SYN_RCVD (mtcp_manager_t mtcp, uint32_t cur_ts, listener = (struct tcp_listener *)ListenerHTSearch(mtcp->listeners, &tcph->dest); ret = StreamEnqueue(listener->acceptq, cur_stream); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("Stream %d: Failed to enqueue to " - "the listen backlog!\n", cur_stream->id); + "the listen backlog!\n", + cur_stream->id); cur_stream->close_reason = TCP_NOT_ACCEPTED; cur_stream->state = TCP_ST_CLOSED; TRACE_STATE("Stream %d: TCP_ST_CLOSED\n", cur_stream->id); AddtoControlList(mtcp, cur_stream, cur_ts); } - //TRACE_DBG("Stream %d inserted into acceptq.\n", cur_stream->id); + // TRACE_DBG("Stream %d inserted into acceptq.\n", cur_stream->id); if (CONFIG.tcp_timeout > 0) AddtoTimeoutList(mtcp, cur_stream); /* raise an event to the listening socket */ - if (listener->socket && (listener->socket->epoll & MTCP_EPOLLIN)) { - AddEpollEvent(mtcp->ep, - MTCP_EVENT_QUEUE, listener->socket, MTCP_EPOLLIN); + if (listener->socket && (listener->socket->epoll & MTCP_EPOLLIN)) + { + AddEpollEvent(mtcp->ep, + MTCP_EVENT_QUEUE, listener->socket, MTCP_EPOLLIN); } - - } else { - TRACE_DBG("Stream %d (TCP_ST_SYN_RCVD): No ACK.\n", - cur_stream->id); + } + else + { + TRACE_DBG("Stream %d (TCP_ST_SYN_RCVD): No ACK.\n", + cur_stream->id); /* retransmit SYN/ACK */ cur_stream->snd_nxt = sndvar->iss; AddtoControlList(mtcp, cur_stream, cur_ts); } } /*----------------------------------------------------------------------------*/ -static inline void -Handle_TCP_ST_ESTABLISHED (mtcp_manager_t mtcp, uint32_t cur_ts, - tcp_stream* cur_stream, struct tcphdr* tcph, uint32_t seq, uint32_t ack_seq, - uint8_t *payload, int payloadlen, uint16_t window) +static inline void +Handle_TCP_ST_ESTABLISHED(mtcp_manager_t mtcp, uint32_t cur_ts, + tcp_stream *cur_stream, struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, + uint8_t *payload, int payloadlen, uint16_t window) { - if (tcph->syn) { + if (tcph->syn) + { TRACE_DBG("Stream %d (TCP_ST_ESTABLISHED): weird SYN. " - "seq: %u, expected: %u, ack_seq: %u, expected: %u\n", - cur_stream->id, seq, cur_stream->rcv_nxt, - ack_seq, cur_stream->snd_nxt); + "seq: %u, expected: %u, ack_seq: %u, expected: %u\n", + cur_stream->id, seq, cur_stream->rcv_nxt, + ack_seq, cur_stream->snd_nxt); cur_stream->snd_nxt = ack_seq; AddtoControlList(mtcp, cur_stream, cur_ts); return; } - if (payloadlen > 0) { - if (ProcessTCPPayload(mtcp, cur_stream, - cur_ts, payload, seq, payloadlen)) { + if (payloadlen > 0) + { + if (ProcessTCPPayload(mtcp, cur_stream, + cur_ts, payload, seq, payloadlen)) + { /* if return is TRUE, send ACK */ EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_AGGREGATE); - } else { + } + else + { EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_NOW); } } - - if (tcph->ack) { - if (cur_stream->sndvar->sndbuf) { - ProcessACK(mtcp, cur_stream, cur_ts, - tcph, seq, ack_seq, window, payloadlen); + + if (tcph->ack) + { + if (cur_stream->sndvar->sndbuf) + { + ProcessACK(mtcp, cur_stream, cur_ts, + tcph, seq, ack_seq, window, payloadlen); } } - if (tcph->fin) { + if (tcph->fin) + { /* process the FIN only if the sequence is valid */ /* FIN packet is allowed to push payload (should we check for PSH flag)? */ - if (seq + payloadlen == cur_stream->rcv_nxt) { + if (seq + payloadlen == cur_stream->rcv_nxt) + { cur_stream->state = TCP_ST_CLOSE_WAIT; TRACE_STATE("Stream %d: TCP_ST_CLOSE_WAIT\n", cur_stream->id); cur_stream->rcv_nxt++; @@ -945,56 +1051,65 @@ Handle_TCP_ST_ESTABLISHED (mtcp_manager_t mtcp, uint32_t cur_ts, /* notify FIN to application */ RaiseReadEvent(mtcp, cur_stream); - } else { + } + else + { EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_NOW); return; } } } /*----------------------------------------------------------------------------*/ -static inline void -Handle_TCP_ST_CLOSE_WAIT (mtcp_manager_t mtcp, uint32_t cur_ts, - tcp_stream* cur_stream, struct tcphdr* tcph, uint32_t seq, uint32_t ack_seq, - int payloadlen, uint16_t window) +static inline void +Handle_TCP_ST_CLOSE_WAIT(mtcp_manager_t mtcp, uint32_t cur_ts, + tcp_stream *cur_stream, struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, + int payloadlen, uint16_t window) { - if (TCP_SEQ_LT(seq, cur_stream->rcv_nxt)) { + if (TCP_SEQ_LT(seq, cur_stream->rcv_nxt)) + { TRACE_DBG("Stream %d (TCP_ST_CLOSE_WAIT): " - "weird seq: %u, expected: %u\n", - cur_stream->id, seq, cur_stream->rcv_nxt); + "weird seq: %u, expected: %u\n", + cur_stream->id, seq, cur_stream->rcv_nxt); AddtoControlList(mtcp, cur_stream, cur_ts); return; } - if (cur_stream->sndvar->sndbuf) { - ProcessACK(mtcp, cur_stream, cur_ts, - tcph, seq, ack_seq, window, payloadlen); + if (cur_stream->sndvar->sndbuf) + { + ProcessACK(mtcp, cur_stream, cur_ts, + tcph, seq, ack_seq, window, payloadlen); } } /*----------------------------------------------------------------------------*/ -static inline void -Handle_TCP_ST_LAST_ACK (mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr *iph, - int ip_len, tcp_stream* cur_stream, struct tcphdr* tcph, - uint32_t seq, uint32_t ack_seq, int payloadlen, uint16_t window) +static inline void +Handle_TCP_ST_LAST_ACK(mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr *iph, + int ip_len, tcp_stream *cur_stream, struct tcphdr *tcph, + uint32_t seq, uint32_t ack_seq, int payloadlen, uint16_t window) { - if (TCP_SEQ_LT(seq, cur_stream->rcv_nxt)) { + if (TCP_SEQ_LT(seq, cur_stream->rcv_nxt)) + { TRACE_DBG("Stream %d (TCP_ST_LAST_ACK): " - "weird seq: %u, expected: %u\n", - cur_stream->id, seq, cur_stream->rcv_nxt); + "weird seq: %u, expected: %u\n", + cur_stream->id, seq, cur_stream->rcv_nxt); return; } - if (tcph->ack) { - if (cur_stream->sndvar->sndbuf) { - ProcessACK(mtcp, cur_stream, cur_ts, - tcph, seq, ack_seq, window, payloadlen); + if (tcph->ack) + { + if (cur_stream->sndvar->sndbuf) + { + ProcessACK(mtcp, cur_stream, cur_ts, + tcph, seq, ack_seq, window, payloadlen); } - if (!cur_stream->sndvar->is_fin_sent) { + if (!cur_stream->sndvar->is_fin_sent) + { /* the case that FIN is not sent yet */ /* this is not ack for FIN, ignore */ TRACE_DBG("Stream %d (TCP_ST_LAST_ACK): " - "No FIN sent yet.\n", cur_stream->id); + "No FIN sent yet.\n", + cur_stream->id); #ifdef DBGMSG DumpIPPacket(mtcp, iph, ip_len); #endif @@ -1006,93 +1121,112 @@ Handle_TCP_ST_LAST_ACK (mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr } /* check if ACK of FIN */ - if (ack_seq == cur_stream->sndvar->fss + 1) { + if (ack_seq == cur_stream->sndvar->fss + 1) + { cur_stream->sndvar->snd_una++; UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); cur_stream->state = TCP_ST_CLOSED; cur_stream->close_reason = TCP_PASSIVE_CLOSE; - TRACE_STATE("Stream %d: TCP_ST_CLOSED\n", - cur_stream->id); + TRACE_STATE("Stream %d: TCP_ST_CLOSED\n", + cur_stream->id); DestroyTCPStream(mtcp, cur_stream); - } else { + } + else + { TRACE_DBG("Stream %d (TCP_ST_LAST_ACK): Not ACK of FIN. " - "ack_seq: %u, expected: %u\n", - cur_stream->id, ack_seq, cur_stream->sndvar->fss + 1); - //cur_stream->snd_nxt = cur_stream->sndvar->fss; + "ack_seq: %u, expected: %u\n", + cur_stream->id, ack_seq, cur_stream->sndvar->fss + 1); + // cur_stream->snd_nxt = cur_stream->sndvar->fss; AddtoControlList(mtcp, cur_stream, cur_ts); } - } else { - CTRACE_ERROR("Stream %d (TCP_ST_LAST_ACK): No ACK\n", - cur_stream->id); - //cur_stream->snd_nxt = cur_stream->sndvar->fss; + } + else + { + CTRACE_ERROR("Stream %d (TCP_ST_LAST_ACK): No ACK\n", + cur_stream->id); + // cur_stream->snd_nxt = cur_stream->sndvar->fss; AddtoControlList(mtcp, cur_stream, cur_ts); } } /*----------------------------------------------------------------------------*/ -static inline void -Handle_TCP_ST_FIN_WAIT_1 (mtcp_manager_t mtcp, uint32_t cur_ts, - tcp_stream* cur_stream, struct tcphdr* tcph, uint32_t seq, uint32_t ack_seq, - uint8_t *payload, int payloadlen, uint16_t window) +static inline void +Handle_TCP_ST_FIN_WAIT_1(mtcp_manager_t mtcp, uint32_t cur_ts, + tcp_stream *cur_stream, struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, + uint8_t *payload, int payloadlen, uint16_t window) { - if (TCP_SEQ_LT(seq, cur_stream->rcv_nxt)) { + if (TCP_SEQ_LT(seq, cur_stream->rcv_nxt)) + { TRACE_DBG("Stream %d (TCP_ST_LAST_ACK): " - "weird seq: %u, expected: %u\n", - cur_stream->id, seq, cur_stream->rcv_nxt); + "weird seq: %u, expected: %u\n", + cur_stream->id, seq, cur_stream->rcv_nxt); AddtoControlList(mtcp, cur_stream, cur_ts); return; } - if (tcph->ack) { - if (cur_stream->sndvar->sndbuf) { - ProcessACK(mtcp, cur_stream, cur_ts, - tcph, seq, ack_seq, window, payloadlen); + if (tcph->ack) + { + if (cur_stream->sndvar->sndbuf) + { + ProcessACK(mtcp, cur_stream, cur_ts, + tcph, seq, ack_seq, window, payloadlen); } - if (cur_stream->sndvar->is_fin_sent && - ack_seq == cur_stream->sndvar->fss + 1) { + if (cur_stream->sndvar->is_fin_sent && + ack_seq == cur_stream->sndvar->fss + 1) + { cur_stream->sndvar->snd_una = ack_seq; - if (TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt)) { - TRACE_DBG("Stream %d: update snd_nxt to %u\n", - cur_stream->id, ack_seq); + if (TCP_SEQ_GT(ack_seq, cur_stream->snd_nxt)) + { + TRACE_DBG("Stream %d: update snd_nxt to %u\n", + cur_stream->id, ack_seq); cur_stream->snd_nxt = ack_seq; } - //cur_stream->sndvar->snd_una++; - //UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); + // cur_stream->sndvar->snd_una++; + // UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); cur_stream->sndvar->nrtx = 0; RemoveFromRTOList(mtcp, cur_stream); cur_stream->state = TCP_ST_FIN_WAIT_2; - TRACE_STATE("Stream %d: TCP_ST_FIN_WAIT_2\n", - cur_stream->id); + TRACE_STATE("Stream %d: TCP_ST_FIN_WAIT_2\n", + cur_stream->id); } - - } else { - TRACE_DBG("Stream %d: does not contain an ack!\n", - cur_stream->id); + } + else + { + TRACE_DBG("Stream %d: does not contain an ack!\n", + cur_stream->id); return; } - if (payloadlen > 0) { - if (ProcessTCPPayload(mtcp, cur_stream, - cur_ts, payload, seq, payloadlen)) { + if (payloadlen > 0) + { + if (ProcessTCPPayload(mtcp, cur_stream, + cur_ts, payload, seq, payloadlen)) + { /* if return is TRUE, send ACK */ EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_AGGREGATE); - } else { + } + else + { EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_NOW); } } - if (tcph->fin) { + if (tcph->fin) + { /* process the FIN only if the sequence is valid */ /* FIN packet is allowed to push payload (should we check for PSH flag)? */ - if (seq + payloadlen == cur_stream->rcv_nxt) { + if (seq + payloadlen == cur_stream->rcv_nxt) + { cur_stream->rcv_nxt++; - if (cur_stream->state == TCP_ST_FIN_WAIT_1) { + if (cur_stream->state == TCP_ST_FIN_WAIT_1) + { cur_stream->state = TCP_ST_CLOSING; TRACE_STATE("Stream %d: TCP_ST_CLOSING\n", cur_stream->id); - - } else if (cur_stream->state == TCP_ST_FIN_WAIT_2) { + } + else if (cur_stream->state == TCP_ST_FIN_WAIT_2) + { cur_stream->state = TCP_ST_TIME_WAIT; TRACE_STATE("Stream %d: TCP_ST_TIME_WAIT\n", cur_stream->id); AddtoTimewaitList(mtcp, cur_stream, cur_ts); @@ -1102,36 +1236,46 @@ Handle_TCP_ST_FIN_WAIT_1 (mtcp_manager_t mtcp, uint32_t cur_ts, } } /*----------------------------------------------------------------------------*/ -static inline void -Handle_TCP_ST_FIN_WAIT_2 (mtcp_manager_t mtcp, uint32_t cur_ts, - tcp_stream* cur_stream, struct tcphdr* tcph, uint32_t seq, uint32_t ack_seq, - uint8_t *payload, int payloadlen, uint16_t window) +static inline void +Handle_TCP_ST_FIN_WAIT_2(mtcp_manager_t mtcp, uint32_t cur_ts, + tcp_stream *cur_stream, struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, + uint8_t *payload, int payloadlen, uint16_t window) { - if (tcph->ack) { - if (cur_stream->sndvar->sndbuf) { - ProcessACK(mtcp, cur_stream, cur_ts, - tcph, seq, ack_seq, window, payloadlen); + if (tcph->ack) + { + if (cur_stream->sndvar->sndbuf) + { + ProcessACK(mtcp, cur_stream, cur_ts, + tcph, seq, ack_seq, window, payloadlen); } - } else { - TRACE_DBG("Stream %d: does not contain an ack!\n", - cur_stream->id); + } + else + { + TRACE_DBG("Stream %d: does not contain an ack!\n", + cur_stream->id); return; } - if (payloadlen > 0) { - if (ProcessTCPPayload(mtcp, cur_stream, - cur_ts, payload, seq, payloadlen)) { + if (payloadlen > 0) + { + if (ProcessTCPPayload(mtcp, cur_stream, + cur_ts, payload, seq, payloadlen)) + { /* if return is TRUE, send ACK */ EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_AGGREGATE); - } else { + } + else + { EnqueueACK(mtcp, cur_stream, cur_ts, ACK_OPT_NOW); } } - if (tcph->fin) { + if (tcph->fin) + { /* process the FIN only if the sequence is valid */ /* FIN packet is allowed to push payload (should we check for PSH flag)? */ - if (seq + payloadlen == cur_stream->rcv_nxt) { + if (seq + payloadlen == cur_stream->rcv_nxt) + { cur_stream->state = TCP_ST_TIME_WAIT; cur_stream->rcv_nxt++; TRACE_STATE("Stream %d: TCP_ST_TIME_WAIT\n", cur_stream->id); @@ -1150,28 +1294,33 @@ Handle_TCP_ST_FIN_WAIT_2 (mtcp_manager_t mtcp, uint32_t cur_ts, #endif #endif } - } /*----------------------------------------------------------------------------*/ static inline void -Handle_TCP_ST_CLOSING (mtcp_manager_t mtcp, uint32_t cur_ts, - tcp_stream* cur_stream, struct tcphdr* tcph, uint32_t seq, uint32_t ack_seq, - int payloadlen, uint16_t window) { - - if (tcph->ack) { - if (cur_stream->sndvar->sndbuf) { - ProcessACK(mtcp, cur_stream, cur_ts, - tcph, seq, ack_seq, window, payloadlen); +Handle_TCP_ST_CLOSING(mtcp_manager_t mtcp, uint32_t cur_ts, + tcp_stream *cur_stream, struct tcphdr *tcph, uint32_t seq, uint32_t ack_seq, + int payloadlen, uint16_t window) +{ + + if (tcph->ack) + { + if (cur_stream->sndvar->sndbuf) + { + ProcessACK(mtcp, cur_stream, cur_ts, + tcph, seq, ack_seq, window, payloadlen); } - if (!cur_stream->sndvar->is_fin_sent) { + if (!cur_stream->sndvar->is_fin_sent) + { TRACE_DBG("Stream %d (TCP_ST_CLOSING): " - "No FIN sent yet.\n", cur_stream->id); + "No FIN sent yet.\n", + cur_stream->id); return; } // check if ACK of FIN - if (ack_seq != cur_stream->sndvar->fss + 1) { + if (ack_seq != cur_stream->sndvar->fss + 1) + { #if 0 CTRACE_ERROR("Stream %d (TCP_ST_CLOSING): Not ACK of FIN. " "ack_seq: %u, snd_nxt: %u, snd_una: %u, fss: %u\n", @@ -1180,44 +1329,44 @@ Handle_TCP_ST_CLOSING (mtcp_manager_t mtcp, uint32_t cur_ts, DumpIPPacketToFile(stderr, iph, ip_len); DumpStream(mtcp, cur_stream); #endif - //assert(0); + // assert(0); /* if the packet is not the ACK of FIN, ignore */ return; } - + cur_stream->sndvar->snd_una = ack_seq; cur_stream->snd_nxt = ack_seq; UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); cur_stream->state = TCP_ST_TIME_WAIT; TRACE_STATE("Stream %d: TCP_ST_TIME_WAIT\n", cur_stream->id); - - AddtoTimewaitList(mtcp, cur_stream, cur_ts); - } else { - CTRACE_ERROR("Stream %d (TCP_ST_CLOSING): Not ACK\n", - cur_stream->id); + AddtoTimewaitList(mtcp, cur_stream, cur_ts); + } + else + { + CTRACE_ERROR("Stream %d (TCP_ST_CLOSING): Not ACK\n", + cur_stream->id); return; } } /*----------------------------------------------------------------------------*/ -int -ProcessTCPPacket(mtcp_manager_t mtcp, - uint32_t cur_ts, const int ifidx, const struct iphdr *iph, int ip_len) +int ProcessTCPPacket(mtcp_manager_t mtcp, + uint32_t cur_ts, const int ifidx, const struct iphdr *iph, int ip_len) { - struct tcphdr* tcph = (struct tcphdr *) ((u_char *)iph + (iph->ihl << 2)); - uint8_t *payload = (uint8_t *)tcph + (tcph->doff << 2); + struct tcphdr *tcph = (struct tcphdr *)((u_char *)iph + (iph->ihl << 2)); + uint8_t *payload = (uint8_t *)tcph + (tcph->doff << 2); int payloadlen = ip_len - (payload - (u_char *)iph); tcp_stream s_stream; tcp_stream *cur_stream = NULL; uint32_t seq = ntohl(tcph->seq); uint32_t ack_seq = ntohl(tcph->ack_seq); uint16_t window = ntohs(tcph->window); - //uint16_t check; - // int ret; - // int rc = -1; + // uint16_t check; + // int ret; + // int rc = -1; - /* Check ip packet invalidation */ + /* Check ip packet invalidation */ if (ip_len < ((iph->ihl + tcph->doff) << 2)) return ERROR; @@ -1225,15 +1374,16 @@ ProcessTCPPacket(mtcp_manager_t mtcp, #ifndef DISABLE_HWCSUM if (mtcp->iom->dev_ioctl != NULL) rc = mtcp->iom->dev_ioctl(mtcp->ctx, ifidx, - PKT_RX_TCP_CSUM, NULL); + PKT_RX_TCP_CSUM, NULL); #endif - if (rc == -1) { - check = TCPCalcChecksum((uint16_t *)tcph, - (tcph->doff << 2) + payloadlen, iph->saddr, iph->daddr); - if (check) { - TRACE_ERROR("Checksum Error: Original: 0x%04x, calculated: 0x%04x\n", - tcph->check, TCPCalcChecksum((uint16_t *)tcph, - (tcph->doff << 2) + payloadlen, iph->saddr, iph->daddr)); + if (rc == -1) + { + check = TCPCalcChecksum((uint16_t *)tcph, + (tcph->doff << 2) + payloadlen, iph->saddr, iph->daddr); + if (check) + { + TRACE_ERROR("Checksum Error: Original: 0x%04x, calculated: 0x%04x\n", + tcph->check, TCPCalcChecksum((uint16_t *)tcph, (tcph->doff << 2) + payloadlen, iph->saddr, iph->daddr)); tcph->check = 0; return ERROR; } @@ -1249,22 +1399,25 @@ ProcessTCPPacket(mtcp_manager_t mtcp, s_stream.daddr = iph->saddr; s_stream.dport = tcph->source; - if (!(cur_stream = StreamHTSearch(mtcp->tcp_flow_table, &s_stream))) { + if (!(cur_stream = StreamHTSearch(mtcp->tcp_flow_table, &s_stream))) + { /* not found in flow table */ TRACE_ERROR("not found in flow table\n"); - cur_stream = CreateNewFlowHTEntry(mtcp, cur_ts, iph, ip_len, tcph, - seq, ack_seq, payloadlen, window); + cur_stream = CreateNewFlowHTEntry(mtcp, cur_ts, iph, ip_len, tcph, + seq, ack_seq, payloadlen, window); if (!cur_stream) return TRUE; } /* Validate sequence. if not valid, ignore the packet */ - if (cur_stream->state > TCP_ST_SYN_RCVD) { - int ret = ValidateSequence(mtcp, cur_stream, - cur_ts, tcph, seq, ack_seq, payloadlen); - if (!ret) { + if (cur_stream->state > TCP_ST_SYN_RCVD) + { + int ret = ValidateSequence(mtcp, cur_stream, + cur_ts, tcph, seq, ack_seq, payloadlen); + if (!ret) + { TRACE_ERROR("Stream %d: Unexpected sequence: %u, expected: %u\n", - cur_stream->id, seq, cur_stream->rcv_nxt); + cur_stream->id, seq, cur_stream->rcv_nxt); #ifdef DBGMSG DumpIPPacket(mtcp, iph, ip_len); #endif @@ -1276,86 +1429,96 @@ ProcessTCPPacket(mtcp_manager_t mtcp, } /* Update receive window size */ - if (tcph->syn) { + if (tcph->syn) + { cur_stream->sndvar->peer_wnd = window; - } else { - cur_stream->sndvar->peer_wnd = - (uint32_t)window << cur_stream->sndvar->wscale_peer; } - + else + { + cur_stream->sndvar->peer_wnd = + (uint32_t)window << cur_stream->sndvar->wscale_peer; + } + cur_stream->last_active_ts = cur_ts; UpdateTimeoutList(mtcp, cur_stream); /* Process RST: process here only if state > TCP_ST_SYN_SENT */ - if (tcph->rst) { + if (tcph->rst) + { TRACE_ERROR("RST packet Received!!! \n"); cur_stream->have_reset = TRUE; - if (cur_stream->state > TCP_ST_SYN_SENT) { - if (ProcessRST(mtcp, cur_stream, ack_seq)) { + if (cur_stream->state > TCP_ST_SYN_SENT) + { + if (ProcessRST(mtcp, cur_stream, ack_seq)) + { return TRUE; } } } - switch (cur_stream->state) { + switch (cur_stream->state) + { // based on current state , process packets case TCP_ST_LISTEN: Handle_TCP_ST_LISTEN(mtcp, cur_ts, cur_stream, tcph); break; case TCP_ST_SYN_SENT: - Handle_TCP_ST_SYN_SENT(mtcp, cur_ts, cur_stream, iph, tcph, - seq, ack_seq, payloadlen, window); + Handle_TCP_ST_SYN_SENT(mtcp, cur_ts, cur_stream, iph, tcph, + seq, ack_seq, payloadlen, window); break; case TCP_ST_SYN_RCVD: /* SYN retransmit implies our SYN/ACK was lost. Resend */ if (tcph->syn && seq == cur_stream->rcvvar->irs) Handle_TCP_ST_LISTEN(mtcp, cur_ts, cur_stream, tcph); - else { + else + { Handle_TCP_ST_SYN_RCVD(mtcp, cur_ts, cur_stream, tcph, ack_seq); - if (payloadlen > 0 && cur_stream->state == TCP_ST_ESTABLISHED) { + if (payloadlen > 0 && cur_stream->state == TCP_ST_ESTABLISHED) + { Handle_TCP_ST_ESTABLISHED(mtcp, cur_ts, cur_stream, tcph, - seq, ack_seq, payload, - payloadlen, window); + seq, ack_seq, payload, + payloadlen, window); } } break; case TCP_ST_ESTABLISHED: - Handle_TCP_ST_ESTABLISHED(mtcp, cur_ts, cur_stream, tcph, - seq, ack_seq, payload, payloadlen, window); + Handle_TCP_ST_ESTABLISHED(mtcp, cur_ts, cur_stream, tcph, + seq, ack_seq, payload, payloadlen, window); break; case TCP_ST_CLOSE_WAIT: Handle_TCP_ST_CLOSE_WAIT(mtcp, cur_ts, cur_stream, tcph, seq, ack_seq, - payloadlen, window); + payloadlen, window); break; case TCP_ST_LAST_ACK: - Handle_TCP_ST_LAST_ACK(mtcp, cur_ts, iph, ip_len, cur_stream, tcph, - seq, ack_seq, payloadlen, window); + Handle_TCP_ST_LAST_ACK(mtcp, cur_ts, iph, ip_len, cur_stream, tcph, + seq, ack_seq, payloadlen, window); break; - + case TCP_ST_FIN_WAIT_1: Handle_TCP_ST_FIN_WAIT_1(mtcp, cur_ts, cur_stream, tcph, seq, ack_seq, - payload, payloadlen, window); + payload, payloadlen, window); break; case TCP_ST_FIN_WAIT_2: - Handle_TCP_ST_FIN_WAIT_2(mtcp, cur_ts, cur_stream, tcph, seq, ack_seq, - payload, payloadlen, window); + Handle_TCP_ST_FIN_WAIT_2(mtcp, cur_ts, cur_stream, tcph, seq, ack_seq, + payload, payloadlen, window); break; case TCP_ST_CLOSING: Handle_TCP_ST_CLOSING(mtcp, cur_ts, cur_stream, tcph, seq, ack_seq, - payloadlen, window); + payloadlen, window); break; case TCP_ST_TIME_WAIT: - /* the only thing that can arrive in this state is a retransmission + /* the only thing that can arrive in this state is a retransmission of the remote FIN. Acknowledge it, and restart the 2 MSL timeout */ - if (cur_stream->on_timewait_list) { + if (cur_stream->on_timewait_list) + { RemoveFromTimewaitList(mtcp, cur_stream); AddtoTimewaitList(mtcp, cur_stream, cur_ts); } @@ -1364,7 +1527,6 @@ ProcessTCPPacket(mtcp_manager_t mtcp, case TCP_ST_CLOSED: break; - } return TRUE; From c082b49ef25432af41e3d79aefa38f91dfcb14a4 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 11 Sep 2025 08:04:40 +0000 Subject: [PATCH 03/11] Solved issues with big file transfer Problem Found: - pcap_dispatch was bottleneck(since handle was opened for blocking I/O , mtcp thread was never returned from pcap_dipatch) Solved: - set pcap handle as non blocking mode Can observe stable 100MB file tranfer between server and client --- mtcp/src/core.c | 37 ++++++++++++++++++------------------- mtcp/src/pcap_module.c | 13 +++++++++---- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/mtcp/src/core.c b/mtcp/src/core.c index 479ec876b..b1b6bbf95 100644 --- a/mtcp/src/core.c +++ b/mtcp/src/core.c @@ -497,36 +497,34 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) } /*************************************************** */ - if (ep->mtcp_queue->num_events > 0) + + while (mtcpq->num_events > 0 && usrq->num_events < usrq->size) { - /* while mtcp_queue have events */ - /* and usr_queue is not full */ - while (mtcpq->num_events > 0 && usrq->num_events < usrq->size) - { - /* copy the event from mtcp_queue to usr_queue */ - usrq->events[usrq->end++] = mtcpq->events[mtcpq->start++]; + /* copy the event from mtcp_queue to usr_queue */ + usrq->events[usrq->end++] = mtcpq->events[mtcpq->start++]; - if (usrq->end >= usrq->size) - usrq->end = 0; - usrq->num_events++; + if (usrq->end >= usrq->size) + usrq->end = 0; + usrq->num_events++; - if (mtcpq->start >= mtcpq->size) - mtcpq->start = 0; - mtcpq->num_events--; - } + if (mtcpq->start >= mtcpq->size) + mtcpq->start = 0; + mtcpq->num_events--; } /* if there are pending events, wake up user */ - if (ep->waiting && (ep->usr_queue->num_events > 0 || - ep->usr_shadow_queue->num_events > 0)) + // if (ep->waiting && (ep->usr_queue->num_events > 0 || + // ep->usr_shadow_queue->num_events > 0)) + if (usrq->num_events > 0 || ep->usr_shadow_queue->num_events > 0) { STAT_COUNT(mtcp->runstat.rounds_epoll); TRACE_EPOLL("Broadcasting events. num: %d, cur_ts: %u, prev_ts: %u\n", ep->usr_queue->num_events, cur_ts, mtcp->ts_last_event); mtcp->ts_last_event = cur_ts; ep->stat.wakes++; + printf("[FlushEpollEvents] MTCP_THREAD: Try to Wake Up application thread\n\n"); pthread_cond_signal(&ep->epoll_cond); - TRACE_ERROR("MTCP_THREAD: Wake Up application thread\n\n"); + printf("[FlushEpollEvents] MTCP_THREAD: Waked Up application thread\n\n"); } pthread_mutex_unlock(&ep->epoll_lock); } @@ -847,6 +845,7 @@ DestroyRemainingFlows(mtcp_manager_t mtcp) static void InterruptApplication(mtcp_manager_t mtcp) { + printf("[InterruptApplication] Interrupting application\n"); int i; struct tcp_listener *listener = NULL; @@ -856,6 +855,7 @@ InterruptApplication(mtcp_manager_t mtcp) pthread_mutex_lock(&mtcp->ep->epoll_lock); if (mtcp->ep->waiting) { + printf("[FlushEpollEvents] signaling app thread!\n"); pthread_cond_signal(&mtcp->ep->epoll_cond); } pthread_mutex_unlock(&mtcp->ep->epoll_lock); @@ -957,7 +957,7 @@ RunMainLoop(struct mtcp_thread_context *ctx) } unsigned char *dummy = 0; int dummy_len = 0; - mtcp->iom->release_pkt(ctx, rx_inf, dummy,dummy_len); + mtcp->iom->release_pkt(ctx, rx_inf, dummy, dummy_len); /* if epoll is in use, flush all the queued events */ if (mtcp->ep) { @@ -1001,7 +1001,6 @@ RunMainLoop(struct mtcp_thread_context *ctx) } } - TRACE_ERROR("while loop ended: done %d, flow_cnt %d, exit %d\n", ctx->done, mtcp->flow_cnt, ctx->exit); diff --git a/mtcp/src/pcap_module.c b/mtcp/src/pcap_module.c index bdeefdb78..75dc73049 100644 --- a/mtcp/src/pcap_module.c +++ b/mtcp/src/pcap_module.c @@ -81,6 +81,7 @@ void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) TRACE_ERROR("pcap_set_timeout failed\n"); if (pcap_set_buffer_size(temp, BUF_SIZE) != 0) TRACE_ERROR("pcap_set_buffer_size failed\n"); + pcap_setnonblock(temp, 1, errbuf); if (pcap_activate(temp) < 0) { @@ -227,12 +228,15 @@ pcap_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) { TRACE_ERROR("ENTER PCAP_RECV_PKTS\n"); struct pcap_private_context *ppc = ctxt->io_private_context; + printf("pcap_rev_pkts: num_pkts_in_chunk=%d\n", ppc->num_pkts_in_chunk); + // for (int i = 0; i < ppc->num_pkts_in_chunk; i++) // { - // if (ppc->hdrs[i]) - // free(ppc->hdrs[i]); - // if (ppc->pkts[i]) - // free((void *)ppc->pkts[i]); + // if(!ppc->hdrs[i]) + // printf("hdrs[%d] is NULL\n",i); + // if(!ppc->pkts[i]) + // printf("pkts[%d] is NULL\n",i); + // printf(" pkt %d: len=%u caplen=%u\n", i,ppc->hdrs[i]->caplen); // } ppc->num_pkts_in_chunk = 0; int ret = pcap_dispatch(ppc->handle, CHUNK_SIZE, pcap_packet_handler, (u_char *)ppc); @@ -248,6 +252,7 @@ pcap_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) { printf("timeout expired on live caputure\n"); } + TRACE_ERROR("QUITTING PCAP_RECV_PKTS\n"); return ppc->num_pkts_in_chunk; } /*----------------------------------------------------------------------------*/ From 76e5555d648f0f601d630eae171ca77eff62a2c3 Mon Sep 17 00:00:00 2001 From: Dojin Date: Mon, 15 Sep 2025 08:10:58 +0000 Subject: [PATCH 04/11] moving file to stream 11 and rapids4 --- .buildtest_pcap.sh | 13 + Makefile.in | 40 +- aclocal.m4 | 79 +- apps/example/config/arp.conf | 2 + apps/example/epserver.conf | 4 +- apps/example/epwget.c | 547 +- apps/example/epwget.conf | 14 +- apps/example/run_client.sh | 2 +- apps/example/run_client2.sh | 1 + apps/example/run_client3.sh | 1 + apps/example/run_client4.sh | 1 + apps/example/run_client5.sh | 1 + apps/example/run_multiple_client.sh | 14 + apps/example/run_wget.sh | 1 + apps/example/sample_client.c | 20 +- apps/example/sample_server.c | 138 + apps/example/www_home/generate_random_txt.c | 29 + compile | 6 +- config.guess | 1674 ++- config.h.in | 18 +- config.h.in~ | 174 + config.sub | 2631 ++-- configure | 4800 ++++--- configure~ | 13316 ++++++++++++++++++ dpdk | 1 - install-sh | 161 +- mtcp/src/api.c | 1 + mtcp/src/core.c | 1 - mtcp/src/dpdk_module.c | 520 +- mtcp/src/eth_out.c | 1 + mtcp/src/eventpoll.c | 30 +- mtcp/src/include/logger.h | 3 +- mtcp/src/include/mtcp.h | 3 +- mtcp/src/include/tcp_send_buffer.h | 1 + mtcp/src/include/tcp_stream.h | 2 +- mtcp/src/logger.c | 2 +- mtcp/src/make_files.sh | 12 + mtcp/src/memory_mgt.c | 2 +- mtcp/src/pcap_module.c | 74 +- mtcp/src/tcp_in.c | 191 +- mtcp/src/tcp_out.c | 15 +- mtcp/src/tcp_send_buffer.c | 114 +- mtcp/src/tcp_stream.c | 539 +- setup_mtcp_dpdk_env.sh | 2 +- 44 files changed, 20051 insertions(+), 5150 deletions(-) create mode 100644 .buildtest_pcap.sh create mode 100644 apps/example/config/arp.conf create mode 100755 apps/example/run_client2.sh create mode 100755 apps/example/run_client3.sh create mode 100755 apps/example/run_client4.sh create mode 100755 apps/example/run_client5.sh create mode 100644 apps/example/run_multiple_client.sh create mode 100755 apps/example/run_wget.sh create mode 100644 apps/example/sample_server.c create mode 100644 apps/example/www_home/generate_random_txt.c create mode 100644 config.h.in~ create mode 100755 configure~ delete mode 160000 dpdk create mode 100755 mtcp/src/make_files.sh diff --git a/.buildtest_pcap.sh b/.buildtest_pcap.sh new file mode 100644 index 000000000..94c501734 --- /dev/null +++ b/.buildtest_pcap.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +export PSIO_TARGET=`echo $PWD`/io_engine +export MTCP_TARGET=`echo $PWD`/mtcp +autoreconf -ivf +./configure --with-psio-lib=`echo $PWD`/io_engine +make +cd apps/lighttpd-1.4.32/ +autoreconf -ivf +./configure --without-bzip2 CFLAGS="-g -O3" --with-libmtcp=$MTCP_TARGET --with-libpsio=$PSIO_TARGET +make +cd ../apache_benchmark +./configure --with-libmtcp=$MTCP_TARGET --with-libpsio=$PSIO_TARGET +make diff --git a/Makefile.in b/Makefile.in index 0398b8e55..ec67e13e9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.1 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2018 Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -85,6 +85,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac @@ -134,8 +136,8 @@ am__recursive_targets = \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -152,9 +154,6 @@ am__define_uniq_tagged_files = \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/apps/example/Makefile.in \ @@ -201,6 +200,8 @@ am__relativize = \ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -217,8 +218,9 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CCP = @CCP@ CFLAGS = @CFLAGS@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ @@ -229,6 +231,7 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ ENFORCE_RX_IDLE = @ENFORCE_RX_IDLE@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ GREP = @GREP@ HWCSUM = @HWCSUM@ @@ -256,6 +259,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PCAP = @PCAP@ +PCAPLIBPATH = @PCAPLIBPATH@ PSIO = @PSIO@ PSLIBPATH = @PSLIBPATH@ RANLIB = @RANLIB@ @@ -275,14 +280,22 @@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ +build = @build@ build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +host = @host@ host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ @@ -477,7 +490,6 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files - distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am @@ -561,6 +573,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -603,6 +619,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -618,7 +636,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -779,7 +797,7 @@ uninstall-am: am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-generic distclean-hdr \ + dist-zstd distcheck distclean distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ diff --git a/aclocal.m4 b/aclocal.m4 index 8c6b78f9d..2154e6ddb 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.5 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -14,13 +14,13 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.1], [], +m4_if([$1], [1.16.5], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.1])dnl +[AM_AUTOMAKE_VERSION([1.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -141,7 +141,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -332,7 +332,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -371,7 +371,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi @@ -398,7 +400,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -426,6 +428,10 @@ m4_defn([AC_PROG_CC]) # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl +m4_ifdef([_$0_ALREADY_INIT], + [m4_fatal([$0 expanded multiple times +]m4_defn([_$0_ALREADY_INIT]))], + [m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -462,7 +468,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl @@ -514,6 +520,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi +AC_SUBST([CTAGS]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi +AC_SUBST([CSCOPE]) + AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This @@ -595,7 +615,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -616,7 +636,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2018 Free Software Foundation, Inc. +# Copyright (C) 2003-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -637,7 +657,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -680,7 +700,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2018 Free Software Foundation, Inc. +# Copyright (C) 1997-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -701,12 +721,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -719,7 +734,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -748,7 +763,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -795,7 +810,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -814,7 +829,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -895,7 +910,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2009-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -955,7 +970,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2018 Free Software Foundation, Inc. +# Copyright (C) 2001-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -983,7 +998,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1002,7 +1017,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2018 Free Software Foundation, Inc. +# Copyright (C) 2004-2021 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/apps/example/config/arp.conf b/apps/example/config/arp.conf new file mode 100644 index 000000000..d46666fef --- /dev/null +++ b/apps/example/config/arp.conf @@ -0,0 +1,2 @@ +ARP_ENTRY 1 +10.200.1.1/24 a6:78:a7:5c:74:8f \ No newline at end of file diff --git a/apps/example/epserver.conf b/apps/example/epserver.conf index 5bae61791..7a9435022 100644 --- a/apps/example/epserver.conf +++ b/apps/example/epserver.conf @@ -66,10 +66,10 @@ port = veth_host #max_num_buffers = 10000 # Receive buffer size of sockets; if not set: rcvbuf = sndbuf -rcvbuf = 8192 +rcvbuf = 131072 # Send buffer size of sockets; if not set: sndbuf = rcvbuf -sndbuf = 8192 +sndbuf = 131072 # if sndbuf & rcvbuf not set: sndbuf = rcvbuf = 8192 diff --git a/apps/example/epwget.c b/apps/example/epwget.c index 56e73c25e..eed2f1b40 100644 --- a/apps/example/epwget.c +++ b/apps/example/epwget.c @@ -26,21 +26,21 @@ #include "debug.h" #define MAX_URL_LEN 128 -#define FILE_LEN 128 -#define FILE_IDX 10 +#define FILE_LEN 128 +#define FILE_IDX 10 #define MAX_FILE_LEN (FILE_LEN + FILE_IDX) #define HTTP_HEADER_LEN 1024 #define IP_RANGE 1 #define MAX_IP_STR_LEN 16 -#define BUF_SIZE (8*1024) +#define BUF_SIZE (8 * 1024) #define CALC_MD5SUM FALSE -#define TIMEVAL_TO_MSEC(t) ((t.tv_sec * 1000) + (t.tv_usec / 1000)) -#define TIMEVAL_TO_USEC(t) ((t.tv_sec * 1000000) + (t.tv_usec)) -#define TS_GT(a,b) ((int64_t)((a)-(b)) > 0) +#define TIMEVAL_TO_MSEC(t) ((t.tv_sec * 1000) + (t.tv_usec / 1000)) +#define TIMEVAL_TO_USEC(t) ((t.tv_sec * 1000000) + (t.tv_usec)) +#define TS_GT(a, b) ((int64_t)((a) - (b)) > 0) #ifndef TRUE #define TRUE (1) @@ -55,7 +55,7 @@ #endif #ifndef MAX_CPUS -#define MAX_CPUS 16 +#define MAX_CPUS 16 #endif /*----------------------------------------------------------------------------*/ static pthread_t app_thread[MAX_CPUS]; @@ -114,7 +114,7 @@ struct thread_context struct wget_stat stat; }; -typedef struct thread_context* thread_context_t; +typedef struct thread_context *thread_context_t; /*----------------------------------------------------------------------------*/ struct wget_vars { @@ -130,20 +130,21 @@ struct wget_vars struct timeval t_start; struct timeval t_end; - + int fd; }; /*----------------------------------------------------------------------------*/ static struct thread_context *g_ctx[MAX_CPUS] = {0}; static struct wget_stat *g_stat[MAX_CPUS] = {0}; /*----------------------------------------------------------------------------*/ -thread_context_t +thread_context_t CreateContext(int core) { thread_context_t ctx; ctx = (thread_context_t)calloc(1, sizeof(struct thread_context)); - if (!ctx) { + if (!ctx) + { perror("malloc"); TRACE_ERROR("Failed to allocate memory for thread context.\n"); return NULL; @@ -151,7 +152,8 @@ CreateContext(int core) ctx->core = core; ctx->mctx = mtcp_create_context(core); - if (!ctx->mctx) { + if (!ctx->mctx) + { TRACE_ERROR("Failed to create mtcp context.\n"); free(ctx); return NULL; @@ -161,15 +163,14 @@ CreateContext(int core) return ctx; } /*----------------------------------------------------------------------------*/ -void -DestroyContext(thread_context_t ctx) +void DestroyContext(thread_context_t ctx) { g_stat[ctx->core] = NULL; mtcp_destroy_context(ctx->mctx); free(ctx); } /*----------------------------------------------------------------------------*/ -static inline int +static inline int CreateConnection(thread_context_t ctx) { mctx_t mctx = ctx->mctx; @@ -179,13 +180,26 @@ CreateConnection(thread_context_t ctx) int ret; sockid = mtcp_socket(mctx, AF_INET, SOCK_STREAM, 0); - if (sockid < 0) { + if (sockid < 0) + { TRACE_INFO("Failed to create socket!\n"); return -1; } + + struct sockaddr_in src_addr; + src_addr.sin_family = AF_INET; + src_addr.sin_addr.s_addr = saddr; // 10.200.1.2 + src_addr.sin_port = 0; + + if (mtcp_bind(mctx, sockid, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) + { + perror("mtcp_bind"); + } + memset(&ctx->wvars[sockid], 0, sizeof(struct wget_vars)); ret = mtcp_setsock_nonblock(mctx, sockid); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("Failed to set socket in nonblocking mode.\n"); exit(-1); } @@ -193,11 +207,13 @@ CreateConnection(thread_context_t ctx) addr.sin_family = AF_INET; addr.sin_addr.s_addr = daddr; addr.sin_port = dport; - - ret = mtcp_connect(mctx, sockid, - (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); - if (ret < 0) { - if (errno != EINPROGRESS) { + + ret = mtcp_connect(mctx, sockid, + (struct sockaddr *)&addr, sizeof(struct sockaddr_in)); + if (ret < 0) + { + if (errno != EINPROGRESS) + { perror("mtcp_connect"); mtcp_close(mctx, sockid); return -1; @@ -215,7 +231,7 @@ CreateConnection(thread_context_t ctx) return sockid; } /*----------------------------------------------------------------------------*/ -static inline void +static inline void CloseConnection(thread_context_t ctx, int sockid) { mtcp_epoll_ctl(ctx->mctx, ctx->ep, MTCP_EPOLL_CTL_DEL, sockid, NULL); @@ -223,15 +239,17 @@ CloseConnection(thread_context_t ctx, int sockid) ctx->pending--; ctx->done++; assert(ctx->pending >= 0); - while (ctx->pending < concurrency && ctx->started < ctx->target) { - if (CreateConnection(ctx) < 0) { + while (ctx->pending < concurrency && ctx->started < ctx->target) + { + if (CreateConnection(ctx) < 0) + { done[ctx->core] = TRUE; break; } } } /*----------------------------------------------------------------------------*/ -static inline int +static inline int SendHTTPRequest(thread_context_t ctx, int sockid, struct wget_vars *wv) { char request[HTTP_HEADER_LEN]; @@ -244,18 +262,20 @@ SendHTTPRequest(thread_context_t ctx, int sockid, struct wget_vars *wv) wv->header_len = wv->file_len = 0; snprintf(request, HTTP_HEADER_LEN, "GET %s HTTP/1.0\r\n" - "User-Agent: Wget/1.12 (linux-gnu)\r\n" - "Accept: */*\r\n" - "Host: %s\r\n" -// "Connection: Keep-Alive\r\n\r\n", - "Connection: Close\r\n\r\n", - url, host); + "User-Agent: Wget/1.12 (linux-gnu)\r\n" + "Accept: */*\r\n" + "Host: %s\r\n" + // "Connection: Keep-Alive\r\n\r\n", + "Connection: Close\r\n\r\n", + url, host); len = strlen(request); wr = mtcp_write(ctx->mctx, sockid, request, len); - if (wr < len) { + if (wr < len) + { TRACE_ERROR("Socket %d: Sending HTTP request failed. " - "try: %d, sent: %d\n", sockid, len, wr); + "try: %d, sent: %d\n", + sockid, len, wr); } ctx->stat.writes += wr; TRACE_APP("Socket %d HTTP Request of %d bytes. sent.\n", sockid, wr); @@ -268,10 +288,12 @@ SendHTTPRequest(thread_context_t ctx, int sockid, struct wget_vars *wv) gettimeofday(&wv->t_start, NULL); char fname[MAX_FILE_LEN + 1]; - if (fio) { + if (fio) + { snprintf(fname, MAX_FILE_LEN, "%s.%d", outfile, flowcnt++); wv->fd = open(fname, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (wv->fd < 0) { + if (wv->fd < 0) + { TRACE_APP("Failed to open file descriptor for %s\n", fname); exit(1); } @@ -280,7 +302,7 @@ SendHTTPRequest(thread_context_t ctx, int sockid, struct wget_vars *wv) return 0; } /*----------------------------------------------------------------------------*/ -static inline int +static inline int DownloadComplete(thread_context_t ctx, int sockid, struct wget_vars *wv) { #ifdef APP @@ -292,23 +314,28 @@ DownloadComplete(thread_context_t ctx, int sockid, struct wget_vars *wv) gettimeofday(&wv->t_end, NULL); CloseConnection(ctx, sockid); ctx->stat.completes++; - if (response_size == 0) { + if (response_size == 0) + { response_size = wv->recv; fprintf(stderr, "Response size set to %lu\n", response_size); - } else { - if (wv->recv != response_size) { - fprintf(stderr, "Response size mismatch! mine: %lu, theirs: %lu\n", + } + else + { + if (wv->recv != response_size) + { + fprintf(stderr, "Response size mismatch! mine: %lu, theirs: %lu\n", wv->recv, response_size); } } - tdiff = (wv->t_end.tv_sec - wv->t_start.tv_sec) * 1000000 + + tdiff = (wv->t_end.tv_sec - wv->t_start.tv_sec) * 1000000 + (wv->t_end.tv_usec - wv->t_start.tv_usec); - TRACE_APP("Socket %d Total received bytes: %lu (%luMB)\n", - sockid, wv->recv, wv->recv / 1000000); + TRACE_APP("Socket %d Total received bytes: %lu (%luMB)\n", + sockid, wv->recv, wv->recv / 1000000); TRACE_APP("Socket %d Total spent time: %lu us\n", sockid, tdiff); - if (tdiff > 0) { - TRACE_APP("Socket %d Average bandwidth: %lf[MB/s]\n", - sockid, (double)wv->recv / tdiff); + if (tdiff > 0) + { + TRACE_APP("Socket %d Average bandwidth: %lf[MB/s]\n", + sockid, (double)wv->recv / tdiff); } ctx->stat.sum_resp_time += tdiff; if (tdiff > ctx->stat.max_resp_time) @@ -323,129 +350,106 @@ DownloadComplete(thread_context_t ctx, int sockid, struct wget_vars *wv) static inline int HandleReadEvent(thread_context_t ctx, int sockid, struct wget_vars *wv) { - mctx_t mctx = ctx->mctx; - char buf[BUF_SIZE]; - char *pbuf; - int rd, copy_len; - - rd = 1; - while (rd > 0) { - rd = mtcp_read(mctx, sockid, buf, BUF_SIZE); - if (rd <= 0) - break; - ctx->stat.reads += rd; - - TRACE_APP("Socket %d: mtcp_read ret: %d, total_recv: %lu, " - "header_set: %d, header_len: %u, file_len: %lu\n", - sockid, rd, wv->recv + rd, - wv->headerset, wv->header_len, wv->file_len); - - pbuf = buf; - if (!wv->headerset) { - copy_len = MIN(rd, HTTP_HEADER_LEN - wv->resp_len); - memcpy(wv->response + wv->resp_len, buf, copy_len); - wv->resp_len += copy_len; - wv->header_len = find_http_header(wv->response, wv->resp_len); - if (wv->header_len > 0) { - wv->response[wv->header_len] = '\0'; - wv->file_len = http_header_long_val(wv->response, - CONTENT_LENGTH_HDR, sizeof(CONTENT_LENGTH_HDR) - 1); - if (wv->file_len < 0) { - /* failed to find the Content-Length field */ - wv->recv += rd; - rd = 0; - CloseConnection(ctx, sockid); - return 0; - } - - TRACE_APP("Socket %d Parsed response header. " - "Header length: %u, File length: %lu (%luMB)\n", - sockid, wv->header_len, - wv->file_len, wv->file_len / 1024 / 1024); - wv->headerset = TRUE; - wv->recv += (rd - (wv->resp_len - wv->header_len)); - - pbuf += (rd - (wv->resp_len - wv->header_len)); - rd = (wv->resp_len - wv->header_len); - //printf("Successfully parse header.\n"); - //fflush(stdout); - - } else { - /* failed to parse response header */ -#if 0 - printf("[CPU %d] Socket %d Failed to parse response header." - " Data: \n%s\n", ctx->core, sockid, wv->response); - fflush(stdout); -#endif - wv->recv += rd; - rd = 0; - ctx->stat.errors++; - ctx->errors++; - CloseConnection(ctx, sockid); - return 0; - } - //pbuf += wv->header_len; - //wv->recv += wv->header_len; - //rd -= wv->header_len; - } - wv->recv += rd; - - if (fio && wv->fd > 0) { - int wr = 0; - while (wr < rd) { - int _wr = write(wv->fd, pbuf + wr, rd - wr); - assert (_wr == rd - wr); - if (_wr < 0) { - perror("write"); - TRACE_ERROR("Failed to write.\n"); - assert(0); - break; - } - wr += _wr; - wv->write += _wr; - } - } - - if (wv->header_len && (wv->recv >= wv->header_len + wv->file_len)) { - break; - } - } - - if (rd > 0) { - if (wv->header_len && (wv->recv >= wv->header_len + wv->file_len)) { - TRACE_APP("Socket %d Done Write: " - "header: %u file: %lu recv: %lu write: %lu\n", - sockid, wv->header_len, wv->file_len, - wv->recv - wv->header_len, wv->write); - DownloadComplete(ctx, sockid, wv); - - return 0; - } - - } else if (rd == 0) { - /* connection closed by remote host */ - TRACE_DBG("Socket %d connection closed with server.\n", sockid); - - if (wv->header_len && (wv->recv >= wv->header_len + wv->file_len)) { - DownloadComplete(ctx, sockid, wv); - } else { - ctx->stat.errors++; - ctx->incompletes++; - CloseConnection(ctx, sockid); - } + mctx_t mctx = ctx->mctx; + char buf[BUF_SIZE]; + int rd; + + while (1) { + rd = mtcp_read(mctx, sockid, buf, BUF_SIZE); + if (rd <= 0) + break; + + ctx->stat.reads += rd; + + if (!wv->headerset) { + /* Look for end of header in this buffer */ + char *hdr_end = strstr(buf, "\r\n\r\n"); + if (hdr_end) { + int header_len_in_buf = (hdr_end - buf) + 4; + /* Copy header into wv->response for parsing */ + int copy_len = MIN(header_len_in_buf, HTTP_HEADER_LEN - wv->resp_len); + memcpy(wv->response + wv->resp_len, buf, copy_len); + wv->resp_len += copy_len; + wv->response[wv->resp_len] = '\0'; + + /* Parse Content-Length */ + wv->file_len = http_header_long_val( + wv->response, + CONTENT_LENGTH_HDR, + sizeof(CONTENT_LENGTH_HDR)-1); + if (wv->file_len < 0) { + CloseConnection(ctx, sockid); + return 0; + } + + TRACE_APP("Socket %d Parsed header len %d, file len %lu\n", + sockid, wv->resp_len, wv->file_len); + + wv->headerset = TRUE; + wv->header_len = wv->resp_len; + + /* Leftover body starts after header in this buf */ + int body_bytes = rd - header_len_in_buf; + if (body_bytes > 0) { + char *body_start = buf + header_len_in_buf; + if (fio && wv->fd > 0) { + int wr = write(wv->fd, body_start, body_bytes); + if (wr != body_bytes) { + perror("write"); + CloseConnection(ctx, sockid); + return -1; + } + wv->write += wr; + } + wv->recv += body_bytes; + } + } else { + /* Header not finished yet, just accumulate */ + int copy_len = MIN(rd, HTTP_HEADER_LEN - wv->resp_len); + memcpy(wv->response + wv->resp_len, buf, copy_len); + wv->resp_len += copy_len; + } + } else { + /* Header already parsed → everything is body */ + if (fio && wv->fd > 0) { + int wr = write(wv->fd, buf, rd); + if (wr != rd) { + perror("write"); + CloseConnection(ctx, sockid); + return -1; + } + wv->write += wr; + } + wv->recv += rd; + } + + /* Completion check */ + if (wv->headerset && wv->recv >= wv->file_len) { + DownloadComplete(ctx, sockid, wv); + return 0; + } + } + + if (rd == 0) { + if (wv->headerset && wv->recv >= wv->file_len) { + DownloadComplete(ctx, sockid, wv); + } else { + ctx->stat.errors++; + ctx->incompletes++; + CloseConnection(ctx, sockid); + } + } else if (rd < 0 && errno != EAGAIN) { + TRACE_DBG("Socket %d: mtcp_read() error %s\n", + sockid, strerror(errno)); + ctx->stat.errors++; + ctx->errors++; + CloseConnection(ctx, sockid); + } + + return 0; +} - } else if (rd < 0) { - if (errno != EAGAIN) { - TRACE_DBG("Socket %d: mtcp_read() error %s\n", - sockid, strerror(errno)); - ctx->stat.errors++; - ctx->errors++; - CloseConnection(ctx, sockid); - } - } - return 0; -} /*----------------------------------------------------------------------------*/ #if 0 void @@ -477,7 +481,7 @@ PrintStats() } #endif /*----------------------------------------------------------------------------*/ -static void +static void PrintStats() { struct wget_stat total = {0}; @@ -486,11 +490,13 @@ PrintStats() uint64_t total_resp_time = 0; int i; - for (i = 0; i < core_limit; i++) { + for (i = 0; i < core_limit; i++) + { st = g_stat[i]; - if (st == NULL) continue; - avg_resp_time = st->completes? st->sum_resp_time / st->completes : 0; + if (st == NULL) + continue; + avg_resp_time = st->completes ? st->sum_resp_time / st->completes : 0; #if 0 fprintf(stderr, "[CPU%2d] epoll_wait: %5lu, event: %7lu, " "connect: %7lu, read: %4lu MB, write: %4lu MB, " @@ -514,12 +520,12 @@ PrintStats() total.errors += st->errors; total.timedout += st->timedout; - memset(st, 0, sizeof(struct wget_stat)); + memset(st, 0, sizeof(struct wget_stat)); } fprintf(stderr, "[ ALL ] connect: %7lu, read: %4lu MB, write: %4lu MB, " - "completes: %7lu (resp_time avg: %4lu, max: %6lu us)\n", - total.connects, - total.reads / 1024 / 1024, total.writes / 1024 / 1024, + "completes: %7lu (resp_time avg: %4lu, max: %6lu us)\n", + total.connects, + total.reads / 1024 / 1024, total.writes / 1024 / 1024, total.completes, total_resp_time / core_limit, total.max_resp_time); #if 0 fprintf(stderr, "[ ALL ] epoll_wait: %5lu, event: %7lu, " @@ -548,12 +554,13 @@ RunWgetMain(void *arg) int i; struct timeval cur_tv, prev_tv; - //uint64_t cur_ts, prev_ts; + // uint64_t cur_ts, prev_ts; mtcp_core_affinitize(core); ctx = CreateContext(core); - if (!ctx) { + if (!ctx) + { return NULL; } mctx = ctx->mctx; @@ -564,7 +571,8 @@ RunWgetMain(void *arg) mtcp_init_rss(mctx, saddr, IP_RANGE, daddr, dport); n = flows[core]; - if (n == 0) { + if (n == 0) + { TRACE_DBG("Application thread %d finished.\n", core); pthread_exit(NULL); return NULL; @@ -572,26 +580,29 @@ RunWgetMain(void *arg) ctx->target = n; daddr_in.s_addr = daddr; - fprintf(stderr, "Thread %d handles %d flows. connecting to %s:%u\n", + fprintf(stderr, "Thread %d handles %d flows. connecting to %s:%u\n", core, n, inet_ntoa(daddr_in), ntohs(dport)); /* Initialization */ maxevents = max_fds * 3; ep = mtcp_epoll_create(mctx, maxevents); - if (ep < 0) { + if (ep < 0) + { TRACE_ERROR("Failed to create epoll struct!n"); exit(EXIT_FAILURE); } events = (struct mtcp_epoll_event *) - calloc(maxevents, sizeof(struct mtcp_epoll_event)); - if (!events) { + calloc(maxevents, sizeof(struct mtcp_epoll_event)); + if (!events) + { TRACE_ERROR("Failed to allocate events!\n"); exit(EXIT_FAILURE); } ctx->ep = ep; wvars = (struct wget_vars *)calloc(max_fds, sizeof(struct wget_vars)); - if (!wvars) { + if (!wvars) + { TRACE_ERROR("Failed to create wget variables!\n"); exit(EXIT_FAILURE); } @@ -601,21 +612,25 @@ RunWgetMain(void *arg) ctx->errors = ctx->incompletes = 0; gettimeofday(&cur_tv, NULL); - //prev_ts = TIMEVAL_TO_USEC(cur_tv); + // prev_ts = TIMEVAL_TO_USEC(cur_tv); prev_tv = cur_tv; - while (!done[core]) { + while (!done[core]) + { gettimeofday(&cur_tv, NULL); - //cur_ts = TIMEVAL_TO_USEC(cur_tv); + // cur_ts = TIMEVAL_TO_USEC(cur_tv); /* print statistics every second */ - if (core == 0 && cur_tv.tv_sec > prev_tv.tv_sec) { - PrintStats(); + if (core == 0 && cur_tv.tv_sec > prev_tv.tv_sec) + { + PrintStats(); prev_tv = cur_tv; } - while (ctx->pending < concurrency && ctx->started < ctx->target) { - if (CreateConnection(ctx) < 0) { + while (ctx->pending < concurrency && ctx->started < ctx->target) + { + if (CreateConnection(ctx) < 0) + { done[core] = TRUE; break; } @@ -623,57 +638,71 @@ RunWgetMain(void *arg) nevents = mtcp_epoll_wait(mctx, ep, events, maxevents, -1); ctx->stat.waits++; - - if (nevents < 0) { - if (errno != EINTR) { + + if (nevents < 0) + { + if (errno != EINTR) + { TRACE_ERROR("mtcp_epoll_wait failed! ret: %d\n", nevents); } done[core] = TRUE; break; - } else { + } + else + { ctx->stat.events += nevents; } - for (i = 0; i < nevents; i++) { + for (i = 0; i < nevents; i++) + { - if (events[i].events & MTCP_EPOLLERR) { + if (events[i].events & MTCP_EPOLLERR) + { int err; socklen_t len = sizeof(err); - TRACE_APP("[CPU %d] Error on socket %d\n", - core, events[i].data.sockid); + TRACE_APP("[CPU %d] Error on socket %d\n", + core, events[i].data.sockid); ctx->stat.errors++; ctx->errors++; - if (mtcp_getsockopt(mctx, events[i].data.sockid, - SOL_SOCKET, SO_ERROR, (void *)&err, &len) == 0) { + if (mtcp_getsockopt(mctx, events[i].data.sockid, + SOL_SOCKET, SO_ERROR, (void *)&err, &len) == 0) + { if (err == ETIMEDOUT) ctx->stat.timedout++; } CloseConnection(ctx, events[i].data.sockid); - - } else if (events[i].events & MTCP_EPOLLIN) { - HandleReadEvent(ctx, - events[i].data.sockid, &wvars[events[i].data.sockid]); - - } else if (events[i].events == MTCP_EPOLLOUT) { + } + else if (events[i].events & MTCP_EPOLLIN) + { + HandleReadEvent(ctx, + events[i].data.sockid, &wvars[events[i].data.sockid]); + } + else if (events[i].events == MTCP_EPOLLOUT) + { struct wget_vars *wv = &wvars[events[i].data.sockid]; - if (!wv->request_sent) { + if (!wv->request_sent) + { SendHTTPRequest(ctx, events[i].data.sockid, wv); - } else { - //TRACE_DBG("Request already sent.\n"); } - - } else { - TRACE_ERROR("Socket %d: event: %s\n", - events[i].data.sockid, EventToString(events[i].events)); + else + { + // TRACE_DBG("Request already sent.\n"); + } + } + else + { + TRACE_ERROR("Socket %d: event: %s\n", + events[i].data.sockid, EventToString(events[i].events)); assert(0); } } - if (ctx->done >= ctx->target) { + if (ctx->done >= ctx->target) + { fprintf(stdout, "[CPU %d] Completed %d connections, " - "errors: %d incompletes: %d\n", + "errors: %d incompletes: %d\n", ctx->core, ctx->done, ctx->errors, ctx->incompletes); break; } @@ -687,18 +716,17 @@ RunWgetMain(void *arg) return NULL; } /*----------------------------------------------------------------------------*/ -void -SignalHandler(int signum) +void SignalHandler(int signum) { int i; - for (i = 0; i < core_limit; i++) { + for (i = 0; i < core_limit; i++) + { done[i] = TRUE; } } /*----------------------------------------------------------------------------*/ -int -main(int argc, char **argv) +int main(int argc, char **argv) { struct mtcp_conf mcfg; char *conf_file; @@ -710,22 +738,27 @@ main(int argc, char **argv) int i, o; int process_cpu; - if (argc < 3) { + if (argc < 3) + { TRACE_CONFIG("Too few arguments!\n"); TRACE_CONFIG("Usage: %s url #flows [output]\n", argv[0]); return FALSE; } - if (strlen(argv[1]) > MAX_URL_LEN) { + if (strlen(argv[1]) > MAX_URL_LEN) + { TRACE_CONFIG("Length of URL should be smaller than %d!\n", MAX_URL_LEN); return FALSE; } - char* slash_p = strchr(argv[1], '/'); - if (slash_p) { + char *slash_p = strchr(argv[1], '/'); + if (slash_p) + { strncpy(host, argv[1], slash_p - argv[1]); strncpy(url, strchr(argv[1], '/'), MAX_URL_LEN); - } else { + } + else + { strncpy(host, argv[1], MAX_IP_STR_LEN); strncpy(url, "/", 2); } @@ -733,11 +766,12 @@ main(int argc, char **argv) conf_file = NULL; process_cpu = -1; daddr = inet_addr(host); - dport = htons(80); - saddr = INADDR_ANY; + dport = htons(8080); + saddr = inet_addr("10.200.1.2"); total_flows = mystrtol(argv[2], 10); - if (total_flows <= 0) { + if (total_flows <= 0) + { TRACE_CONFIG("Number of flows should be large than 0.\n"); return FALSE; } @@ -746,20 +780,26 @@ main(int argc, char **argv) core_limit = num_cores; concurrency = 100; - while (-1 != (o = getopt(argc, argv, "N:c:o:n:f:"))) { - switch(o) { + while (-1 != (o = getopt(argc, argv, "N:c:o:n:f:"))) + { + switch (o) + { case 'N': core_limit = mystrtol(optarg, 10); - if (core_limit > num_cores) { + if (core_limit > num_cores) + { TRACE_CONFIG("CPU limit should be smaller than the " - "number of CPUS: %d\n", num_cores); + "number of CPUS: %d\n", + num_cores); return FALSE; - } else if (core_limit < 1) { + } + else if (core_limit < 1) + { TRACE_CONFIG("CPU limit should be greater than 0\n"); return FALSE; } - /** - * it is important that core limit is set + /** + * it is important that core limit is set * before mtcp_init() is called. You can * not set core_limit after mtcp_init() */ @@ -771,9 +811,10 @@ main(int argc, char **argv) total_concurrency = mystrtol(optarg, 10); break; case 'o': - if (strlen(optarg) > MAX_FILE_LEN) { - TRACE_CONFIG("Output file length should be smaller than %d!\n", - MAX_FILE_LEN); + if (strlen(optarg) > MAX_FILE_LEN) + { + TRACE_CONFIG("Output file length should be smaller than %d!\n", + MAX_FILE_LEN); return FALSE; } fio = TRUE; @@ -781,7 +822,8 @@ main(int argc, char **argv) break; case 'n': process_cpu = mystrtol(optarg, 10); - if (process_cpu > core_limit) { + if (process_cpu > core_limit) + { TRACE_CONFIG("Starting CPU is way off limits!\n"); return FALSE; } @@ -792,7 +834,8 @@ main(int argc, char **argv) } } - if (total_flows < core_limit) { + if (total_flows < core_limit) + { core_limit = total_flows; } @@ -808,17 +851,20 @@ main(int argc, char **argv) TRACE_CONFIG("# of total_flows: %d\n", total_flows); TRACE_CONFIG("# of cores: %d\n", core_limit); TRACE_CONFIG("Concurrency: %d\n", total_concurrency); - if (fio) { + if (fio) + { TRACE_CONFIG("Output file: %s\n", outfile); } - if (conf_file == NULL) { + if (conf_file == NULL) + { TRACE_ERROR("mTCP configuration file is not set!\n"); exit(EXIT_FAILURE); } - + ret = mtcp_init(conf_file); - if (ret) { + if (ret) + { TRACE_ERROR("Failed to initialize mtcp.\n"); exit(EXIT_FAILURE); } @@ -831,7 +877,8 @@ main(int argc, char **argv) flow_per_thread = total_flows / core_limit; flow_remainder_cnt = total_flows % core_limit; - for (i = ((process_cpu == -1) ? 0 : process_cpu); i < core_limit; i++) { + for (i = ((process_cpu == -1) ? 0 : process_cpu); i < core_limit; i++) + { cores[i] = i; done[i] = FALSE; flows[i] = flow_per_thread; @@ -842,8 +889,9 @@ main(int argc, char **argv) if (flows[i] == 0) continue; - if (pthread_create(&app_thread[i], - NULL, RunWgetMain, (void *)&cores[i])) { + if (pthread_create(&app_thread[i], + NULL, RunWgetMain, (void *)&cores[i])) + { perror("pthread_create"); TRACE_ERROR("Failed to create wget thread.\n"); exit(-1); @@ -853,7 +901,8 @@ main(int argc, char **argv) break; } - for (i = ((process_cpu == -1) ? 0 : process_cpu); i < core_limit; i++) { + for (i = ((process_cpu == -1) ? 0 : process_cpu); i < core_limit; i++) + { pthread_join(app_thread[i], NULL); TRACE_INFO("Wget thread %d joined.\n", i); diff --git a/apps/example/epwget.conf b/apps/example/epwget.conf index b425ad97d..4908b6b06 100644 --- a/apps/example/epwget.conf +++ b/apps/example/epwget.conf @@ -5,8 +5,8 @@ #io = psio #io = onvm #io = netmap -io = dpdk - +#io = dpdk +io = pcap # No. of cores setting (enabling this option will override # the `cpu' config for those applications that accept # num_cores as command line arguments) @@ -14,10 +14,10 @@ io = dpdk # e.g. in case ./epwget is executed with `-N 4', the # mtcp core will still invoke 8 mTCP threads if the # following line is uncommented. -#num_cores = 8 +num_cores = 1 # Number of memory channels per processor socket (dpdk-only) -num_mem_ch = 4 +#num_mem_ch = 4 #--- ONVM specific args ---# # Service id (required) @@ -39,10 +39,10 @@ num_mem_ch = 4 #port = xge0 xge1 #port = xge1 #------ DPDK ports -------# -port = dpdk0 +#port = dpdk0 #port = dpdk1 #port = dpdk0 dpdk1 - +port = veth_client # Enable multi-process support #multiprocess = 1 @@ -79,7 +79,7 @@ tcp_timewait = 0 #stat_print = xge0 #stat_print = xge1 #------ DPDK ports -------# -stat_print = dpdk0 +#stat_print = dpdk0 #stat_print = dpdk0 dpdk1 ####################################################### diff --git a/apps/example/run_client.sh b/apps/example/run_client.sh index 58d4999f8..910e99c7b 100755 --- a/apps/example/run_client.sh +++ b/apps/example/run_client.sh @@ -1 +1 @@ -sudo ip netns exec ns_client ./sample_client \ No newline at end of file +sudo ip netns exec ns_client ./sample_client 1 \ No newline at end of file diff --git a/apps/example/run_client2.sh b/apps/example/run_client2.sh new file mode 100755 index 000000000..bfeb9a2fc --- /dev/null +++ b/apps/example/run_client2.sh @@ -0,0 +1 @@ +sudo ip netns exec ns_client ./sample_client 2 \ No newline at end of file diff --git a/apps/example/run_client3.sh b/apps/example/run_client3.sh new file mode 100755 index 000000000..8451111a0 --- /dev/null +++ b/apps/example/run_client3.sh @@ -0,0 +1 @@ +sudo ip netns exec ns_client ./sample_client 3 \ No newline at end of file diff --git a/apps/example/run_client4.sh b/apps/example/run_client4.sh new file mode 100755 index 000000000..71bcb9319 --- /dev/null +++ b/apps/example/run_client4.sh @@ -0,0 +1 @@ +sudo ip netns exec ns_client ./sample_client 4 \ No newline at end of file diff --git a/apps/example/run_client5.sh b/apps/example/run_client5.sh new file mode 100755 index 000000000..b938f94bf --- /dev/null +++ b/apps/example/run_client5.sh @@ -0,0 +1 @@ +sudo ip netns exec ns_client ./sample_client 5 \ No newline at end of file diff --git a/apps/example/run_multiple_client.sh b/apps/example/run_multiple_client.sh new file mode 100644 index 000000000..f87da95dc --- /dev/null +++ b/apps/example/run_multiple_client.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Run 5 clients in background, each fetching a different file +for i in {1..5}; do + FILE="${i}" + ( + echo "[Client $i] Starting with file $FILE ..." + sudo ip netns exec ns_client ./sample_client "$FILE" & + ) +done + +# Wait for all clients to finish +wait +echo "All clients finished." \ No newline at end of file diff --git a/apps/example/run_wget.sh b/apps/example/run_wget.sh new file mode 100755 index 000000000..e36515822 --- /dev/null +++ b/apps/example/run_wget.sh @@ -0,0 +1 @@ +sudo ip netns exec ns_client ./epwget 10.200.1.1/random_100MB_1.txt 1 -N 1 -c 1 -o output.txt -f epwget.conf \ No newline at end of file diff --git a/apps/example/sample_client.c b/apps/example/sample_client.c index 8b119d0b1..b623f0999 100644 --- a/apps/example/sample_client.c +++ b/apps/example/sample_client.c @@ -6,15 +6,15 @@ #define SERVER_IP "10.200.1.1" // server IP #define SERVER_PORT 8080 -#define BUF_SIZE (64*1024) +#define BUF_SIZE (64 * 1024) -int main() +int main(int argc, char *argv[]) { int sock; struct sockaddr_in serv_addr; char buffer[BUF_SIZE]; int n; - + char *file_name = "random_100MB"; // default file name // create socket if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { @@ -46,9 +46,11 @@ int main() } // send HTTP GET - //char *req = "GET /random_10MB.txt HTTP/1.0\r\nHost: 10.200.1.1\r\n\r\n"; - char *req = "GET /random_100MB.txt HTTP/1.0\r\nHost: 10.200.1.1\r\n\r\n"; - + // char *req = "GET /random_10MB.txt HTTP/1.0\r\nHost: 10.200.1.1\r\n\r\n"; + // char *req = "GET /random_100MB.txt HTTP/1.0\r\nHost: 10.200.1.1\r\n\r\n"; + char req[1024]; + snprintf(req, sizeof(req), "GET /%s_%s.txt HTTP/1.0\r\nHost: %s\r\n\r\n", file_name, argv[1], SERVER_IP); + printf("Request:\n%s", req); if (write(sock, req, strlen(req)) < 0) { perror("write"); @@ -57,7 +59,11 @@ int main() } // open output file - FILE *fp = fopen("downloaded.txt", "wb"); + char down[1024]; + char *downloading_file_name = "downloaded_100MB"; + snprintf(down, sizeof(down), "%s_%s.txt", downloading_file_name, argv[1]); + fprintf(stderr,"Saving to file: %s\n", down); + FILE *fp = fopen(down, "wb"); if (!fp) { perror("fopen"); diff --git a/apps/example/sample_server.c b/apps/example/sample_server.c new file mode 100644 index 000000000..8126d5167 --- /dev/null +++ b/apps/example/sample_server.c @@ -0,0 +1,138 @@ +// sample_server.c +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SERVER_PORT 8080 +#define BACKLOG 128 +#define BUF_SIZE 8192 + +static int running = 1; + +void handle_sigint(int sig) { + running = 0; +} + +// Thread to handle each client +void *client_thread(void *arg) { + int client_fd = *(int *)arg; + free(arg); + + char buf[BUF_SIZE]; + ssize_t n = read(client_fd, buf, sizeof(buf) - 1); + if (n <= 0) { + close(client_fd); + return NULL; + } + buf[n] = '\0'; + printf("=== Request ===\n%s\n", buf); + + // Extract file name from "GET /file" + char filename[256] = {0}; + sscanf(buf, "GET /%255s", filename); + if (strlen(filename) == 0) { + strcpy(filename, "index.html"); + } + + // Try to open requested file + int fd = open(filename, O_RDONLY); + if (fd < 0) { + const char *resp404 = + "HTTP/1.0 404 Not Found\r\n" + "Content-Length: 0\r\n" + "Connection: Close\r\n\r\n"; + write(client_fd, resp404, strlen(resp404)); + close(client_fd); + return NULL; + } + + struct stat st; + fstat(fd, &st); + + // Send HTTP response header + char header[512]; + int header_len = snprintf(header, sizeof(header), + "HTTP/1.0 200 OK\r\n" + "Content-Length: %ld\r\n" + "Connection: Close\r\n\r\n", st.st_size); + write(client_fd, header, header_len); + + // Send file contents + ssize_t r; + while ((r = read(fd, buf, sizeof(buf))) > 0) { + ssize_t sent = 0; + while (sent < r) { + ssize_t w = write(client_fd, buf + sent, r - sent); + if (w < 0) { + perror("write"); + break; + } + sent += w; + } + } + close(fd); + close(client_fd); + printf("Finished serving %s\n", filename); + return NULL; +} + +int main() { + signal(SIGINT, handle_sigint); + + int server_fd = socket(AF_INET, SOCK_STREAM, 0); + if (server_fd < 0) { + perror("socket"); + exit(1); + } + + int opt = 1; + setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + + struct sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_port = htons(SERVER_PORT); + addr.sin_addr.s_addr = inet_addr("10.200.1.1"); + + if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { + perror("bind"); + exit(1); + } + + if (listen(server_fd, BACKLOG) < 0) { + perror("listen"); + exit(1); + } + + printf("Linux TCP server running on port %d\n", SERVER_PORT); + + while (running) { + struct sockaddr_in client_addr; + socklen_t len = sizeof(client_addr); + int *client_fd = malloc(sizeof(int)); + *client_fd = accept(server_fd, (struct sockaddr *)&client_addr, &len); + printf("Accepted connection from %s:%d\n", + inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port)); + if (*client_fd < 0) { + if (errno == EINTR) break; // interrupted by SIGINT + perror("accept"); + continue; + } + + pthread_t tid; + pthread_create(&tid, NULL, client_thread, client_fd); + pthread_detach(tid); + } + + close(server_fd); + printf("Server shutting down\n"); + return 0; +} diff --git a/apps/example/www_home/generate_random_txt.c b/apps/example/www_home/generate_random_txt.c new file mode 100644 index 000000000..32410a6fd --- /dev/null +++ b/apps/example/www_home/generate_random_txt.c @@ -0,0 +1,29 @@ +#include +#include +#include + +int main() +{ + FILE *fp = fopen("random_1GB.txt", "w"); + if (!fp) + { + perror("fopen"); + return 1; + } + + const char charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + size_t charset_size = sizeof(charset) - 1; // exclude null terminator + const size_t target_size = 1024 * 1024 * 1024; // 1 GB + + srand((unsigned)time(NULL)); + + for (size_t i = 0; i < target_size; i++) + { + char c = charset[rand() % charset_size]; + fputc(c, fp); + } + + fclose(fp); + printf("Generated random_1GB.txt with random alphabets.\n"); + return 0; +} diff --git a/compile b/compile index 99e50524b..df363c8fb 100755 --- a/compile +++ b/compile @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2018 Free Software Foundation, Inc. +# Copyright (C) 1999-2021 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff --git a/config.guess b/config.guess index b79252d6b..7f76b6228 100755 --- a/config.guess +++ b/config.guess @@ -1,12 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. -timestamp='2013-06-10' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-01-09' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -15,7 +17,7 @@ timestamp='2013-06-10' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -24,12 +26,20 @@ timestamp='2013-06-10' # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` @@ -39,7 +49,7 @@ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -50,7 +60,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,7 +94,8 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 +# Just in case it came from the environment. +GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -96,66 +107,90 @@ trap 'exit 1' 1 2 15 # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "${UNAME_SYSTEM}" in +case $UNAME_SYSTEM in Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu + LIBC=unknown - eval $set_cc_for_build - cat <<-EOF > $dummy.c + set_cc_for_build + cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc - #else + #elif defined(__GLIBC__) LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi ;; esac # Note: order is significant - the case branches are not exclusive. -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -167,22 +202,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -197,45 +242,80 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in os=netbsd ;; esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in + case $UNAME_VERSION in Debian*) release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -249,163 +329,158 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in + case $ALPHA_CPU_TYPE in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" + set_cc_for_build + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in sun3) - echo m68k-sun-sunos${UNAME_RELEASE} + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos${UNAME_RELEASE} + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -415,44 +490,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { @@ -461,95 +536,96 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux${UNAME_RELEASE} + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs${UNAME_RELEASE} + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux${UNAME_RELEASE} + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then + if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #include main() @@ -560,76 +636,77 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=rs6000-ibm-aix3.2 fi - exit ;; + ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then + if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include @@ -662,13 +739,13 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if test "$HP_ARCH" = hppa2.0w then - eval $set_cc_for_build + set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -679,23 +756,23 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #include int main () @@ -720,38 +797,38 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo ${UNAME_MACHINE}-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -759,139 +836,148 @@ EOF fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in + case $UNAME_PROCESSOR in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case $UNAME_MACHINE in x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; @@ -901,172 +987,226 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) - eval $set_cc_for_build + set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el + MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} + MIPS_ENDIAN= #else - CPU= + MIPS_ENDIAN= #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; + GUESS=powerpc64le-unknown-linux-$LIBC + ;; ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI=${LIBC}x32 + fi + fi + GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; + GUESS=i386-sequent-sysv4 + ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi - exit ;; + ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in @@ -1074,12 +1214,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1089,43 +1229,43 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo ${UNAME_MACHINE}-pc-sysv32 + GUESS=$UNAME_MACHINE-pc-sysv32 fi - exit ;; + ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) @@ -1133,9 +1273,9 @@ EOF test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; @@ -1144,228 +1284,284 @@ EOF test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; + ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv${UNAME_RELEASE} + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; + GUESS=i586-pc-haiku + ;; x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=x86_64-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build fi - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; esac -eval $set_cc_for_build -cat >$dummy.c < "$dummy.c" < -# include +#include +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif #endif main () { @@ -1378,20 +1574,12 @@ main () #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" -#endif - ); exit (0); + "" #endif + ); exit (0); #endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) @@ -1433,39 +1621,54 @@ main () #endif #if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); + struct utsname un; + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif #endif #if defined (alliant) && defined (i860) @@ -1476,54 +1679,46 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } +echo "$0: unable to guess system type" >&2 -# Convex versions that predate uname can use getsysinfo(1) +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 < in order to provide the needed -information to handle your system. +our_year=`echo $timestamp | sed 's,-.*,,'` +thisyear=`date +%Y` +# shellcheck disable=SC2003 +script_age=`expr "$thisyear" - "$our_year"` +if test "$script_age" -lt 3 ; then + cat >&2 </dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" EOF +fi exit 1 # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/config.h.in b/config.h.in index 69e477abd..c7250cf7d 100644 --- a/config.h.in +++ b/config.h.in @@ -19,9 +19,6 @@ /* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET @@ -31,6 +28,12 @@ /* Define to 1 if you have the `munmap' function. */ #undef HAVE_MUNMAP +/* Define if libpcap is available */ +#undef HAVE_PCAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_PCAP_H + /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT @@ -40,6 +43,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -94,7 +100,9 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Version number of package */ @@ -140,7 +148,7 @@ /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc -/* Define to `int' if does not define. */ +/* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* Define to `unsigned int' if does not define. */ diff --git a/config.h.in~ b/config.h.in~ new file mode 100644 index 000000000..c7250cf7d --- /dev/null +++ b/config.h.in~ @@ -0,0 +1,174 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `bzero' function. */ +#undef HAVE_BZERO + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define if libpcap is available */ +#undef HAVE_PCAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_PCAP_H + +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strstr' function. */ +#undef HAVE_STRSTR + +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT32_T + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT8_T + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef int16_t + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef int32_t + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef int64_t + +/* Define to the type of a signed integer type of width exactly 8 bits if such + a type exists and the standard includes do not define it. */ +#undef int8_t + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define as a signed integer type capable of holding a process identifier. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#undef uint16_t + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#undef uint32_t + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#undef uint8_t diff --git a/config.sub b/config.sub index 9633db704..dba16e84c 100755 --- a/config.sub +++ b/config.sub @@ -1,12 +1,14 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright 1992-2022 Free Software Foundation, Inc. -timestamp='2013-08-10' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2022-01-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -15,7 +17,7 @@ timestamp='2013-08-10' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -25,7 +27,7 @@ timestamp='2013-08-10' # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +35,7 @@ timestamp='2013-08-10' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -50,15 +52,21 @@ timestamp='2013-08-10' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. -Operation modes: +Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -68,7 +76,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright 1992-2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -90,12 +98,12 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - echo "$me: invalid option $1$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. - echo $1 + echo "$1" exit ;; * ) @@ -111,1209 +119,1186 @@ case $# in exit 1;; esac -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac ;; - -psos*) - os=-psos + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac ;; esac -# Decode aliases for certain CPU-COMPANY combinations. +# Decode 1-component or ad-hoc basic machines case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 \ - | or1k | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown + op50n) + cpu=hppa1.1 + vendor=oki ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none + op60c) + cpu=hppa1.1 + vendor=oki ;; - xscaleeb) - basic_machine=armeb-unknown + ibm*) + cpu=i370 + vendor=ibm ;; - - xscaleel) - basic_machine=armel-unknown + orion105) + cpu=clipper + vendor=highlevel ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown + pmac | pmac-mpw) + cpu=powerpc + vendor=apple ;; + # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att + cpu=m68000 + vendor=att ;; 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux + cpu=we32k + vendor=att ;; bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec + cpu=powerpc + vendor=ibm + basic_os=cnk ;; decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 + cpu=pdp10 + vendor=dec + basic_os=tops10 ;; decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 + cpu=pdp10 + vendor=dec + basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon + cpu=m68k + vendor=motorola ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 ;; encore | umax | mmax) - basic_machine=ns32k-encore + cpu=ns32k + vendor=encore ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} ;; fx2800) - basic_machine=i860-alliant + cpu=i860 + vendor=alliant ;; genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 + cpu=ns32k + vendor=ns ;; h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp + cpu=m68000 + vendor=hp ;; hp9k3[2-9][0-9]) - basic_machine=m68k-hp + cpu=m68k + vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm + cpu=hppa1.0 + vendor=hp ;; i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 ;; i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 ;; i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv ;; i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} ;; iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) + cpu=mips + vendor=sgi + case $basic_os in + irix*) ;; *) - os=-irix4 + basic_os=irix4 ;; esac ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; miniframe) - basic_machine=m68000-convergent + cpu=m68000 + vendor=convergent ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint ;; news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) ;; - -ns2*) - os=-nextstep2 + ns2*) + basic_os=nextstep2 ;; *) - os=-nextstep3 + basic_os=nextstep3 ;; esac ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem + cpu=np1 + vendor=gould ;; op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k + cpu=hppa1.1 + vendor=oki + basic_os=proelf ;; pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; pbd) - basic_machine=sparc-tti + cpu=sparc + vendor=tti ;; pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + cpu=m68k + vendor=tti ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + pc532) + cpu=ns32k + vendor=pc532 ;; pn) - basic_machine=pn-gould + cpu=pn + vendor=gould ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + power) + cpu=power + vendor=ibm ;; ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff + cpu=i386 + vendor=ibm ;; rm[46]00) - basic_machine=mips-siemens + cpu=mips + vendor=siemens ;; rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm + cpu=romp + vendor=ibm ;; - sa29200) - basic_machine=a29k-amd - os=-udi + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} ;; - sb1) - basic_machine=mipsisa64sb1-unknown + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown + tower | tower-32) + cpu=m68k + vendor=ncr ;; - sde) - basic_machine=mipsisa32-sde - os=-elf + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu ;; - sei) - basic_machine=mips-sei - os=-seiux + w65) + cpu=w65 + vendor=wdc ;; - sequent) - basic_machine=i386-sequent + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf ;; - sh) - basic_machine=sh-hitachi - os=-hms + none) + cpu=none + vendor=none ;; - sh5el) - basic_machine=sh5le-unknown + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine ;; - sh64) - basic_machine=sh64-unknown + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 - exit 1 + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb | arc32 | arc64 \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | loongarch32 | loongarch64 | loongarchx32 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64eb | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r3 | mipsisa32r3el \ + | mipsisa32r5 | mipsisa32r5el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r3 | mipsisa64r3el \ + | mipsisa64r5 | mipsisa64r5el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 + exit 1 + ;; + esac ;; esac # Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` +case $vendor in + digital*) + vendor=dec ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + commodore*) + vendor=cbm ;; *) ;; @@ -1321,200 +1306,215 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x"$os" != x"" ] +if test x$basic_os != x then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 - exit 1 + # No normalization, but not necessarily accepted, that comes below. ;; esac + else # Here we handle the default operating systems that come with various machines. @@ -1527,264 +1527,363 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -case $basic_machine in +kernel= +case $cpu-$vendor in score-*) - os=-elf + os=elf ;; spu-*) - os=-elf + os=elf ;; *-acorn) - os=-riscix1.2 + os=riscix1.2 ;; arm*-rebel) - os=-linux + kernel=linux + os=gnu ;; arm*-semi) - os=-aout + os=aout ;; c4x-* | tic4x-*) - os=-coff + os=coff ;; c8051-*) - os=-elf + os=elf + ;; + clipper-intergraph) + os=clix ;; hexagon-*) - os=-elf + os=elf ;; tic54x-*) - os=-coff + os=coff ;; tic55x-*) - os=-coff + os=coff ;; tic6x-*) - os=-coff + os=coff ;; # This must come before the *-dec entry. pdp10-*) - os=-tops20 + os=tops20 ;; pdp11-*) - os=-none + os=none ;; *-dec | vax-*) - os=-ultrix4.2 + os=ultrix4.2 ;; m68*-apollo) - os=-domain + os=domain ;; i386-sun) - os=-sunos4.0.2 + os=sunos4.0.2 ;; m68000-sun) - os=-sunos3 + os=sunos3 ;; m68*-cisco) - os=-aout + os=aout ;; mep-*) - os=-elf + os=elf ;; mips*-cisco) - os=-elf + os=elf ;; mips*-*) - os=-elf - ;; - or1k-*) - os=-elf + os=elf ;; or32-*) - os=-coff + os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 + os=sysv3 ;; sparc-* | *-sun) - os=-sunos4.1.1 + os=sunos4.1.1 ;; - *-be) - os=-beos + pru-*) + os=elf ;; - *-haiku) - os=-haiku + *-be) + os=beos ;; *-ibm) - os=-aix + os=aix ;; *-knuth) - os=-mmixware + os=mmixware ;; *-wec) - os=-proelf + os=proelf ;; *-winbond) - os=-proelf + os=proelf ;; *-oki) - os=-proelf + os=proelf ;; *-hp) - os=-hpux + os=hpux ;; *-hitachi) - os=-hiux + os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv + os=sysv ;; *-cbm) - os=-amigaos + os=amigaos ;; *-dg) - os=-dgux + os=dgux ;; *-dolphin) - os=-sysv3 + os=sysv3 ;; m68k-ccur) - os=-rtu + os=rtu ;; m88k-omron*) - os=-luna + os=luna ;; - *-next ) - os=-nextstep + *-next) + os=nextstep ;; *-sequent) - os=-ptx + os=ptx ;; *-crds) - os=-unos + os=unos ;; *-ns) - os=-genix + os=genix ;; i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 + os=mvs ;; *-gould) - os=-sysv + os=sysv ;; *-highlevel) - os=-bsd + os=bsd ;; *-encore) - os=-bsd + os=bsd ;; *-sgi) - os=-irix + os=irix ;; *-siemens) - os=-sysv4 + os=sysv4 ;; *-masscomp) - os=-rtu + os=rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=-uxpv + os=uxpv ;; *-rom68k) - os=-coff + os=coff ;; *-*bug) - os=-coff + os=coff ;; *-apple) - os=-macos + os=macos ;; *-atari*) - os=-mint + os=mint + ;; + *-wrs) + os=vxworks ;; *) - os=-none + os=none ;; esac + fi +# Now, validate our (potentially fixed-up) OS. +case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. + musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) + ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ + | fiwix* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + *) + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \ + | linux-musl* | linux-relibc* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) vendor=acorn ;; - -sunos*) + *-sunos*) vendor=sun ;; - -cnk*|-aix*) + *-cnk* | *-aix*) vendor=ibm ;; - -beos*) + *-beos*) vendor=be ;; - -hpux*) + *-hpux*) vendor=hp ;; - -mpeix*) + *-mpeix*) vendor=hp ;; - -hiux*) + *-hiux*) vendor=hitachi ;; - -unos*) + *-unos*) vendor=crds ;; - -dgux*) + *-dgux*) vendor=dg ;; - -luna*) + *-luna*) vendor=omron ;; - -genix*) + *-genix*) vendor=ns ;; - -mvs* | -opened*) + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) vendor=ibm ;; - -os400*) + s390-* | s390x-*) vendor=ibm ;; - -ptx*) + *-ptx*) vendor=sequent ;; - -tpf*) + *-tpf*) vendor=ibm ;; - -vxsim* | -vxworks* | -windiss*) + *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; - -aux*) + *-aux*) vendor=apple ;; - -hms*) + *-hms*) vendor=hitachi ;; - -mpw* | -macos*) + *-mpw* | *-macos*) vendor=apple ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; - -vos*) + *-vos*) vendor=stratus ;; esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac -echo $basic_machine$os +echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/configure b/configure index bcd7cc3a4..c1b695fce 100755 --- a/configure +++ b/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for mtcp 3. +# Generated by GNU Autoconf 2.71 for mtcp 3. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,53 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +223,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -255,18 +255,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: mtcp-user@list.ndsl.kaist.edu about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run @@ -294,6 +295,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +313,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +335,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +344,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,12 +383,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +401,59 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +465,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +494,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -486,7 +538,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +552,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +569,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -589,41 +652,37 @@ ac_unique_file="mtcp/src/eventpoll.c" enable_option_checking=no # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" -ac_header_list= +ac_header_c_list= +ac_func_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS @@ -631,6 +690,9 @@ AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -669,6 +731,10 @@ CCP DPDK_FALSE DPDK_TRUE DPDKLIBPATH +PCAP_FALSE +PCAP_TRUE +PCAP +PCAPLIBPATH HWCSUM NETMAP ONVM @@ -678,9 +744,16 @@ RX_IDLE_THRESH ENFORCE_RX_IDLE DPDK LIBOBJS +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build EGREP GREP -CPP BC_CHECK RANLIB OBJEXT @@ -733,6 +806,7 @@ am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking +with_pcap_lib with_stuff enable_lro enable_ccp @@ -748,8 +822,7 @@ CC CFLAGS LDFLAGS LIBS -CPPFLAGS -CPP' +CPPFLAGS' # Initialize some variables set by options. @@ -818,8 +891,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -860,9 +931,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -886,9 +957,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1099,9 +1170,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1115,9 +1186,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1161,9 +1232,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1179,7 +1250,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1243,7 +1314,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1362,6 +1433,10 @@ Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi @@ -1390,6 +1465,7 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pcap-lib=PATH path to libpcap install root --with-dpdk-lib path to the dpdk-17.08 install root --with-rx-idle=ARG how much idle cycles needed before enforcing timeout (dpdk-only) --with-psio-lib path to the ioengine install root @@ -1403,7 +1479,6 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1424,9 +1499,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1454,7 +1529,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1462,7 +1538,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1472,9 +1548,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF mtcp configure 3 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1491,14 +1567,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1506,14 +1582,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1523,176 +1600,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## -------------------------------------------- ## -## Report this to mtcp-user@list.ndsl.kaist.edu ## -## -------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1700,26 +1607,28 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1731,11 +1640,12 @@ $as_echo "$ac_res" >&6; } ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 +printf %s "checking for int$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. @@ -1746,7 +1656,7 @@ else $ac_includes_default enum { N = $2 / 2 - 1 }; int -main () +main (void) { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; @@ -1756,13 +1666,14 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int -main () +main (void) { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; @@ -1773,9 +1684,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( @@ -1783,19 +1695,20 @@ else eval "$3=\$ac_type" ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : -else +else $as_nop break fi done fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_intX_t @@ -1807,17 +1720,18 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof ($2)) return 0; @@ -1825,12 +1739,13 @@ if (sizeof ($2)) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { if (sizeof (($2))) return 0; @@ -1838,18 +1753,19 @@ if (sizeof (($2))) return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop eval "$3=yes" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type @@ -1861,11 +1777,12 @@ $as_echo "$ac_res" >&6; } ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 -$as_echo_n "checking for uint$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +printf %s "checking for uint$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. @@ -1875,7 +1792,7 @@ else /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; @@ -1885,7 +1802,8 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( @@ -1893,35 +1811,79 @@ if ac_fn_c_try_compile "$LINENO"; then : eval "$3=\$ac_type" ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : -else +else $as_nop break fi done fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_find_uintX_t +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1929,17 +1891,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1960,11 +1923,12 @@ fi ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1972,16 +1936,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1999,35 +1956,56 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by mtcp $as_me 3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -2060,8 +2038,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -2096,7 +2078,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2131,11 +2113,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2146,8 +2130,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2171,7 +2155,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2179,14 +2163,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2194,15 +2178,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2210,8 +2194,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2225,63 +2209,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2291,64 +2260,478 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -as_fn_append ac_header_list " stdlib.h" -as_fn_append ac_header_list " unistd.h" -as_fn_append ac_header_list " sys/param.h" -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " sys/param.h sys_param_h HAVE_SYS_PARAM_H" +as_fn_append ac_func_c_list " getpagesize HAVE_GETPAGESIZE" + +# Auxiliary files required by this configure script. +ac_aux_files="missing install-sh config.guess config.sub compile" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -2358,11 +2741,12 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2380,6 +2764,15 @@ ac_config_headers="$ac_config_headers config.h" # Checks for programs. + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2388,11 +2781,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2400,11 +2794,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2415,11 +2813,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2428,11 +2826,12 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2440,11 +2839,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2455,11 +2858,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2467,8 +2870,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2481,11 +2884,12 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2493,11 +2897,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2508,11 +2916,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2521,11 +2929,12 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2534,15 +2943,19 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2558,18 +2971,18 @@ if test $ac_prog_rejected = yes; then # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2580,11 +2993,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -2592,11 +3006,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2607,11 +3025,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2624,11 +3042,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -2636,11 +3055,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2651,11 +3074,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2667,34 +3090,138 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi +else + CC="$ac_cv_prog_CC" fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -2704,7 +3231,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done @@ -2712,7 +3239,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2724,9 +3251,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -2747,11 +3274,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -2768,7 +3296,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2784,44 +3312,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2835,15 +3365,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -2852,7 +3382,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; @@ -2864,8 +3394,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -2873,10 +3403,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -2884,39 +3414,40 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -2930,11 +3461,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -2943,31 +3475,32 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -2977,29 +3510,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3008,57 +3545,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3073,94 +3613,144 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -3169,53 +3759,28 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -ac_ext=c + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3243,8 +3808,8 @@ _ACEOF rm -f core conftest* unset am_i fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. @@ -3263,11 +3828,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -3275,11 +3841,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3290,11 +3860,11 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3303,11 +3873,12 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -3315,11 +3886,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3330,11 +3905,11 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -3342,8 +3917,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -3362,11 +3937,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Extract the first word of "bc", so it can be a program name with args. set dummy bc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_BC_CHECK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_BC_CHECK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$BC_CHECK"; then ac_cv_prog_BC_CHECK="$BC_CHECK" # Let the user override the test. else @@ -3374,11 +3950,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_BC_CHECK="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3389,11 +3969,11 @@ fi fi BC_CHECK=$ac_cv_prog_BC_CHECK if test -n "$BC_CHECK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BC_CHECK" >&5 -$as_echo "$BC_CHECK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BC_CHECK" >&5 +printf "%s\n" "$BC_CHECK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3403,149 +3983,41 @@ fi # Checks for header files. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes +ac_header= ac_cache= +for ac_item in $ac_header_c_list do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - done - ac_cv_prog_CPP=$CPP -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST @@ -3553,10 +4025,15 @@ else for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP @@ -3565,13 +4042,13 @@ case `"$ac_path_GREP" --version 2>&1` in ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -3599,16 +4076,20 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else @@ -3619,10 +4100,15 @@ else for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP @@ -3631,13 +4117,13 @@ case `"$ac_path_EGREP" --version 2>&1` in ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + printf %s 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val @@ -3666,269 +4152,149 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +ac_fn_c_check_header_compile "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" +if test "x$ac_cv_header_pcap_h" = xyes +then : +else $as_nop + as_fn_error $? "Could not find pcap.h. Please install libpcap-dev." "$LINENO" 5 fi -done - - -ac_fn_c_check_header_mongrel "$LINENO" "linux/sched.h" "ac_cv_header_linux_sched_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_sched_h" = xyes; then : +ac_fn_c_check_header_compile "$LINENO" "linux/sched.h" "ac_cv_header_linux_sched_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_sched_h" = xyes +then : -else +else $as_nop as_fn_error $? "Could not find linux/sched.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find pthread.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "numa.h" "ac_cv_header_numa_h" "$ac_includes_default" +if test "x$ac_cv_header_numa_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "numa.h" "ac_cv_header_numa_h" "$ac_includes_default" -if test "x$ac_cv_header_numa_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find numa.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" +if test "x$ac_cv_header_arpa_inet_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" -if test "x$ac_cv_header_arpa_inet_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find arpa/inet.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" -if test "x$ac_cv_header_fcntl_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find fcntl.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" -if test "x$ac_cv_header_limits_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find limits.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" +if test "x$ac_cv_header_netdb_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" -if test "x$ac_cv_header_netdb_h" = xyes; then : - -else +else $as_nop as_fn_error $? "netdb.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" +if test "x$ac_cv_header_netinet_in_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_in_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find netinet/in.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find stdint.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find stdlib.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" -if test "x$ac_cv_header_string_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find string.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ioctl_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_ioctl_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find sys/ioctl.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_socket_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find sys/socket.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_time_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find sys/time.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" -if test "x$ac_cv_header_unistd_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find unistd.h" "$LINENO" 5 fi +ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default" +if test "x$ac_cv_header_gmp_h" = xyes +then : -ac_fn_c_check_header_mongrel "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default" -if test "x$ac_cv_header_gmp_h" = xyes; then : - -else +else $as_nop as_fn_error $? "Could not find gmp.h" "$LINENO" 5 fi - # Check for AC_PTHREAD [FC is preventing this to be enabled..] #AX_PTHREAD( [ # AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]) @@ -3938,32 +4304,34 @@ fi # CC="$PTHREAD_CC"],[]) # Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_inline=$ac_kw fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; @@ -3985,9 +4353,7 @@ case $ac_cv_c_int16_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<_ACEOF -#define int16_t $ac_cv_c_int16_t -_ACEOF +printf "%s\n" "#define int16_t $ac_cv_c_int16_t" >>confdefs.h ;; esac @@ -3996,9 +4362,7 @@ case $ac_cv_c_int32_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<_ACEOF -#define int32_t $ac_cv_c_int32_t -_ACEOF +printf "%s\n" "#define int32_t $ac_cv_c_int32_t" >>confdefs.h ;; esac @@ -4007,9 +4371,7 @@ case $ac_cv_c_int64_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<_ACEOF -#define int64_t $ac_cv_c_int64_t -_ACEOF +printf "%s\n" "#define int64_t $ac_cv_c_int64_t" >>confdefs.h ;; esac @@ -4018,42 +4380,64 @@ case $ac_cv_c_int8_t in #( no|yes) ;; #( *) -cat >>confdefs.h <<_ACEOF -#define int8_t $ac_cv_c_int8_t -_ACEOF +printf "%s\n" "#define int8_t $ac_cv_c_int8_t" >>confdefs.h ;; esac -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : -else + ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default +" +if test "x$ac_cv_type_pid_t" = xyes +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined _WIN64 && !defined __CYGWIN__ + LLP64 + #endif + +int +main (void) +{ + + ; + return 0; +} -cat >>confdefs.h <<_ACEOF -#define pid_t int _ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_pid_type='int' +else $as_nop + ac_pid_type='__int64' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h + fi + ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : +if test "x$ac_cv_type_size_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF +printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : +if test "x$ac_cv_type_ssize_t" = xyes +then : -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define ssize_t int -_ACEOF +printf "%s\n" "#define ssize_t int" >>confdefs.h fi @@ -4063,9 +4447,7 @@ case $ac_cv_c_uint16_t in #( *) -cat >>confdefs.h <<_ACEOF -#define uint16_t $ac_cv_c_uint16_t -_ACEOF +printf "%s\n" "#define uint16_t $ac_cv_c_uint16_t" >>confdefs.h ;; esac @@ -4074,12 +4456,10 @@ case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT32_T 1" >>confdefs.h +printf "%s\n" "#define _UINT32_T 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define uint32_t $ac_cv_c_uint32_t -_ACEOF +printf "%s\n" "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h ;; esac @@ -4088,12 +4468,10 @@ case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT64_T 1" >>confdefs.h +printf "%s\n" "#define _UINT64_T 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define uint64_t $ac_cv_c_uint64_t -_ACEOF +printf "%s\n" "#define uint64_t $ac_cv_c_uint64_t" >>confdefs.h ;; esac @@ -4102,56 +4480,126 @@ case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) -$as_echo "#define _UINT8_T 1" >>confdefs.h +printf "%s\n" "#define _UINT8_T 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define uint8_t $ac_cv_c_uint8_t -_ACEOF +printf "%s\n" "#define uint8_t $ac_cv_c_uint8_t" >>confdefs.h ;; esac # Checks for library functions. -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF -fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +printf %s "checking for GNU libc compatible malloc... " >&6; } +if test ${ac_cv_func_malloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_malloc_0_nonnull=no ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif +#include int -main () +main (void) { -return ! malloc (0); +void *p = malloc (0); + int result = !p; + free (p); + return result; ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_malloc_0_nonnull=yes -else +else $as_nop ac_cv_func_malloc_0_nonnull=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4159,14 +4607,15 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes +then : -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h +printf "%s\n" "#define HAVE_MALLOC 1" >>confdefs.h -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h +else $as_nop + printf "%s\n" "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; @@ -4175,54 +4624,42 @@ else esac -$as_echo "#define malloc rpl_malloc" >>confdefs.h +printf "%s\n" "#define malloc rpl_malloc" >>confdefs.h fi - - - for ac_header in $ac_header_list -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi done - - - - - - -for ac_func in getpagesize -do : - ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" -if test "x$ac_cv_func_getpagesize" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETPAGESIZE 1 -_ACEOF - -fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 -$as_echo_n "checking for working mmap... " >&6; } -if ${ac_cv_func_mmap_fixed_mapped+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_mmap_fixed_mapped=no -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 +printf %s "checking for working mmap... " >&6; } +if test ${ac_cv_func_mmap_fixed_mapped+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + linux*) ac_cv_func_mmap_fixed_mapped=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_mmap_fixed_mapped=no ;; + esac +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default @@ -4254,10 +4691,6 @@ $ac_includes_default #include #include -#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H -char *malloc (); -#endif - /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE @@ -4291,7 +4724,7 @@ char *malloc (); #endif /* no HAVE_GETPAGESIZE */ int -main () +main (void) { char *data, *data2, *data3; const char *cdata2; @@ -4364,9 +4797,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_func_mmap_fixed_mapped=yes -else +else $as_nop ac_cv_func_mmap_fixed_mapped=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4374,36 +4808,39 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 -$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 +printf "%s\n" "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then -$as_echo "#define HAVE_MMAP 1" >>confdefs.h +printf "%s\n" "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" -if test "x$ac_cv_func_clock_gettime" = xyes; then : +if test "x$ac_cv_func_clock_gettime" = xyes +then : -else +else $as_nop as_fn_error $? "librt library is missing" "$LINENO" 5 fi -for ac_func in bzero getpagesize gettimeofday memmove memset munmap select socket strchr strerror strstr strtol + + for ac_func in bzero getpagesize gettimeofday memmove memset munmap select socket strchr strerror strstr strtol do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -else +else $as_nop as_fn_error $? "glibc library is missing" "$LINENO" 5 fi -done +done # Reset DPDK to 0 DPDK=0 @@ -4425,14 +4862,106 @@ ONVM=0 # Reset NETMAP to 0 NETMAP=0 -# Reset HWCSUM to 1 -HWCSUM=1 +# Reset HWCSUM to 1 +HWCSUM=1 + + +# Check pcap path (lib & inc) + +# Check whether --with-pcap-lib was given. +if test ${with_pcap_lib+y} +then : + withval=$with_pcap_lib; pcap_lib=$withval +else $as_nop + pcap_lib="" +fi + + +if test "x$pcap_lib" != "x"; then + PCAPLIBPATH=$pcap_lib + + PCAP=1 + + + CPPFLAGS="$CPPFLAGS -I$pcap_lib/include" + LDFLAGS="$LDFLAGS -L$pcap_lib/lib" +fi + +# Check presence of pcap headers and functions + for ac_header in pcap.h +do : + ac_fn_c_check_header_compile "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" +if test "x$ac_cv_header_pcap_h" = xyes +then : + printf "%s\n" "#define HAVE_PCAP_H 1" >>confdefs.h + +else $as_nop + as_fn_error $? "Could not find pcap.h" "$LINENO" 5 +fi + +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcap_open_live in -lpcap" >&5 +printf %s "checking for pcap_open_live in -lpcap... " >&6; } +if test ${ac_cv_lib_pcap_pcap_open_live+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcap $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pcap_open_live (); +int +main (void) +{ +return pcap_open_live (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pcap_pcap_open_live=yes +else $as_nop + ac_cv_lib_pcap_pcap_open_live=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_open_live" >&5 +printf "%s\n" "$ac_cv_lib_pcap_pcap_open_live" >&6; } +if test "x$ac_cv_lib_pcap_pcap_open_live" = xyes +then : + LIBS="$LIBS -lpcap" +else $as_nop + as_fn_error $? "Could not find libpcap. Please install libpcap-dev." "$LINENO" 5 +fi + + + +printf "%s\n" "#define HAVE_PCAP 1" >>confdefs.h + + if test x$PCAP = x1; then + PCAP_TRUE= + PCAP_FALSE='#' +else + PCAP_TRUE='#' + PCAP_FALSE= +fi + # Check dpdk-17.08 path (lib & inc) # Check whether --with-stuff was given. -if test "${with_stuff+set}" = set; then : +if test ${with_stuff+y} +then : withval=$with_stuff; fi @@ -4444,7 +4973,8 @@ then # Check whether --with-stuff was given. -if test "${with_stuff+set}" = set; then : +if test ${with_stuff+y} +then : withval=$with_stuff; fi @@ -4466,7 +4996,8 @@ fi # Check whether --enable-lro was given. -if test "${enable_lro+set}" = set; then : +if test ${enable_lro+y} +then : enableval=$enable_lro; fi @@ -4481,7 +5012,8 @@ then fi # Check whether --enable-ccp was given. -if test "${enable_ccp+set}" = set; then : +if test ${enable_ccp+y} +then : enableval=$enable_ccp; fi @@ -4493,7 +5025,8 @@ then fi # Check whether --enable-hwcsum was given. -if test "${enable_hwcsum+set}" = set; then : +if test ${enable_hwcsum+y} +then : enableval=$enable_hwcsum; fi @@ -4507,7 +5040,8 @@ fi # Check psio path (lib & inc) # Check whether --with-stuff was given. -if test "${with_stuff+set}" = set; then : +if test ${with_stuff+y} +then : withval=$with_stuff; fi @@ -4520,12 +5054,14 @@ then fi # Check whether --enable-netmap was given. -if test "${enable_netmap+set}" = set; then : +if test ${enable_netmap+y} +then : enableval=$enable_netmap; fi -if test "x$enable_netmap" = "xyes"; then : +if test "x$enable_netmap" = "xyes" +then : NETMAP=1 @@ -4535,7 +5071,8 @@ fi # Check onvm lib path # Check whether --with-stuff was given. -if test "${with_stuff+set}" = set; then : +if test ${with_stuff+y} +then : withval=$with_stuff; fi @@ -4547,18 +5084,20 @@ then fi -if test "$with_psio_lib" == "" && test "$with_dpdk_lib" == "" && test "$enable_netmap" = "" +if test "$with_psio_lib" == "" && test "$with_dpdk_lib" == "" && test "$enable_netmap" = "" && test "x$pcap_lib" = "x" then - as_fn_error $? "Packet I/O library is missing. Please set either dpdk or psio or netmap as your I/O lib." "$LINENO" 5 + as_fn_error $? "Packet I/O library is missing. Please set either dpdk, psio, netmap, or pcap as your I/O lib." "$LINENO" 5 fi + if test "x$enable_ccp" = "xyes" then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libstartccp_run_forever in -lstartccp" >&5 -$as_echo_n "checking for libstartccp_run_forever in -lstartccp... " >&6; } -if ${ac_cv_lib_startccp_libstartccp_run_forever+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libstartccp_run_forever in -lstartccp" >&5 +printf %s "checking for libstartccp_run_forever in -lstartccp... " >&6; } +if test ${ac_cv_lib_startccp_libstartccp_run_forever+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lstartccp $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4567,32 +5106,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char libstartccp_run_forever (); int -main () +main (void) { return libstartccp_run_forever (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_startccp_libstartccp_run_forever=yes -else +else $as_nop ac_cv_lib_startccp_libstartccp_run_forever=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_startccp_libstartccp_run_forever" >&5 -$as_echo "$ac_cv_lib_startccp_libstartccp_run_forever" >&6; } -if test "x$ac_cv_lib_startccp_libstartccp_run_forever" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_startccp_libstartccp_run_forever" >&5 +printf "%s\n" "$ac_cv_lib_startccp_libstartccp_run_forever" >&6; } +if test "x$ac_cv_lib_startccp_libstartccp_run_forever" = xyes +then : echo "Found CCP library" -else +else $as_nop as_fn_error $? "CCP library is missing. Please see README.md for instructions." "$LINENO" 5 @@ -4602,7 +5140,8 @@ fi am__api_version='1.16' -# Find a good install program. We prefer a C program (faster), + + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -4616,20 +5155,25 @@ am__api_version='1.16' # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -4639,13 +5183,13 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -4653,12 +5197,12 @@ case $as_dir/ in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -4674,7 +5218,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -4684,8 +5228,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -4695,8 +5239,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -4750,8 +5294,8 @@ else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -4770,23 +5314,19 @@ test "$program_suffix" != NONE && # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -4806,11 +5346,12 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -4818,11 +5359,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4833,11 +5378,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4846,11 +5391,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -4858,11 +5404,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4873,11 +5423,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -4885,8 +5435,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -4898,25 +5448,31 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -4927,7 +5483,7 @@ IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -4937,18 +5493,19 @@ fi MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -4956,11 +5513,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4971,24 +5532,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -5004,12 +5566,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -5026,8 +5588,8 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out @@ -5063,11 +5625,12 @@ esac fi done rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test ${enable_dependency_tracking+y} +then : enableval=$enable_dependency_tracking; fi @@ -5086,7 +5649,8 @@ fi # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -5096,12 +5660,13 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -5113,8 +5678,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -5150,14 +5715,10 @@ fi VERSION=3 -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. @@ -5199,11 +5760,12 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -5310,8 +5872,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if @@ -5325,6 +5887,20 @@ else fi +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -5399,8 +5975,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -5430,15 +6006,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -5452,8 +6028,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -5470,7 +6046,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -5481,18 +6057,22 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then as_fn_error $? "conditional \"DPDK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -5514,8 +6094,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -5538,14 +6118,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -5555,46 +6137,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -5603,13 +6185,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -5618,8 +6193,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -5631,30 +6210,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -5667,13 +6226,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -5700,18 +6260,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -5723,12 +6285,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -5759,7 +6322,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -5781,6 +6344,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -5794,6 +6361,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -5835,7 +6408,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -5844,7 +6417,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5907,7 +6480,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by mtcp $as_me 3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5969,14 +6542,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ mtcp config.status 3 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -6016,15 +6591,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -6032,7 +6607,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -6041,7 +6616,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -6069,7 +6644,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -6083,7 +6658,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -6116,9 +6691,9 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -6454,7 +7029,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -6462,17 +7037,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -6489,7 +7064,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6513,9 +7088,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -6577,8 +7152,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -6622,9 +7197,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -6640,20 +7215,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -6673,7 +7248,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | +printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6693,8 +7268,8 @@ $as_echo X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -6720,7 +7295,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -6732,7 +7307,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -6754,7 +7329,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -6779,10 +7354,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -6828,8 +7405,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ac_config_files="$ac_config_files apps/example/Makefile" @@ -6861,8 +7438,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -6892,15 +7469,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -6914,8 +7491,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -6932,7 +7509,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -6943,18 +7520,22 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then as_fn_error $? "conditional \"DPDK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -6980,8 +7561,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -7004,14 +7585,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -7021,46 +7604,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -7069,13 +7652,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -7084,8 +7660,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -7097,30 +7677,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -7133,13 +7693,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -7166,18 +7727,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -7189,12 +7752,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -7225,7 +7789,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -7247,6 +7811,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -7260,6 +7828,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -7301,7 +7875,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -7310,7 +7884,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -7373,7 +7947,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by mtcp $as_me 3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -7435,14 +8009,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ mtcp config.status 3 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -7482,15 +8058,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -7498,7 +8074,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -7507,7 +8083,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -7535,7 +8111,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -7549,7 +8125,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -7583,9 +8159,9 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -7921,7 +8497,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -7929,17 +8505,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -7956,7 +8532,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -7980,9 +8556,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -8044,8 +8620,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -8089,9 +8665,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -8107,20 +8683,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -8140,7 +8716,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | +printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8160,8 +8736,8 @@ $as_echo X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -8187,7 +8763,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -8199,7 +8775,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8221,7 +8797,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -8246,10 +8822,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -8295,8 +8873,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ac_config_files="$ac_config_files apps/perf/Makefile" @@ -8328,8 +8906,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -8359,15 +8937,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -8381,8 +8959,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -8399,7 +8977,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -8410,18 +8988,22 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then as_fn_error $? "conditional \"DPDK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -8451,8 +9033,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -8475,14 +9057,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -8492,46 +9076,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -8540,13 +9124,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -8555,8 +9132,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -8568,30 +9149,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -8604,13 +9165,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -8637,18 +9199,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -8660,12 +9224,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -8696,7 +9261,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -8718,6 +9283,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -8731,6 +9300,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -8772,7 +9347,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -8781,7 +9356,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8844,7 +9419,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by mtcp $as_me 3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -8906,14 +9481,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ mtcp config.status 3 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -8953,15 +9530,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -8969,7 +9546,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -8978,7 +9555,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -9006,7 +9583,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -9020,7 +9597,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -9055,9 +9632,9 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -9393,7 +9970,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -9401,17 +9978,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -9428,7 +10005,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -9452,9 +10029,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -9516,8 +10093,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -9561,9 +10138,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -9579,20 +10156,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -9612,7 +10189,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | +printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -9632,8 +10209,8 @@ $as_echo X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -9659,7 +10236,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -9671,7 +10248,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -9693,7 +10270,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -9718,10 +10295,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -9767,8 +10346,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ac_config_files="$ac_config_files util/Makefile" @@ -9800,8 +10379,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -9831,15 +10410,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -9853,8 +10432,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -9871,7 +10450,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -9882,18 +10461,22 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then as_fn_error $? "conditional \"DPDK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -9927,8 +10510,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -9951,14 +10534,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -9968,46 +10553,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -10016,13 +10601,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -10031,8 +10609,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -10044,30 +10626,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -10080,13 +10642,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -10113,18 +10676,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -10136,12 +10701,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -10172,7 +10738,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -10194,6 +10760,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -10207,6 +10777,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -10248,7 +10824,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -10257,7 +10833,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -10320,7 +10896,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by mtcp $as_me 3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -10382,14 +10958,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ mtcp config.status 3 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -10429,15 +11007,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -10445,7 +11023,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -10454,7 +11032,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -10482,7 +11060,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -10496,7 +11074,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -10532,9 +11110,9 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -10870,7 +11448,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -10878,17 +11456,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -10905,7 +11483,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -10929,9 +11507,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -10993,8 +11571,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -11038,9 +11616,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -11056,20 +11634,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -11089,7 +11667,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | +printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -11109,8 +11687,8 @@ $as_echo X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -11136,7 +11714,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -11148,7 +11726,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -11170,7 +11748,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -11195,10 +11773,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -11244,8 +11824,8 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ac_config_files="$ac_config_files io_engine/lib/Makefile" @@ -11277,8 +11857,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -11308,15 +11888,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -11330,8 +11910,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -11348,7 +11928,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -11359,18 +11939,22 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then as_fn_error $? "conditional \"DPDK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -11408,8 +11992,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -11432,14 +12016,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -11449,46 +12035,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -11497,13 +12083,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -11512,8 +12091,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -11525,30 +12108,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -11561,13 +12124,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -11594,18 +12158,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -11617,12 +12183,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -11653,7 +12220,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -11675,6 +12242,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -11688,6 +12259,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -11729,7 +12306,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -11738,7 +12315,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -11801,7 +12378,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by mtcp $as_me 3, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -11863,14 +12440,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ mtcp config.status 3 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -11910,15 +12489,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -11926,7 +12505,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -11935,7 +12514,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -11963,7 +12542,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -11977,7 +12556,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -12014,9 +12593,9 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -12352,7 +12931,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -12360,17 +12939,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -12387,7 +12966,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -12411,9 +12990,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -12475,8 +13054,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -12520,9 +13099,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -12538,20 +13117,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -12571,7 +13150,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | +printf "%s\n" X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -12591,8 +13170,8 @@ $as_echo X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -12618,7 +13197,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -12630,7 +13209,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -12652,7 +13231,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -12677,10 +13256,12 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. Try re-running configure with the + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } @@ -12726,9 +13307,10 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi bash ./.check_hyperthreading.sh + diff --git a/configure~ b/configure~ new file mode 100755 index 000000000..c1b695fce --- /dev/null +++ b/configure~ @@ -0,0 +1,13316 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for mtcp 3. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and +$0: mtcp-user@list.ndsl.kaist.edu about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='mtcp' +PACKAGE_TARNAME='mtcp' +PACKAGE_VERSION='3' +PACKAGE_STRING='mtcp 3' +PACKAGE_BUGREPORT='mtcp-user@list.ndsl.kaist.edu' +PACKAGE_URL='' + +ac_unique_file="mtcp/src/eventpoll.c" +enable_option_checking=no +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= +ac_func_c_list= +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +CSCOPE +ETAGS +CTAGS +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +ONVMLIBPATH +PSLIBPATH +CCP +DPDK_FALSE +DPDK_TRUE +DPDKLIBPATH +PCAP_FALSE +PCAP_TRUE +PCAP +PCAPLIBPATH +HWCSUM +NETMAP +ONVM +PSIO +LRO +RX_IDLE_THRESH +ENFORCE_RX_IDLE +DPDK +LIBOBJS +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +EGREP +GREP +BC_CHECK +RANLIB +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_pcap_lib +with_stuff +enable_lro +enable_ccp +enable_hwcsum +enable_netmap +enable_dependency_tracking +enable_silent_rules +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures mtcp 3 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/mtcp] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of mtcp 3:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-lro Enable dpdk lro (for relevant NICs) + --enable-ccp Enable Congestion Control Plane (CCP) + --disable-hwcsum Disable h/w-based checksum offloading (for relevant + NICs) + --enable-netmap Enable netmap module + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pcap-lib=PATH path to libpcap install root + --with-dpdk-lib path to the dpdk-17.08 install root + --with-rx-idle=ARG how much idle cycles needed before enforcing timeout (dpdk-only) + --with-psio-lib path to the ioengine install root + --with-onvm-lib path to the onvm install root + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +mtcp configure 3 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_find_intX_t LINENO BITS VAR +# ----------------------------------- +# Finds a signed integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_intX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 +printf %s "checking for int$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in int$2_t 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main (void) +{ +static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default + enum { N = $2 / 2 - 1 }; +int +main (void) +{ +static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) + < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + case $ac_type in #( + int$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : + +else $as_nop + break +fi + done +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_intX_t + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +printf %s "checking for uint$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : + +else $as_nop + break +fi + done +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_uintX_t + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by mtcp $as_me 3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " sys/param.h sys_param_h HAVE_SYS_PARAM_H" +as_fn_append ac_func_c_list " getpagesize HAVE_GETPAGESIZE" + +# Auxiliary files required by this configure script. +ac_aux_files="missing install-sh config.guess config.sub compile" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_config_headers="$ac_config_headers config.h" + + +# Checks for programs. + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Extract the first word of "bc", so it can be a program name with args. +set dummy bc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_BC_CHECK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$BC_CHECK"; then + ac_cv_prog_BC_CHECK="$BC_CHECK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_BC_CHECK="yes" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +BC_CHECK=$ac_cv_prog_BC_CHECK +if test -n "$BC_CHECK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BC_CHECK" >&5 +printf "%s\n" "$BC_CHECK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +if test x"$BC_CHECK" != x"yes" ; then + as_fn_error $? "Please install bc before compiling mTCP." "$LINENO" 5 +fi + +# Checks for header files. + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +# Autoupdate added the next two lines to ensure that your configure +# script's behavior did not change. They are probably safe to remove. + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + +ac_fn_c_check_header_compile "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" +if test "x$ac_cv_header_pcap_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find pcap.h. Please install libpcap-dev." "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "linux/sched.h" "ac_cv_header_linux_sched_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_sched_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find linux/sched.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find pthread.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "numa.h" "ac_cv_header_numa_h" "$ac_includes_default" +if test "x$ac_cv_header_numa_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find numa.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" +if test "x$ac_cv_header_arpa_inet_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find arpa/inet.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find fcntl.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find limits.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" +if test "x$ac_cv_header_netdb_h" = xyes +then : + +else $as_nop + as_fn_error $? "netdb.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" +if test "x$ac_cv_header_netinet_in_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find netinet/in.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find stdint.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find stdlib.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find string.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ioctl_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find sys/ioctl.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find sys/socket.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find sys/time.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find unistd.h" "$LINENO" 5 +fi + +ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default" +if test "x$ac_cv_header_gmp_h" = xyes +then : + +else $as_nop + as_fn_error $? "Could not find gmp.h" "$LINENO" 5 +fi + + +# Check for AC_PTHREAD [FC is preventing this to be enabled..] +#AX_PTHREAD( [ +# AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]) +# CLIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC"],[]) + +# Checks for typedefs, structures, and compiler characteristics. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" +case $ac_cv_c_int16_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define int16_t $ac_cv_c_int16_t" >>confdefs.h +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" +case $ac_cv_c_int32_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define int32_t $ac_cv_c_int32_t" >>confdefs.h +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" +case $ac_cv_c_int64_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define int64_t $ac_cv_c_int64_t" >>confdefs.h +;; +esac + +ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" +case $ac_cv_c_int8_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define int8_t $ac_cv_c_int8_t" >>confdefs.h +;; +esac + + + ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default +" +if test "x$ac_cv_type_pid_t" = xyes +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined _WIN64 && !defined __CYGWIN__ + LLP64 + #endif + +int +main (void) +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_pid_type='int' +else $as_nop + ac_pid_type='__int64' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h + + +fi + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define ssize_t int" >>confdefs.h + +fi + +ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" +case $ac_cv_c_uint16_t in #( + no|yes) ;; #( + *) + + +printf "%s\n" "#define uint16_t $ac_cv_c_uint16_t" >>confdefs.h +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define _UINT32_T 1" >>confdefs.h + + +printf "%s\n" "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" +case $ac_cv_c_uint64_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define _UINT64_T 1" >>confdefs.h + + +printf "%s\n" "#define uint64_t $ac_cv_c_uint64_t" >>confdefs.h +;; + esac + +ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" +case $ac_cv_c_uint8_t in #( + no|yes) ;; #( + *) + +printf "%s\n" "#define _UINT8_T 1" >>confdefs.h + + +printf "%s\n" "#define uint8_t $ac_cv_c_uint8_t" >>confdefs.h +;; + esac + + +# Checks for library functions. + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +printf %s "checking for GNU libc compatible malloc... " >&6; } +if test ${ac_cv_func_malloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_malloc_0_nonnull=no ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +void *p = malloc (0); + int result = !p; + free (p); + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_malloc_0_nonnull=yes +else $as_nop + ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes +then : + +printf "%s\n" "#define HAVE_MALLOC 1" >>confdefs.h + +else $as_nop + printf "%s\n" "#define HAVE_MALLOC 0" >>confdefs.h + + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +printf "%s\n" "#define malloc rpl_malloc" >>confdefs.h + +fi + + + +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi +done + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 +printf %s "checking for working mmap... " >&6; } +if test ${ac_cv_func_mmap_fixed_mapped+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + linux*) ac_cv_func_mmap_fixed_mapped=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_mmap_fixed_mapped=no ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propagated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include +#include + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main (void) +{ + char *data, *data2, *data3; + const char *cdata2; + int i, pagesize; + int fd, fd2; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + return 1; + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + return 2; + if (write (fd, data, pagesize) != pagesize) + return 3; + close (fd); + + /* Next, check that the tail of a page is zero-filled. File must have + non-zero length, otherwise we risk SIGBUS for entire page. */ + fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); + if (fd2 < 0) + return 4; + cdata2 = ""; + if (write (fd2, cdata2, 1) != 1) + return 5; + data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); + if (data2 == MAP_FAILED) + return 6; + for (i = 0; i < pagesize; ++i) + if (*(data2 + i)) + return 7; + close (fd2); + if (munmap (data2, pagesize)) + return 8; + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + return 9; + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + return 10; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + return 11; + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + return 12; + if (read (fd, data3, pagesize) != pagesize) + return 13; + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + return 14; + close (fd); + free (data); + free (data3); + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_mmap_fixed_mapped=yes +else $as_nop + ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 +printf "%s\n" "$ac_cv_func_mmap_fixed_mapped" >&6; } +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +printf "%s\n" "#define HAVE_MMAP 1" >>confdefs.h + +fi +rm -f conftest.mmap conftest.txt + +ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" +if test "x$ac_cv_func_clock_gettime" = xyes +then : + +else $as_nop + as_fn_error $? "librt library is missing" "$LINENO" 5 +fi + + + for ac_func in bzero getpagesize gettimeofday memmove memset munmap select socket strchr strerror strstr strtol +do : + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : + cat >>confdefs.h <<_ACEOF +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else $as_nop + as_fn_error $? "glibc library is missing" "$LINENO" 5 +fi + +done + +# Reset DPDK to 0 +DPDK=0 + +# Reset enforcement value +ENFORCE_RX_IDLE=0 + +RX_IDLE_THRESH=0 + +# Reset DPDK's LRO to 0 +LRO=0 + +# Reset PSIO to 0 +PSIO=0 + +# Reset ONVM to 0 +ONVM=0 + +# Reset NETMAP to 0 +NETMAP=0 + +# Reset HWCSUM to 1 +HWCSUM=1 + + +# Check pcap path (lib & inc) + +# Check whether --with-pcap-lib was given. +if test ${with_pcap_lib+y} +then : + withval=$with_pcap_lib; pcap_lib=$withval +else $as_nop + pcap_lib="" +fi + + +if test "x$pcap_lib" != "x"; then + PCAPLIBPATH=$pcap_lib + + PCAP=1 + + + CPPFLAGS="$CPPFLAGS -I$pcap_lib/include" + LDFLAGS="$LDFLAGS -L$pcap_lib/lib" +fi + +# Check presence of pcap headers and functions + for ac_header in pcap.h +do : + ac_fn_c_check_header_compile "$LINENO" "pcap.h" "ac_cv_header_pcap_h" "$ac_includes_default" +if test "x$ac_cv_header_pcap_h" = xyes +then : + printf "%s\n" "#define HAVE_PCAP_H 1" >>confdefs.h + +else $as_nop + as_fn_error $? "Could not find pcap.h" "$LINENO" 5 +fi + +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pcap_open_live in -lpcap" >&5 +printf %s "checking for pcap_open_live in -lpcap... " >&6; } +if test ${ac_cv_lib_pcap_pcap_open_live+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcap $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pcap_open_live (); +int +main (void) +{ +return pcap_open_live (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pcap_pcap_open_live=yes +else $as_nop + ac_cv_lib_pcap_pcap_open_live=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_open_live" >&5 +printf "%s\n" "$ac_cv_lib_pcap_pcap_open_live" >&6; } +if test "x$ac_cv_lib_pcap_pcap_open_live" = xyes +then : + LIBS="$LIBS -lpcap" +else $as_nop + as_fn_error $? "Could not find libpcap. Please install libpcap-dev." "$LINENO" 5 +fi + + + +printf "%s\n" "#define HAVE_PCAP 1" >>confdefs.h + + if test x$PCAP = x1; then + PCAP_TRUE= + PCAP_FALSE='#' +else + PCAP_TRUE='#' + PCAP_FALSE= +fi + + + +# Check dpdk-17.08 path (lib & inc) + +# Check whether --with-stuff was given. +if test ${with_stuff+y} +then : + withval=$with_stuff; +fi + +if test "$with_dpdk_lib" != "" +then + DPDKLIBPATH=$with_dpdk_lib + + DPDK=1 + + +# Check whether --with-stuff was given. +if test ${with_stuff+y} +then : + withval=$with_stuff; +fi + + if test "$with_rx_idle" != "" + then + ENFORCE_RX_IDLE=1 + + RX_IDLE_THRESH=$with_rx_idle + + fi +fi + if test x$DPDK = x1; then + DPDK_TRUE= + DPDK_FALSE='#' +else + DPDK_TRUE='#' + DPDK_FALSE= +fi + + +# Check whether --enable-lro was given. +if test ${enable_lro+y} +then : + enableval=$enable_lro; +fi + + +if test "$with_dpdk_lib" != "" +then + if test "x$enable_lro" = "xyes" + then + LRO=1 + + fi +fi + +# Check whether --enable-ccp was given. +if test ${enable_ccp+y} +then : + enableval=$enable_ccp; +fi + + +if test "x$enable_ccp" = "xyes" +then + CCP=1 + +fi + +# Check whether --enable-hwcsum was given. +if test ${enable_hwcsum+y} +then : + enableval=$enable_hwcsum; +fi + + +if test "x$enable_hwcsum" = "xno" +then + HWCSUM=0 + +fi + +# Check psio path (lib & inc) + +# Check whether --with-stuff was given. +if test ${with_stuff+y} +then : + withval=$with_stuff; +fi + +if test "$with_psio_lib" != "" +then + PSLIBPATH=$with_psio_lib + + PSIO=1 + +fi + +# Check whether --enable-netmap was given. +if test ${enable_netmap+y} +then : + enableval=$enable_netmap; +fi + + +if test "x$enable_netmap" = "xyes" +then : + + NETMAP=1 + + +fi + +# Check onvm lib path + +# Check whether --with-stuff was given. +if test ${with_stuff+y} +then : + withval=$with_stuff; +fi + +if test "$with_onvm_lib" != "" +then + ONVMLIBPATH=$with_onvm_lib + + ONVM=1 + +fi + +if test "$with_psio_lib" == "" && test "$with_dpdk_lib" == "" && test "$enable_netmap" = "" && test "x$pcap_lib" = "x" +then + as_fn_error $? "Packet I/O library is missing. Please set either dpdk, psio, netmap, or pcap as your I/O lib." "$LINENO" 5 +fi + + +if test "x$enable_ccp" = "xyes" +then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libstartccp_run_forever in -lstartccp" >&5 +printf %s "checking for libstartccp_run_forever in -lstartccp... " >&6; } +if test ${ac_cv_lib_startccp_libstartccp_run_forever+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lstartccp $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char libstartccp_run_forever (); +int +main (void) +{ +return libstartccp_run_forever (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_startccp_libstartccp_run_forever=yes +else $as_nop + ac_cv_lib_startccp_libstartccp_run_forever=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_startccp_libstartccp_run_forever" >&5 +printf "%s\n" "$ac_cv_lib_startccp_libstartccp_run_forever" >&6; } +if test "x$ac_cv_lib_startccp_libstartccp_run_forever" = xyes +then : + echo "Found CCP library" +else $as_nop + + as_fn_error $? "CCP library is missing. Please see README.md for instructions." "$LINENO" 5 + +fi + +fi + +am__api_version='1.16' + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + + PACKAGE=mtcp + VERSION=3 + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + +ac_config_files="$ac_config_files Makefile" + +ac_config_files="$ac_config_files mtcp/src/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then + as_fn_error $? "conditional \"DPDK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by mtcp $as_me 3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +mtcp config.status 3 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "mtcp/src/Makefile") CONFIG_FILES="$CONFIG_FILES mtcp/src/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +ac_config_files="$ac_config_files apps/example/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then + as_fn_error $? "conditional \"DPDK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by mtcp $as_me 3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +mtcp config.status 3 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "mtcp/src/Makefile") CONFIG_FILES="$CONFIG_FILES mtcp/src/Makefile" ;; + "apps/example/Makefile") CONFIG_FILES="$CONFIG_FILES apps/example/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +ac_config_files="$ac_config_files apps/perf/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then + as_fn_error $? "conditional \"DPDK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by mtcp $as_me 3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +mtcp config.status 3 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "mtcp/src/Makefile") CONFIG_FILES="$CONFIG_FILES mtcp/src/Makefile" ;; + "apps/example/Makefile") CONFIG_FILES="$CONFIG_FILES apps/example/Makefile" ;; + "apps/perf/Makefile") CONFIG_FILES="$CONFIG_FILES apps/perf/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +ac_config_files="$ac_config_files util/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then + as_fn_error $? "conditional \"DPDK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by mtcp $as_me 3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +mtcp config.status 3 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "mtcp/src/Makefile") CONFIG_FILES="$CONFIG_FILES mtcp/src/Makefile" ;; + "apps/example/Makefile") CONFIG_FILES="$CONFIG_FILES apps/example/Makefile" ;; + "apps/perf/Makefile") CONFIG_FILES="$CONFIG_FILES apps/perf/Makefile" ;; + "util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + +ac_config_files="$ac_config_files io_engine/lib/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${PCAP_TRUE}" && test -z "${PCAP_FALSE}"; then + as_fn_error $? "conditional \"PCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DPDK_TRUE}" && test -z "${DPDK_FALSE}"; then + as_fn_error $? "conditional \"DPDK\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then + as_fn_error $? "conditional \"am__EXEEXT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by mtcp $as_me 3, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +mtcp config.status 3 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "mtcp/src/Makefile") CONFIG_FILES="$CONFIG_FILES mtcp/src/Makefile" ;; + "apps/example/Makefile") CONFIG_FILES="$CONFIG_FILES apps/example/Makefile" ;; + "apps/perf/Makefile") CONFIG_FILES="$CONFIG_FILES apps/perf/Makefile" ;; + "util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;; + "io_engine/lib/Makefile") CONFIG_FILES="$CONFIG_FILES io_engine/lib/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +bash ./.check_hyperthreading.sh + diff --git a/dpdk b/dpdk deleted file mode 160000 index a5dce5555..000000000 --- a/dpdk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a5dce55556286cc56655320d975c67b0dbe08693 diff --git a/install-sh b/install-sh index 8175c640f..ec298b537 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2018-03-11.20; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ while test $# -ne 0; do -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -301,22 +325,6 @@ do if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -326,52 +334,49 @@ do fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # Note that $RANDOM variable is not portable (e.g. dash); Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p' feature. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -382,7 +387,7 @@ do then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -411,7 +416,7 @@ do prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -451,7 +456,18 @@ do trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -477,6 +493,13 @@ do then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -491,9 +514,9 @@ do # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 diff --git a/mtcp/src/api.c b/mtcp/src/api.c index 540ad09c2..a89b7c791 100644 --- a/mtcp/src/api.c +++ b/mtcp/src/api.c @@ -1759,6 +1759,7 @@ mtcp_write(mctx_t mctx, int sockid, const char *buf, size_t len) { if ((socket->epoll & MTCP_EPOLLOUT) && !(socket->epoll & MTCP_EPOLLET)) { + printf("[MTCP_WRITE] Add EPOLLOUT event in SHADOW QUEUE\n"); AddEpollEvent(mtcp->ep, USR_SHADOW_EVENT_QUEUE, socket, MTCP_EPOLLOUT); #if BLOCKING_SUPPORT diff --git a/mtcp/src/core.c b/mtcp/src/core.c index b1b6bbf95..ef25704cc 100644 --- a/mtcp/src/core.c +++ b/mtcp/src/core.c @@ -902,7 +902,6 @@ RunMainLoop(struct mtcp_thread_context *ctx) gettimeofday(&cur_ts, NULL); ts = TIMEVAL_TO_TS(&cur_ts); mtcp->cur_ts = ts; - printf("eths_num: %d\n", CONFIG.eths_num); for (rx_inf = 0; rx_inf < CONFIG.eths_num; rx_inf++) { diff --git a/mtcp/src/dpdk_module.c b/mtcp/src/dpdk_module.c index 76d6da8c3..c1f0a334e 100644 --- a/mtcp/src/dpdk_module.c +++ b/mtcp/src/dpdk_module.c @@ -16,7 +16,7 @@ /* for delay funcs */ #include #include -#define ENABLE_STATS_IOCTL 1 +#define ENABLE_STATS_IOCTL 1 #ifdef ENABLE_STATS_IOCTL /* for close */ #include @@ -27,7 +27,7 @@ #endif /* !ENABLE_STATS_IOCTL */ /* for ip pseudo-chksum */ #include -//#define IP_DEFRAG 1 +// #define IP_DEFRAG 1 #ifdef IP_DEFRAG /* for ip defragging */ #include @@ -38,20 +38,20 @@ #include /*----------------------------------------------------------------------------*/ /* Essential macros */ -#define MAX_RX_QUEUE_PER_LCORE MAX_CPUS -#define MAX_TX_QUEUE_PER_PORT MAX_CPUS +#define MAX_RX_QUEUE_PER_LCORE MAX_CPUS +#define MAX_TX_QUEUE_PER_PORT MAX_CPUS #ifdef ENABLELRO -#define BUF_SIZE 16384 +#define BUF_SIZE 16384 #else -#define BUF_SIZE 2048 +#define BUF_SIZE 2048 #endif /* !ENABLELRO */ -#define MBUF_SIZE (BUF_SIZE + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) -#define NB_MBUF 8192 -#define MEMPOOL_CACHE_SIZE 256 +#define MBUF_SIZE (BUF_SIZE + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define NB_MBUF 8192 +#define MEMPOOL_CACHE_SIZE 256 #ifdef ENFORCE_RX_IDLE -#define RX_IDLE_ENABLE 1 -#define RX_IDLE_TIMEOUT 1 /* in micro-seconds */ +#define RX_IDLE_ENABLE 1 +#define RX_IDLE_TIMEOUT 1 /* in micro-seconds */ #endif /* @@ -60,46 +60,46 @@ * controller's datasheet and supporting DPDK documentation for guidance * on how these parameters should be set. */ -#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ -#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ -#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ +#define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */ +#define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */ +#define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */ /* * These default values are optimized for use with the Intel(R) 82599 10 GbE * Controller and the DPDK ixgbe PMD. Consider using other values for other * network controllers and/or network drivers. */ -#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ -#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ -#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ +#define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */ +#define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */ +#define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */ -#define MAX_PKT_BURST 64/*128*/ +#define MAX_PKT_BURST 64 /*128*/ /* * Configurable number of RX/TX ring descriptors */ -#define RTE_TEST_RX_DESC_DEFAULT 128 -#define RTE_TEST_TX_DESC_DEFAULT 128 +#define RTE_TEST_RX_DESC_DEFAULT 128 +#define RTE_TEST_TX_DESC_DEFAULT 128 /* * Ethernet frame overhead */ -#define ETHER_IFG 12 -#define ETHER_PREAMBLE 8 +#define ETHER_IFG 12 +#define ETHER_PREAMBLE 8 #if RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0) -#define ETHER_OVR (ETHER_CRC_LEN + ETHER_PREAMBLE + ETHER_IFG) +#define ETHER_OVR (ETHER_CRC_LEN + ETHER_PREAMBLE + ETHER_IFG) #else -#define ETHER_OVR (RTE_ETHER_CRC_LEN + ETHER_PREAMBLE + ETHER_IFG) +#define ETHER_OVR (RTE_ETHER_CRC_LEN + ETHER_PREAMBLE + ETHER_IFG) #endif -static const uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; -static const uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; +static const uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; +static const uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /*----------------------------------------------------------------------------*/ /* packet memory pools for storing packet bufs */ static struct rte_mempool *pktmbuf_pool[MAX_CPUS] = {NULL}; -//#define DEBUG 1 +// #define DEBUG 1 #ifdef DEBUG /* ethernet addresses of ports */ static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; @@ -109,84 +109,79 @@ static struct rte_eth_dev_info dev_info[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { - .mq_mode = ETH_MQ_RX_RSS, + .mq_mode = RTE_ETH_MQ_RX_RSS, #if RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0) - .max_rx_pkt_len = ETHER_MAX_LEN, + .max_rx_pkt_len = ETHER_MAX_LEN, #else - .max_rx_pkt_len = RTE_ETHER_MAX_LEN, + .max_lro_pkt_size = RTE_ETHER_MAX_LEN, #endif #if RTE_VERSION > RTE_VERSION_NUM(17, 8, 0, 0) - .offloads = ( + .offloads = ( #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) - DEV_RX_OFFLOAD_CRC_STRIP | + DEV_RX_OFFLOAD_CRC_STRIP | #endif /* !18.05 */ - DEV_RX_OFFLOAD_CHECKSUM + RTE_ETH_RX_OFFLOAD_CHECKSUM #ifdef ENABLELRO - | DEV_RX_OFFLOAD_TCP_LRO + | DEV_RX_OFFLOAD_TCP_LRO #endif - ), + ), #endif /* !17.08 */ - .split_hdr_size = 0, + //.split_hdr_size = 0, #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) - .header_split = 0, /**< Header Split disabled */ - .hw_ip_checksum = 1, /**< IP checksum offload enabled */ - .hw_vlan_filter = 0, /**< VLAN filtering disabled */ - .jumbo_frame = 0, /**< Jumbo Frame Support disabled */ - .hw_strip_crc = 1, /**< CRC stripped by hardware */ -#endif /* !18.05 */ + .header_split = 0, /**< Header Split disabled */ + .hw_ip_checksum = 1, /**< IP checksum offload enabled */ + .hw_vlan_filter = 0, /**< VLAN filtering disabled */ + .jumbo_frame = 0, /**< Jumbo Frame Support disabled */ + .hw_strip_crc = 1, /**< CRC stripped by hardware */ +#endif /* !18.05 */ #ifdef ENABLELRO - .enable_lro = 1, /**< Enable LRO */ + .enable_lro = 1, /**< Enable LRO */ #endif }, .rx_adv_conf = { - .rss_conf = { - .rss_key = NULL, - .rss_hf = ETH_RSS_TCP | ETH_RSS_UDP | - ETH_RSS_IP | ETH_RSS_L2_PAYLOAD - }, + .rss_conf = {.rss_key = NULL, .rss_hf = RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP | ETH_P_IP | RTE_ETH_RSS_L2_PAYLOAD}, }, - .txmode = { - .mq_mode = ETH_MQ_TX_NONE, + .txmode = {.mq_mode = RTE_ETH_MQ_TX_NONE, #if RTE_VERSION >= RTE_VERSION_NUM(18, 5, 0, 0) - .offloads = (DEV_TX_OFFLOAD_IPV4_CKSUM | - DEV_TX_OFFLOAD_UDP_CKSUM | - DEV_TX_OFFLOAD_TCP_CKSUM) + .offloads = (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_UDP_CKSUM | RTE_ETH_TX_OFFLOAD_TCP_CKSUM) #endif }, }; static const struct rte_eth_rxconf rx_conf = { .rx_thresh = { - .pthresh = RX_PTHRESH, /* RX prefetch threshold reg */ - .hthresh = RX_HTHRESH, /* RX host threshold reg */ - .wthresh = RX_WTHRESH, /* RX write-back threshold reg */ + .pthresh = RX_PTHRESH, /* RX prefetch threshold reg */ + .hthresh = RX_HTHRESH, /* RX host threshold reg */ + .wthresh = RX_WTHRESH, /* RX write-back threshold reg */ }, - .rx_free_thresh = 32, + .rx_free_thresh = 32, }; static const struct rte_eth_txconf tx_conf = { .tx_thresh = { - .pthresh = TX_PTHRESH, /* TX prefetch threshold reg */ - .hthresh = TX_HTHRESH, /* TX host threshold reg */ - .wthresh = TX_WTHRESH, /* TX write-back threshold reg */ + .pthresh = TX_PTHRESH, /* TX prefetch threshold reg */ + .hthresh = TX_HTHRESH, /* TX host threshold reg */ + .wthresh = TX_WTHRESH, /* TX write-back threshold reg */ }, - .tx_free_thresh = 0, /* Use PMD default values */ - .tx_rs_thresh = 0, /* Use PMD default values */ + .tx_free_thresh = 0, /* Use PMD default values */ + .tx_rs_thresh = 0, /* Use PMD default values */ #if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0) /* * As the example won't handle mult-segments and offload cases, * set the flag by default. */ - .txq_flags = 0x0, + .txq_flags = 0x0, #endif }; -struct mbuf_table { +struct mbuf_table +{ uint16_t len; /* length of queued packets */ struct rte_mbuf *m_table[MAX_PKT_BURST]; }; -struct dpdk_private_context { +struct dpdk_private_context +{ struct mbuf_table rmbufs[RTE_MAX_ETHPORTS]; struct mbuf_table wmbufs[RTE_MAX_ETHPORTS]; struct rte_mempool *pktmbuf_pool; @@ -211,7 +206,8 @@ struct dpdk_private_context { /** * stats struct passed on from user space to the driver */ -struct stats_struct { +struct stats_struct +{ uint64_t tx_bytes; uint64_t tx_pkts; uint64_t rx_bytes; @@ -226,13 +222,12 @@ struct stats_struct { #ifdef IP_DEFRAG /* Should be power of two. */ -#define IP_FRAG_TBL_BUCKET_ENTRIES 16 -#define RTE_LOGTYPE_IP_RSMBL RTE_LOGTYPE_USER1 -#define MAX_FRAG_NUM RTE_LIBRTE_IP_FRAG_MAX_FRAG +#define IP_FRAG_TBL_BUCKET_ENTRIES 16 +#define RTE_LOGTYPE_IP_RSMBL RTE_LOGTYPE_USER1 +#define MAX_FRAG_NUM RTE_LIBRTE_IP_FRAG_MAX_FRAG #endif /* !IP_DEFRAG */ /*----------------------------------------------------------------------------*/ -void -dpdk_init_handle(struct mtcp_thread_context *ctxt) +void dpdk_init_handle(struct mtcp_thread_context *ctxt) { struct dpdk_private_context *dpc; int i, j; @@ -240,9 +235,10 @@ dpdk_init_handle(struct mtcp_thread_context *ctxt) /* create and initialize private I/O module context */ ctxt->io_private_context = calloc(1, sizeof(struct dpdk_private_context)); - if (ctxt->io_private_context == NULL) { + if (ctxt->io_private_context == NULL) + { TRACE_ERROR("Failed to initialize ctxt->io_private_context: " - "Can't allocate memory\n"); + "Can't allocate memory\n"); exit(EXIT_FAILURE); } @@ -251,13 +247,16 @@ dpdk_init_handle(struct mtcp_thread_context *ctxt) dpc->pktmbuf_pool = pktmbuf_pool[ctxt->cpu]; /* set wmbufs correctly */ - for (j = 0; j < num_devices_attached; j++) { + for (j = 0; j < num_devices_attached; j++) + { /* Allocate wmbufs for each registered port */ - for (i = 0; i < MAX_PKT_BURST; i++) { + for (i = 0; i < MAX_PKT_BURST; i++) + { dpc->wmbufs[j].m_table[i] = rte_pktmbuf_alloc(pktmbuf_pool[ctxt->cpu]); - if (dpc->wmbufs[j].m_table[i] == NULL) { + if (dpc->wmbufs[j].m_table[i] == NULL) + { TRACE_ERROR("Failed to allocate %d:wmbuf[%d] on device %d!\n", - ctxt->cpu, i, j); + ctxt->cpu, i, j); exit(EXIT_FAILURE); } } @@ -271,42 +270,41 @@ dpdk_init_handle(struct mtcp_thread_context *ctxt) uint64_t frag_cycles; max_flows = CONFIG.max_concurrency / CONFIG.num_cores; - frag_cycles = (rte_get_tsc_hz() + MS_PER_S - 1) - / MS_PER_S * max_flows; + frag_cycles = (rte_get_tsc_hz() + MS_PER_S - 1) / MS_PER_S * max_flows; socket = rte_lcore_to_socket_id(ctxt->cpu); if ((dpc->frag_tbl = rte_ip_frag_table_create(max_flows, - IP_FRAG_TBL_BUCKET_ENTRIES, - max_flows, - frag_cycles, - socket)) == NULL) { + IP_FRAG_TBL_BUCKET_ENTRIES, + max_flows, + frag_cycles, + socket)) == NULL) + { RTE_LOG(ERR, IP_RSMBL, "ip_frag_tbl_create(%u) on " - "lcore: %u for queue: %u failed\n", - max_flows, ctxt->cpu, ctxt->cpu); + "lcore: %u for queue: %u failed\n", + max_flows, ctxt->cpu, ctxt->cpu); exit(EXIT_FAILURE); } -#endif /* !IP_DEFRAG */ +#endif /* !IP_DEFRAG */ #ifdef ENABLE_STATS_IOCTL dpc->fd = open(DEV_PATH, O_RDWR); - if (dpc->fd == -1) { + if (dpc->fd == -1) + { TRACE_ERROR("Can't open " DEV_PATH " for context->cpu: %d! " - "Are you using mlx4/mlx5 driver?\n", - ctxt->cpu); + "Are you using mlx4/mlx5 driver?\n", + ctxt->cpu); } #endif /* !ENABLE_STATS_IOCTL */ } /*----------------------------------------------------------------------------*/ -int -dpdk_link_devices(struct mtcp_thread_context *ctxt) +int dpdk_link_devices(struct mtcp_thread_context *ctxt) { /* linking takes place during mtcp_init() */ return 0; } /*----------------------------------------------------------------------------*/ -void -dpdk_release_pkt(struct mtcp_thread_context *ctxt, int ifidx, unsigned char *pkt_data, int len) +void dpdk_release_pkt(struct mtcp_thread_context *ctxt, int ifidx, unsigned char *pkt_data, int len) { /* * do nothing over here - memory reclamation @@ -314,8 +312,7 @@ dpdk_release_pkt(struct mtcp_thread_context *ctxt, int ifidx, unsigned char *pkt */ } /*----------------------------------------------------------------------------*/ -int -dpdk_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) +int dpdk_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) { struct dpdk_private_context *dpc; #ifdef NETSTAT @@ -330,7 +327,8 @@ dpdk_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) ret = 0; /* if there are packets in the queue... flush them out to the wire */ - if (dpc->wmbufs[ifidx].len >/*= MAX_PKT_BURST*/ 0) { + if (dpc->wmbufs[ifidx].len > /*= MAX_PKT_BURST*/ 0) + { struct rte_mbuf **pkts; #ifdef ENABLE_STATS_IOCTL #ifdef NETSTAT @@ -345,16 +343,19 @@ dpdk_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) #ifdef ENABLE_STATS_IOCTL /* only pass stats after >= 1 sec interval */ if (abs(mtcp->cur_ts - dpc->cur_ts) >= 1000 && - likely(dpc->fd >= 0)) { + likely(dpc->fd >= 0)) + { /* rte_get_stats is global func, use only for 1 core */ - if (ctxt->cpu == 0) { + if (ctxt->cpu == 0) + { rte_eth_stats_get(portid, &stats); ss.rmiss = stats.imissed; ss.rerr = stats.ierrors; ss.terr = stats.oerrors; - } else + } + else ss.rmiss = ss.rerr = ss.terr = 0; - + ss.tx_pkts = mtcp->nstat.tx_packets[ifidx]; ss.tx_bytes = mtcp->nstat.tx_bytes[ifidx]; ss.rx_pkts = mtcp->nstat.rx_packets[ifidx]; @@ -370,22 +371,25 @@ dpdk_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) } #endif /* !ENABLE_STATS_IOCTL */ #endif - do { + do + { /* tx cnt # of packets */ ret = rte_eth_tx_burst(portid, ctxt->cpu, - pkts, cnt); + pkts, cnt); pkts += ret; cnt -= ret; /* if not all pkts were sent... then repeat the cycle */ } while (cnt > 0); /* time to allocate fresh mbufs for the queue */ - for (i = 0; i < dpc->wmbufs[ifidx].len; i++) { + for (i = 0; i < dpc->wmbufs[ifidx].len; i++) + { dpc->wmbufs[ifidx].m_table[i] = rte_pktmbuf_alloc(pktmbuf_pool[ctxt->cpu]); /* error checking */ - if (unlikely(dpc->wmbufs[ifidx].m_table[i] == NULL)) { + if (unlikely(dpc->wmbufs[ifidx].m_table[i] == NULL)) + { TRACE_ERROR("Failed to allocate %d:wmbuf[%d] on device %d!\n", - ctxt->cpu, i, ifidx); + ctxt->cpu, i, ifidx); exit(EXIT_FAILURE); } } @@ -407,7 +411,7 @@ dpdk_get_wptr(struct mtcp_thread_context *ctxt, int ifidx, uint16_t pktsize) uint8_t *ptr; int len_of_mbuf; - dpc = (struct dpdk_private_context *) ctxt->io_private_context; + dpc = (struct dpdk_private_context *)ctxt->io_private_context; #ifdef NETSTAT mtcp = ctxt->mtcp_manager; #endif @@ -441,9 +445,10 @@ free_pkts(struct rte_mbuf **mtable, unsigned len) int i; /* free the freaking packets */ - for (i = 0; i < len; i++) { + for (i = 0; i < len; i++) + { rte_pktmbuf_free(mtable[i]); - RTE_MBUF_PREFETCH_TO_FREE(mtable[i+1]); + RTE_MBUF_PREFETCH_TO_FREE(mtable[i + 1]); } } /*----------------------------------------------------------------------------*/ @@ -453,16 +458,17 @@ dpdk_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) struct dpdk_private_context *dpc; int ret; - dpc = (struct dpdk_private_context *) ctxt->io_private_context; + dpc = (struct dpdk_private_context *)ctxt->io_private_context; - if (dpc->rmbufs[ifidx].len != 0) { + if (dpc->rmbufs[ifidx].len != 0) + { free_pkts(dpc->rmbufs[ifidx].m_table, dpc->rmbufs[ifidx].len); dpc->rmbufs[ifidx].len = 0; } int portid = CONFIG.eths[ifidx].ifindex; ret = rte_eth_rx_burst((uint8_t)portid, ctxt->cpu, - dpc->pkts_burst, MAX_PKT_BURST); + dpc->pkts_burst, MAX_PKT_BURST); #ifdef RX_IDLE_ENABLE dpc->rx_idle = (likely(ret != 0)) ? 0 : dpc->rx_idle + 1; #endif @@ -480,14 +486,16 @@ ip_reassemble(struct dpdk_private_context *dpc, struct rte_mbuf *m) struct rte_ip_frag_death_row *dr; /* if packet is IPv4 */ - if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { + if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) + { struct ipv4_hdr *ip_hdr; eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); /* if it is a fragmented packet, then try to reassemble. */ - if (rte_ipv4_frag_pkt_is_fragmented(ip_hdr)) { + if (rte_ipv4_frag_pkt_is_fragmented(ip_hdr)) + { struct rte_mbuf *mo; tbl = dpc->frag_tbl; @@ -521,7 +529,7 @@ dpdk_get_rptr(struct mtcp_thread_context *ctxt, int ifidx, int index, uint16_t * struct rte_mbuf *m; uint8_t *pktbuf; - dpc = (struct dpdk_private_context *) ctxt->io_private_context; + dpc = (struct dpdk_private_context *)ctxt->io_private_context; m = dpc->pkts_burst[index]; #ifdef IP_DEFRAG @@ -534,10 +542,11 @@ dpdk_get_rptr(struct mtcp_thread_context *ctxt, int ifidx, int index, uint16_t * dpc->rmbufs[ifidx].m_table[index] = m; /* verify checksum values from ol_flags */ - if ((m->ol_flags & (PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD)) != 0) { + if ((m->ol_flags & (PKT_RX_IP_CSUM | PKT_RX_IP_CSUM)) != 0) + { TRACE_ERROR("%s(%p, %d, %d): mbuf with invalid checksum: " - "%p(%lu);\n", - __func__, ctxt, ifidx, index, m, m->ol_flags); + "%p(%lu);\n", + __func__, ctxt, ifidx, index, m, m->ol_flags); pktbuf = NULL; } #ifdef ENABLELRO @@ -553,8 +562,9 @@ dpdk_select(struct mtcp_thread_context *ctxt) #ifdef RX_IDLE_ENABLE struct dpdk_private_context *dpc; - dpc = (struct dpdk_private_context *) ctxt->io_private_context; - if (dpc->rx_idle > RX_IDLE_THRESH) { + dpc = (struct dpdk_private_context *)ctxt->io_private_context; + if (dpc->rx_idle > RX_IDLE_THRESH) + { dpc->rx_idle = 0; usleep(RX_IDLE_TIMEOUT); } @@ -562,13 +572,12 @@ dpdk_select(struct mtcp_thread_context *ctxt) return 0; } /*----------------------------------------------------------------------------*/ -void -dpdk_destroy_handle(struct mtcp_thread_context *ctxt) +void dpdk_destroy_handle(struct mtcp_thread_context *ctxt) { struct dpdk_private_context *dpc; int i; - dpc = (struct dpdk_private_context *) ctxt->io_private_context; + dpc = (struct dpdk_private_context *)ctxt->io_private_context; /* free wmbufs */ for (i = 0; i < num_devices_attached; i++) @@ -587,36 +596,43 @@ dpdk_destroy_handle(struct mtcp_thread_context *ctxt) static void check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) { -#define CHECK_INTERVAL 100 /* 100ms */ -#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ +#define CHECK_INTERVAL 100 /* 100ms */ +#define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ uint8_t portid, count, all_ports_up, print_flag = 0; struct rte_eth_link link; printf("\nChecking link status"); fflush(stdout); - for (count = 0; count <= MAX_CHECK_TIME; count++) { + for (count = 0; count <= MAX_CHECK_TIME; count++) + { all_ports_up = 1; - for (portid = 0; portid < port_num; portid++) { + for (portid = 0; portid < port_num; portid++) + { if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + if (!rte_eth_link_get_nowait(portid, &link)) + { + perror("rte_eth_link_get_nowait failed: "); + } /* print link status if flag set */ - if (print_flag == 1) { + if (print_flag == 1) + { if (link.link_status) printf("Port %d Link Up - speed %u " - "Mbps - %s\n", (uint8_t)portid, - (unsigned)link.link_speed, - (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? - ("full-duplex") : ("half-duplex\n")); + "Mbps - %s\n", + (uint8_t)portid, + (unsigned)link.link_speed, + (link.link_duplex == RTE_ETH_LINK_FULL_DUPLEX) ? ("full-duplex") : ("half-duplex\n")); else printf("Port %d Link Down\n", - (uint8_t)portid); + (uint8_t)portid); continue; } /* clear all_ports_up flag if any link down */ - if (link.link_status == 0) { + if (link.link_status == 0) + { all_ports_up = 0; break; } @@ -625,22 +641,23 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask) if (print_flag == 1) break; - if (all_ports_up == 0) { + if (all_ports_up == 0) + { printf("."); fflush(stdout); rte_delay_ms(CHECK_INTERVAL); } /* set the print_flag if all ports up or timeout */ - if (all_ports_up == 1 || count == (MAX_CHECK_TIME - 1)) { + if (all_ports_up == 1 || count == (MAX_CHECK_TIME - 1)) + { print_flag = 1; printf("done\n"); } } } /*----------------------------------------------------------------------------*/ -void -dpdk_load_module(void) +void dpdk_load_module(void) { int portid, rxlcore_id, ret; /* for Ethernet flow control settings */ @@ -652,14 +669,16 @@ dpdk_load_module(void) 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 30 */ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 40 */ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 50 */ - 0x05, 0x05 /* 60 - 8 */ + 0x05, 0x05 /* 60 - 8 */ }; port_conf.rx_adv_conf.rss_conf.rss_key = (uint8_t *)key; port_conf.rx_adv_conf.rss_conf.rss_key_len = sizeof(key); - if (!CONFIG.multi_process || (CONFIG.multi_process && CONFIG.multi_process_is_master)) { - for (rxlcore_id = 0; rxlcore_id < CONFIG.num_cores; rxlcore_id++) { + if (!CONFIG.multi_process || (CONFIG.multi_process && CONFIG.multi_process_is_master)) + { + for (rxlcore_id = 0; rxlcore_id < CONFIG.num_cores; rxlcore_id++) + { char name[RTE_MEMPOOL_NAMESIZE]; uint32_t nb_mbuf; sprintf(name, "mbuf_pool-%d", rxlcore_id); @@ -683,40 +702,43 @@ dpdk_load_module(void) /* create the mbuf pools */ pktmbuf_pool[rxlcore_id] = rte_mempool_create(name, nb_mbuf, - MBUF_SIZE, MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), MEMPOOL_F_SP_PUT | - MEMPOOL_F_SC_GET); + MBUF_SIZE, MEMPOOL_CACHE_SIZE, + sizeof(struct rte_pktmbuf_pool_private), + rte_pktmbuf_pool_init, NULL, + rte_pktmbuf_init, NULL, + rte_socket_id(), MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET); if (pktmbuf_pool[rxlcore_id] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool, errno: %d\n", - rte_errno); + rte_errno); } /* Initialise each port */ int i; - for (i = 0; i < num_devices_attached; ++i) { - /* get portid form the index of attached devices */ - portid = devices_attached[i]; + for (i = 0; i < num_devices_attached; ++i) + { + /* get portid form the index of attached devices */ + portid = devices_attached[i]; /* check port capabilities */ - rte_eth_dev_info_get(portid, &dev_info[portid]); + if (!rte_eth_dev_info_get(portid, &dev_info[portid])) + { + perror("rte_eth_dev_info_get failed: "); + } #if RTE_VERSION >= RTE_VERSION_NUM(18, 5, 0, 0) /* re-adjust rss_hf */ port_conf.rx_adv_conf.rss_conf.rss_hf &= dev_info[portid].flow_type_rss_offloads; #endif /* init port */ - printf("Initializing port %u... ", (unsigned) portid); + printf("Initializing port %u... ", (unsigned)portid); fflush(stdout); if (!strncmp(dev_info[portid].driver_name, "net_mlx", 7)) port_conf.rx_adv_conf.rss_conf.rss_key_len = 40; - + ret = rte_eth_dev_configure(portid, CONFIG.num_cores, CONFIG.num_cores, &port_conf); if (ret < 0) rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u, cores: %d\n", - ret, (unsigned) portid, CONFIG.num_cores); + ret, (unsigned)portid, CONFIG.num_cores); /* init one RX queue per CPU */ fflush(stdout); @@ -724,80 +746,89 @@ dpdk_load_module(void) rte_eth_macaddr_get(portid, &ports_eth_addr[portid]); #endif - for (rxlcore_id = 0; rxlcore_id < CONFIG.num_cores; rxlcore_id++) { + for (rxlcore_id = 0; rxlcore_id < CONFIG.num_cores; rxlcore_id++) + { ret = rte_eth_rx_queue_setup(portid, rxlcore_id, nb_rxd, - rte_eth_dev_socket_id(portid), &rx_conf, - pktmbuf_pool[rxlcore_id]); + rte_eth_dev_socket_id(portid), &rx_conf, + pktmbuf_pool[rxlcore_id]); if (ret < 0) rte_exit(EXIT_FAILURE, - "rte_eth_rx_queue_setup:err=%d, port=%u, queueid: %d\n", - ret, (unsigned) portid, rxlcore_id); + "rte_eth_rx_queue_setup:err=%d, port=%u, queueid: %d\n", + ret, (unsigned)portid, rxlcore_id); } /* init one TX queue on each port per CPU (this is redundant for this app) */ fflush(stdout); - for (rxlcore_id = 0; rxlcore_id < CONFIG.num_cores; rxlcore_id++) { + for (rxlcore_id = 0; rxlcore_id < CONFIG.num_cores; rxlcore_id++) + { ret = rte_eth_tx_queue_setup(portid, rxlcore_id, nb_txd, - rte_eth_dev_socket_id(portid), &tx_conf); + rte_eth_dev_socket_id(portid), &tx_conf); if (ret < 0) rte_exit(EXIT_FAILURE, - "rte_eth_tx_queue_setup:err=%d, port=%u, queueid: %d\n", - ret, (unsigned) portid, rxlcore_id); + "rte_eth_tx_queue_setup:err=%d, port=%u, queueid: %d\n", + ret, (unsigned)portid, rxlcore_id); } /* Start device */ ret = rte_eth_dev_start(portid); if (ret < 0) rte_exit(EXIT_FAILURE, "rte_eth_dev_start:err=%d, port=%u\n", - ret, (unsigned) portid); + ret, (unsigned)portid); printf("done: \n"); rte_eth_promiscuous_enable(portid); - /* retrieve current flow control settings per port */ + /* retrieve current flow control settings per port */ memset(&fc_conf, 0, sizeof(fc_conf)); - ret = rte_eth_dev_flow_ctrl_get(portid, &fc_conf); + ret = rte_eth_dev_flow_ctrl_get(portid, &fc_conf); if (ret != 0) - TRACE_INFO("Failed to get flow control info!\n"); + TRACE_INFO("Failed to get flow control info!\n"); /* and just disable the rx/tx flow control */ - fc_conf.mode = RTE_FC_NONE; + fc_conf.mode = RTE_ETH_FC_NONE; ret = rte_eth_dev_flow_ctrl_set(portid, &fc_conf); - if (ret != 0) - TRACE_INFO("Failed to set flow control info!: errno: %d\n", - ret); + if (ret != 0) + TRACE_INFO("Failed to set flow control info!: errno: %d\n", + ret); #ifdef DEBUG printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", - (unsigned) portid, - ports_eth_addr[portid].addr_bytes[0], - ports_eth_addr[portid].addr_bytes[1], - ports_eth_addr[portid].addr_bytes[2], - ports_eth_addr[portid].addr_bytes[3], - ports_eth_addr[portid].addr_bytes[4], - ports_eth_addr[portid].addr_bytes[5]); + (unsigned)portid, + ports_eth_addr[portid].addr_bytes[0], + ports_eth_addr[portid].addr_bytes[1], + ports_eth_addr[portid].addr_bytes[2], + ports_eth_addr[portid].addr_bytes[3], + ports_eth_addr[portid].addr_bytes[4], + ports_eth_addr[portid].addr_bytes[5]); #endif } /* only check for link status if the thread is master */ check_all_ports_link_status(num_devices_attached, 0xFFFFFFFF); - } else { /* CONFIG.multi_process && !CONFIG.multi_process_is_master */ - for (rxlcore_id = 0; rxlcore_id < CONFIG.num_cores; rxlcore_id++) { - char name[RTE_MEMPOOL_NAMESIZE]; - sprintf(name, "mbuf_pool-%d", rxlcore_id); - /* initialize the mbuf pools */ - pktmbuf_pool[rxlcore_id] = - rte_mempool_lookup(name); - if (pktmbuf_pool[rxlcore_id] == NULL) - rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); - } + } + else + { /* CONFIG.multi_process && !CONFIG.multi_process_is_master */ + for (rxlcore_id = 0; rxlcore_id < CONFIG.num_cores; rxlcore_id++) + { + char name[RTE_MEMPOOL_NAMESIZE]; + sprintf(name, "mbuf_pool-%d", rxlcore_id); + /* initialize the mbuf pools */ + pktmbuf_pool[rxlcore_id] = + rte_mempool_lookup(name); + if (pktmbuf_pool[rxlcore_id] == NULL) + rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); + } int i; /* initializing dev_info struct */ - for (i = 0; i < num_devices_attached; i++) { - /* get portid form the index of attached devices */ - portid = devices_attached[i]; + for (i = 0; i < num_devices_attached; i++) + { + /* get portid form the index of attached devices */ + portid = devices_attached[i]; /* check port capabilities */ - rte_eth_dev_info_get(i, &dev_info[portid]); + if (!rte_eth_dev_info_get(i, &dev_info[portid])) + { + perror("rte_eth_dev_info_get failed: "); + } } } } @@ -816,7 +847,8 @@ dpdk_dev_ioctl(struct mtcp_thread_context *ctx, int nif, int cmd, void *argp) int seg_off; #endif - if (cmd == DRV_NAME) { + if (cmd == DRV_NAME) + { *argpptr = (void *)dev_info[nif].driver_name; return 0; } @@ -827,25 +859,26 @@ dpdk_dev_ioctl(struct mtcp_thread_context *ctx, int nif, int cmd, void *argp) dpc = (struct dpdk_private_context *)ctx->io_private_context; len_of_mbuf = dpc->wmbufs[eidx].len; - switch (cmd) { + switch (cmd) + { case PKT_TX_IP_CSUM: - if ((dev_info[nif].tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) + if ((dev_info[nif].tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) == 0) goto dev_ioctl_err; m = dpc->wmbufs[eidx].m_table[len_of_mbuf - 1]; - m->ol_flags = PKT_TX_IP_CKSUM | PKT_TX_IPV4; + m->ol_flags = PKT_TX_IP_CSUM | RTE_MBUF_F_TX_IPV4; #if RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0) m->l2_len = sizeof(struct ether_hdr); #else m->l2_len = sizeof(struct rte_ether_hdr); #endif - m->l3_len = (iph->ihl<<2); + m->l3_len = (iph->ihl << 2); break; case PKT_TX_TCP_CSUM: - if ((dev_info[nif].tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) + if ((dev_info[nif].tx_offload_capa & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) == 0) goto dev_ioctl_err; m = dpc->wmbufs[eidx].m_table[len_of_mbuf - 1]; - tcph = (struct tcphdr *)((unsigned char *)iph + (iph->ihl<<2)); - m->ol_flags |= PKT_TX_TCP_CKSUM; + tcph = (struct tcphdr *)((unsigned char *)iph + (iph->ihl << 2)); + m->ol_flags |= PKT_TX_TCP_CSUM; #if RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0) tcph->check = rte_ipv4_phdr_cksum((struct ipv4_hdr *)iph, m->ol_flags); #else @@ -855,34 +888,35 @@ dpdk_dev_ioctl(struct mtcp_thread_context *ctx, int nif, int cmd, void *argp) #ifdef ENABLELRO case PKT_RX_TCP_LROSEG: m = dpc->cur_rx_m; - //if (m->next != NULL) + // if (m->next != NULL) // rte_prefetch0(rte_pktmbuf_mtod(m->next, void *)); iph = rte_pktmbuf_mtod_offset(m, struct iphdr *, sizeof(struct ether_hdr)); tcph = (struct tcphdr *)((u_char *)iph + (iph->ihl << 2)); payload = (uint8_t *)tcph + (tcph->doff << 2); seg_off = m->data_len - - sizeof(struct ether_hdr) - (iph->ihl << 2) - - (tcph->doff << 2); + sizeof(struct ether_hdr) - (iph->ihl << 2) - + (tcph->doff << 2); - to = (uint8_t *) argp; + to = (uint8_t *)argp; m = m->next; memcpy(to, payload, seg_off); - while (m != NULL) { - //if (m->next != NULL) + while (m != NULL) + { + // if (m->next != NULL) // rte_prefetch0(rte_pktmbuf_mtod(m->next, void *)); memcpy(to + seg_off, - rte_pktmbuf_mtod(m, uint8_t *), - m->data_len); + rte_pktmbuf_mtod(m, uint8_t *), + m->data_len); seg_off += m->data_len; m = m->next; } break; #endif case PKT_TX_TCPIP_CSUM: - if ((dev_info[nif].tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) + if ((dev_info[nif].tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) == 0) goto dev_ioctl_err; - if ((dev_info[nif].tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) + if ((dev_info[nif].tx_offload_capa & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) == 0) goto dev_ioctl_err; m = dpc->wmbufs[eidx].m_table[len_of_mbuf - 1]; #if RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0) @@ -890,15 +924,15 @@ dpdk_dev_ioctl(struct mtcp_thread_context *ctx, int nif, int cmd, void *argp) #else iph = rte_pktmbuf_mtod_offset(m, struct iphdr *, sizeof(struct rte_ether_hdr)); #endif - tcph = (struct tcphdr *)((uint8_t *)iph + (iph->ihl<<2)); + tcph = (struct tcphdr *)((uint8_t *)iph + (iph->ihl << 2)); #if RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0) m->l2_len = sizeof(struct ether_hdr); #else m->l2_len = sizeof(struct rte_ether_hdr); #endif - m->l3_len = (iph->ihl<<2); - m->l4_len = (tcph->doff<<2); - m->ol_flags = PKT_TX_TCP_CKSUM | PKT_TX_IP_CKSUM | PKT_TX_IPV4; + m->l3_len = (iph->ihl << 2); + m->l4_len = (tcph->doff << 2); + m->ol_flags = PKT_TX_TCP_CSUM | PKT_TX_IP_CSUM | RTE_MBUF_F_TX_IPV4; #if RTE_VERSION < RTE_VERSION_NUM(19, 8, 0, 0) tcph->check = rte_ipv4_phdr_cksum((struct ipv4_hdr *)iph, m->ol_flags); #else @@ -906,54 +940,52 @@ dpdk_dev_ioctl(struct mtcp_thread_context *ctx, int nif, int cmd, void *argp) #endif break; case PKT_RX_IP_CSUM: - if ((dev_info[nif].rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) == 0) + if ((dev_info[nif].rx_offload_capa & RTE_ETH_RX_OFFLOAD_IPV4_CKSUM) == 0) goto dev_ioctl_err; break; case PKT_RX_TCP_CSUM: - if ((dev_info[nif].rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) == 0) + if ((dev_info[nif].rx_offload_capa & RTE_ETH_RX_OFFLOAD_TCP_CKSUM) == 0) goto dev_ioctl_err; break; case PKT_TX_TCPIP_CSUM_PEEK: - if ((dev_info[nif].tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) == 0) + if ((dev_info[nif].tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) == 0) goto dev_ioctl_err; - if ((dev_info[nif].tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) == 0) + if ((dev_info[nif].tx_offload_capa & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) == 0) goto dev_ioctl_err; break; default: goto dev_ioctl_err; } return 0; - dev_ioctl_err: +dev_ioctl_err: return -1; } /*----------------------------------------------------------------------------*/ io_module_func dpdk_module_func = { - .load_module = dpdk_load_module, - .init_handle = dpdk_init_handle, - .link_devices = dpdk_link_devices, - .release_pkt = dpdk_release_pkt, - .send_pkts = dpdk_send_pkts, - .get_wptr = dpdk_get_wptr, - .recv_pkts = dpdk_recv_pkts, - .get_rptr = dpdk_get_rptr, - .select = dpdk_select, - .destroy_handle = dpdk_destroy_handle, - .dev_ioctl = dpdk_dev_ioctl -}; + .load_module = dpdk_load_module, + .init_handle = dpdk_init_handle, + .link_devices = dpdk_link_devices, + .release_pkt = dpdk_release_pkt, + .send_pkts = dpdk_send_pkts, + .get_wptr = dpdk_get_wptr, + .recv_pkts = dpdk_recv_pkts, + .get_rptr = dpdk_get_rptr, + .select = dpdk_select, + .destroy_handle = dpdk_destroy_handle, + .dev_ioctl = dpdk_dev_ioctl}; /*----------------------------------------------------------------------------*/ #else io_module_func dpdk_module_func = { - .load_module = NULL, - .init_handle = NULL, - .link_devices = NULL, - .release_pkt = NULL, - .send_pkts = NULL, - .get_wptr = NULL, - .recv_pkts = NULL, - .get_rptr = NULL, - .select = NULL, - .destroy_handle = NULL, - .dev_ioctl = NULL -}; + .load_module = NULL, + .init_handle = NULL, + .link_devices = NULL, + .release_pkt = NULL, + .send_pkts = NULL, + .get_wptr = NULL, + .recv_pkts = NULL, + .get_rptr = NULL, + .select = NULL, + .destroy_handle = NULL, + .dev_ioctl = NULL}; /*----------------------------------------------------------------------------*/ #endif /* !DISABLE_DPDK */ diff --git a/mtcp/src/eth_out.c b/mtcp/src/eth_out.c index 06f6b4138..f3f280a70 100644 --- a/mtcp/src/eth_out.c +++ b/mtcp/src/eth_out.c @@ -56,6 +56,7 @@ EthernetOutput(struct mtcp_manager *mtcp, uint16_t h_proto, } buf = mtcp->iom->get_wptr(mtcp->ctx, eidx, iplen + ETHERNET_HEADER_LEN); + // allocat memory for TX path packet if (!buf) { //TRACE_DBG("Failed to get available write buffer\n"); return NULL; diff --git a/mtcp/src/eventpoll.c b/mtcp/src/eventpoll.c index 4a07d1068..fb2529a94 100644 --- a/mtcp/src/eventpoll.c +++ b/mtcp/src/eventpoll.c @@ -223,7 +223,9 @@ int CloseEpollSocket(mctx_t mctx, int epid) pthread_mutex_lock(&ep->epoll_lock); mtcp->ep = NULL; mtcp->smap[epid].ep = NULL; + printf("[CloseEpollSocket] MTCP_THREAD: Try to Wake Up application thread\n\n"); pthread_cond_signal(&ep->epoll_cond); + printf("[CloseEpollSocket] MTCP_THREAD: Waked Up application thread\n\n"); pthread_mutex_unlock(&ep->epoll_lock); pthread_cond_destroy(&ep->epoll_cond); @@ -469,14 +471,14 @@ int mtcp_epoll_wait(mctx_t mctx, int epid, /* signal to mtcp thread if it is sleeping */ if (mtcp->wakeup_flag && mtcp->is_sleeping) { - TRACE_ERROR("SERVER_THREAD: Killing mtcp thread\n\n"); + printf("[mtcp_epoll_wait] : SERVER_THREAD: singaling mtcp thread\n\n"); pthread_kill(mtcp->ctx->thread, SIGUSR1); } #endif ep->stat.waits++; ep->waiting = TRUE; - if (timeout > 0) + if (timeout > 0) { struct timespec deadline; @@ -500,6 +502,7 @@ int mtcp_epoll_wait(mctx_t mctx, int epid, // deadline.tv_sec = mtcp->cur_tv.tv_sec; // deadline.tv_nsec = (mtcp->cur_tv.tv_usec + timeout * 1000) * 1000; TRACE_ERROR("waiting for epoll_cond\n\n"); + // goes to sleep ret = pthread_cond_timedwait(&ep->epoll_cond, &ep->epoll_lock, &deadline); if (ret && ret != ETIMEDOUT) @@ -514,8 +517,10 @@ int mtcp_epoll_wait(mctx_t mctx, int epid, } else if (timeout < 0) { + printf("mtcp wake up flag: %d\n",mtcp->wakeup_flag); TRACE_ERROR("[epoll_wait] usr_q=%d shadow_q=%d timeout=%d\n", eq->num_events, eq_shadow->num_events, timeout); + // goes to sleep ret = pthread_cond_wait(&ep->epoll_cond, &ep->epoll_lock); if (ret) { @@ -526,13 +531,13 @@ int mtcp_epoll_wait(mctx_t mctx, int epid, return -1; } } - TRACE_ERROR("SERVER_THREAD: Wake Up!!\n\n"); + printf("SERVER_THREAD: Wake Up!!\n\n"); ep->waiting = FALSE; if (mtcp->ctx->done || mtcp->ctx->exit || mtcp->ctx->interrupt) { mtcp->ctx->interrupt = FALSE; - //ret = pthread_cond_signal(&ep->epoll_cond); + // ret = pthread_cond_signal(&ep->epoll_cond); pthread_mutex_unlock(&ep->epoll_lock); errno = EINTR; return -1; @@ -699,8 +704,23 @@ AddEpollEvent(struct mtcp_epoll *ep, #endif if (queue_type == USR_EVENT_QUEUE) + // { + // if (ep->waiting) + // { + // pthread_cond_signal(&ep->epoll_cond); + // } + // pthread_mutex_unlock(&ep->epoll_lock); + // } + // else if (queue_type == MTCP_EVENT_QUEUE) + // { + // pthread_mutex_lock(&ep->epoll_lock); + // if (ep->waiting) + // { + // pthread_cond_signal(&ep->epoll_cond); + // } + // pthread_mutex_unlock(&ep->epoll_lock); + // } pthread_mutex_unlock(&ep->epoll_lock); - ep->stat.registered++; return 0; diff --git a/mtcp/src/include/logger.h b/mtcp/src/include/logger.h index 19e83f710..c5129e6c7 100644 --- a/mtcp/src/include/logger.h +++ b/mtcp/src/include/logger.h @@ -9,8 +9,9 @@ enum { IDLE_LOGT, ACTIVE_LOGT -} log_thread_state; +}; +extern int log_thread_state; typedef struct log_buff { int tid; diff --git a/mtcp/src/include/mtcp.h b/mtcp/src/include/mtcp.h index 791acf9b3..5172cd7c8 100644 --- a/mtcp/src/include/mtcp.h +++ b/mtcp/src/include/mtcp.h @@ -1,6 +1,5 @@ #ifndef MTCP_H #define MTCP_H - #include #include #include @@ -42,7 +41,7 @@ #define ETHERNET_HEADER_LEN 14 // sizeof(struct ethhdr) #define IP_HEADER_LEN 20 // sizeof(struct iphdr) #define TCP_HEADER_LEN 20 // sizeof(struct tcphdr) -#define TOTAL_TCP_HEADER_LEN 54 // total header length +#define TOTAL_TCP_HEADER_LEN 54 // total header length 14+20+20 /* configurations */ #define BACKLOG_SIZE (10*1024) diff --git a/mtcp/src/include/tcp_send_buffer.h b/mtcp/src/include/tcp_send_buffer.h index 3009933cc..57e6fcbf7 100644 --- a/mtcp/src/include/tcp_send_buffer.h +++ b/mtcp/src/include/tcp_send_buffer.h @@ -10,6 +10,7 @@ typedef struct mtcp_manager* mtcp_manager_t; /*----------------------------------------------------------------------------*/ struct tcp_send_buffer { + unsigned char *data; unsigned char *head; diff --git a/mtcp/src/include/tcp_stream.h b/mtcp/src/include/tcp_stream.h index 9dd48d9a7..f6876bf48 100644 --- a/mtcp/src/include/tcp_stream.h +++ b/mtcp/src/include/tcp_stream.h @@ -85,6 +85,7 @@ struct tcp_recv_vars struct tcp_send_vars { + int need_wakeup; /* IP-level information */ uint16_t ip_id; @@ -122,7 +123,6 @@ struct tcp_send_vars uint8_t is_wack:1, /* is ack for window adertisement? */ ack_cnt:6; /* number of acks to send. max 64 */ - uint8_t on_control_list; uint8_t on_send_list; uint8_t on_ack_list; diff --git a/mtcp/src/logger.c b/mtcp/src/logger.c index 7d4c507ce..5c2fcb9a1 100644 --- a/mtcp/src/logger.c +++ b/mtcp/src/logger.c @@ -11,7 +11,7 @@ #include "cpu.h" #include "debug.h" #include "logger.h" - +int log_thread_state = IDLE_LOGT; /*----------------------------------------------------------------------------*/ static void EnqueueFreeBuffer(log_thread_context *ctx, log_buff *free_bp) diff --git a/mtcp/src/make_files.sh b/mtcp/src/make_files.sh new file mode 100755 index 000000000..29a168853 --- /dev/null +++ b/mtcp/src/make_files.sh @@ -0,0 +1,12 @@ +#make files in mtcp/src and apps/example +#mtcp/src +make clean +make "CFLAGS=-DDISABLE_DPDK -DDISABLE_HWCSUM -O0" +#files in util +cd ../../util +make clean +make +#files in apps/example +cd ../apps/example +make clean +make \ No newline at end of file diff --git a/mtcp/src/memory_mgt.c b/mtcp/src/memory_mgt.c index e0baca36f..80fb1f5bb 100644 --- a/mtcp/src/memory_mgt.c +++ b/mtcp/src/memory_mgt.c @@ -30,7 +30,7 @@ typedef struct mem_pool /*----------------------------------------------------------------------------*/ mem_pool * MPCreate(int chunk_size, size_t total_size) -{ +{ mem_pool_t mp; if (chunk_size < sizeof(mem_chunk)) { diff --git a/mtcp/src/pcap_module.c b/mtcp/src/pcap_module.c index 75dc73049..1efb916d8 100644 --- a/mtcp/src/pcap_module.c +++ b/mtcp/src/pcap_module.c @@ -17,10 +17,10 @@ #include "mtcp.h" #include "config.h" -#define CHUNK_SIZE 64 -#define BUF_SIZE (64 * 1024 * 1024) +#define CHUNK_SIZE 262144 +#define BUF_SIZE (128 * 1024 * 1024) #define SNAPLEN 65535 -#define TIMEOUT_MS 1 +#define TIMEOUT_MS 50 #define MAX_TX_BURST 1024 // assume single core (x need to RSS packets to multiple cores) // x concept of core affinity @@ -81,8 +81,10 @@ void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) TRACE_ERROR("pcap_set_timeout failed\n"); if (pcap_set_buffer_size(temp, BUF_SIZE) != 0) TRACE_ERROR("pcap_set_buffer_size failed\n"); - pcap_setnonblock(temp, 1, errbuf); - + if(!pcap_setnonblock(temp, 1, errbuf)){ + TRACE_ERROR("pcap_setnonblock failed: %s\n", errbuf); + } + pcap_set_immediate_mode(temp, 1); // set immediate mode if (pcap_activate(temp) < 0) { TRACE_ERROR("pcap_activate failed: %s\n", pcap_geterr(temp)); @@ -98,19 +100,19 @@ void pcap_release_pkt(struct mtcp_thread_context *ctxt, int ifidx, unsigned char // free received packets here all after processing packets struct pcap_private_context *ppc = (struct pcap_private_context *)ctxt->io_private_context; - for (int k = 0; k < ppc->num_pkts_in_chunk; k++) - { - if (ppc->hdrs[k]) - { - free(ppc->hdrs[k]); - ppc->hdrs[k] = NULL; - } - if (ppc->pkts[k]) - { - free((void *)ppc->pkts[k]); - ppc->pkts[k] = NULL; - } - } + // for (int k = 0; k < ppc->num_pkts_in_chunk; k++) + // { + // if (ppc->hdrs[k]) + // { + // free(ppc->hdrs[k]); + // ppc->hdrs[k] = NULL; + // } + // if (ppc->pkts[k]) + // { + // free((void *)ppc->pkts[k]); + // ppc->pkts[k] = NULL; + // } + // } ppc->num_pkts_in_chunk = 0; /**************************************************************** */ @@ -136,7 +138,7 @@ pcap_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) } else { - TRACE_ERROR("pcap_inject failed: %s\n", pcap_geterr(ppc->handle)); + TRACE_ERROR("pcap_inject failed: %s\n", pcap_geterr(ppc->handle)); } free(buf); } @@ -165,7 +167,7 @@ pcap_get_wptr(struct mtcp_thread_context *ctxt, int ifidx, uint16_t len) // used struct pcap_private_context *ppc = (struct pcap_private_context *)ctxt->io_private_context; - if (ppc->w_buf.cnt >0) + if (ppc->w_buf.cnt > 0) { pcap_send_pkts(ctxt, ifidx); } @@ -189,19 +191,22 @@ pcap_get_rptr(struct mtcp_thread_context *ctxt, int ifidx, int index, uint16_t * uint8_t *pktbuf; ppc = (struct pcap_private_context *)ctxt->io_private_context; pktbuf = (uint8_t *)ppc->pkts[index]; - if(!ppc->hdrs[index]) + if (ppc->hdrs[index]) *len = ppc->hdrs[index]->caplen; + else + *len = 0; return pktbuf; } /*----------------------------------------------------------------------------*/ static void pcap_packet_handler(u_char *user, - const struct pcap_pkthdr *h, - const u_char *bytes) + const struct pcap_pkthdr *h, + const u_char *bytes) { struct pcap_private_context *ppc = (struct pcap_private_context *)user; /************************************************************ */ + // For Debuggging purpose struct iphdr *iph = (struct iphdr *)(bytes + sizeof(struct ether_header)); struct tcphdr *tcph = (struct tcphdr *)((uint8_t *)iph + (iph->ihl << 2)); if (tcph->ack) @@ -213,12 +218,12 @@ pcap_packet_handler(u_char *user, if (ppc->num_pkts_in_chunk < CHUNK_SIZE) { // safety guard // deep copy pkthdr and buf - struct pcap_pkthdr *hdr = (struct pcap_pkthdr *)malloc(sizeof(struct pcap_pkthdr)); - memcpy(hdr, h, sizeof(struct pcap_pkthdr)); - ppc->hdrs[ppc->num_pkts_in_chunk] = hdr; - u_char *bts = malloc(hdr->caplen); - memcpy(bts, bytes, hdr->caplen); - ppc->pkts[ppc->num_pkts_in_chunk] = bts; + // struct pcap_pkthdr *hdr = (struct pcap_pkthdr *)malloc(sizeof(struct pcap_pkthdr)); + // memcpy(hdr, h, sizeof(struct pcap_pkthdr)); + ppc->hdrs[ppc->num_pkts_in_chunk] = (struct pcap_pkthdr *)h; + // u_char *bts = malloc(hdr->caplen); + // memcpy(bts, bytes, hdr->caplen); + ppc->pkts[ppc->num_pkts_in_chunk] = bytes; ppc->num_pkts_in_chunk++; } } @@ -229,16 +234,7 @@ pcap_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) TRACE_ERROR("ENTER PCAP_RECV_PKTS\n"); struct pcap_private_context *ppc = ctxt->io_private_context; printf("pcap_rev_pkts: num_pkts_in_chunk=%d\n", ppc->num_pkts_in_chunk); - - // for (int i = 0; i < ppc->num_pkts_in_chunk; i++) - // { - // if(!ppc->hdrs[i]) - // printf("hdrs[%d] is NULL\n",i); - // if(!ppc->pkts[i]) - // printf("pkts[%d] is NULL\n",i); - // printf(" pkt %d: len=%u caplen=%u\n", i,ppc->hdrs[i]->caplen); - // } - ppc->num_pkts_in_chunk = 0; + // ppc->num_pkts_in_chunk = 0; int ret = pcap_dispatch(ppc->handle, CHUNK_SIZE, pcap_packet_handler, (u_char *)ppc); TRACE_ERROR("pcap dispatch returned %d\n\n", ret); // receive up to max CHUNK_SIZE packets diff --git a/mtcp/src/tcp_in.c b/mtcp/src/tcp_in.c index d8ce722a1..fbb38ef6c 100644 --- a/mtcp/src/tcp_in.c +++ b/mtcp/src/tcp_in.c @@ -33,21 +33,29 @@ FilterSYNPacket(mtcp_manager_t mtcp, uint32_t ip, uint16_t port) /* if not the address we want, drop */ listener = (struct tcp_listener *)ListenerHTSearch(mtcp->listeners, &port); - if (listener == NULL) return FALSE; + if (listener == NULL) + return FALSE; addr = &listener->socket->saddr; - if (addr->sin_port == port) { - if (addr->sin_addr.s_addr != INADDR_ANY) { - if (ip == addr->sin_addr.s_addr) { + if (addr->sin_port == port) + { + if (addr->sin_addr.s_addr != INADDR_ANY) + { + if (ip == addr->sin_addr.s_addr) + { return TRUE; } return FALSE; - } else { + } + else + { int i; - for (i = 0; i < CONFIG.eths_num; i++) { - if (ip == CONFIG.eths[i].ip_addr) { + for (i = 0; i < CONFIG.eths_num; i++) + { + if (ip == CONFIG.eths[i].ip_addr) + { return TRUE; } } @@ -67,7 +75,8 @@ HandlePassiveOpen(mtcp_manager_t mtcp, uint32_t cur_ts, const struct iphdr *iph, /* create new stream and add to flow hash table */ cur_stream = CreateTCPStream(mtcp, NULL, MTCP_SOCK_STREAM, iph->daddr, tcph->dest, iph->saddr, tcph->source); - if (!cur_stream) { + if (!cur_stream) + { TRACE_ERROR("INFO: Could not allocate tcp_stream!\n"); return FALSE; } @@ -93,8 +102,7 @@ HandleActiveOpen(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, cur_stream->rcvvar->last_ack_seq = ack_seq; ParseTCPOptions(cur_stream, cur_ts, (uint8_t *)tcph + TCP_HEADER_LEN, (tcph->doff << 2) - TCP_HEADER_LEN); - cur_stream->sndvar->cwnd = ((cur_stream->sndvar->cwnd == 1)? - (cur_stream->sndvar->mss * TCP_INIT_CWND): cur_stream->sndvar->mss); + cur_stream->sndvar->cwnd = ((cur_stream->sndvar->cwnd == 1) ? (cur_stream->sndvar->mss * TCP_INIT_CWND) : cur_stream->sndvar->mss); cur_stream->sndvar->ssthresh = cur_stream->sndvar->mss * 10; UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); @@ -355,7 +363,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, int ret; cwindow = window; - if (!tcph->syn) { + if (!tcph->syn) + { cwindow = cwindow << sndvar->wscale_peer; } right_wnd_edge = sndvar->peer_wnd + cur_stream->rcvvar->snd_wl2; @@ -365,15 +374,19 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, cur_stream->state == TCP_ST_FIN_WAIT_2 || cur_stream->state == TCP_ST_CLOSING || cur_stream->state == TCP_ST_CLOSE_WAIT || - cur_stream->state == TCP_ST_LAST_ACK) { - if (sndvar->is_fin_sent && ack_seq == sndvar->fss + 1) { + cur_stream->state == TCP_ST_LAST_ACK) + { + if (sndvar->is_fin_sent && ack_seq == sndvar->fss + 1) + { ack_seq--; } } - if (TCP_SEQ_GT(ack_seq, sndvar->sndbuf->head_seq + sndvar->sndbuf->len)) { + if (TCP_SEQ_GT(ack_seq, sndvar->sndbuf->head_seq + sndvar->sndbuf->len)) + { TRACE_DBG("Stream %d (%s): invalid acknologement. " - "ack_seq: %u, possible max_ack_seq: %u\n", cur_stream->id, + "ack_seq: %u, possible max_ack_seq: %u\n", + cur_stream->id, TCPStateToString(cur_stream), ack_seq, sndvar->sndbuf->head_seq + sndvar->sndbuf->len); return; @@ -384,7 +397,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, (cur_stream->rcvvar->snd_wl1 == seq && TCP_SEQ_LT(cur_stream->rcvvar->snd_wl2, ack_seq)) || (cur_stream->rcvvar->snd_wl2 == ack_seq && - cwindow > sndvar->peer_wnd)) { + cwindow > sndvar->peer_wnd)) + { cwindow_prev = sndvar->peer_wnd; sndvar->peer_wnd = cwindow; cur_stream->rcvvar->snd_wl1 = seq; @@ -394,13 +408,14 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, "ack: %u, peer_wnd: %u, snd_nxt-snd_una: %u\n", ack_seq, cwindow, cur_stream->snd_nxt - sndvar->snd_una); #endif - if (cwindow_prev < cur_stream->snd_nxt - sndvar->snd_una && - sndvar->peer_wnd >= cur_stream->snd_nxt - sndvar->snd_una) { + if (cwindow_prev < cur_stream->snd_nxt - sndvar->snd_una && + sndvar->peer_wnd >= cur_stream->snd_nxt - sndvar->snd_una) + { TRACE_CLWND("%u Broadcasting client window update! " - "ack_seq: %u, peer_wnd: %u (before: %u), " - "(snd_nxt - snd_una: %u)\n", - cur_stream->id, ack_seq, sndvar->peer_wnd, cwindow_prev, - cur_stream->snd_nxt - sndvar->snd_una); + "ack_seq: %u, peer_wnd: %u (before: %u), " + "(snd_nxt - snd_una: %u)\n", + cur_stream->id, ack_seq, sndvar->peer_wnd, cwindow_prev, + cur_stream->snd_nxt - sndvar->snd_una); RaiseWriteEvent(mtcp, cur_stream); } } @@ -415,10 +430,14 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, */ dup = FALSE; - if (TCP_SEQ_LT(ack_seq, cur_stream->snd_nxt)) { - if (ack_seq == cur_stream->rcvvar->last_ack_seq && payloadlen == 0) { - if (cur_stream->rcvvar->snd_wl2 + sndvar->peer_wnd == right_wnd_edge) { - if (cur_stream->rcvvar->dup_acks + 1 > cur_stream->rcvvar->dup_acks) { + if (TCP_SEQ_LT(ack_seq, cur_stream->snd_nxt)) + { + if (ack_seq == cur_stream->rcvvar->last_ack_seq && payloadlen == 0) + { + if (cur_stream->rcvvar->snd_wl2 + sndvar->peer_wnd == right_wnd_edge) + { + if (cur_stream->rcvvar->dup_acks + 1 > cur_stream->rcvvar->dup_acks) + { cur_stream->rcvvar->dup_acks++; #if USE_CCP ccp_record_event(mtcp, cur_stream, EVENT_DUPACK, @@ -429,12 +448,14 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, } } } - if (!dup) { + if (!dup) + { #if USE_CCP - if (cur_stream->rcvvar->dup_acks >= 3) { + if (cur_stream->rcvvar->dup_acks >= 3) + { TRACE_DBG("passed dup_acks, ack=%u, snd_nxt=%u, last_ack=%u len=%u wl2=%u peer_wnd=%u right=%u\n", - ack_seq-sndvar->iss, cur_stream->snd_nxt-sndvar->iss, cur_stream->rcvvar->last_ack_seq-sndvar->iss, - payloadlen, cur_stream->rcvvar->snd_wl2-sndvar->iss, sndvar->peer_wnd / sndvar->mss, + ack_seq - sndvar->iss, cur_stream->snd_nxt - sndvar->iss, cur_stream->rcvvar->last_ack_seq - sndvar->iss, + payloadlen, cur_stream->rcvvar->snd_wl2 - sndvar->iss, sndvar->peer_wnd / sndvar->mss, right_wnd_edge - sndvar->iss); } #endif @@ -442,19 +463,22 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, cur_stream->rcvvar->last_ack_seq = ack_seq; } #if USE_CCP - if(cur_stream->wait_for_acks) { + if (cur_stream->wait_for_acks) + { TRACE_ERROR("got ack, but waiting to send... ack=%u, snd_next=%u cwnd=%u\n", - ack_seq-sndvar->iss, cur_stream->snd_nxt-sndvar->iss, + ack_seq - sndvar->iss, cur_stream->snd_nxt - sndvar->iss, sndvar->cwnd / sndvar->mss); } #endif /* Fast retransmission */ - if (dup && cur_stream->rcvvar->dup_acks == 3) { + if (dup && cur_stream->rcvvar->dup_acks == 3) + { TRACE_ERROR("Triple duplicated ACKs!! ack_seq: %u\n", ack_seq); TRACE_CCP("tridup ack %u (%u)!\n", ack_seq - cur_stream->sndvar->iss, ack_seq); - if (TCP_SEQ_LT(ack_seq, cur_stream->snd_nxt)) { + if (TCP_SEQ_LT(ack_seq, cur_stream->snd_nxt)) + { TRACE_LOSS("Reducing snd_nxt from %u to %u\n", - cur_stream->snd_nxt-sndvar->iss, + cur_stream->snd_nxt - sndvar->iss, ack_seq - cur_stream->sndvar->iss); #if RTM_STAT @@ -465,7 +489,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, #if USE_CCP ccp_record_event(mtcp, cur_stream, EVENT_TRI_DUPACK, ack_seq); #endif - if (ack_seq != sndvar->snd_una) { + if (ack_seq != sndvar->snd_una) + { TRACE_DBG("ack_seq and snd_una mismatch on tdp ack. " "ack_seq: %u, snd_una: %u\n", ack_seq, sndvar->snd_una); @@ -480,7 +505,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, /* update congestion control variables */ /* ssthresh to half of min of cwnd and peer wnd */ sndvar->ssthresh = MIN(sndvar->cwnd, sndvar->peer_wnd) / 2; - if (sndvar->ssthresh < 2 * sndvar->mss) { + if (sndvar->ssthresh < 2 * sndvar->mss) + { sndvar->ssthresh = 2 * sndvar->mss; } sndvar->cwnd = sndvar->ssthresh + 3 * sndvar->mss; @@ -490,17 +516,22 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, sndvar->cwnd / sndvar->mss); /* count number of retransmissions */ - if (sndvar->nrtx < TCP_MAX_RTX) { + if (sndvar->nrtx < TCP_MAX_RTX) + { sndvar->nrtx++; - } else { + } + else + { TRACE_DBG("Exceed MAX_RTX.\n"); } AddtoSendList(mtcp, cur_stream); - - } else if (cur_stream->rcvvar->dup_acks > 3) { + } + else if (cur_stream->rcvvar->dup_acks > 3) + { /* Inflate congestion window until before overflow */ - if ((uint32_t)(sndvar->cwnd + sndvar->mss) > sndvar->cwnd) { + if ((uint32_t)(sndvar->cwnd + sndvar->mss) > sndvar->cwnd) + { sndvar->cwnd += sndvar->mss; TRACE_CONG("Dupack cwnd inflate. cwnd: %u, ssthresh: %u\n", sndvar->cwnd, sndvar->ssthresh); @@ -538,12 +569,15 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, #endif cur_stream->snd_nxt = ack_seq; TRACE_DBG("Sending again..., ack_seq=%u sndlen=%u cwnd=%u\n", - ack_seq-sndvar->iss, + ack_seq - sndvar->iss, sndvar->sndbuf->len, sndvar->cwnd / sndvar->mss); - if (sndvar->sndbuf->len == 0) { + if (sndvar->sndbuf->len == 0) + { RemoveFromSendList(mtcp, cur_stream); - } else { + } + else + { AddtoSendList(mtcp, cur_stream); } } @@ -551,7 +585,8 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, rmlen = ack_seq - sndvar->sndbuf->head_seq; uint16_t packets = rmlen / sndvar->eff_mss; - if (packets * sndvar->eff_mss > rmlen) { + if (packets * sndvar->eff_mss > rmlen) + { packets++; } @@ -562,39 +597,50 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, #endif /* If ack_seq is previously acked, return */ - if (TCP_SEQ_GEQ(sndvar->sndbuf->head_seq, ack_seq)) { + if (TCP_SEQ_GEQ(sndvar->sndbuf->head_seq, ack_seq)) + { return; } /* Remove acked sequence from send buffer */ - if (rmlen > 0) { + if (rmlen > 0) + { /* Routine goes here only if there is new payload (not retransmitted) */ /* Estimate RTT and calculate rto */ - if (cur_stream->saw_timestamp) { + if (cur_stream->saw_timestamp) + { EstimateRTT(mtcp, cur_stream, cur_ts - cur_stream->rcvvar->ts_lastack_rcvd); sndvar->rto = (cur_stream->rcvvar->srtt >> 3) + cur_stream->rcvvar->rttvar; assert(sndvar->rto > 0); - } else { - //TODO: Need to implement timestamp estimation without timestamp + } + else + { + // TODO: Need to implement timestamp estimation without timestamp TRACE_RTT("NOT IMPLEMENTED.\n"); } // TODO CCP should comment this out? /* Update congestion control variables */ - if (cur_stream->state >= TCP_ST_ESTABLISHED) { - if (sndvar->cwnd < sndvar->ssthresh) { - if ((sndvar->cwnd + sndvar->mss) > sndvar->cwnd) { + if (cur_stream->state >= TCP_ST_ESTABLISHED) + { + if (sndvar->cwnd < sndvar->ssthresh) + { + if ((sndvar->cwnd + sndvar->mss) > sndvar->cwnd) + { sndvar->cwnd += (sndvar->mss * packets); } TRACE_CONG("slow start cwnd: %u, ssthresh: %u\n", sndvar->cwnd, sndvar->ssthresh); - } else { + } + else + { uint32_t new_cwnd = sndvar->cwnd + packets * sndvar->mss * sndvar->mss / sndvar->cwnd; - if (new_cwnd > sndvar->cwnd) { + if (new_cwnd > sndvar->cwnd) + { sndvar->cwnd = new_cwnd; } // TRACE_CONG("congestion avoidance cwnd: %u, ssthresh: %u\n", @@ -602,14 +648,15 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, } } - if (SBUF_LOCK(&sndvar->write_lock)) { + if (SBUF_LOCK(&sndvar->write_lock)) + { if (errno == EDEADLK) perror("ProcessACK: write_lock blocked\n"); assert(0); } ret = SBRemove(mtcp->rbm_snd, sndvar->sndbuf, rmlen); - TRACE_ERROR("[ProcessACK] post-SBRemove: " + printf("[ProcessACK] post-SBRemove: " "snd_una=%u snd_nxt=%u snd_wnd=%u " "peer_wnd=%u buf->len=%u buf->head_seq=%u\n", sndvar->snd_una, @@ -623,28 +670,20 @@ ProcessACK(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts, snd_wnd_prev = sndvar->snd_wnd; sndvar->snd_wnd = sndvar->sndbuf->size - sndvar->sndbuf->len; - /* If there was no available sending window */ - /* notify the newly available window to application */ -#if SELECTIVE_WRITE_EVENT_NOTIFY - if (snd_wnd_prev <= 0 || sndvar->sndbuf->len == 0 ) { -#endif /* SELECTIVE_WRITE_EVENT_NOTIFY */ - RaiseWriteEvent(mtcp, cur_stream); -#if SELECTIVE_WRITE_EVENT_NOTIFY + if (snd_wnd_prev <= 0 || sndvar->sndbuf->len == 0) + { + if (cur_stream->socket) + { + RaiseWriteEvent(mtcp, cur_stream); + printf("[ProcessACK] Raised write event for sock %d (wnd_prev=%u, wnd=%u, len=%u)\n", + cur_stream->socket->id, + snd_wnd_prev, sndvar->snd_wnd, sndvar->sndbuf->len); + } } -#endif /* SELECTIVE_WRITE_EVENT_NOTIFY */ - SBUF_UNLOCK(&sndvar->write_lock); UpdateRetransmissionTimer(mtcp, cur_stream, cur_ts); } - TRACE_ERROR("[ProcessACK] " - "ack_seq=%u | snd_una=%u | snd_wnd=%u | peer_wnd=%u | iss=%u | fss=%u\n", - ack_seq, - sndvar->snd_una, - sndvar->snd_wnd, - sndvar->peer_wnd, - sndvar->iss, - sndvar->fss); - + UNUSED(ret); } /*----------------------------------------------------------------------------*/ diff --git a/mtcp/src/tcp_out.c b/mtcp/src/tcp_out.c index 8348357d1..ee870c2cb 100644 --- a/mtcp/src/tcp_out.c +++ b/mtcp/src/tcp_out.c @@ -238,6 +238,8 @@ SendTCPPacket(struct mtcp_manager *mtcp, tcp_stream *cur_stream, tcph = (struct tcphdr *)IPOutput(mtcp, cur_stream, TCP_HEADER_LEN + optlen + payloadlen); + + if (tcph == NULL) { return -2; } @@ -611,29 +613,35 @@ FlushTCPSendingBuffer(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ static inline int SendControlPacket(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts) { + printf("DEBUG: SendControlPacket\n"); struct tcp_send_vars *sndvar = cur_stream->sndvar; int ret = 0; if (cur_stream->state == TCP_ST_SYN_SENT) { /* Send SYN here */ + printf("DEBUG: SYN SENT\n"); ret = SendTCPPacket(mtcp, cur_stream, cur_ts, TCP_FLAG_SYN, NULL, 0); } else if (cur_stream->state == TCP_ST_SYN_RCVD) { /* Send SYN/ACK here */ + printf("DEBUG: SYN RCVD\n"); cur_stream->snd_nxt = sndvar->iss; ret = SendTCPPacket(mtcp, cur_stream, cur_ts, TCP_FLAG_SYN | TCP_FLAG_ACK, NULL, 0); } else if (cur_stream->state == TCP_ST_ESTABLISHED) { /* Send ACK here */ + printf("DEBUG: ST_ESTABLISHED\n"); ret = SendTCPPacket(mtcp, cur_stream, cur_ts, TCP_FLAG_ACK, NULL, 0); } else if (cur_stream->state == TCP_ST_CLOSE_WAIT) { /* Send ACK for the FIN here */ + printf("DEBUG: ST_CLOSE_WAIT SENT\n"); ret = SendTCPPacket(mtcp, cur_stream, cur_ts, TCP_FLAG_ACK, NULL, 0); } else if (cur_stream->state == TCP_ST_LAST_ACK) { /* if it is on ack_list, send it after sending ack */ + printf("DEBUG: LAST ACK SENT\n"); if (sndvar->on_send_list || sndvar->on_ack_list) { ret = -1; } else { @@ -642,6 +650,7 @@ SendControlPacket(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts) TCP_FLAG_FIN | TCP_FLAG_ACK, NULL, 0); } } else if (cur_stream->state == TCP_ST_FIN_WAIT_1) { + printf("DEBUG: FIN_WAIT_1\n"); /* if it is on ack_list, send it after sending ack */ if (sndvar->on_send_list || sndvar->on_ack_list) { ret = -1; @@ -653,9 +662,11 @@ SendControlPacket(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts) } else if (cur_stream->state == TCP_ST_FIN_WAIT_2) { /* Send ACK here */ + printf("DEBUG: FIN_WAIT_2\n"); ret = SendTCPPacket(mtcp, cur_stream, cur_ts, TCP_FLAG_ACK, NULL, 0); } else if (cur_stream->state == TCP_ST_CLOSING) { + printf("DEBUG: ST_CLOSING\n"); if (sndvar->is_fin_sent) { /* if the sequence is for FIN, send FIN */ if (cur_stream->snd_nxt == sndvar->fss) { @@ -673,10 +684,12 @@ SendControlPacket(mtcp_manager_t mtcp, tcp_stream *cur_stream, uint32_t cur_ts) } else if (cur_stream->state == TCP_ST_TIME_WAIT) { /* Send ACK here */ + printf("DEBUG: ST_TIMEWAIT\n"); ret = SendTCPPacket(mtcp, cur_stream, cur_ts, TCP_FLAG_ACK, NULL, 0); } else if (cur_stream->state == TCP_ST_CLOSED) { /* Send RST here */ + printf("DEBUG: ST_CLOSED\n"); TRACE_DBG("Stream %d: Try sending RST (TCP_ST_CLOSED)\n", cur_stream->id); /* first flush the data and ack */ @@ -1082,7 +1095,7 @@ EnqueueACK(mtcp_manager_t mtcp, cur_stream->state == TCP_ST_CLOSE_WAIT || cur_stream->state == TCP_ST_FIN_WAIT_1 || cur_stream->state == TCP_ST_FIN_WAIT_2)) { - TRACE_DBG("Stream %u: Enqueueing ack at state %s\n", + TRACE_ERROR("Stream %u: Enqueueing ack at state %s\n", cur_stream->id, TCPStateToString(cur_stream)); } diff --git a/mtcp/src/tcp_send_buffer.c b/mtcp/src/tcp_send_buffer.c index 78095d213..924e7c9d5 100644 --- a/mtcp/src/tcp_send_buffer.c +++ b/mtcp/src/tcp_send_buffer.c @@ -5,8 +5,8 @@ #include "tcp_send_buffer.h" #include "tcp_sb_queue.h" -#define MAX(a, b) ((a)>(b)?(a):(b)) -#define MIN(a, b) ((a)<(b)?(a):(b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) /*----------------------------------------------------------------------------*/ struct sb_manager @@ -19,38 +19,45 @@ struct sb_manager } sb_manager; /*----------------------------------------------------------------------------*/ -uint32_t +uint32_t SBGetCurnum(sb_manager_t sbm) { return sbm->cur_num; } /*----------------------------------------------------------------------------*/ -sb_manager_t +sb_manager_t SBManagerCreate(mtcp_manager_t mtcp, size_t chunk_size, uint32_t cnum) { sb_manager_t sbm = (sb_manager_t)calloc(1, sizeof(sb_manager)); - if (!sbm) { + if (!sbm) + { TRACE_ERROR("SBManagerCreate() failed. %s\n", strerror(errno)); return NULL; } sbm->chunk_size = chunk_size; sbm->cnum = cnum; + #if !defined(DISABLE_DPDK) && !defined(ENABLE_ONVM) char pool_name[RTE_MEMPOOL_NAMESIZE]; sprintf(pool_name, "sbm_pool_%d", mtcp->ctx->cpu); - sbm->mp = (mem_pool_t)MPCreate(pool_name, chunk_size, (uint64_t)chunk_size * cnum); + sbm->mp = (mem_pool_t)MPCreate(pool_name, chunk_size, (uint64_t)chunk_size * cnum); #else sbm->mp = (mem_pool_t)MPCreate(chunk_size, (uint64_t)chunk_size * cnum); #endif - if (!sbm->mp) { + if (!sbm->mp) + { TRACE_ERROR("Failed to create mem pool for sb.\n"); free(sbm); return NULL; } + /*This queue stores the indices of currently free buffer chunks. + When a stream needs a send buffer, it pops from this queue; + when buffer is freed, it pushes back.*/ sbm->freeq = CreateSBQueue(cnum); - if (!sbm->freeq) { + if (!sbm->freeq) + { TRACE_ERROR("Failed to create free buffer queue.\n"); MPDestroy(sbm->mp); free(sbm); @@ -67,14 +74,17 @@ SBInit(sb_manager_t sbm, uint32_t init_seq) /* first try dequeue from free buffer queue */ buf = SBDequeue(sbm->freeq); - if (!buf) { + if (!buf) + { buf = (struct tcp_send_buffer *)malloc(sizeof(struct tcp_send_buffer)); - if (!buf) { + if (!buf) + { perror("malloc() for buf"); return NULL; } buf->data = MPAllocateChunk(sbm->mp); - if (!buf->data) { + if (!buf->data) + { TRACE_ERROR("Failed to fetch memory chunk for data.\n"); free(buf); return NULL; @@ -89,7 +99,7 @@ SBInit(sb_manager_t sbm, uint32_t init_seq) buf->size = sbm->chunk_size; buf->init_seq = buf->head_seq = init_seq; - + return buf; } /*----------------------------------------------------------------------------*/ @@ -110,8 +120,7 @@ SBFreeInternal(sb_manager_t sbm, struct tcp_send_buffer *buf) } #endif /*----------------------------------------------------------------------------*/ -void -SBFree(sb_manager_t sbm, struct tcp_send_buffer *buf) +void SBFree(sb_manager_t sbm, struct tcp_send_buffer *buf) { if (!buf) return; @@ -119,7 +128,7 @@ SBFree(sb_manager_t sbm, struct tcp_send_buffer *buf) SBEnqueue(sbm->freeq, buf); } /*----------------------------------------------------------------------------*/ -size_t +size_t SBPut(sb_manager_t sbm, struct tcp_send_buffer *buf, const void *data, size_t len) { size_t to_put; @@ -129,15 +138,19 @@ SBPut(sb_manager_t sbm, struct tcp_send_buffer *buf, const void *data, size_t le /* if no space, return -2 */ to_put = MIN(len, buf->size - buf->len); - if (to_put <= 0) { + if (to_put <= 0) + { return -2; } - if (buf->tail_off + to_put < buf->size) { + if (buf->tail_off + to_put < buf->size) + { /* if the data fit into the buffer, copy it */ memcpy(buf->data + buf->tail_off, data, to_put); buf->tail_off += to_put; - } else { + } + else + { /* if buffer overflows, move the existing payload and merge */ memmove(buf->data, buf->head, buf->len); buf->head = buf->data; @@ -151,30 +164,49 @@ SBPut(sb_manager_t sbm, struct tcp_send_buffer *buf, const void *data, size_t le return to_put; } /*----------------------------------------------------------------------------*/ -size_t +size_t SBRemove(sb_manager_t sbm, struct tcp_send_buffer *buf, size_t len) { - size_t to_remove; - - if (len <= 0) - return 0; - - to_remove = MIN(len, buf->len); - if (to_remove <= 0) { - return -2; - } - - buf->head_off += to_remove; - buf->head = buf->data + buf->head_off; - buf->head_seq += to_remove; - buf->len -= to_remove; - - /* if buffer is empty, move the head to 0 */ - if (buf->len == 0 && buf->head_off > 0) { - buf->head = buf->data; - buf->head_off = buf->tail_off = 0; - } - - return to_remove; + TRACE_ERROR("[SBRemove] called: req_len=%zu | " + "before: head_seq=%u head_off=%u tail_off=%u len=%u size=%u\n", + len, + buf->head_seq, + buf->head_off, + buf->tail_off, + buf->len, + buf->size); + + if (len <= 0) + return 0; + + size_t to_remove = MIN(len, buf->len); + if (to_remove <= 0) { + TRACE_ERROR("[SBRemove] nothing to remove (len=%zu buf->len=%u)\n", + len, buf->len); + return 0; + } + + buf->head_off += to_remove; + buf->head = buf->data + buf->head_off; + buf->head_seq += to_remove; + buf->len -= to_remove; + + /* if buffer is empty, reset offsets */ + if (buf->len == 0 && buf->head_off > 0) { + buf->head = buf->data; + buf->head_off = buf->tail_off = 0; + } + + TRACE_ERROR("[SBRemove] done: removed=%zu | " + "after: head_seq=%u head_off=%u tail_off=%u len=%u size=%u\n", + to_remove, + buf->head_seq, + buf->head_off, + buf->tail_off, + buf->len, + buf->size); + + return to_remove; } + /*---------------------------------------------------------------------------*/ diff --git a/mtcp/src/tcp_stream.c b/mtcp/src/tcp_stream.c index 6bf89ffbe..dc33df3ad 100644 --- a/mtcp/src/tcp_stream.c +++ b/mtcp/src/tcp_stream.c @@ -18,30 +18,28 @@ #define TCP_MAX_SEQ 4294967295 /*---------------------------------------------------------------------------*/ -char *state_str[] = {"TCP_ST_CLOSED", - "TCP_ST_LISTEN", - "TCP_ST_SYN_SENT", - "TCP_ST_SYN_RCVD", - "TCP_ST_ESTABILSHED", - "TCP_ST_FIN_WAIT_1", - "TCP_ST_FIN_WAIT_2", - "TCP_ST_CLOSE_WAIT", - "TCP_ST_CLOSING", - "TCP_ST_LAST_ACK", - "TCP_ST_TIME_WAIT" -}; +char *state_str[] = {"TCP_ST_CLOSED", + "TCP_ST_LISTEN", + "TCP_ST_SYN_SENT", + "TCP_ST_SYN_RCVD", + "TCP_ST_ESTABILSHED", + "TCP_ST_FIN_WAIT_1", + "TCP_ST_FIN_WAIT_2", + "TCP_ST_CLOSE_WAIT", + "TCP_ST_CLOSING", + "TCP_ST_LAST_ACK", + "TCP_ST_TIME_WAIT"}; /*---------------------------------------------------------------------------*/ char *close_reason_str[] = { - "NOT_CLOSED", - "CLOSE", - "CLOSED", - "CONN_FAIL", - "CONN_LOST", - "RESET", - "NO_MEM", - "DENIED", - "TIMEDOUT" -}; + "NOT_CLOSED", + "CLOSE", + "CLOSED", + "CONN_FAIL", + "CONN_LOST", + "RESET", + "NO_MEM", + "DENIED", + "TIMEDOUT"}; /*---------------------------------------------------------------------------*/ /* for rand_r() functions */ static __thread unsigned int next_seed; @@ -82,7 +80,8 @@ HashFlow(const void *f) unsigned int hash, i; char *key = (char *)&flow->saddr; - for (hash = i = 0; i < 12; ++i) { + for (hash = i = 0; i < 12; ++i) + { hash += key[i]; hash += (hash << 10); hash ^= (hash >> 6); @@ -95,13 +94,12 @@ HashFlow(const void *f) #endif } /*---------------------------------------------------------------------------*/ -int -EqualFlow(const void *f1, const void *f2) +int EqualFlow(const void *f1, const void *f2) { tcp_stream *flow1 = (tcp_stream *)f1; tcp_stream *flow2 = (tcp_stream *)f2; - return (flow1->saddr == flow2->saddr && + return (flow1->saddr == flow2->saddr && flow1->sport == flow2->sport && flow1->daddr == flow2->daddr && flow1->dport == flow2->dport); @@ -109,70 +107,81 @@ EqualFlow(const void *f1, const void *f2) #if USE_CCP /*---------------------------------------------------------------------------*/ -unsigned int HashSID(const void *f) { +unsigned int HashSID(const void *f) +{ tcp_stream *flow = (tcp_stream *)f; - return (flow->id % (NUM_BINS_FLOWS -1)); + return (flow->id % (NUM_BINS_FLOWS - 1)); } -int -EqualSID(const void *f1, const void *f2) { +int EqualSID(const void *f1, const void *f2) +{ return (((tcp_stream *)f1)->id == ((tcp_stream *)f2)->id); } /*----------------------------------------------------------------------------*/ #endif -inline void +inline void RaiseReadEvent(mtcp_manager_t mtcp, tcp_stream *stream) { - if (stream->socket) { - if (stream->socket->epoll & MTCP_EPOLLIN) { - AddEpollEvent(mtcp->ep, - MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLIN); + if (stream->socket) + { + if (stream->socket->epoll & MTCP_EPOLLIN) + { + TRACE_ERROR("To check it is non block : block\n"); + AddEpollEvent(mtcp->ep, + MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLIN); #if BLOCKING_SUPPORT - } else if (!(stream->socket->opts & MTCP_NONBLOCK)) { - if (!stream->on_rcv_br_list) { + } + else if (!(stream->socket->opts & MTCP_NONBLOCK)) + { + TRACE_ERROR("To check it is non block : non - block\n"); + if (!stream->on_rcv_br_list) + { stream->on_rcv_br_list = TRUE; TAILQ_INSERT_TAIL(&mtcp->rcv_br_list, stream, rcvvar->rcv_br_link); mtcp->rcv_br_list_cnt++; } #endif } - } else { + } + else + { TRACE_EPOLL("Stream %d: Raising read without a socket!\n", stream->id); } } /*---------------------------------------------------------------------------*/ -inline void +inline void RaiseWriteEvent(mtcp_manager_t mtcp, tcp_stream *stream) { if (stream->socket) { if (stream->socket->epoll & MTCP_EPOLLOUT) { - AddEpollEvent(mtcp->ep, + AddEpollEvent(mtcp->ep, MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLOUT); #if BLOCKING_SUPPORT } else if (!(stream->socket->opts & MTCP_NONBLOCK)) { if (!stream->on_snd_br_list) { - stream->on_snd_br_list = TRUE; - TAILQ_INSERT_TAIL(&mtcp->snd_br_list, stream, sndvar->snd_br_link); - mtcp->snd_br_list_cnt++; - } -#endif + stream->on_snd_br_list = TRUE; + TAILQ_INSERT_TAIL(&mtcp->snd_br_list, stream, sndvar->snd_br_link); + mtcp->snd_br_list_cnt++; } +#endif + } } else { TRACE_EPOLL("Stream %d: Raising write without a socket!\n", stream->id); } + } /*---------------------------------------------------------------------------*/ -inline void +inline void RaiseCloseEvent(mtcp_manager_t mtcp, tcp_stream *stream) { if (stream->socket) { if (stream->socket->epoll & MTCP_EPOLLRDHUP) { - AddEpollEvent(mtcp->ep, - MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLRDHUP); + AddEpollEvent(mtcp->ep, + MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLRDHUP); } else if (stream->socket->epoll & MTCP_EPOLLIN) { - AddEpollEvent(mtcp->ep, - MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLIN); + AddEpollEvent(mtcp->ep, + MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLIN); #if BLOCKING_SUPPORT } else if (!(stream->socket->opts & MTCP_NONBLOCK)) { //pthread_cond_signal(&stream->rcvvar->read_cond); @@ -194,35 +203,43 @@ RaiseCloseEvent(mtcp_manager_t mtcp, tcp_stream *stream) } } /*---------------------------------------------------------------------------*/ -inline void +inline void RaiseErrorEvent(mtcp_manager_t mtcp, tcp_stream *stream) { - if (stream->socket) { - if (stream->socket->epoll & MTCP_EPOLLERR) { - AddEpollEvent(mtcp->ep, - MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLERR); + if (stream->socket) + { + if (stream->socket->epoll & MTCP_EPOLLERR) + { + AddEpollEvent(mtcp->ep, + MTCP_EVENT_QUEUE, stream->socket, MTCP_EPOLLERR); #if BLOCKING_SUPPORT - } else if (!(stream->socket->opts & MTCP_NONBLOCK)) { - if (!stream->on_rcv_br_list) { + } + else if (!(stream->socket->opts & MTCP_NONBLOCK)) + { + if (!stream->on_rcv_br_list) + { stream->on_rcv_br_list = TRUE; TAILQ_INSERT_TAIL(&mtcp->rcv_br_list, stream, rcvvar->rcv_br_link); mtcp->rcv_br_list_cnt++; } - if (!stream->on_snd_br_list) { + if (!stream->on_snd_br_list) + { stream->on_snd_br_list = TRUE; TAILQ_INSERT_TAIL(&mtcp->snd_br_list, stream, sndvar->snd_br_link); mtcp->snd_br_list_cnt++; } #endif } - } else { + } + else + { TRACE_EPOLL("Stream %d: Raising error without a socket!\n", stream->id); } } /*---------------------------------------------------------------------------*/ tcp_stream * -CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, - uint32_t saddr, uint16_t sport, uint32_t daddr, uint16_t dport) +CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, + uint32_t saddr, uint16_t sport, uint32_t daddr, uint16_t dport) { tcp_stream *stream = NULL; int ret; @@ -230,14 +247,14 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, uint8_t is_external; uint8_t *sa; uint8_t *da; - + pthread_mutex_lock(&mtcp->ctx->flow_pool_lock); stream = (tcp_stream *)MPAllocateChunk(mtcp->flow_pool); if (!stream) { TRACE_ERROR("Cannot allocate memory for the stream. " - "CONFIG.max_concurrency: %d, concurrent: %u\n", - CONFIG.max_concurrency, mtcp->flow_cnt); + "CONFIG.max_concurrency: %d, concurrent: %u\n", + CONFIG.max_concurrency, mtcp->flow_cnt); pthread_mutex_unlock(&mtcp->ctx->flow_pool_lock); return NULL; } @@ -266,9 +283,11 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, stream->dport = dport; ret = StreamHTInsert(mtcp->tcp_flow_table, stream); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("Stream %d: " - "Failed to insert the stream into hash table.\n", stream->id); + "Failed to insert the stream into hash table.\n", + stream->id); MPFreeChunk(mtcp->flow_pool, stream); pthread_mutex_unlock(&mtcp->ctx->flow_pool_lock); return NULL; @@ -276,9 +295,11 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, #if USE_CCP ret = StreamHTInsert(mtcp->tcp_sid_table, stream); - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("Stream %d: " - "Failed to insert the stream into SID lookup table.\n", stream->id); + "Failed to insert the stream into SID lookup table.\n", + stream->id); MPFreeChunk(mtcp->flow_pool, stream); pthread_mutex_unlock(&mtcp->ctx->flow_pool_lock); return NULL; @@ -290,7 +311,8 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, pthread_mutex_unlock(&mtcp->ctx->flow_pool_lock); - if (socket) { + if (socket) + { stream->socket = socket; socket->stream = stream; } @@ -299,7 +321,7 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, stream->state = TCP_ST_LISTEN; stream->on_rto_idx = -1; - + stream->sndvar->ip_id = 0; stream->sndvar->mss = TCP_DEFAULT_MSS; stream->sndvar->wscale_mine = TCP_DEFAULT_WSCALE; @@ -308,7 +330,7 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, stream->is_external = is_external; stream->sndvar->iss = rand_r(&next_seed) % TCP_MAX_SEQ; - //stream->sndvar->iss = 0; + // stream->sndvar->iss = 0; stream->rcvvar->irs = 0; stream->snd_nxt = stream->sndvar->iss; @@ -325,20 +347,24 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, stream->sndvar->rto = TCP_INITIAL_RTO; #if BLOCKING_SUPPORT - if (pthread_cond_init(&stream->rcvvar->read_cond, NULL)) { + if (pthread_cond_init(&stream->rcvvar->read_cond, NULL)) + { perror("pthread_cond_init of read_cond"); return NULL; } - if (pthread_cond_init(&stream->sndvar->write_cond, NULL)) { + if (pthread_cond_init(&stream->sndvar->write_cond, NULL)) + { perror("pthread_cond_init of write_cond"); return NULL; } #endif #if USE_SPIN_LOCK - if (pthread_spin_init(&stream->rcvvar->read_lock, PTHREAD_PROCESS_PRIVATE)) { + if (pthread_spin_init(&stream->rcvvar->read_lock, PTHREAD_PROCESS_PRIVATE)) + { #else - if (pthread_mutex_init(&stream->rcvvar->read_lock, NULL)) { + if (pthread_mutex_init(&stream->rcvvar->read_lock, NULL)) + { #endif perror("pthread_mutex_init of read_lock"); #if BLOCKING_SUPPORT @@ -348,11 +374,13 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, return NULL; } #if USE_SPIN_LOCK - if (pthread_spin_init(&stream->sndvar->write_lock, PTHREAD_PROCESS_PRIVATE)) { + if (pthread_spin_init(&stream->sndvar->write_lock, PTHREAD_PROCESS_PRIVATE)) + { perror("pthread_spin_init of write_lock"); pthread_spin_destroy(&stream->rcvvar->read_lock); #else - if (pthread_mutex_init(&stream->sndvar->write_lock, NULL)) { + if (pthread_mutex_init(&stream->sndvar->write_lock, NULL)) + { perror("pthread_mutex_init of write_lock"); pthread_mutex_destroy(&stream->rcvvar->read_lock); #endif @@ -366,10 +394,11 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, sa = (uint8_t *)&stream->saddr; da = (uint8_t *)&stream->daddr; TRACE_STREAM("CREATED NEW TCP STREAM %d: " - "%u.%u.%u.%u(%d) -> %u.%u.%u.%u(%d) (ISS: %u)\n", stream->id, - sa[0], sa[1], sa[2], sa[3], ntohs(stream->sport), - da[0], da[1], da[2], da[3], ntohs(stream->dport), - stream->sndvar->iss); + "%u.%u.%u.%u(%d) -> %u.%u.%u.%u(%d) (ISS: %u)\n", + stream->id, + sa[0], sa[1], sa[2], sa[3], ntohs(stream->sport), + da[0], da[1], da[2], da[3], ntohs(stream->dport), + stream->sndvar->iss); #if RATE_LIMIT_ENABLED stream->bucket = NewTokenBucket(); @@ -386,8 +415,7 @@ CreateTCPStream(mtcp_manager_t mtcp, socket_map_t socket, int type, return stream; } /*---------------------------------------------------------------------------*/ -void -DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) +void DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) { struct sockaddr_in addr; int bound_addr = FALSE; @@ -395,10 +423,10 @@ DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) int ret; #ifdef DUMP_STREAM - if (stream->close_reason != TCP_ACTIVE_CLOSE && + if (stream->close_reason != TCP_ACTIVE_CLOSE && stream->close_reason != TCP_PASSIVE_CLOSE) { - thread_printf(mtcp, mtcp->log_fp, - "Stream %d abnormally closed.\n", stream->id); + thread_printf(mtcp, mtcp->log_fp, + "Stream %d abnormally closed.\n", stream->id); DumpStream(mtcp, stream); DumpControlList(mtcp, mtcp->n_sender[0]); } @@ -407,72 +435,87 @@ DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) sa = (uint8_t *)&stream->saddr; da = (uint8_t *)&stream->daddr; TRACE_STREAM("DESTROY TCP STREAM %d: " - "%u.%u.%u.%u(%d) -> %u.%u.%u.%u(%d) (%s)\n", stream->id, - sa[0], sa[1], sa[2], sa[3], ntohs(stream->sport), - da[0], da[1], da[2], da[3], ntohs(stream->dport), - close_reason_str[stream->close_reason]); - - if (stream->sndvar->sndbuf) { + "%u.%u.%u.%u(%d) -> %u.%u.%u.%u(%d) (%s)\n", + stream->id, + sa[0], sa[1], sa[2], sa[3], ntohs(stream->sport), + da[0], da[1], da[2], da[3], ntohs(stream->dport), + close_reason_str[stream->close_reason]); + + if (stream->sndvar->sndbuf) + { TRACE_FSTAT("Stream %d: send buffer " - "cum_len: %lu, len: %u\n", stream->id, - stream->sndvar->sndbuf->cum_len, - stream->sndvar->sndbuf->len); + "cum_len: %lu, len: %u\n", + stream->id, + stream->sndvar->sndbuf->cum_len, + stream->sndvar->sndbuf->len); } - if (stream->rcvvar->rcvbuf) { + if (stream->rcvvar->rcvbuf) + { TRACE_FSTAT("Stream %d: recv buffer " - "cum_len: %lu, merged_len: %u, last_len: %u\n", stream->id, - stream->rcvvar->rcvbuf->cum_len, - stream->rcvvar->rcvbuf->merged_len, - stream->rcvvar->rcvbuf->last_len); + "cum_len: %lu, merged_len: %u, last_len: %u\n", + stream->id, + stream->rcvvar->rcvbuf->cum_len, + stream->rcvvar->rcvbuf->merged_len, + stream->rcvvar->rcvbuf->last_len); } #if RTM_STAT /* Triple duplicated ack stats */ - if (stream->sndvar->rstat.tdp_ack_cnt) { + if (stream->sndvar->rstat.tdp_ack_cnt) + { TRACE_FSTAT("Stream %d: triple duplicated ack: %u, " - "retransmission bytes: %u, average rtm bytes/ack: %u\n", - stream->id, - stream->sndvar->rstat.tdp_ack_cnt, stream->sndvar->rstat.tdp_ack_bytes, - stream->sndvar->rstat.tdp_ack_bytes / stream->sndvar->rstat.tdp_ack_cnt); + "retransmission bytes: %u, average rtm bytes/ack: %u\n", + stream->id, + stream->sndvar->rstat.tdp_ack_cnt, stream->sndvar->rstat.tdp_ack_bytes, + stream->sndvar->rstat.tdp_ack_bytes / stream->sndvar->rstat.tdp_ack_cnt); } /* Retransmission timeout stats */ - if (stream->sndvar->rstat.rto_cnt > 0) { - TRACE_FSTAT("Stream %d: timeout count: %u, bytes: %u\n", stream->id, - stream->sndvar->rstat.rto_cnt, stream->sndvar->rstat.rto_bytes); + if (stream->sndvar->rstat.rto_cnt > 0) + { + TRACE_FSTAT("Stream %d: timeout count: %u, bytes: %u\n", stream->id, + stream->sndvar->rstat.rto_cnt, stream->sndvar->rstat.rto_bytes); } /* Recovery stats */ - if (stream->sndvar->rstat.ack_upd_cnt) { + if (stream->sndvar->rstat.ack_upd_cnt) + { TRACE_FSTAT("Stream %d: snd_nxt update count: %u, " - "snd_nxt update bytes: %u, average update bytes/update: %u\n", - stream->id, - stream->sndvar->rstat.ack_upd_cnt, stream->sndvar->rstat.ack_upd_bytes, - stream->sndvar->rstat.ack_upd_bytes / stream->sndvar->rstat.ack_upd_cnt); + "snd_nxt update bytes: %u, average update bytes/update: %u\n", + stream->id, + stream->sndvar->rstat.ack_upd_cnt, stream->sndvar->rstat.ack_upd_bytes, + stream->sndvar->rstat.ack_upd_bytes / stream->sndvar->rstat.ack_upd_cnt); } #if TCP_OPT_SACK_ENABLED - if (stream->sndvar->rstat.sack_cnt) { + if (stream->sndvar->rstat.sack_cnt) + { TRACE_FSTAT("Selective ack count: %u, bytes: %u, " - "average bytes/ack: %u\n", - stream->sndvar->rstat.sack_cnt, stream->sndvar->rstat.sack_bytes, - stream->sndvar->rstat.sack_bytes / stream->sndvar->rstat.sack_cnt); - } else { - TRACE_FSTAT("Selective ack count: %u, bytes: %u\n", - stream->sndvar->rstat.sack_cnt, stream->sndvar->rstat.sack_bytes); + "average bytes/ack: %u\n", + stream->sndvar->rstat.sack_cnt, stream->sndvar->rstat.sack_bytes, + stream->sndvar->rstat.sack_bytes / stream->sndvar->rstat.sack_cnt); + } + else + { + TRACE_FSTAT("Selective ack count: %u, bytes: %u\n", + stream->sndvar->rstat.sack_cnt, stream->sndvar->rstat.sack_bytes); } - if (stream->sndvar->rstat.tdp_sack_cnt) { + if (stream->sndvar->rstat.tdp_sack_cnt) + { TRACE_FSTAT("Selective tdp ack count: %u, bytes: %u, " - "average bytes/ack: %u\n", - stream->sndvar->rstat.tdp_sack_cnt, stream->sndvar->rstat.tdp_sack_bytes, - stream->sndvar->rstat.tdp_sack_bytes / stream->sndvar->rstat.tdp_sack_cnt); - } else { - TRACE_FSTAT("Selective ack count: %u, bytes: %u\n", - stream->sndvar->rstat.tdp_sack_cnt, stream->sndvar->rstat.tdp_sack_bytes); + "average bytes/ack: %u\n", + stream->sndvar->rstat.tdp_sack_cnt, stream->sndvar->rstat.tdp_sack_bytes, + stream->sndvar->rstat.tdp_sack_bytes / stream->sndvar->rstat.tdp_sack_cnt); + } + else + { + TRACE_FSTAT("Selective ack count: %u, bytes: %u\n", + stream->sndvar->rstat.tdp_sack_cnt, stream->sndvar->rstat.tdp_sack_bytes); } #endif /* TCP_OPT_SACK_ENABLED */ #endif /* RTM_STAT */ - if (stream->is_bound_addr) { + if (stream->is_bound_addr) + { bound_addr = TRUE; addr.sin_addr.s_addr = stream->saddr; addr.sin_port = stream->sport; @@ -481,10 +524,10 @@ DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) RemoveFromControlList(mtcp, stream); RemoveFromSendList(mtcp, stream); RemoveFromACKList(mtcp, stream); - + if (stream->on_rto_idx >= 0) RemoveFromRTOList(mtcp, stream); - + if (stream->on_timewait_list) RemoveFromTimewaitList(mtcp, stream); @@ -492,26 +535,31 @@ DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) RemoveFromTimeoutList(mtcp, stream); #if BLOCKING_SUPPORT - if (stream->on_snd_br_list) { + if (stream->on_snd_br_list) + { stream->on_snd_br_list = FALSE; TAILQ_REMOVE(&mtcp->snd_br_list, stream, sndvar->snd_br_link); mtcp->snd_br_list_cnt--; } - if (stream->on_rcv_br_list) { + if (stream->on_rcv_br_list) + { stream->on_rcv_br_list = FALSE; TAILQ_REMOVE(&mtcp->rcv_br_list, stream, rcvvar->rcv_br_link); mtcp->rcv_br_list_cnt--; } - if (!stream->epoll) { + if (!stream->epoll) + { pthread_cond_signal(&stream->rcvvar->read_cond); pthread_cond_signal(&stream->sndvar->write_cond); } - if (pthread_cond_destroy(&stream->rcvvar->read_cond)) { + if (pthread_cond_destroy(&stream->rcvvar->read_cond)) + { perror("pthread_cond_destroy of read_cond"); } - if (pthread_cond_destroy(&stream->sndvar->write_cond)) { + if (pthread_cond_destroy(&stream->sndvar->write_cond)) + { perror("pthread_cond_destroy of write_cond"); } #endif @@ -519,13 +567,15 @@ DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) SBUF_LOCK_DESTROY(&stream->sndvar->write_lock); assert(stream->on_hash_table == TRUE); - + /* free ring buffers */ - if (stream->sndvar->sndbuf) { + if (stream->sndvar->sndbuf) + { SBFree(mtcp->rbm_snd, stream->sndvar->sndbuf); stream->sndvar->sndbuf = NULL; } - if (stream->rcvvar->rcvbuf) { + if (stream->rcvvar->rcvbuf) + { RBFree(mtcp->rbm_rcv, stream->rcvvar->rcvbuf); stream->rcvvar->rcvbuf = NULL; } @@ -535,7 +585,7 @@ DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) /* remove from flow hash table */ StreamHTRemove(mtcp->tcp_flow_table, stream); stream->on_hash_table = FALSE; - + mtcp->flow_cnt--; MPFreeChunk(mtcp->rv_pool, stream->rcvvar); @@ -543,27 +593,34 @@ DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) MPFreeChunk(mtcp->flow_pool, stream); pthread_mutex_unlock(&mtcp->ctx->flow_pool_lock); - if (bound_addr) { - if (mtcp->ap) { + if (bound_addr) + { + if (mtcp->ap) + { ret = FreeAddress(mtcp->ap, &addr); - } else { + } + else + { uint8_t is_external; int nif = GetOutputInterface(addr.sin_addr.s_addr, &is_external); - if (nif < 0) { + if (nif < 0) + { TRACE_ERROR("nif is negative!\n"); ret = -1; - } else { - int eidx = CONFIG.nif_to_eidx[nif]; + } + else + { + int eidx = CONFIG.nif_to_eidx[nif]; ret = FreeAddress(ap[eidx], &addr); } UNUSED(is_external); } - if (ret < 0) { + if (ret < 0) + { TRACE_ERROR("(NEVER HAPPEN) Failed to free address.\n"); } } - #ifdef NETSTAT #if NETSTAT_PERTHREAD TRACE_STREAM("Destroyed. Remaining flows: %u\n", mtcp->flow_cnt); @@ -574,8 +631,7 @@ DestroyTCPStream(mtcp_manager_t mtcp, tcp_stream *stream) UNUSED(sa); } /*---------------------------------------------------------------------------*/ -void -DumpStream(mtcp_manager_t mtcp, tcp_stream *stream) +void DumpStream(mtcp_manager_t mtcp, tcp_stream *stream) { uint8_t *sa, *da; struct tcp_send_vars *sndvar = stream->sndvar; @@ -584,101 +640,114 @@ DumpStream(mtcp_manager_t mtcp, tcp_stream *stream) sa = (uint8_t *)&stream->saddr; da = (uint8_t *)&stream->daddr; thread_printf(mtcp, mtcp->log_fp, "========== Stream %u: " - "%u.%u.%u.%u(%u) -> %u.%u.%u.%u(%u) ==========\n", stream->id, - sa[0], sa[1], sa[2], sa[3], ntohs(stream->sport), - da[0], da[1], da[2], da[3], ntohs(stream->dport)); - thread_printf(mtcp, mtcp->log_fp, - "Stream id: %u, type: %u, state: %s, close_reason: %s\n", - stream->id, stream->stream_type, - TCPStateToString(stream), close_reason_str[stream->close_reason]); - if (stream->socket) { + "%u.%u.%u.%u(%u) -> %u.%u.%u.%u(%u) ==========\n", + stream->id, + sa[0], sa[1], sa[2], sa[3], ntohs(stream->sport), + da[0], da[1], da[2], da[3], ntohs(stream->dport)); + thread_printf(mtcp, mtcp->log_fp, + "Stream id: %u, type: %u, state: %s, close_reason: %s\n", + stream->id, stream->stream_type, + TCPStateToString(stream), close_reason_str[stream->close_reason]); + if (stream->socket) + { socket_map_t socket = stream->socket; thread_printf(mtcp, mtcp->log_fp, "Socket id: %d, type: %d, opts: %u\n" - "epoll: %u (IN: %u, OUT: %u, ERR: %u, RDHUP: %u, ET: %u)\n" - "events: %u (IN: %u, OUT: %u, ERR: %u, RDHUP: %u, ET: %u)\n", - socket->id, socket->socktype, socket->opts, - socket->epoll, socket->epoll & MTCP_EPOLLIN, - socket->epoll & MTCP_EPOLLOUT, socket->epoll & MTCP_EPOLLERR, - socket->epoll & MTCP_EPOLLRDHUP, socket->epoll & MTCP_EPOLLET, - socket->events, socket->events & MTCP_EPOLLIN, - socket->events & MTCP_EPOLLOUT, socket->events & MTCP_EPOLLERR, - socket->events & MTCP_EPOLLRDHUP, socket->events & MTCP_EPOLLET); - } else { + "epoll: %u (IN: %u, OUT: %u, ERR: %u, RDHUP: %u, ET: %u)\n" + "events: %u (IN: %u, OUT: %u, ERR: %u, RDHUP: %u, ET: %u)\n", + socket->id, socket->socktype, socket->opts, + socket->epoll, socket->epoll & MTCP_EPOLLIN, + socket->epoll & MTCP_EPOLLOUT, socket->epoll & MTCP_EPOLLERR, + socket->epoll & MTCP_EPOLLRDHUP, socket->epoll & MTCP_EPOLLET, + socket->events, socket->events & MTCP_EPOLLIN, + socket->events & MTCP_EPOLLOUT, socket->events & MTCP_EPOLLERR, + socket->events & MTCP_EPOLLRDHUP, socket->events & MTCP_EPOLLET); + } + else + { thread_printf(mtcp, mtcp->log_fp, "Socket: (null)\n"); } - thread_printf(mtcp, mtcp->log_fp, - "on_hash_table: %u, on_control_list: %u (wait: %u), on_send_list: %u, " - "on_ack_list: %u, is_wack: %u, ack_cnt: %u\n" - "on_rto_idx: %d, on_timewait_list: %u, on_timeout_list: %u, " - "on_rcv_br_list: %u, on_snd_br_list: %u\n" - "on_sendq: %u, on_ackq: %u, closed: %u, on_closeq: %u, " - "on_closeq_int: %u, on_resetq: %u, on_resetq_int: %u\n" - "have_reset: %u, is_fin_sent: %u, is_fin_ackd: %u, " - "saw_timestamp: %u, sack_permit: %u, " - "is_bound_addr: %u, need_wnd_adv: %u\n", stream->on_hash_table, - sndvar->on_control_list, stream->control_list_waiting, sndvar->on_send_list, - sndvar->on_ack_list, sndvar->is_wack, sndvar->ack_cnt, - stream->on_rto_idx, stream->on_timewait_list, stream->on_timeout_list, - stream->on_rcv_br_list, stream->on_snd_br_list, - sndvar->on_sendq, sndvar->on_ackq, - stream->closed, sndvar->on_closeq, sndvar->on_closeq_int, - sndvar->on_resetq, sndvar->on_resetq_int, - stream->have_reset, sndvar->is_fin_sent, - sndvar->is_fin_ackd, stream->saw_timestamp, stream->sack_permit, - stream->is_bound_addr, stream->need_wnd_adv); + thread_printf(mtcp, mtcp->log_fp, + "on_hash_table: %u, on_control_list: %u (wait: %u), on_send_list: %u, " + "on_ack_list: %u, is_wack: %u, ack_cnt: %u\n" + "on_rto_idx: %d, on_timewait_list: %u, on_timeout_list: %u, " + "on_rcv_br_list: %u, on_snd_br_list: %u\n" + "on_sendq: %u, on_ackq: %u, closed: %u, on_closeq: %u, " + "on_closeq_int: %u, on_resetq: %u, on_resetq_int: %u\n" + "have_reset: %u, is_fin_sent: %u, is_fin_ackd: %u, " + "saw_timestamp: %u, sack_permit: %u, " + "is_bound_addr: %u, need_wnd_adv: %u\n", + stream->on_hash_table, + sndvar->on_control_list, stream->control_list_waiting, sndvar->on_send_list, + sndvar->on_ack_list, sndvar->is_wack, sndvar->ack_cnt, + stream->on_rto_idx, stream->on_timewait_list, stream->on_timeout_list, + stream->on_rcv_br_list, stream->on_snd_br_list, + sndvar->on_sendq, sndvar->on_ackq, + stream->closed, sndvar->on_closeq, sndvar->on_closeq_int, + sndvar->on_resetq, sndvar->on_resetq_int, + stream->have_reset, sndvar->is_fin_sent, + sndvar->is_fin_ackd, stream->saw_timestamp, stream->sack_permit, + stream->is_bound_addr, stream->need_wnd_adv); thread_printf(mtcp, mtcp->log_fp, "========== Send variables ==========\n"); - thread_printf(mtcp, mtcp->log_fp, - "ip_id: %u, mss: %u, eff_mss: %u, wscale (me, peer): (%u, %u), " - "nif_out: %d\n", - sndvar->ip_id, sndvar->mss, sndvar->eff_mss, - sndvar->wscale_mine, sndvar->wscale_peer, sndvar->nif_out); - thread_printf(mtcp, mtcp->log_fp, - "snd_nxt: %u, snd_una: %u, iss: %u, fss: %u\nsnd_wnd: %u, " - "peer_wnd: %u, cwnd: %u, ssthresh: %u\n", - stream->snd_nxt, sndvar->snd_una, sndvar->iss, sndvar->fss, - sndvar->snd_wnd, sndvar->peer_wnd, sndvar->cwnd, sndvar->ssthresh); - - if (sndvar->sndbuf) { - thread_printf(mtcp, mtcp->log_fp, - "Send buffer: init_seq: %u, head_seq: %u, " - "len: %d, cum_len: %lu, size: %d\n", - sndvar->sndbuf->init_seq, sndvar->sndbuf->head_seq, - sndvar->sndbuf->len, sndvar->sndbuf->cum_len, sndvar->sndbuf->size); - } else { + thread_printf(mtcp, mtcp->log_fp, + "ip_id: %u, mss: %u, eff_mss: %u, wscale (me, peer): (%u, %u), " + "nif_out: %d\n", + sndvar->ip_id, sndvar->mss, sndvar->eff_mss, + sndvar->wscale_mine, sndvar->wscale_peer, sndvar->nif_out); + thread_printf(mtcp, mtcp->log_fp, + "snd_nxt: %u, snd_una: %u, iss: %u, fss: %u\nsnd_wnd: %u, " + "peer_wnd: %u, cwnd: %u, ssthresh: %u\n", + stream->snd_nxt, sndvar->snd_una, sndvar->iss, sndvar->fss, + sndvar->snd_wnd, sndvar->peer_wnd, sndvar->cwnd, sndvar->ssthresh); + + if (sndvar->sndbuf) + { + thread_printf(mtcp, mtcp->log_fp, + "Send buffer: init_seq: %u, head_seq: %u, " + "len: %d, cum_len: %lu, size: %d\n", + sndvar->sndbuf->init_seq, sndvar->sndbuf->head_seq, + sndvar->sndbuf->len, sndvar->sndbuf->cum_len, sndvar->sndbuf->size); + } + else + { thread_printf(mtcp, mtcp->log_fp, "Send buffer: (null)\n"); } - thread_printf(mtcp, mtcp->log_fp, - "nrtx: %u, max_nrtx: %u, rto: %u, ts_rto: %u, " - "ts_lastack_sent: %u\n", sndvar->nrtx, sndvar->max_nrtx, - sndvar->rto, sndvar->ts_rto, sndvar->ts_lastack_sent); - - thread_printf(mtcp, mtcp->log_fp, - "========== Receive variables ==========\n"); - thread_printf(mtcp, mtcp->log_fp, - "rcv_nxt: %u, irs: %u, rcv_wnd: %u, " - "snd_wl1: %u, snd_wl2: %u\n", - stream->rcv_nxt, rcvvar->irs, - rcvvar->rcv_wnd, rcvvar->snd_wl1, rcvvar->snd_wl2); - if (rcvvar->rcvbuf) { - thread_printf(mtcp, mtcp->log_fp, - "Receive buffer: init_seq: %u, head_seq: %u, " - "merged_len: %d, cum_len: %lu, last_len: %d, size: %d\n", - rcvvar->rcvbuf->init_seq, rcvvar->rcvbuf->head_seq, - rcvvar->rcvbuf->merged_len, rcvvar->rcvbuf->cum_len, - rcvvar->rcvbuf->last_len, rcvvar->rcvbuf->size); - } else { + thread_printf(mtcp, mtcp->log_fp, + "nrtx: %u, max_nrtx: %u, rto: %u, ts_rto: %u, " + "ts_lastack_sent: %u\n", + sndvar->nrtx, sndvar->max_nrtx, + sndvar->rto, sndvar->ts_rto, sndvar->ts_lastack_sent); + + thread_printf(mtcp, mtcp->log_fp, + "========== Receive variables ==========\n"); + thread_printf(mtcp, mtcp->log_fp, + "rcv_nxt: %u, irs: %u, rcv_wnd: %u, " + "snd_wl1: %u, snd_wl2: %u\n", + stream->rcv_nxt, rcvvar->irs, + rcvvar->rcv_wnd, rcvvar->snd_wl1, rcvvar->snd_wl2); + if (rcvvar->rcvbuf) + { + thread_printf(mtcp, mtcp->log_fp, + "Receive buffer: init_seq: %u, head_seq: %u, " + "merged_len: %d, cum_len: %lu, last_len: %d, size: %d\n", + rcvvar->rcvbuf->init_seq, rcvvar->rcvbuf->head_seq, + rcvvar->rcvbuf->merged_len, rcvvar->rcvbuf->cum_len, + rcvvar->rcvbuf->last_len, rcvvar->rcvbuf->size); + } + else + { thread_printf(mtcp, mtcp->log_fp, "Receive buffer: (null)\n"); } - thread_printf(mtcp, mtcp->log_fp, "last_ack_seq: %u, dup_acks: %u\n", - rcvvar->last_ack_seq, rcvvar->dup_acks); - thread_printf(mtcp, mtcp->log_fp, - "ts_recent: %u, ts_lastack_rcvd: %u, ts_last_ts_upd: %u, " - "ts_tw_expire: %u\n", rcvvar->ts_recent, rcvvar->ts_lastack_rcvd, - rcvvar->ts_last_ts_upd, rcvvar->ts_tw_expire); - thread_printf(mtcp, mtcp->log_fp, - "srtt: %u, mdev: %u, mdev_max: %u, rttvar: %u, rtt_seq: %u\n", - rcvvar->srtt, rcvvar->mdev, rcvvar->mdev_max, - rcvvar->rttvar, rcvvar->rtt_seq); + thread_printf(mtcp, mtcp->log_fp, "last_ack_seq: %u, dup_acks: %u\n", + rcvvar->last_ack_seq, rcvvar->dup_acks); + thread_printf(mtcp, mtcp->log_fp, + "ts_recent: %u, ts_lastack_rcvd: %u, ts_last_ts_upd: %u, " + "ts_tw_expire: %u\n", + rcvvar->ts_recent, rcvvar->ts_lastack_rcvd, + rcvvar->ts_last_ts_upd, rcvvar->ts_tw_expire); + thread_printf(mtcp, mtcp->log_fp, + "srtt: %u, mdev: %u, mdev_max: %u, rttvar: %u, rtt_seq: %u\n", + rcvvar->srtt, rcvvar->mdev, rcvvar->mdev_max, + rcvvar->rttvar, rcvvar->rtt_seq); } diff --git a/setup_mtcp_dpdk_env.sh b/setup_mtcp_dpdk_env.sh index 509a5e0bc..5b874e0ec 100755 --- a/setup_mtcp_dpdk_env.sh +++ b/setup_mtcp_dpdk_env.sh @@ -50,7 +50,7 @@ cd - printf "Set ${GREEN}RTE_SDK$NC env variable as $RTE_SDK\n" printf "Set ${GREEN}RTE_TARGET$NC env variable as $RTE_TARGET\n" -# Check if you are using an Intel NIC +# Check if you are using an Intel NIC while true; do read -p "Are you using an Intel NIC (y/n)? " response case $response in From da52ad22c1dad73c12b8b4867341ea5b14b57a36 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 18 Sep 2025 09:45:41 +0000 Subject: [PATCH 05/11] modified to make mTCP server working on stream11 --changes 1. reflected change on interface name and IP address 2. removed some wasteful deep copy logic at pcap_module.c --- apps/example/epserver.c | 6 ++--- apps/example/epserver.conf | 6 ++--- apps/example/sample_server.c | 2 +- mtcp/src/core.c | 2 +- mtcp/src/io_module.c | 13 +++++----- mtcp/src/pcap_module.c | 46 +++++++++++------------------------- 6 files changed, 29 insertions(+), 46 deletions(-) diff --git a/apps/example/epserver.c b/apps/example/epserver.c index 578769019..4d5940d02 100644 --- a/apps/example/epserver.c +++ b/apps/example/epserver.c @@ -423,9 +423,9 @@ int CreateListeningSocket(struct thread_context *ctx) return -1; } - /* bind to port 80 */ + /* bind to port 8080 */ saddr.sin_family = AF_INET; - saddr.sin_addr.s_addr = INADDR_ANY; + saddr.sin_addr.s_addr = inet_addr("10.2.0.1"); //bind to 10.2.0.1 saddr.sin_port = htons(8080); ret = mtcp_bind(ctx->mctx, listener, (struct sockaddr *)&saddr, sizeof(struct sockaddr_in)); @@ -495,7 +495,7 @@ RunServerThread(void *arg) { printf("\nwaiting\n"); nevents = mtcp_epoll_wait(mctx, ep, events, MAX_EVENTS, -1); - printf("[RUNServerThread: Epoll wait returned %d\n", nevents); + printf("[RUNServerThread]: Epoll wait returned %d\n", nevents); if (nevents < 0) { if (errno != EINTR) diff --git a/apps/example/epserver.conf b/apps/example/epserver.conf index 7a9435022..1496e4d16 100644 --- a/apps/example/epserver.conf +++ b/apps/example/epserver.conf @@ -52,7 +52,7 @@ num_cores = 1 #port = dpdk1 #port = dpdk0 dpdk1 #------ PCAP ports -------# -port = veth_host +port = ens2f1np1 # Congestion control algorithm # (only available when configured with --enable-ccp) # cc = reno @@ -66,10 +66,10 @@ port = veth_host #max_num_buffers = 10000 # Receive buffer size of sockets; if not set: rcvbuf = sndbuf -rcvbuf = 131072 +rcvbuf = 4194304 # Send buffer size of sockets; if not set: sndbuf = rcvbuf -sndbuf = 131072 +sndbuf = 4194304 # if sndbuf & rcvbuf not set: sndbuf = rcvbuf = 8192 diff --git a/apps/example/sample_server.c b/apps/example/sample_server.c index 8126d5167..669423276 100644 --- a/apps/example/sample_server.c +++ b/apps/example/sample_server.c @@ -100,7 +100,7 @@ int main() { struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(SERVER_PORT); - addr.sin_addr.s_addr = inet_addr("10.200.1.1"); + addr.sin_addr.s_addr = inet_addr("10.2.0.1"); if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("bind"); diff --git a/mtcp/src/core.c b/mtcp/src/core.c index ef25704cc..1b83551ee 100644 --- a/mtcp/src/core.c +++ b/mtcp/src/core.c @@ -515,7 +515,7 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) /* if there are pending events, wake up user */ // if (ep->waiting && (ep->usr_queue->num_events > 0 || // ep->usr_shadow_queue->num_events > 0)) - if (usrq->num_events > 0 || ep->usr_shadow_queue->num_events > 0) + if (usrq->num_events > 0 || ep->usr_shadow_queue->num_events > 0) { STAT_COUNT(mtcp->runstat.rounds_epoll); TRACE_EPOLL("Broadcasting events. num: %d, cur_ts: %u, prev_ts: %u\n", diff --git a/mtcp/src/io_module.c b/mtcp/src/io_module.c index 856c65e4a..4da2d030c 100644 --- a/mtcp/src/io_module.c +++ b/mtcp/src/io_module.c @@ -185,7 +185,7 @@ int SetNetEnv(char *dev_name_list, char *port_stat_list) TRACE_ERROR("Can't allocate space for CONFIG.eths\n"); exit(EXIT_FAILURE); } - + if (current_iomodule_func == &pcap_module_func) { if (!CONFIG.eths) @@ -226,12 +226,13 @@ int SetNetEnv(char *dev_name_list, char *port_stat_list) } /* getting address */ - if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) - { - struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; - CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; - } + // if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) + // { + // struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; + // CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; + // } + CONFIG.eths[eidx].ip_addr = inet_addr("10.2.0.1"); if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0) { for (j = 0; j < ETH_ALEN; j++) diff --git a/mtcp/src/pcap_module.c b/mtcp/src/pcap_module.c index 1efb916d8..2ec6aaa4a 100644 --- a/mtcp/src/pcap_module.c +++ b/mtcp/src/pcap_module.c @@ -66,8 +66,9 @@ void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) exit(EXIT_FAILURE); } ppc = (struct pcap_private_context *)ctxt->io_private_context; - + printf("pcap init handle enetered\n\n"); pcap_t *temp = pcap_create(CONFIG.eths[0].dev_name, errbuf); + printf("handle created \n\n"); if (!temp) { TRACE_ERROR("pcap_create failed: %s\n", errbuf); @@ -75,22 +76,26 @@ void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) } if (pcap_set_snaplen(temp, SNAPLEN) != 0) TRACE_ERROR("pcap_set_snaplen failed\n"); + printf("set snaplen\n\n"); if (pcap_set_promisc(temp, 1) != 0) TRACE_ERROR("pcap_set_promisc failed\n"); + printf("set promisc \n\n"); if (pcap_set_timeout(temp, TIMEOUT_MS) != 0) TRACE_ERROR("pcap_set_timeout failed\n"); + printf("set timeout \n\n"); if (pcap_set_buffer_size(temp, BUF_SIZE) != 0) TRACE_ERROR("pcap_set_buffer_size failed\n"); - if(!pcap_setnonblock(temp, 1, errbuf)){ + printf("set buffer size \n\n"); + if (pcap_setnonblock(temp, 1, errbuf) < 0) TRACE_ERROR("pcap_setnonblock failed: %s\n", errbuf); - } - pcap_set_immediate_mode(temp, 1); // set immediate mode + + // pcap_set_immediate_mode(temp, 1); // set immediate mode if (pcap_activate(temp) < 0) { TRACE_ERROR("pcap_activate failed: %s\n", pcap_geterr(temp)); exit(EXIT_FAILURE); } - + printf("pcap is activated!! \n\n "); ppc->handle = temp; } /*----------------------------------------------------------------------------*/ @@ -100,19 +105,7 @@ void pcap_release_pkt(struct mtcp_thread_context *ctxt, int ifidx, unsigned char // free received packets here all after processing packets struct pcap_private_context *ppc = (struct pcap_private_context *)ctxt->io_private_context; - // for (int k = 0; k < ppc->num_pkts_in_chunk; k++) - // { - // if (ppc->hdrs[k]) - // { - // free(ppc->hdrs[k]); - // ppc->hdrs[k] = NULL; - // } - // if (ppc->pkts[k]) - // { - // free((void *)ppc->pkts[k]); - // ppc->pkts[k] = NULL; - // } - // } + ppc->num_pkts_in_chunk = 0; /**************************************************************** */ @@ -125,6 +118,7 @@ pcap_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) TRACE_ERROR("ENTER PCAP_SEND_PKTS\n"); struct pcap_private_context *ppc = (struct pcap_private_context *)ctxt->io_private_context; + int sent = 0; for (int i = 0; i < ppc->w_buf.cnt; i++) @@ -144,18 +138,6 @@ pcap_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) } TRACE_ERROR("[pcap_send_pkts] flushing %d packets\n", ppc->w_buf.cnt); - // Check pcap statistics after flushing - struct pcap_stat ps; - if (pcap_stats(ppc->handle, &ps) == 0) - { - TRACE_ERROR("[pcap_stats] recv=%u drop=%u ifdrop=%u\n", - ps.ps_recv, ps.ps_drop, ps.ps_ifdrop); - } - else - { - TRACE_ERROR("[pcap_stats] failed: %s\n", pcap_geterr(ppc->handle)); - } - ppc->w_buf.cnt = 0; // reset buffer return sent; } @@ -193,8 +175,8 @@ pcap_get_rptr(struct mtcp_thread_context *ctxt, int ifidx, int index, uint16_t * pktbuf = (uint8_t *)ppc->pkts[index]; if (ppc->hdrs[index]) *len = ppc->hdrs[index]->caplen; - else - *len = 0; + else + *len = 0; return pktbuf; } /*----------------------------------------------------------------------------*/ From 55102522cb9865c7fe042dbc4dd8564ddbefe8f0 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 18 Sep 2025 09:59:32 +0000 Subject: [PATCH 06/11] modified to make mTCP client working on rapids4 --- apps/example/epwget.c | 6 +++--- apps/example/epwget.conf | 6 +++--- apps/example/sample_client.c | 2 +- apps/example/sample_server.c | 2 +- mtcp/src/api.c | 7 ++++--- mtcp/src/io_module.c | 12 ++++++------ mtcp/src/pcap_module.c | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/apps/example/epwget.c b/apps/example/epwget.c index eed2f1b40..d2c5db3f0 100644 --- a/apps/example/epwget.c +++ b/apps/example/epwget.c @@ -188,8 +188,8 @@ CreateConnection(thread_context_t ctx) struct sockaddr_in src_addr; src_addr.sin_family = AF_INET; - src_addr.sin_addr.s_addr = saddr; // 10.200.1.2 - src_addr.sin_port = 0; + src_addr.sin_addr.s_addr = saddr; + src_addr.sin_port = 11111; if (mtcp_bind(mctx, sockid, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) { @@ -767,7 +767,7 @@ int main(int argc, char **argv) process_cpu = -1; daddr = inet_addr(host); dport = htons(8080); - saddr = inet_addr("10.200.1.2"); + saddr = inet_addr("10.2.0.3"); total_flows = mystrtol(argv[2], 10); if (total_flows <= 0) diff --git a/apps/example/epwget.conf b/apps/example/epwget.conf index 4908b6b06..ecce72d50 100644 --- a/apps/example/epwget.conf +++ b/apps/example/epwget.conf @@ -42,7 +42,7 @@ num_cores = 1 #port = dpdk0 #port = dpdk1 #port = dpdk0 dpdk1 -port = veth_client +port = ens23f0v1 # Enable multi-process support #multiprocess = 1 @@ -52,10 +52,10 @@ port = veth_client # cc = cubic # Receive buffer size of sockets; if not set: rcvbuf = sndbuf -rcvbuf = 8192 +rcvbuf = 4194304 # Send buffer size of sockets; if not set: sndbuf = rcvbuf -sndbuf = 8192 +sndbuf = 4194304 # if sndbuf & rcvbuf not set: sndbuf = rcvbuf = 8192 diff --git a/apps/example/sample_client.c b/apps/example/sample_client.c index b623f0999..d05568db2 100644 --- a/apps/example/sample_client.c +++ b/apps/example/sample_client.c @@ -4,7 +4,7 @@ #include #include -#define SERVER_IP "10.200.1.1" // server IP +#define SERVER_IP "10.2.0.1" // server IP #define SERVER_PORT 8080 #define BUF_SIZE (64 * 1024) diff --git a/apps/example/sample_server.c b/apps/example/sample_server.c index 8126d5167..669423276 100644 --- a/apps/example/sample_server.c +++ b/apps/example/sample_server.c @@ -100,7 +100,7 @@ int main() { struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(SERVER_PORT); - addr.sin_addr.s_addr = inet_addr("10.200.1.1"); + addr.sin_addr.s_addr = inet_addr("10.2.0.1"); if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("bind"); diff --git a/mtcp/src/api.c b/mtcp/src/api.c index a89b7c791..e2f394136 100644 --- a/mtcp/src/api.c +++ b/mtcp/src/api.c @@ -847,10 +847,11 @@ int mtcp_connect(mctx_t mctx, int sockid, socket->saddr.sin_addr.s_addr != INADDR_ANY) { int rss_core; - uint8_t endian_check = FetchEndianType(); + //uint8_t endian_check = FetchEndianType(); - rss_core = GetRSSCPUCore(socket->saddr.sin_addr.s_addr, dip, - socket->saddr.sin_port, dport, num_queues, endian_check); + rss_core = mctx->cpu; /*GetRSSCPUCore(socket->saddr.sin_addr.s_addr, dip, + socket->saddr.sin_port, dport, num_queues, endian_check);*/ + if (rss_core != mctx->cpu) { diff --git a/mtcp/src/io_module.c b/mtcp/src/io_module.c index 856c65e4a..5ec3b3eb6 100644 --- a/mtcp/src/io_module.c +++ b/mtcp/src/io_module.c @@ -226,12 +226,12 @@ int SetNetEnv(char *dev_name_list, char *port_stat_list) } /* getting address */ - if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) - { - struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; - CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; - } - + // if (ioctl(sock, SIOCGIFADDR, &ifr) == 0) + // { + // struct in_addr sin = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr; + // CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; + // } + CONFIG.eths[eidx].ip_addr = inet_addr("10.2.0.3"); if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0) { for (j = 0; j < ETH_ALEN; j++) diff --git a/mtcp/src/pcap_module.c b/mtcp/src/pcap_module.c index 1efb916d8..220e3d05e 100644 --- a/mtcp/src/pcap_module.c +++ b/mtcp/src/pcap_module.c @@ -84,7 +84,7 @@ void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) if(!pcap_setnonblock(temp, 1, errbuf)){ TRACE_ERROR("pcap_setnonblock failed: %s\n", errbuf); } - pcap_set_immediate_mode(temp, 1); // set immediate mode + //pcap_set_immediate_mode(temp, 1); // set immediate mode if (pcap_activate(temp) < 0) { TRACE_ERROR("pcap_activate failed: %s\n", pcap_geterr(temp)); From 519dda7190fc86a4ab84f302dec4534f1101f078 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 18 Sep 2025 10:11:17 +0000 Subject: [PATCH 07/11] merging process --- apps/example/sample_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/example/sample_client.c b/apps/example/sample_client.c index b623f0999..d05568db2 100644 --- a/apps/example/sample_client.c +++ b/apps/example/sample_client.c @@ -4,7 +4,7 @@ #include #include -#define SERVER_IP "10.200.1.1" // server IP +#define SERVER_IP "10.2.0.1" // server IP #define SERVER_PORT 8080 #define BUF_SIZE (64 * 1024) From eb9e44c81f07470ced694b919ea46d2f948d7f56 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 18 Sep 2025 10:14:15 +0000 Subject: [PATCH 08/11] modified api.c --- mtcp/src/api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mtcp/src/api.c b/mtcp/src/api.c index 66adf5e1b..e2f394136 100644 --- a/mtcp/src/api.c +++ b/mtcp/src/api.c @@ -847,11 +847,11 @@ int mtcp_connect(mctx_t mctx, int sockid, socket->saddr.sin_addr.s_addr != INADDR_ANY) { int rss_core; -// uint8_t endian_check = FetchEndianType(); + //uint8_t endian_check = FetchEndianType(); rss_core = mctx->cpu; /*GetRSSCPUCore(socket->saddr.sin_addr.s_addr, dip, socket->saddr.sin_port, dport, num_queues, endian_check);*/ - + if (rss_core != mctx->cpu) { From e493cdca929cd2565d046a45b535643dd7fc1b77 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 25 Sep 2025 05:59:44 +0000 Subject: [PATCH 09/11] quitting rapids4 --- apps/example/epwget.c | 18 +++++++++--------- apps/example/sample_client.c | 5 ++--- mtcp/src/io_module.c | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/apps/example/epwget.c b/apps/example/epwget.c index d2c5db3f0..75ac807f7 100644 --- a/apps/example/epwget.c +++ b/apps/example/epwget.c @@ -186,15 +186,15 @@ CreateConnection(thread_context_t ctx) return -1; } - struct sockaddr_in src_addr; - src_addr.sin_family = AF_INET; - src_addr.sin_addr.s_addr = saddr; - src_addr.sin_port = 11111; + // struct sockaddr_in src_addr; + // src_addr.sin_family = AF_INET; + // src_addr.sin_addr.s_addr = saddr; + // src_addr.sin_port = 11111; - if (mtcp_bind(mctx, sockid, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) - { - perror("mtcp_bind"); - } + // if (mtcp_bind(mctx, sockid, (struct sockaddr *)&src_addr, sizeof(src_addr)) < 0) + // { + // perror("mtcp_bind"); + // } memset(&ctx->wvars[sockid], 0, sizeof(struct wget_vars)); ret = mtcp_setsock_nonblock(mctx, sockid); @@ -767,7 +767,7 @@ int main(int argc, char **argv) process_cpu = -1; daddr = inet_addr(host); dport = htons(8080); - saddr = inet_addr("10.2.0.3"); + saddr = inet_addr("10.153.1.2"); total_flows = mystrtol(argv[2], 10); if (total_flows <= 0) diff --git a/apps/example/sample_client.c b/apps/example/sample_client.c index d05568db2..b6dcf4bb7 100644 --- a/apps/example/sample_client.c +++ b/apps/example/sample_client.c @@ -4,10 +4,9 @@ #include #include -#define SERVER_IP "10.2.0.1" // server IP +#define SERVER_IP "10.153.1.1" // server IP #define SERVER_PORT 8080 -#define BUF_SIZE (64 * 1024) - +#define BUF_SIZE (128 * 1024) // 128 MB int main(int argc, char *argv[]) { int sock; diff --git a/mtcp/src/io_module.c b/mtcp/src/io_module.c index 02c63b1e6..c8913b298 100644 --- a/mtcp/src/io_module.c +++ b/mtcp/src/io_module.c @@ -232,7 +232,7 @@ int SetNetEnv(char *dev_name_list, char *port_stat_list) // CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; // } - CONFIG.eths[eidx].ip_addr = inet_addr("10.2.0.3"); + CONFIG.eths[eidx].ip_addr = inet_addr("10.153.1.2"); // for server case // CONFIG.eths[eidx].ip_addr = inet_addr("10.2.0.1"); From 8dec2155b632668567089fc5ec8a3f3c897f7345 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 27 Nov 2025 07:27:19 +0000 Subject: [PATCH 10/11] ** TX path improvement --- apps/example/epwget.conf | 6 +- apps/example/sample_client.c | 2 +- apps/example/sample_server.c | 2 +- mtcp/src/core.c | 53 ++++---- mtcp/src/io_module.c | 6 +- mtcp/src/pcap_module.c | 229 ++++++++++++++++++++++++++--------- 6 files changed, 208 insertions(+), 90 deletions(-) diff --git a/apps/example/epwget.conf b/apps/example/epwget.conf index 4908b6b06..b85e56d82 100644 --- a/apps/example/epwget.conf +++ b/apps/example/epwget.conf @@ -42,7 +42,7 @@ num_cores = 1 #port = dpdk0 #port = dpdk1 #port = dpdk0 dpdk1 -port = veth_client +port = ens2np0 # Enable multi-process support #multiprocess = 1 @@ -52,10 +52,10 @@ port = veth_client # cc = cubic # Receive buffer size of sockets; if not set: rcvbuf = sndbuf -rcvbuf = 8192 +rcvbuf = 4194304 # Send buffer size of sockets; if not set: sndbuf = rcvbuf -sndbuf = 8192 +sndbuf = 4194304 # if sndbuf & rcvbuf not set: sndbuf = rcvbuf = 8192 diff --git a/apps/example/sample_client.c b/apps/example/sample_client.c index d05568db2..9cb14494f 100644 --- a/apps/example/sample_client.c +++ b/apps/example/sample_client.c @@ -4,7 +4,7 @@ #include #include -#define SERVER_IP "10.2.0.1" // server IP +#define SERVER_IP "10.153.1.1" // server IP #define SERVER_PORT 8080 #define BUF_SIZE (64 * 1024) diff --git a/apps/example/sample_server.c b/apps/example/sample_server.c index 669423276..af6ce1ae8 100644 --- a/apps/example/sample_server.c +++ b/apps/example/sample_server.c @@ -100,7 +100,7 @@ int main() { struct sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(SERVER_PORT); - addr.sin_addr.s_addr = inet_addr("10.2.0.1"); + addr.sin_addr.s_addr = inet_addr("10.153.1.1"); if (bind(server_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("bind"); diff --git a/mtcp/src/core.c b/mtcp/src/core.c index 1b83551ee..1fa5e1c65 100644 --- a/mtcp/src/core.c +++ b/mtcp/src/core.c @@ -481,7 +481,7 @@ FlushReadEvents(mtcp_manager_t mtcp, int thresh) static inline void FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) { - TRACE_ERROR("FlushEpollEvents: Inside\n"); + //TRACE_ERROR("FlushEpollEvents: Inside\n"); struct mtcp_epoll *ep = mtcp->ep; struct event_queue *usrq = ep->usr_queue; struct event_queue *mtcpq = ep->mtcp_queue; @@ -489,12 +489,12 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) pthread_mutex_lock(&ep->epoll_lock); /*************************************************** */ // debugging purpose - struct mtcp_epoll_event_int *ev_i = mtcpq->events; - int start = mtcpq->start; - for (int i = start; i < start + mtcpq->num_events; i++) - { - TRACE_ERROR("mtcp_queue event %d: sockid %d, events %u\n", i, ev_i[i].sockid, ev_i[i].ev.events); - } + // struct mtcp_epoll_event_int *ev_i = mtcpq->events; + // int start = mtcpq->start; + // for (int i = start; i < start + mtcpq->num_events; i++) + // { + // TRACE_ERROR("mtcp_queue event %d: sockid %d, events %u\n", i, ev_i[i].sockid, ev_i[i].ev.events); + // } /*************************************************** */ @@ -522,9 +522,9 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) ep->usr_queue->num_events, cur_ts, mtcp->ts_last_event); mtcp->ts_last_event = cur_ts; ep->stat.wakes++; - printf("[FlushEpollEvents] MTCP_THREAD: Try to Wake Up application thread\n\n"); + // printf("[FlushEpollEvents] MTCP_THREAD: Try to Wake Up application thread\n\n"); pthread_cond_signal(&ep->epoll_cond); - printf("[FlushEpollEvents] MTCP_THREAD: Waked Up application thread\n\n"); + // printf("[FlushEpollEvents] MTCP_THREAD: Waked Up application thread\n\n"); } pthread_mutex_unlock(&ep->epoll_lock); } @@ -532,7 +532,7 @@ FlushEpollEvents(mtcp_manager_t mtcp, uint32_t cur_ts) static inline void HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) { - TRACE_ERROR("HandleApplicationCalls: Inside\n"); + //TRACE_ERROR("HandleApplicationCalls: Inside\n"); tcp_stream *stream; int cnt, max_cnt; int handled, delayed; @@ -765,7 +765,7 @@ HandleApplicationCalls(mtcp_manager_t mtcp, uint32_t cur_ts) static inline void WritePacketsToChunks(mtcp_manager_t mtcp, uint32_t cur_ts) { - TRACE_ERROR("here in write packet to chunks \n"); + //TRACE_ERROR("here in write packet to chunks \n"); int thresh = CONFIG.max_concurrency; int i; @@ -794,20 +794,20 @@ WritePacketsToChunks(mtcp_manager_t mtcp, uint32_t cur_ts) assert(mtcp->n_sender[i] != NULL); if (mtcp->n_sender[i]->control_list_cnt) { - TRACE_ERROR("no 11\n"); + //TRACE_ERROR("no 11\n"); WriteTCPControlList(mtcp, mtcp->n_sender[i], cur_ts, thresh); } if (mtcp->n_sender[i]->ack_list_cnt) { - TRACE_ERROR("no 12\n"); + //TRACE_ERROR("no 12\n"); WriteTCPACKList(mtcp, mtcp->n_sender[i], cur_ts, thresh); } if (mtcp->n_sender[i]->send_list_cnt) { - TRACE_ERROR("no 13\n"); + //TRACE_ERROR("no 13\n"); WriteTCPDataList(mtcp, mtcp->n_sender[i], cur_ts, thresh); } - TRACE_ERROR("no 99\n") + //TRACE_ERROR("no 99\n") } } /*----------------------------------------------------------------------------*/ @@ -845,7 +845,7 @@ DestroyRemainingFlows(mtcp_manager_t mtcp) static void InterruptApplication(mtcp_manager_t mtcp) { - printf("[InterruptApplication] Interrupting application\n"); + //printf("[InterruptApplication] Interrupting application\n"); int i; struct tcp_listener *listener = NULL; @@ -855,7 +855,7 @@ InterruptApplication(mtcp_manager_t mtcp) pthread_mutex_lock(&mtcp->ep->epoll_lock); if (mtcp->ep->waiting) { - printf("[FlushEpollEvents] signaling app thread!\n"); + //printf("[FlushEpollEvents] signaling app thread!\n"); pthread_cond_signal(&mtcp->ep->epoll_cond); } pthread_mutex_unlock(&mtcp->ep->epoll_lock); @@ -884,7 +884,7 @@ RunMainLoop(struct mtcp_thread_context *ctx) mtcp_manager_t mtcp = ctx->mtcp_manager; int i; int recv_cnt; - int rx_inf, tx_inf; + int rx_inf , tx_inf; struct timeval cur_ts = {0}; uint32_t ts, ts_prev; int thresh; @@ -908,7 +908,6 @@ RunMainLoop(struct mtcp_thread_context *ctx) static uint16_t len; static uint8_t *pktbuf; recv_cnt = mtcp->iom->recv_pkts(ctx, rx_inf); - printf("recv_vnt: %d \n", recv_cnt); STAT_COUNT(mtcp->runstat.rounds_rx_try); for (i = 0; i < recv_cnt; i++) @@ -927,7 +926,6 @@ RunMainLoop(struct mtcp_thread_context *ctx) /* interaction with application */ if (mtcp->flow_cnt > 0) { - printf("flow_cnt: %d\n", mtcp->flow_cnt); /* check retransmission timeout and timewait expire */ #if 0 thresh = (int)mtcp->flow_cnt / (TS_TO_USEC(PER_STREAM_TCHECK)); @@ -950,24 +948,26 @@ RunMainLoop(struct mtcp_thread_context *ctx) if (CONFIG.tcp_timeout > 0 && ts != ts_prev) { - TRACE_ERROR("\nCheckConnectionTimeout Start\n"); + //TRACE_ERROR("\nCheckConnectionTimeout Start\n"); CheckConnectionTimeout(mtcp, ts, thresh); } } + unsigned char *dummy = 0; int dummy_len = 0; mtcp->iom->release_pkt(ctx, rx_inf, dummy, dummy_len); + /* if epoll is in use, flush all the queued events */ if (mtcp->ep) { - TRACE_ERROR("epoll is in use \n"); + //TRACE_ERROR("epoll is in use \n"); FlushEpollEvents(mtcp, ts); } if (mtcp->flow_cnt > 0) { /* hadnle stream queues */ - TRACE_ERROR("Handle Application Calls\n"); + //TRACE_ERROR("Handle Application Calls\n"); HandleApplicationCalls(mtcp, ts); } @@ -1000,8 +1000,8 @@ RunMainLoop(struct mtcp_thread_context *ctx) } } - TRACE_ERROR("while loop ended: done %d, flow_cnt %d, exit %d\n", - ctx->done, mtcp->flow_cnt, ctx->exit); + //TRACE_ERROR("while loop ended: done %d, flow_cnt %d, exit %d\n", + // ctx->done, mtcp->flow_cnt, ctx->exit); #if TESTING DestroyRemainingFlows(mtcp); @@ -1203,7 +1203,7 @@ InitializeMTCPManager(struct mtcp_thread_context *ctx) } mtcp->closeq = CreateStreamQueue(CONFIG.max_concurrency); if (!mtcp->closeq) - { + { CTRACE_ERROR("Failed to create close queue.\n"); return NULL; } @@ -1815,7 +1815,6 @@ int mtcp_init(const char *config_file) for (i = 0; i < CONFIG.eths_num; i++) { - // in case of pcap, ip_address of veth_host is passed as argument ap[i] = CreateAddressPool(CONFIG.eths[i].ip_addr, 1); if (!ap[i]) { diff --git a/mtcp/src/io_module.c b/mtcp/src/io_module.c index 4da2d030c..20529b971 100644 --- a/mtcp/src/io_module.c +++ b/mtcp/src/io_module.c @@ -232,7 +232,11 @@ int SetNetEnv(char *dev_name_list, char *port_stat_list) // CONFIG.eths[eidx].ip_addr = *(uint32_t *)&sin; // } - CONFIG.eths[eidx].ip_addr = inet_addr("10.2.0.1"); + //for client case + //CONFIG.eths[eidx].ip_addr = inet_addr("10.153.1.2"); + // for server case + CONFIG.eths[eidx].ip_addr = inet_addr("10.153.1.1"); + if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0) { for (j = 0; j < ETH_ALEN; j++) diff --git a/mtcp/src/pcap_module.c b/mtcp/src/pcap_module.c index 2ec6aaa4a..494df1700 100644 --- a/mtcp/src/pcap_module.c +++ b/mtcp/src/pcap_module.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,8 @@ #define BUF_SIZE (128 * 1024 * 1024) #define SNAPLEN 65535 #define TIMEOUT_MS 50 -#define MAX_TX_BURST 1024 +#define MAX_TX_BURST 128 + // assume single core (x need to RSS packets to multiple cores) // x concept of core affinity // x concept of specific NIC queue @@ -51,10 +53,62 @@ struct pcap_private_context // metadata includes time it was captured and total length of this packet const u_char *pkts[CHUNK_SIZE]; int num_pkts_in_chunk; + + int tx_sock; + struct sockaddr_ll tx_addr; + } __attribute__((aligned(__WORDSIZE))); /*----------------------------------------------------------------------------*/ -void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) +// improving tx functionality of pcap + +// init_tx_sock +// creates an AF_PACKET raw socket +// lookup the interface index for a given interface name +// fill a sockaddr_ll with the interface index and protocol +// bind the socket to that NIC interface + Protocol +/*----------------------------------------------------------------------------*/ +static int init_tx_sock(struct mtcp_thread_context *ctxt) +{ // for stream 11 -> may be ens2f1np1 + struct pcap_private_context *ppc = + (struct pcap_private_context *)ctxt->io_private_context; + int s; + if ((s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_IP))) < 0) // send/receive raw socket including L2 header + { + perror("tx_sock initialziation failed"); + return -1; + } + struct sockaddr_ll sll; + memset(&sll, 0, sizeof(sll)); + struct ifreq ifr; + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, CONFIG.eths[0].dev_name); + if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) + { + perror("tx socekt ioctl failed"); + close(s); + return -1; + } + + sll.sll_family = AF_PACKET; + sll.sll_ifindex = ifr.ifr_ifindex; + sll.sll_protocol = htons(ETH_P_IP); + + if (bind(s, (struct sockaddr *)&sll, sizeof(sll)) < 0) + { + perror("tx_sock bind error"); + close(s); + return -1; + } // attaches socket to specific interface and specifc EtherType + + ppc->tx_addr = sll; + ppc->tx_sock = s; + + return 0; +} + +/*----------------------------------------------------------------------------*/ +void pcap_init_handle(struct mtcp_thread_context *ctxt) { char errbuf[PCAP_ERRBUF_SIZE]; struct pcap_private_context *ppc; @@ -66,81 +120,144 @@ void pcap_init_handle(struct mtcp_thread_context *ctxt) //,int designated_port) exit(EXIT_FAILURE); } ppc = (struct pcap_private_context *)ctxt->io_private_context; - printf("pcap init handle enetered\n\n"); + printf("Using pcap interface: [%s]\n", CONFIG.eths[0].dev_name); + pcap_t *temp = pcap_create(CONFIG.eths[0].dev_name, errbuf); - printf("handle created \n\n"); if (!temp) { TRACE_ERROR("pcap_create failed: %s\n", errbuf); exit(EXIT_FAILURE); } + // make tx_sock + if (init_tx_sock(ctxt) < 0) + { + perror("error initialzing tx_sock "); + exit(EXIT_FAILURE); + } + if (pcap_set_snaplen(temp, SNAPLEN) != 0) TRACE_ERROR("pcap_set_snaplen failed\n"); - printf("set snaplen\n\n"); if (pcap_set_promisc(temp, 1) != 0) TRACE_ERROR("pcap_set_promisc failed\n"); - printf("set promisc \n\n"); if (pcap_set_timeout(temp, TIMEOUT_MS) != 0) TRACE_ERROR("pcap_set_timeout failed\n"); - printf("set timeout \n\n"); if (pcap_set_buffer_size(temp, BUF_SIZE) != 0) TRACE_ERROR("pcap_set_buffer_size failed\n"); - printf("set buffer size \n\n"); if (pcap_setnonblock(temp, 1, errbuf) < 0) TRACE_ERROR("pcap_setnonblock failed: %s\n", errbuf); // pcap_set_immediate_mode(temp, 1); // set immediate mode + if (pcap_activate(temp) < 0) { TRACE_ERROR("pcap_activate failed: %s\n", pcap_geterr(temp)); exit(EXIT_FAILURE); } - printf("pcap is activated!! \n\n "); ppc->handle = temp; + struct bpf_program fp; + struct ifreq ifr; + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, CONFIG.eths[0].dev_name); + + int fd = socket(AF_INET, SOCK_DGRAM, 0); + ioctl(fd, SIOCGIFHWADDR, &ifr); + close(fd); + + unsigned char *m = (unsigned char *)ifr.ifr_hwaddr.sa_data; + + char filter[128]; + sprintf(filter, + "not ether src %02x:%02x:%02x:%02x:%02x:%02x", + m[0], m[1], m[2], m[3], m[4], m[5]); + pcap_compile(ppc->handle, &fp, filter, 0, PCAP_NETMASK_UNKNOWN); + pcap_setfilter(ppc->handle, &fp); } /*----------------------------------------------------------------------------*/ void pcap_release_pkt(struct mtcp_thread_context *ctxt, int ifidx, unsigned char *pkt_data, int len) { - /**************************************************************** */ - // free received packets here all after processing packets struct pcap_private_context *ppc = (struct pcap_private_context *)ctxt->io_private_context; ppc->num_pkts_in_chunk = 0; - - /**************************************************************** */ return; } /*----------------------------------------------------------------------------*/ -int32_t -pcap_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) +static int raw_send_batch(struct mtcp_thread_context *ctxt) { - TRACE_ERROR("ENTER PCAP_SEND_PKTS\n"); - struct pcap_private_context *ppc = - (struct pcap_private_context *)ctxt->io_private_context; + struct pcap_private_context *ppc = (struct pcap_private_context *)ctxt->io_private_context; + int cnt = ppc->w_buf.cnt; + if (cnt == 0) + return 0; + + struct mmsghdr msgs[cnt]; + struct iovec iov[cnt]; - int sent = 0; + memset(msgs, 0, sizeof(msgs)); + memset(iov, 0, sizeof(iov)); - for (int i = 0; i < ppc->w_buf.cnt; i++) + for (int i = 0; i < cnt; i++) { - uint8_t *buf = ppc->w_buf.pkts[i].buf; - int len = ppc->w_buf.pkts[i].len; + iov[i].iov_base = ppc->w_buf.pkts[i].buf; + iov[i].iov_len = ppc->w_buf.pkts[i].len; - if (pcap_inject(ppc->handle, buf, len) == len) - { - sent++; - } - else - { - TRACE_ERROR("pcap_inject failed: %s\n", pcap_geterr(ppc->handle)); - } - free(buf); + msgs[i].msg_hdr.msg_iov = &iov[i]; + msgs[i].msg_hdr.msg_iovlen = 1; + msgs[i].msg_hdr.msg_name = &ppc->tx_addr; + msgs[i].msg_hdr.msg_namelen = sizeof(ppc->tx_addr); + } + + int sent = sendmmsg(ppc->tx_sock, msgs, cnt, 0); + if (sent < 0) + { + perror("sendmmsg error"); + sent = 0; + } + /* free only successfully sent buffers */ + for (int i = 0; i < sent; i++) + { + free(ppc->w_buf.pkts[i].buf); } - TRACE_ERROR("[pcap_send_pkts] flushing %d packets\n", ppc->w_buf.cnt); - ppc->w_buf.cnt = 0; // reset buffer + for (int i = sent; i < cnt; i++) + { + free(ppc->w_buf.pkts[i].buf); + } + + ppc->w_buf.cnt = 0; return sent; } + +/*----------------------------------------------------------------------------*/ + +int32_t +pcap_send_pkts(struct mtcp_thread_context *ctxt, int ifidx) +{ + // TRACE_ERROR("ENTER PCAP_SEND_PKTS\n"); + + return raw_send_batch(ctxt); + /* + int sent = 0; + + for (int i = 0; i < ppc->w_buf.cnt; i++) + { + uint8_t *buf = ppc->w_buf.pkts[i].buf; + int len = ppc->w_buf.pkts[i].len; + if (pcap_inject(ppc->handle, buf, len) == len) + { + sent++; + } + else + { + TRACE_ERROR("pcap_inject failed: %s\n", pcap_geterr(ppc->handle)); + } + free(buf); + } + // TRACE_ERROR("[pcap_send_pkts] flushing %d packets\n", ppc->w_buf.cnt); + + ppc->w_buf.cnt = 0; // reset buffer + return sent; + */ +} /*----------------------------------------------------------------------------*/ uint8_t * @@ -149,13 +266,13 @@ pcap_get_wptr(struct mtcp_thread_context *ctxt, int ifidx, uint16_t len) // used struct pcap_private_context *ppc = (struct pcap_private_context *)ctxt->io_private_context; - if (ppc->w_buf.cnt > 0) + if (ppc->w_buf.cnt == MAX_TX_BURST) // if count reached maximum capacity flush it first, then allocate new buffer { - pcap_send_pkts(ctxt, ifidx); + raw_send_batch(ctxt); } // allocate buffer (heap ) - uint8_t *buf = malloc(len); //!! neeed free logic in the code!! + uint8_t *buf = malloc(len); if (!buf) return NULL; @@ -189,22 +306,20 @@ pcap_packet_handler(u_char *user, (struct pcap_private_context *)user; /************************************************************ */ // For Debuggging purpose - struct iphdr *iph = (struct iphdr *)(bytes + sizeof(struct ether_header)); - struct tcphdr *tcph = (struct tcphdr *)((uint8_t *)iph + (iph->ihl << 2)); - if (tcph->ack) - { - printf("Captured ACK: ack_seq=%u win=%u\n", - ntohl(tcph->ack_seq), ntohs(tcph->window)); - } + // struct iphdr *iph = (struct iphdr *)(bytes + sizeof(struct ether_header)); + // struct tcphdr *tcph = (struct tcphdr *)((uint8_t *)iph + (iph->ihl << 2)); + + /************************************************************ */ + // if (tcph->ack) + // { + // printf("Captured ACK: ack_seq=%u win=%u\n", + // ntohl(tcph->ack_seq), ntohs(tcph->window)); + // } /************************************************************ */ + if (ppc->num_pkts_in_chunk < CHUNK_SIZE) - { // safety guard - // deep copy pkthdr and buf - // struct pcap_pkthdr *hdr = (struct pcap_pkthdr *)malloc(sizeof(struct pcap_pkthdr)); - // memcpy(hdr, h, sizeof(struct pcap_pkthdr)); + { ppc->hdrs[ppc->num_pkts_in_chunk] = (struct pcap_pkthdr *)h; - // u_char *bts = malloc(hdr->caplen); - // memcpy(bts, bytes, hdr->caplen); ppc->pkts[ppc->num_pkts_in_chunk] = bytes; ppc->num_pkts_in_chunk++; } @@ -213,12 +328,12 @@ pcap_packet_handler(u_char *user, int32_t pcap_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) { - TRACE_ERROR("ENTER PCAP_RECV_PKTS\n"); + // TRACE_ERROR("ENTER PCAP_RECV_PKTS\n"); struct pcap_private_context *ppc = ctxt->io_private_context; - printf("pcap_rev_pkts: num_pkts_in_chunk=%d\n", ppc->num_pkts_in_chunk); + // printf("pcap_rev_pkts: num_pkts_in_chunk=%d\n", ppc->num_pkts_in_chunk); // ppc->num_pkts_in_chunk = 0; int ret = pcap_dispatch(ppc->handle, CHUNK_SIZE, pcap_packet_handler, (u_char *)ppc); - TRACE_ERROR("pcap dispatch returned %d\n\n", ret); + // TRACE_ERROR("pcap dispatch returned %d\n\n", ret); // receive up to max CHUNK_SIZE packets // packets in socket's receive buffers are copied to user application buffer if (ret < 0) // error @@ -226,11 +341,11 @@ pcap_recv_pkts(struct mtcp_thread_context *ctxt, int ifidx) TRACE_ERROR("pcap_dispatch failed: %s\n", pcap_geterr(ppc->handle)); return -1; } - if (ret == 0) - { - printf("timeout expired on live caputure\n"); - } - TRACE_ERROR("QUITTING PCAP_RECV_PKTS\n"); + // if (ret == 0) + // { + // fprintf(stderr, "timeout expired on live caputure\n"); + // } + // TRACE_ERROR("QUITTING PCAP_RECV_PKTS\n"); return ppc->num_pkts_in_chunk; } /*----------------------------------------------------------------------------*/ From edcc6fcbfc5a708ff0c4f256c29a5a4990070486 Mon Sep 17 00:00:00 2001 From: Dojin Date: Thu, 27 Nov 2025 07:30:44 +0000 Subject: [PATCH 11/11] ** TX path improve 1 --- apps/example/epwget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/example/epwget.c b/apps/example/epwget.c index eed2f1b40..097271bac 100644 --- a/apps/example/epwget.c +++ b/apps/example/epwget.c @@ -767,7 +767,7 @@ int main(int argc, char **argv) process_cpu = -1; daddr = inet_addr(host); dport = htons(8080); - saddr = inet_addr("10.200.1.2"); + saddr = inet_addr("10.2.0.3"); total_flows = mystrtol(argv[2], 10); if (total_flows <= 0)