From e8c7457b80f413350f9ccc6539357c378bf2d480 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Tue, 20 Jun 2023 23:11:35 +0100 Subject: [PATCH 01/82] Fix null pointer de-ref --- win32/wintap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/wintap.c b/win32/wintap.c index e228ca110..66fb08ddb 100644 --- a/win32/wintap.c +++ b/win32/wintap.c @@ -277,7 +277,7 @@ int open_wintap(struct tuntap_dev *device, /* ************************************** */ - if(device_mac[0]) + if(device_mac && device_mac[0]) set_interface_mac(device, device_mac); /* Get MAC address from tap device->device_name */ From 7b779503524c8641a402cc670e716d9b5cf0e2f4 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 24 Jun 2023 14:34:30 +0100 Subject: [PATCH 02/82] Address lint concerns --- scripts/n2n-ctl | 4 ++-- scripts/test_integration_edge.sh | 22 +++++++++++----------- scripts/test_integration_supernode.sh | 16 ++++++++-------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/n2n-ctl b/scripts/n2n-ctl index 84b48cbcd..e389ecb48 100755 --- a/scripts/n2n-ctl +++ b/scripts/n2n-ctl @@ -48,7 +48,7 @@ class JsonUDP(): data = json.loads(data.decode('utf8')) # TODO: We assume the first packet we get will be tagged for us - assert(data['_tag'] == tagstr) + assert (data['_tag'] == tagstr) if data['_type'] == 'error': raise ValueError('Error: {}'.format(data['error'])) @@ -128,7 +128,7 @@ class JsonUDP(): data, _ = self.sock.recvfrom(1024) data = json.loads(data.decode('utf8')) # assert(data['_tag'] == tagstr) - assert(data['_type'] == 'event') + assert (data['_type'] == 'event') del data['_tag'] del data['_type'] diff --git a/scripts/test_integration_edge.sh b/scripts/test_integration_edge.sh index 93a5424a9..4c6ee8016 100755 --- a/scripts/test_integration_edge.sh +++ b/scripts/test_integration_edge.sh @@ -16,16 +16,16 @@ docmd() { } # start a supernode -docmd ${BINDIR}/supernode -v +docmd "${BINDIR}"/supernode -v # Start the edge in the background -docmd sudo ${BINDIR}/edge -l localhost:7654 -c test >/dev/null +docmd sudo "${BINDIR}"/edge -l localhost:7654 -c test >/dev/null # TODO: # - send edge messages to stderr? -docmd ${TOPDIR}/scripts/n2n-ctl communities -docmd ${TOPDIR}/scripts/n2n-ctl packetstats -docmd ${TOPDIR}/scripts/n2n-ctl edges --raw +docmd "${TOPDIR}"/scripts/n2n-ctl communities +docmd "${TOPDIR}"/scripts/n2n-ctl packetstats +docmd "${TOPDIR}"/scripts/n2n-ctl edges --raw # TODO: # docmd ${TOPDIR}/scripts/n2n-ctl supernodes --raw @@ -35,15 +35,15 @@ docmd ${TOPDIR}/scripts/n2n-ctl edges --raw # - last_seen timestamp # - uptime -docmd ${TOPDIR}/scripts/n2n-ctl verbose -docmd ${TOPDIR}/scripts/n2n-ctl --write verbose 1 2>/dev/null +docmd "${TOPDIR}"/scripts/n2n-ctl verbose +docmd "${TOPDIR}"/scripts/n2n-ctl --write verbose 1 2>/dev/null echo $? -docmd ${TOPDIR}/scripts/n2n-ctl -k $AUTH --write verbose 1 +docmd "${TOPDIR}"/scripts/n2n-ctl -k $AUTH --write verbose 1 # looks strange, but we are querying the state of the "stop" verb -docmd ${TOPDIR}/scripts/n2n-ctl stop +docmd "${TOPDIR}"/scripts/n2n-ctl stop # stop them both -docmd ${TOPDIR}/scripts/n2n-ctl -k $AUTH --write stop -docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 -k $AUTH --write stop +docmd "${TOPDIR}"/scripts/n2n-ctl -k $AUTH --write stop +docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 -k $AUTH --write stop diff --git a/scripts/test_integration_supernode.sh b/scripts/test_integration_supernode.sh index 57f44bcdf..4d5145dc1 100755 --- a/scripts/test_integration_supernode.sh +++ b/scripts/test_integration_supernode.sh @@ -16,18 +16,18 @@ docmd() { } # start it running in the background -docmd ${BINDIR}/supernode -v +docmd "${BINDIR}"/supernode -v -docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 communities -docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 packetstats -docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 edges --raw +docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 communities +docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 packetstats +docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 edges --raw -docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 verbose -docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 -k $AUTH --write verbose 1 +docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 verbose +docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 -k $AUTH --write verbose 1 # looks strange, but we are querying the state of the "stop" verb -docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 stop +docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 stop # stop it -docmd ${TOPDIR}/scripts/n2n-ctl -t 5645 -k $AUTH --write stop +docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 -k $AUTH --write stop From 4f9a7d31d3415951fa9bef3b23e3f81c5defd66b Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 21 Jun 2023 18:23:34 +0100 Subject: [PATCH 03/82] Fix bug in returned interface address --- include/edge_utils_win32.h | 3 +-- src/edge_utils.c | 2 +- src/edge_utils_win32.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/edge_utils_win32.h b/include/edge_utils_win32.h index 09f83666e..caf75ebaf 100644 --- a/include/edge_utils_win32.h +++ b/include/edge_utils_win32.h @@ -43,8 +43,7 @@ struct tunread_arg { }; extern HANDLE startTunReadThread (struct tunread_arg *arg); -int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t ip_addr); - +int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t *ip_addr); #endif /* WIN32 */ diff --git a/src/edge_utils.c b/src/edge_utils.c index 8d6568ae7..e560b24c4 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -1184,7 +1184,7 @@ static void check_join_multicast_group (n2n_edge_t *eee) { mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP); #ifdef WIN32 dec_ip_str_t ip_addr; - get_best_interface_ip(eee, ip_addr); + get_best_interface_ip(eee, &ip_addr); mreq.imr_interface.s_addr = inet_addr(ip_addr); #else mreq.imr_interface.s_addr = htonl(INADDR_ANY); diff --git a/src/edge_utils_win32.c b/src/edge_utils_win32.c index a32e06ca3..786968e25 100644 --- a/src/edge_utils_win32.c +++ b/src/edge_utils_win32.c @@ -51,7 +51,7 @@ HANDLE startTunReadThread (struct tunread_arg *arg) { -int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t ip_addr){ +int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t *ip_addr){ DWORD interface_index = -1; DWORD dwRetVal = 0; PIP_ADAPTER_INFO pAdapterInfo = NULL, pAdapter = NULL; @@ -94,7 +94,7 @@ int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t ip_addr){ traceEvent(TRACE_DEBUG, "IP Address: %s\n", pAdapter->IpAddressList.IpAddress.String); traceEvent(TRACE_DEBUG, "IP Mask: %s\n", pAdapter->IpAddressList.IpMask.String); traceEvent(TRACE_DEBUG, "Gateway: %s\n", pAdapter->GatewayList.IpAddress.String); - strncpy(ip_addr, pAdapter->IpAddressList.IpAddress.String, sizeof(dec_ip_str_t)-1); + strncpy(ip_addr, pAdapter->IpAddressList.IpAddress.String, sizeof(*ip_addr)); } } else { traceEvent(TRACE_WARNING, "GetAdaptersInfo failed with error: %d\n", dwRetVal); From 0dd94a11233818784ffe78b662491eb9c1b9a53a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Thu, 22 Jun 2023 10:04:23 +0100 Subject: [PATCH 04/82] Fix distclean with newer config.mak style --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9e68188c..ce7181f25 100644 --- a/Makefile +++ b/Makefile @@ -303,7 +303,7 @@ clean: distclean: rm -f tests/*.out src/*.gcno src/*.gcda src/*.indent src/*.unc-backup* rm -rf autom4te.cache/ - rm -f config.log config.status configure Makefile tools/Makefile include/config.h include/config.h.in + rm -f config.log config.status configure include/config.h include/config.h.in rm -f doc/edge.8.gz doc/n2n.7.gz doc/supernode.1.gz rm -f packages/debian/config.log packages/debian/config.status rm -rf packages/debian/autom4te.cache/ From 0545a54b1325945caf597733d22a32961e8f02e4 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 21 Jun 2023 12:21:30 +0100 Subject: [PATCH 05/82] Allow windres to run when cross compiling --- .github/workflows/tests.yml | 1 + Makefile | 2 +- config.mak.in | 1 + configure.ac | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c942631d7..a2d48ba6a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -705,6 +705,7 @@ jobs: ./autogen.sh export CC=${{ matrix.arch }}-gcc export AR=${{ matrix.arch }}-ar + export WINDRES=${{ matrix.arch }}-windres ./configure --host ${{ matrix.arch }} make diff --git a/Makefile b/Makefile index ce7181f25..26b16d33f 100644 --- a/Makefile +++ b/Makefile @@ -209,7 +209,7 @@ win32: $(MAKE) -C $@ win32/edge_rc.o: win32/edge.rc win32/edge.manifest - windres win32/edge.rc -O coff -o win32/edge_rc.o + $(WINDRES) win32/edge.rc -O coff -o win32/edge_rc.o src/edge.o: $(N2N_DEPS) src/supernode.o: $(N2N_DEPS) diff --git a/config.mak.in b/config.mak.in index 7ac67851e..4f08f4a83 100644 --- a/config.mak.in +++ b/config.mak.in @@ -1,6 +1,7 @@ N2N_VERSION=@N2N_VERSION@ CC=@CC@ AR=@AR@ +WINDRES=@WINDRES@ CFLAGS=@CFLAGS@ -I./include LDFLAGS=@LDFLAGS@ -L. LDLIBS_EXTRA=@N2N_LIBS_EXTRA@ diff --git a/configure.ac b/configure.ac index 3a4f9da83..0ddf589b0 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,9 @@ fi if test "${AR+set}" != set; then AR=ar fi +if test "${WINDRES+set}" != set; then + WINDRES=windres +fi N2N_LIBS_EXTRA= @@ -149,6 +152,7 @@ AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name]) AC_SUBST(CC) AC_SUBST(AR) +AC_SUBST(WINDRES) AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(N2N_VERSION) From 3b5855707f32ee93ed1c3e9f7b89abbd53c7786c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 21 Jun 2023 13:36:39 +0100 Subject: [PATCH 06/82] Need to specify a windres tool name for non cross compiled windows --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 26b16d33f..60b5b5d02 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ export CONFIG_TARGET ifndef CONFIG_TARGET ifeq ($(shell uname -o),Msys) CONFIG_TARGET=mingw +WINDRES=windres else ifeq ($(shell uname -s),Darwin) CONFIG_TARGET=darwin else ifeq ($(shell uname), SunOS) From 1b83e0e0e9f63d4e98ddfcba7574d4d75fe7c8b5 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Thu, 22 Jun 2023 10:20:05 +0100 Subject: [PATCH 07/82] Remove some config items that are just wrong with cross compilation --- config.mak.in | 2 +- configure.ac | 18 ------------------ scripts/hack_fakeautoconf.sh | 1 - src/n2n.c | 6 +++--- win32/winconfig.h | 11 ----------- 5 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 win32/winconfig.h diff --git a/config.mak.in b/config.mak.in index 4f08f4a83..684c66484 100644 --- a/config.mak.in +++ b/config.mak.in @@ -1,4 +1,4 @@ -N2N_VERSION=@N2N_VERSION@ +PACKAGE_VERSION=@PACKAGE_VERSION@ CC=@CC@ AR=@AR@ WINDRES=@WINDRES@ diff --git a/configure.ac b/configure.ac index 0ddf589b0..997c3781c 100644 --- a/configure.ac +++ b/configure.ac @@ -2,8 +2,6 @@ odnl> Do not add anything above AC_INIT([edge], m4_esyscmd([scripts/version.sh | tr -d '\n'])) dnl> Do not add anything above -N2N_VERSION=${PACKAGE_VERSION} - AC_DEFINE([PACKAGE_BUILDDATE], "[m4_esyscmd([scripts/version.sh date | tr -d '\n'])]", [Last change date]) if test "${CC+set}" != set; then @@ -134,28 +132,12 @@ AS_IF([test "x$enable_pthread" != xno], ) -MACHINE=`uname -m` -SYSTEM=`uname -s` - -if test $SYSTEM = "Linux"; then - if test -f /etc/debian_version; then - DEBIAN_VERSION=`cat /etc/debian_version` - OSNAME="Debian $DEBIAN_VERSION" - else - OSNAME=`./config.guess` - fi -else -dnl> wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' - OSNAME=`./config.guess` -fi -AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name]) AC_SUBST(CC) AC_SUBST(AR) AC_SUBST(WINDRES) AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) -AC_SUBST(N2N_VERSION) AC_SUBST(N2N_LIBS_EXTRA) AC_SUBST(TOOLS_ADDITIONAL) AC_CONFIG_HEADERS(include/config.h) diff --git a/scripts/hack_fakeautoconf.sh b/scripts/hack_fakeautoconf.sh index 4c6d8ccab..0165f2e81 100755 --- a/scripts/hack_fakeautoconf.sh +++ b/scripts/hack_fakeautoconf.sh @@ -17,6 +17,5 @@ EOF cat <include/config.h #define PACKAGE_VERSION "FIXME" -#define PACKAGE_OSNAME "FIXME" #define PACKAGE_BUILDDATE "$(date)" EOF diff --git a/src/n2n.c b/src/n2n.c index c5a65adf5..3d6ce080c 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -24,7 +24,7 @@ #include // for memcmp, memcpy, memset, strlen, strerror #include // for gettimeofday, timeval #include // for time, localtime, strftime -#include "config.h" // for PACKAGE_BUILDDATE, PACKAGE_OSNAME, PACKA... +#include "config.h" // for PACKAGE_BUILDDATE, PACKA... #include "n2n.h" #include "random_numbers.h" // for n2n_rand #include "sn_selection.h" // for sn_selection_criterion_default @@ -608,10 +608,10 @@ void hexdump (const uint8_t *buf, size_t len) { void print_n2n_version () { - printf("Welcome to n2n v.%s for %s\n" + printf("Welcome to n2n v.%s\n" "Built on %s\n" "Copyright 2007-2022 - ntop.org and contributors\n\n", - PACKAGE_VERSION, PACKAGE_OSNAME, PACKAGE_BUILDDATE); + PACKAGE_VERSION, PACKAGE_BUILDDATE); } /* *********************************************** */ diff --git a/win32/winconfig.h b/win32/winconfig.h deleted file mode 100644 index aa9794af9..000000000 --- a/win32/winconfig.h +++ /dev/null @@ -1,11 +0,0 @@ -/* winconfig.h. Win32 replacement for file generated from config.h.in by configure. */ - -/* OS name */ -#ifndef PACKAGE_OSNAME -#define PACKAGE_OSNAME "windows" -#endif - -/* Define to the version of this package. */ -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION N2N_VERSION -#endif From 4bbee2c3b5d208e6cce2f0ad80d8ceb90a7b30a8 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Thu, 22 Jun 2023 10:43:36 +0100 Subject: [PATCH 08/82] Use the standard autoconf macros to help with cross-compile --- configure.ac | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 997c3781c..93da2a27f 100644 --- a/configure.ac +++ b/configure.ac @@ -4,19 +4,11 @@ dnl> Do not add anything above AC_DEFINE([PACKAGE_BUILDDATE], "[m4_esyscmd([scripts/version.sh date | tr -d '\n'])]", [Last change date]) -if test "${CC+set}" != set; then - CC=gcc -fi -if test "${AR+set}" != set; then - AR=ar -fi -if test "${WINDRES+set}" != set; then - WINDRES=windres -fi - N2N_LIBS_EXTRA= AC_PROG_CC +AC_CHECK_TOOL([AR], [ar], [false]) +AC_CHECK_TOOL([WINDRES], [windres], [false]) # TODO: ideally, should use AC_ARG_ENABLE AC_ARG_WITH([edgex], From 1581b740275bd081f4f43db76fbadf4813aad35c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Thu, 22 Jun 2023 10:57:14 +0100 Subject: [PATCH 09/82] Update everything to reference the simpler tool autodetection --- .github/workflows/tests.yml | 7 ------- doc/Building.md | 4 +--- scripts/hack_fakeautoconf.sh | 1 + 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a2d48ba6a..769b8b94c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -386,8 +386,6 @@ jobs: run: | # This will warn about CC, but we cannot set CC until we run it :-S HOST_TRIPLET=$(dpkg-architecture -a${{ matrix.arch }} -q DEB_HOST_GNU_TYPE) - export CC=$HOST_TRIPLET-gcc - export AR=$HOST_TRIPLET-ar ./autogen.sh ./configure --host $HOST_TRIPLET cd packages/debian/ @@ -598,7 +596,6 @@ jobs: # this is a hack! it assumes the default SDK is the 'right' one export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk ./autogen.sh - export CC=clang export CFLAGS="-target ${{ matrix.arch }}" export LDFLAGS="-target ${{ matrix.arch }}" ./configure --host=${{ matrix.arch }} @@ -647,7 +644,6 @@ jobs: # this is a hack! it assumes the default SDK is the 'right' one export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk ./autogen.sh - export CC=clang export CFLAGS="-arch x86_64 -arch arm64" export LDFLAGS="-arch x86_64 -arch arm64" ./configure @@ -703,9 +699,6 @@ jobs: shell: bash run: | ./autogen.sh - export CC=${{ matrix.arch }}-gcc - export AR=${{ matrix.arch }}-ar - export WINDRES=${{ matrix.arch }}-windres ./configure --host ${{ matrix.arch }} make diff --git a/doc/Building.md b/doc/Building.md index 35433665a..4882c6ef4 100644 --- a/doc/Building.md +++ b/doc/Building.md @@ -103,7 +103,7 @@ See `edge.exe --help` and `supernode.exe --help` for a full list of supported op The Makefiles are all setup to allow cross compiling of this code. You will need to have the cross compiler, binutils and any additional libraries desired installed for the target architecture. Then you can run the `./configure` -with the appropriate CC and AR environment and the right `--host` option. +with the appropriate `--host` option. If compiling on Debian or Ubuntu, this can be as simple as the following example: @@ -111,8 +111,6 @@ If compiling on Debian or Ubuntu, this can be as simple as the following example HOST_TRIPLET=arm-linux-gnueabi sudo apt-get install binutils-$HOST_TRIPLET gcc-$HOST_TRIPLET ./autogen.sh -export CC=$HOST_TRIPLET-gcc -export AR=$HOST_TRIPLET-ar ./configure --host $HOST_TRIPLET make ``` diff --git a/scripts/hack_fakeautoconf.sh b/scripts/hack_fakeautoconf.sh index 0165f2e81..8247b7072 100755 --- a/scripts/hack_fakeautoconf.sh +++ b/scripts/hack_fakeautoconf.sh @@ -6,6 +6,7 @@ cat >config.mak < Date: Sat, 24 Jun 2023 17:09:17 +0100 Subject: [PATCH 10/82] Dont need to tell configure to subst some vars as they are exported by default --- configure.ac | 4 ---- 1 file changed, 4 deletions(-) diff --git a/configure.ac b/configure.ac index 93da2a27f..eede71126 100644 --- a/configure.ac +++ b/configure.ac @@ -125,11 +125,7 @@ AS_IF([test "x$enable_pthread" != xno], -AC_SUBST(CC) -AC_SUBST(AR) AC_SUBST(WINDRES) -AC_SUBST(CFLAGS) -AC_SUBST(LDFLAGS) AC_SUBST(N2N_LIBS_EXTRA) AC_SUBST(TOOLS_ADDITIONAL) AC_CONFIG_HEADERS(include/config.h) From 9417866394f069aa7bdebc3990ec2a7dba6ba32a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 24 Jun 2023 18:11:41 +0100 Subject: [PATCH 11/82] Use the more usual name for autoconf libs variable --- config.mak.in | 2 +- configure.ac | 31 ++++++------------------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/config.mak.in b/config.mak.in index 684c66484..7622aad6e 100644 --- a/config.mak.in +++ b/config.mak.in @@ -4,5 +4,5 @@ AR=@AR@ WINDRES=@WINDRES@ CFLAGS=@CFLAGS@ -I./include LDFLAGS=@LDFLAGS@ -L. -LDLIBS_EXTRA=@N2N_LIBS_EXTRA@ +LDLIBS_EXTRA=@LIBS@ TOOLS_ADDITIONAL=@TOOLS_ADDITIONAL@ diff --git a/configure.ac b/configure.ac index eede71126..b1fede600 100644 --- a/configure.ac +++ b/configure.ac @@ -4,8 +4,6 @@ dnl> Do not add anything above AC_DEFINE([PACKAGE_BUILDDATE], "[m4_esyscmd([scripts/version.sh date | tr -d '\n'])]", [Last change date]) -N2N_LIBS_EXTRA= - AC_PROG_CC AC_CHECK_TOOL([AR], [ar], [false]) AC_CHECK_TOOL([WINDRES], [windres], [false]) @@ -27,11 +25,7 @@ AC_ARG_WITH([zstd], AS_HELP_STRING([--with-zstd], [use zstd library]), [], [with_zstd=no]) AS_IF([test "x$with_zstd" != "xno"], - [AC_CHECK_LIB([zstd], [ZSTD_compress], - [ - AC_DEFINE([HAVE_ZSTD], [1], [Have ZSTD support]) - N2N_LIBS_EXTRA="-lzstd ${N2N_LIBS_EXTRA}" - ], + [AC_CHECK_LIB([zstd], [ZSTD_compress],, [AC_MSG_ERROR([zstd library not found])] )], ) @@ -44,7 +38,7 @@ AS_IF([test "x$with_openssl" != xno], [AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset], [ AC_DEFINE([HAVE_OPENSSL_1_1], [1], [OpenSSL 1.1 is present]) - N2N_LIBS_EXTRA="-lcrypto ${N2N_LIBS_EXTRA}" + LIBS="-lcrypto ${LIBS}" ], [AC_MSG_ERROR([openssl library not found])] )], @@ -54,11 +48,7 @@ AC_ARG_ENABLE([miniupnp], [AS_HELP_STRING([--enable-miniupnp], [support for miniupnp])], [], [enable_miniupnp=no]) AS_IF([test "x$enable_miniupnp" != xno], - [AC_CHECK_LIB([miniupnpc], [upnpDiscover], - [ - AC_DEFINE([HAVE_MINIUPNP], [1], [Have miniupnp library]) - N2N_LIBS_EXTRA="-lminiupnpc ${N2N_LIBS_EXTRA}" - ], + [AC_CHECK_LIB([miniupnpc], [upnpDiscover],, [AC_MSG_ERROR([miniupnp library not found])] )], ) @@ -67,11 +57,7 @@ AC_ARG_ENABLE([natpmp], [AS_HELP_STRING([--enable-natpmp], [support for natpmp])], [], [enable_natpmp=no]) AS_IF([test "x$enable_natpmp" != xno], - [AC_CHECK_LIB([natpmp], [initnatpmp], - [ - AC_DEFINE([HAVE_NATPMP], [1], [Have natpmp library]) - N2N_LIBS_EXTRA="-lnatpmp ${N2N_LIBS_EXTRA}" - ], + [AC_CHECK_LIB([natpmp], [initnatpmp],, [AC_MSG_ERROR([natpmp library not found])] )], ) @@ -83,7 +69,7 @@ AS_IF([test "x$enable_pcap" != xno], [AC_CHECK_LIB([pcap], [pcap_open_live], [ AC_DEFINE([N2N_HAVE_PCAP], [1], [Have PCAP library]) - N2N_LIBS_EXTRA="-lpcap ${N2N_LIBS_EXTRA}" + LIBS="-lpcap ${LIBS}" TOOLS_ADDITIONAL="$TOOLS_ADDITIONAL n2n-decode" # TODO @@ -101,11 +87,7 @@ AC_ARG_ENABLE([cap], [AS_HELP_STRING([--enable-cap], [support for cap])], [], [enable_cap=no]) AS_IF([test "x$enable_cap" != xno], - [AC_CHECK_LIB([cap], [cap_get_proc], - [ - AC_DEFINE([HAVE_LIBCAP],[1],[Support for linux capabilities]) - N2N_LIBS_EXTRA="${N2N_LIBS_EXTRA} -lcap" - ], + [AC_CHECK_LIB([cap], [cap_get_proc],, [AC_MSG_ERROR([cap library not found])] )], ) @@ -126,7 +108,6 @@ AS_IF([test "x$enable_pthread" != xno], AC_SUBST(WINDRES) -AC_SUBST(N2N_LIBS_EXTRA) AC_SUBST(TOOLS_ADDITIONAL) AC_CONFIG_HEADERS(include/config.h) AC_CONFIG_FILES(config.mak) From 87c20d750e38e43584bdfcae94d859c453dce4e1 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 24 Jun 2023 18:27:28 +0100 Subject: [PATCH 12/82] Add rules to run autogen/configure and use them in some of the simpler CI builds --- .github/workflows/tests.yml | 22 +++++----------------- Makefile | 6 +++++- scripts/hack_fakeautoconf.sh | 13 +++++++++++++ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 769b8b94c..31bc28f04 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,8 +21,6 @@ jobs: - name: Run minimal test set run: | - ./autogen.sh - ./configure make test - if: ${{ failure() }} @@ -55,7 +53,7 @@ jobs: - name: Run minimal test set run: | - ./autogen.sh + make configure ./configure \ --enable-pthread \ --enable-miniupnp \ @@ -78,12 +76,6 @@ jobs: run: | git fetch --force --tags - - - name: Make the makefiles - run: | - ./autogen.sh - ./configure - - name: Install essential run: | sudo apt update @@ -118,7 +110,7 @@ jobs: - name: Make the makefiles run: | - ./autogen.sh + make configure export CFLAGS="${{ matrix.flags }}" export LDFLAGS="${{ matrix.flags }}" @@ -164,10 +156,8 @@ jobs: sudo apt-get update sudo apt-get install build-essential - - name: generate a makefile and use it to install more packages + - name: Install required packages run: | - ./autogen.sh - ./configure make build-dep shell: bash @@ -230,14 +220,12 @@ jobs: git fetch --force --tags - - name: Install packages + - name: Install essential run: | brew install automake - - name: generate a makefile and use it to install more packages + - name: Install required packages run: | - ./autogen.sh - ./configure make build-dep shell: bash diff --git a/Makefile b/Makefile index 60b5b5d02..f4ea5dc7a 100644 --- a/Makefile +++ b/Makefile @@ -193,7 +193,6 @@ COVERAGEDIR?=coverage .PHONY: $(SUBDIRS) -.PHONY: all all: version $(APPS) $(DOCS) $(SUBDIRS) # This allows breaking the build if the version.sh script discovers @@ -322,6 +321,11 @@ install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz $(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/ $(MAKE) -C tools install SBINDIR=$(abspath $(SBINDIR)) +configure include/config.h.in: configure.ac + autoreconf -if +config.mak include/config.h: config.mak.in include/config.h.in configure + ./configure + # Docker builder section DOCKER_IMAGE_NAME=ntop/supernode DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT diff --git a/scripts/hack_fakeautoconf.sh b/scripts/hack_fakeautoconf.sh index 8247b7072..dd01a6da3 100755 --- a/scripts/hack_fakeautoconf.sh +++ b/scripts/hack_fakeautoconf.sh @@ -3,6 +3,19 @@ # Specifically for windows, where installing autoconf looks suspiciously # like boiling the ocean. +cat <include/config.h.in +// Created by hack fake autoconf for windows +// not actually a config input +EOF + +cat <configure +#!/bin/sh +echo Created by hack fake autoconf for windows +echo not a confgure script +exit 1 +EOF +chmod a+x configure + cat >config.mak < Date: Sat, 24 Jun 2023 19:33:31 +0100 Subject: [PATCH 13/82] Use the correct modern windows sockets header As suggested in a PR from @Legend-Master (this change is basically unrelated to the main point of his PR, so extracted here) Windows is a confusing and disappointing development environment. They completely replaced all the definitions in winsock.h with exact equivalents in winsock2.h (except for a small number of deprecated functions). However they didnt make them mutually exclusive - so if you include both, you get errors. They also automatically include winsock.h from windows.h, so you must remember to include winsock2.h first. They also didnt just remove winsock.h and replace it with the new contents. (Probably in the name of "compatibility", whilst swearing that the new winsock is the same as the old one - because if you cannot believe two inconsistent things simultaneously, you shouldnt be a windows programmer) All these things are totally nuts. Thanks, windows dev environment, for not noticing that this is nuts --- include/n2n.h | 2 +- src/edge.c | 2 +- src/edge_management.c | 2 +- src/edge_utils.c | 2 +- src/example_sn_embed.c | 2 +- src/management.h | 2 +- src/n2n.c | 2 +- src/network_traffic_filter.c | 2 +- src/sn_management.c | 2 +- src/sn_utils.c | 2 +- src/supernode.c | 2 +- src/wire.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/n2n.h b/include/n2n.h index e5b0bfd77..f41f2a4d4 100644 --- a/include/n2n.h +++ b/include/n2n.h @@ -56,11 +56,11 @@ #include "n2n_typedefs.h" #ifdef WIN32 +#include /* for tcp */ #include /* for privilege check in tools/n2n-route */ #include /* for privilege check in tools/n2n-route */ #include #include /* for privilege check in tools/n2n-route */ -#include /* for tcp */ #include "wintap.h" #define SHUT_RDWR SD_BOTH /* for tcp */ #endif /* #ifdef WIN32 */ diff --git a/src/edge.c b/src/edge.c index d2c028877..5e76ab52a 100644 --- a/src/edge.c +++ b/src/edge.c @@ -43,7 +43,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ADD, HASH_C... #ifdef WIN32 -#include +#include #include #else #include // for inet_addr, inet_ntop diff --git a/src/edge_management.c b/src/edge_management.c index 53e0b6feb..7381f1c3b 100644 --- a/src/edge_management.c +++ b/src/edge_management.c @@ -36,7 +36,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER #ifdef WIN32 -#include +#include #include #include "edge_utils_win32.h" #else diff --git a/src/edge_utils.c b/src/edge_utils.c index e560b24c4..d59f1ad28 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -41,7 +41,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_COUNT, HASH... #ifdef WIN32 -#include +#include #include #include "edge_utils_win32.h" #else diff --git a/src/example_sn_embed.c b/src/example_sn_embed.c index 713d068f4..cdd16ed2d 100644 --- a/src/example_sn_embed.c +++ b/src/example_sn_embed.c @@ -22,7 +22,7 @@ #include "n2n.h" // for n2n_sn_t, open_socket, run_sn_loop, sn_init #ifdef WIN32 -#include +#include #else #include // for INADDR_ANY, INADDR_LOOPBACK #endif diff --git a/src/management.h b/src/management.h index 3e954580d..53592bdbf 100644 --- a/src/management.h +++ b/src/management.h @@ -17,7 +17,7 @@ #include "strbuf.h" #ifdef WIN32 -#include +#include #else #include // for sockaddr, sockaddr_storage, socklen_t #endif diff --git a/src/n2n.c b/src/n2n.c index 3d6ce080c..bcba07b5f 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -31,7 +31,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_DEL, HASH_ITER, HAS... #ifdef WIN32 -#include +#include #include #include #else diff --git a/src/network_traffic_filter.c b/src/network_traffic_filter.c index fc8b4c14a..4ba0d0bdc 100644 --- a/src/network_traffic_filter.c +++ b/src/network_traffic_filter.c @@ -26,7 +26,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_DEL #ifdef WIN32 -#include +#include #include #else #include // for inet_ntoa, inet_addr diff --git a/src/sn_management.c b/src/sn_management.c index 3dae672fa..4954cdfa8 100644 --- a/src/sn_management.c +++ b/src/sn_management.c @@ -36,7 +36,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_COUNT #ifdef WIN32 -#include +#include #include "edge_utils_win32.h" #else #include // for sendto, socklen_t diff --git a/src/sn_utils.c b/src/sn_utils.c index 9b57f5872..88686f7e7 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -41,7 +41,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_DEL #ifdef WIN32 -#include +#include #include #else #include // for inet_addr, inet_ntoa diff --git a/src/supernode.c b/src/supernode.c index 1c640f1cf..2f604162a 100644 --- a/src/supernode.c +++ b/src/supernode.c @@ -36,7 +36,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_ADD_STR #ifdef WIN32 -#include +#include #include #else #include // for inet_addr diff --git a/src/wire.c b/src/wire.c index af1011fbc..765a8e7b2 100644 --- a/src/wire.c +++ b/src/wire.c @@ -34,7 +34,7 @@ #include "n2n_wire.h" // for decode_PACKET, decode_PEER_INFO, decode_QUER... #ifdef WIN32 -#include +#include #include #else #include // for sockaddr_in, sockaddr_in6, in6_addr, in_addr From a1bef636de657ff245660b6161458dcfe24c7a61 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 09:34:27 +0100 Subject: [PATCH 14/82] Partially Revert "Add rules to run autogen/configure and use them in some of the simpler CI builds" This reverts commit 87c20d750e38e43584bdfcae94d859c453dce4e1. --- .github/workflows/tests.yml | 22 +++++++++++++++++----- Makefile | 6 +----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 31bc28f04..769b8b94c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,6 +21,8 @@ jobs: - name: Run minimal test set run: | + ./autogen.sh + ./configure make test - if: ${{ failure() }} @@ -53,7 +55,7 @@ jobs: - name: Run minimal test set run: | - make configure + ./autogen.sh ./configure \ --enable-pthread \ --enable-miniupnp \ @@ -76,6 +78,12 @@ jobs: run: | git fetch --force --tags + + - name: Make the makefiles + run: | + ./autogen.sh + ./configure + - name: Install essential run: | sudo apt update @@ -110,7 +118,7 @@ jobs: - name: Make the makefiles run: | - make configure + ./autogen.sh export CFLAGS="${{ matrix.flags }}" export LDFLAGS="${{ matrix.flags }}" @@ -156,8 +164,10 @@ jobs: sudo apt-get update sudo apt-get install build-essential - - name: Install required packages + - name: generate a makefile and use it to install more packages run: | + ./autogen.sh + ./configure make build-dep shell: bash @@ -220,12 +230,14 @@ jobs: git fetch --force --tags - - name: Install essential + - name: Install packages run: | brew install automake - - name: Install required packages + - name: generate a makefile and use it to install more packages run: | + ./autogen.sh + ./configure make build-dep shell: bash diff --git a/Makefile b/Makefile index f4ea5dc7a..60b5b5d02 100644 --- a/Makefile +++ b/Makefile @@ -193,6 +193,7 @@ COVERAGEDIR?=coverage .PHONY: $(SUBDIRS) +.PHONY: all all: version $(APPS) $(DOCS) $(SUBDIRS) # This allows breaking the build if the version.sh script discovers @@ -321,11 +322,6 @@ install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz $(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/ $(MAKE) -C tools install SBINDIR=$(abspath $(SBINDIR)) -configure include/config.h.in: configure.ac - autoreconf -if -config.mak include/config.h: config.mak.in include/config.h.in configure - ./configure - # Docker builder section DOCKER_IMAGE_NAME=ntop/supernode DOCKER_IMAGE_VERSION=$N2N_VERSION_SHORT From 4c0c1732213f343f73c3bcf1e1129ec2af3184e3 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 09:42:39 +0100 Subject: [PATCH 15/82] Check if we have been configured before running most of Make --- Makefile | 10 +++++++++- config.mak.in | 4 ++++ configure.ac | 3 ++- scripts/hack_fakeautoconf.sh | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 60b5b5d02..e3ab9ee35 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# Our default make target +all: export CC export AR @@ -6,7 +8,13 @@ export LDFLAGS export LDLIBS export TOOLS_ADDITIONAL -include config.mak +-include config.mak + +ifndef CONFIG_HOST +# TODO: +# dont error if we are installing build-deps or other non-compile action +$(error Please run ./configure) +endif #Ultrasparc64 users experiencing SIGBUS should try the following gcc options #(thanks to Robert Gibbon) diff --git a/config.mak.in b/config.mak.in index 7622aad6e..997e8e843 100644 --- a/config.mak.in +++ b/config.mak.in @@ -1,3 +1,7 @@ +# Global configuration, included in top Makefile and exported from there. +# @configure_input@ + +CONFIG_HOST=@host@ PACKAGE_VERSION=@PACKAGE_VERSION@ CC=@CC@ AR=@AR@ diff --git a/configure.ac b/configure.ac index b1fede600..8b7377aad 100644 --- a/configure.ac +++ b/configure.ac @@ -4,6 +4,7 @@ dnl> Do not add anything above AC_DEFINE([PACKAGE_BUILDDATE], "[m4_esyscmd([scripts/version.sh date | tr -d '\n'])]", [Last change date]) +AC_CANONICAL_HOST AC_PROG_CC AC_CHECK_TOOL([AR], [ar], [false]) AC_CHECK_TOOL([WINDRES], [windres], [false]) @@ -106,7 +107,7 @@ AS_IF([test "x$enable_pthread" != xno], ) - +AC_SUBST(host) AC_SUBST(WINDRES) AC_SUBST(TOOLS_ADDITIONAL) AC_CONFIG_HEADERS(include/config.h) diff --git a/scripts/hack_fakeautoconf.sh b/scripts/hack_fakeautoconf.sh index dd01a6da3..7cbd38554 100755 --- a/scripts/hack_fakeautoconf.sh +++ b/scripts/hack_fakeautoconf.sh @@ -17,6 +17,7 @@ EOF chmod a+x configure cat >config.mak < Date: Sun, 25 Jun 2023 09:06:22 +0100 Subject: [PATCH 16/82] Simplify and make more consistant the pthread library --- configure.ac | 6 +----- include/n2n_typedefs.h | 2 +- src/edge_utils.c | 4 ++-- src/n2n.c | 12 ++++++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 8b7377aad..9a6005d56 100644 --- a/configure.ac +++ b/configure.ac @@ -97,11 +97,7 @@ AC_ARG_ENABLE([pthread], [AS_HELP_STRING([--enable-pthread], [support for pthread])], [], [enable_pthread=no]) AS_IF([test "x$enable_pthread" != xno], - [AC_CHECK_LIB([pthread], [pthread_mutex_trylock], - [ - AC_DEFINE([HAVE_PTHREAD],[1],[pthread is present]) - LDFLAGS="${LDFLAGS} -pthread" - ], + [AC_CHECK_LIB([pthread], [pthread_mutex_trylock],, [AC_MSG_ERROR([pthread library not found])] )], ) diff --git a/include/n2n_typedefs.h b/include/n2n_typedefs.h index 582b59084..500bfcd9e 100644 --- a/include/n2n_typedefs.h +++ b/include/n2n_typedefs.h @@ -637,7 +637,7 @@ typedef struct n2n_resolve_ip_sock { typedef struct n2n_resolve_parameter { n2n_resolve_ip_sock_t *list; /* pointer to list of to be resolved nodes */ uint8_t changed; /* indicates a change */ -#ifdef HAVE_PTHREAD +#ifdef HAVE_LIBPTHREAD pthread_t id; /* thread id */ pthread_mutex_t access; /* mutex for shared access */ #endif diff --git a/src/edge_utils.c b/src/edge_utils.c index d59f1ad28..85ef0db8a 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -1642,14 +1642,14 @@ void update_supernode_reg (n2n_edge_t * eee, time_t now) { --(eee->sup_attempts); } -#ifndef HAVE_PTHREAD +#ifndef HAVE_LIBPTHREAD if(supernode2sock(&(eee->curr_sn->sock), eee->curr_sn->ip_addr) == 0) { #endif traceEvent(TRACE_INFO, "registering with supernode [%s][number of supernodes %d][attempts left %u]", supernode_ip(eee), HASH_COUNT(eee->conf.supernodes), (unsigned int)eee->sup_attempts); send_register_super(eee); -#ifndef HAVE_PTHREAD +#ifndef HAVE_LIBPTHREAD } #endif diff --git a/src/n2n.c b/src/n2n.c index bcba07b5f..9b8689f2e 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -30,6 +30,10 @@ #include "sn_selection.h" // for sn_selection_criterion_default #include "uthash.h" // for UT_hash_handle, HASH_DEL, HASH_ITER, HAS... +#ifdef HAVE_LIBPTHREAD +#include +#endif + #ifdef WIN32 #include #include @@ -332,7 +336,7 @@ int supernode2sock (n2n_sock_t *sn, const n2n_sn_name_t addrIn) { } -#ifdef HAVE_PTHREAD +#ifdef HAVE_LIBPTHREAD N2N_THREAD_RETURN_DATATYPE resolve_thread(N2N_THREAD_PARAMETER_DATATYPE p) { n2n_resolve_parameter_t *param = (n2n_resolve_parameter_t*)p; @@ -385,7 +389,7 @@ N2N_THREAD_RETURN_DATATYPE resolve_thread(N2N_THREAD_PARAMETER_DATATYPE p) { int resolve_create_thread (n2n_resolve_parameter_t **param, struct peer_info *sn_list) { -#ifdef HAVE_PTHREAD +#ifdef HAVE_LIBPTHREAD struct peer_info *sn, *tmp_sn; n2n_resolve_ip_sock_t *entry; int ret; @@ -430,7 +434,7 @@ int resolve_create_thread (n2n_resolve_parameter_t **param, struct peer_info *sn void resolve_cancel_thread (n2n_resolve_parameter_t *param) { -#ifdef HAVE_PTHREAD +#ifdef HAVE_LIBPTHREAD pthread_cancel(param->id); free(param); #endif @@ -441,7 +445,7 @@ uint8_t resolve_check (n2n_resolve_parameter_t *param, uint8_t requires_resoluti uint8_t ret = requires_resolution; /* if trylock fails, it still requires resolution */ -#ifdef HAVE_PTHREAD +#ifdef HAVE_LIBPTHREAD n2n_resolve_ip_sock_t *entry, *tmp_entry; n2n_sock_str_t sock_buf; From 169d3a8cc70a96ca9a77a09b8e68d5f57591f521 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 10:20:42 +0100 Subject: [PATCH 17/82] Fix use with older autoconf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some versions of autoconf (eg, the one included with Ubuntu 20.04 - which is GNU Autoconf 2.69) will produce a configure script that requires finding the install-sh script in either a short list of parent directories or the defined AUX_DIR (This new requirement was probably triggered by the use of the cross-compile features in configure.ac) Newer versions flexibly identify which of the support scripts are actually needed (from the list of config.guess, config.sub, install-sh) and only check for those ones that are needed. When the `./autogen.sh` runs `autoreconf -i`, it should have copied the required aux scripts, but for some reason this is not happening. Once we are not supporting the older autoconf, we should revisit this config option as these auxiliary scripts should normally not be checked into a version control system, for the same reasons that configure shouldn’t be. For now, we ensure that all three scripts are available and we have set the AC_CONFIG_AUX_DIR() to point to them If the older autoconf is used, it will report the error: configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.." Which is included here for search engines. --- .gitignore | 1 - configure.ac | 3 + config.guess => scripts/config.guess | 0 scripts/config.sub | 1890 ++++++++++++++++++++++++++ scripts/install-sh | 541 ++++++++ 5 files changed, 2434 insertions(+), 1 deletion(-) rename config.guess => scripts/config.guess (100%) create mode 100755 scripts/config.sub create mode 100755 scripts/install-sh diff --git a/.gitignore b/.gitignore index b4a902ff5..4c2c448d2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ config.rpath config.status include/config.h include/config.h.in -tools/config.mak autom4te.cache edge example_edge_embed_quick_edge_init diff --git a/configure.ac b/configure.ac index 9a6005d56..4e5cd2349 100644 --- a/configure.ac +++ b/configure.ac @@ -4,6 +4,9 @@ dnl> Do not add anything above AC_DEFINE([PACKAGE_BUILDDATE], "[m4_esyscmd([scripts/version.sh date | tr -d '\n'])]", [Last change date]) +# Older versions of the autotools expect to find install-sh here. +AC_CONFIG_AUX_DIR(scripts) + AC_CANONICAL_HOST AC_PROG_CC AC_CHECK_TOOL([AR], [ar], [false]) diff --git a/config.guess b/scripts/config.guess similarity index 100% rename from config.guess rename to scripts/config.guess diff --git a/scripts/config.sub b/scripts/config.sub new file mode 100755 index 000000000..dba16e84c --- /dev/null +++ b/scripts/config.sub @@ -0,0 +1,1890 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2022 Free Software Foundation, Inc. + +# 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 +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# 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 . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# 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 +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# 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 or ALIAS + +Canonicalize a configuration name. + +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 + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +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." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # 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 + ;; + *-*) + # 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 + ;; + *) + # 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 1-component or ad-hoc basic machines +case $basic_machine in + # 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 + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + 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. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-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 + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +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 + ;; +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. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/scripts/install-sh b/scripts/install-sh new file mode 100755 index 000000000..ec298b537 --- /dev/null +++ b/scripts/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +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 +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +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= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -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 + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -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 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + 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 + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # 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 + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # 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. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (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 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (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. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + 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 || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: From 89125ec42335fc10afd746af6a3d405189c8b7d8 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 11:55:29 +0100 Subject: [PATCH 18/82] Use the defined access method for structure. Not all struct sockaddr are going to have the sa_family as their first field. Since there is a named structure member, we can simply use that and let the compiler sort it out. This fixes a bug with at least FreeBSD and allows us to remove the special case for Apple. --- src/wire.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/wire.c b/src/wire.c index 765a8e7b2..485020f8d 100644 --- a/src/wire.c +++ b/src/wire.c @@ -687,11 +687,8 @@ int fill_sockaddr (struct sockaddr * addr, // fills struct sockaddr's data into n2n_sock int fill_n2nsock (n2n_sock_t* sock, const struct sockaddr* sa) { -#ifdef __APPLE__ sock->family = sa->sa_family; -#else - sock->family = *(sa_family_t*)sa; -#endif + switch(sock->family) { case AF_INET: { sock->port = ntohs(((struct sockaddr_in*)sa)->sin_port); From 2413ce498fcb0b806902c651f34ca42b3f5e29eb Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 11:59:05 +0100 Subject: [PATCH 19/82] The autogen script is not using any bash features --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index d6aac56a4..dfa8610fe 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh rm -f include/config.h include/config.h.in include/config.h.in~ config.mak configure From a2c78e140ad9bd8b32c64b26bc4a169029a955a7 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 12:00:24 +0100 Subject: [PATCH 20/82] Minor fixes for FreeBSD --- include/n2n_typedefs.h | 1 + src/tuntap_freebsd.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/n2n_typedefs.h b/include/n2n_typedefs.h index 500bfcd9e..4951aa47e 100644 --- a/include/n2n_typedefs.h +++ b/include/n2n_typedefs.h @@ -23,6 +23,7 @@ #include // for uint8_t and friends #ifndef WIN32 #include // for in_addr_t +#include // for sockaddr #endif #include #include diff --git a/src/tuntap_freebsd.c b/src/tuntap_freebsd.c index 6501659b7..9ccdf0e90 100644 --- a/src/tuntap_freebsd.c +++ b/src/tuntap_freebsd.c @@ -17,6 +17,7 @@ */ +#include // for open. O_RDWR #include "n2n.h" From 42a716ae7b733e991e0ebce33ac158246a9336ea Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Fri, 16 Jun 2023 10:05:31 +0100 Subject: [PATCH 21/82] Actually test freebsd --- .github/workflows/tests.yml | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 769b8b94c..a0ae51db0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -211,6 +211,45 @@ jobs: - name: Upload data to codecov uses: codecov/codecov-action@v3 + test_bsd: + name: Test BSD + runs-on: ubuntu-latest + strategy: + matrix: + os: + - name: freebsd + architecture: x86-64 + version: '13.2' + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Fix Checkout + run: | + git fetch --force --tags + + - name: Test on ${{ matrix.os.name }} + uses: cross-platform-actions/action@v0.15.0 + with: + operating_system: ${{ matrix.os.name }} + architecture: ${{ matrix.os.architecture }} + version: ${{ matrix.os.version }} + shell: bash + memory: 5G + cpu_count: 4 + run: | + sudo pkg install -y \ + autoconf \ + automake \ + gcc \ + git \ + gmake \ + python3 + ./autogen.sh + ./configure + gmake test + test_macos: name: Test MacOS runs-on: ${{ matrix.os }} From 0d005d189d6d5c3680ac37fd8904f5883e82b148 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 13:40:00 +0100 Subject: [PATCH 22/82] Fix silent failure of sizeof for STRBUF_INIT() --- src/edge_management.c | 8 ++++---- src/management.c | 2 +- src/sn_management.c | 2 +- src/strbuf.h | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/edge_management.c b/src/edge_management.c index 7381f1c3b..827a6b97e 100644 --- a/src/edge_management.c +++ b/src/edge_management.c @@ -381,7 +381,7 @@ static void handleMgmtJson (mgmt_req_t *req, char *udp_buf, const int recvlen) { traceEvent(TRACE_DEBUG, "mgmt json %s", cmdlinebuf); /* we reuse the buffer already on the stack for all our strings */ - STRBUF_INIT(buf, udp_buf); + STRBUF_INIT(buf, udp_buf, N2N_SN_PKTBUF_SIZE); mgmt_req_init2(req, buf, (char *)&cmdlinebuf); @@ -476,7 +476,7 @@ void readFromMgmtSocket (n2n_edge_t *eee) { if((0 == memcmp(udp_buf, "help", 4)) || (0 == memcmp(udp_buf, "?", 1))) { strbuf_t *buf; - STRBUF_INIT(buf, &udp_buf); + STRBUF_INIT(buf, &udp_buf, sizeof(udp_buf)); msg_len = snprintf(buf->str, buf->size, "Help for edge management console:\n" "\tstop | Gracefully exit edge\n" @@ -505,7 +505,7 @@ void readFromMgmtSocket (n2n_edge_t *eee) { traceEvent(TRACE_NORMAL, "+verb traceLevel=%u", (unsigned int) getTraceLevel()); strbuf_t *buf; - STRBUF_INIT(buf, &udp_buf); + STRBUF_INIT(buf, &udp_buf, sizeof(udp_buf)); msg_len = snprintf(buf->str, buf->size, "> +OK traceLevel=%u\n", (unsigned int) getTraceLevel()); @@ -516,7 +516,7 @@ void readFromMgmtSocket (n2n_edge_t *eee) { if(0 == memcmp(udp_buf, "-verb", 5)) { strbuf_t *buf; - STRBUF_INIT(buf, &udp_buf); + STRBUF_INIT(buf, &udp_buf, sizeof(udp_buf)); if(getTraceLevel() > 0) { setTraceLevel(getTraceLevel() - 1); diff --git a/src/management.c b/src/management.c index 70a3b4f67..6f914b5db 100644 --- a/src/management.c +++ b/src/management.c @@ -102,7 +102,7 @@ void mgmt_event_post2 (enum n2n_event_topic topic, int data0, void *data1, mgmt_ char buf_space[100]; strbuf_t *buf; - STRBUF_INIT(buf, buf_space); + STRBUF_INIT(buf, buf_space, sizeof(buf_space)); char *tag; if(sub->type == N2N_MGMT_SUB) { diff --git a/src/sn_management.c b/src/sn_management.c index 4954cdfa8..5a288ca87 100644 --- a/src/sn_management.c +++ b/src/sn_management.c @@ -240,7 +240,7 @@ static void handleMgmtJson (mgmt_req_t *req, char *udp_buf, const int recvlen) { /* we reuse the buffer already on the stack for all our strings */ // xx - STRBUF_INIT(buf, udp_buf); + STRBUF_INIT(buf, udp_buf, N2N_SN_PKTBUF_SIZE); mgmt_req_init2(req, buf, (char *)&cmdlinebuf); diff --git a/src/strbuf.h b/src/strbuf.h index 1bf2c4bf3..cc2e7c2dc 100644 --- a/src/strbuf.h +++ b/src/strbuf.h @@ -14,10 +14,10 @@ typedef struct strbuf { } strbuf_t; // Initialise the strbuf pointer buf to point at the storage area p -// p must be a known sized object -#define STRBUF_INIT(buf,p) do { \ +// of size buflen +#define STRBUF_INIT(buf,p,buflen) do { \ buf = (void *)p; \ - buf->size = sizeof(*p) - sizeof(size_t); \ + buf->size = buflen - sizeof(size_t); \ } while(0) From ccd33dc8ccc7807ef52eb4bad8e35669e9e9e935 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 13:49:31 +0100 Subject: [PATCH 23/82] Hacky fix for tests running on freebsd --- scripts/test_integration_supernode.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/test_integration_supernode.sh b/scripts/test_integration_supernode.sh index 4d5145dc1..d939769fd 100755 --- a/scripts/test_integration_supernode.sh +++ b/scripts/test_integration_supernode.sh @@ -18,6 +18,9 @@ docmd() { # start it running in the background docmd "${BINDIR}"/supernode -v +# TODO: probe the api endpoint, waiting for the supernode to be available? +sleep 0.1 + docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 communities docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 packetstats docmd "${TOPDIR}"/scripts/n2n-ctl -t 5645 edges --raw From ce3ed1fb90a3216ea36595c530b82cdc9ab3973c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 14:48:31 +0100 Subject: [PATCH 24/82] Expand the freebsd hacky fix to encompas edge tests as well --- scripts/test_integration_edge.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/test_integration_edge.sh b/scripts/test_integration_edge.sh index 4c6ee8016..be65261f2 100755 --- a/scripts/test_integration_edge.sh +++ b/scripts/test_integration_edge.sh @@ -23,6 +23,10 @@ docmd sudo "${BINDIR}"/edge -l localhost:7654 -c test >/dev/null # TODO: # - send edge messages to stderr? +# TODO: probe the api endpoint, waiting for both the supernode and edge to be +# available? +sleep 0.1 + docmd "${TOPDIR}"/scripts/n2n-ctl communities docmd "${TOPDIR}"/scripts/n2n-ctl packetstats docmd "${TOPDIR}"/scripts/n2n-ctl edges --raw From d39f5c78925f1fb4ace084333391224d7db153cc Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 15:10:10 +0100 Subject: [PATCH 25/82] Disable running full tests on BSD builds - they are flappy --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a0ae51db0..625d73c3e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -248,7 +248,7 @@ jobs: python3 ./autogen.sh ./configure - gmake test + gmake all test_macos: name: Test MacOS From 548e1204f372a28e1451fd2bd6bf2096063597c0 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 21 Jun 2023 18:24:00 +0100 Subject: [PATCH 26/82] Address warning - another windows pedantic header order issue --- src/edge_utils_win32.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/edge_utils_win32.c b/src/edge_utils_win32.c index 786968e25..b65c44cd8 100644 --- a/src/edge_utils_win32.c +++ b/src/edge_utils_win32.c @@ -18,6 +18,8 @@ #ifdef WIN32 +#include + #include "edge_utils_win32.h" /* ************************************** */ From d21a4fe0a2ac86903a5fb0091e57dde6b2582373 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 15:28:46 +0100 Subject: [PATCH 27/82] Remove some unneeded includes --- src/edge_management.c | 1 - src/sn_management.c | 1 - 2 files changed, 2 deletions(-) diff --git a/src/edge_management.c b/src/edge_management.c index 827a6b97e..ebf2cfadf 100644 --- a/src/edge_management.c +++ b/src/edge_management.c @@ -38,7 +38,6 @@ #ifdef WIN32 #include #include -#include "edge_utils_win32.h" #else #include // for inet_ntoa #include // for in_addr, htonl, in_addr_t diff --git a/src/sn_management.c b/src/sn_management.c index 5a288ca87..2ef8f4151 100644 --- a/src/sn_management.c +++ b/src/sn_management.c @@ -37,7 +37,6 @@ #ifdef WIN32 #include -#include "edge_utils_win32.h" #else #include // for sendto, socklen_t #endif From 3c9a170b123a255f3ba7f4b249009fac6f843d84 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Thu, 22 Jun 2023 08:54:46 +0100 Subject: [PATCH 28/82] Some header simplification --- include/edge_utils_win32.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/edge_utils_win32.h b/include/edge_utils_win32.h index caf75ebaf..087c13b4c 100644 --- a/include/edge_utils_win32.h +++ b/include/edge_utils_win32.h @@ -19,14 +19,7 @@ #ifndef _EDGE_UTILS_WIN32_H_ #define _EDGE_UTILS_WIN32_H_ -#ifdef WIN32 - -#define WIN32_LEAN_AND_MEAN - -#include #include -#include -#include /* Multicast peers discovery disabled due to https://github.com/ntop/n2n/issues/65 */ @@ -45,7 +38,6 @@ struct tunread_arg { extern HANDLE startTunReadThread (struct tunread_arg *arg); int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t *ip_addr); -#endif /* WIN32 */ #endif /* _EDGE_UTILS_WIN32_H_ */ From 6d464f24a6ff977951619877fce16a6ae7753851 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 24 Jun 2023 20:11:47 +0100 Subject: [PATCH 29/82] Ensure that WINDRES always has a value --- Makefile | 1 - configure.ac | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e3ab9ee35..4204c03d2 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,6 @@ export CONFIG_TARGET ifndef CONFIG_TARGET ifeq ($(shell uname -o),Msys) CONFIG_TARGET=mingw -WINDRES=windres else ifeq ($(shell uname -s),Darwin) CONFIG_TARGET=darwin else ifeq ($(shell uname), SunOS) diff --git a/configure.ac b/configure.ac index 4e5cd2349..95fb826c7 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ AC_CONFIG_AUX_DIR(scripts) AC_CANONICAL_HOST AC_PROG_CC AC_CHECK_TOOL([AR], [ar], [false]) -AC_CHECK_TOOL([WINDRES], [windres], [false]) +AC_CHECK_TOOL([WINDRES], [windres], [windres]) # TODO: ideally, should use AC_ARG_ENABLE AC_ARG_WITH([edgex], From afbc5344e0afa9e5cff321e8aca2a7c6fe012218 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 01:10:17 +0100 Subject: [PATCH 30/82] Move some generic appending out of the config.mak --- Makefile | 3 +++ config.mak.in | 4 ++-- scripts/hack_fakeautoconf.sh | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4204c03d2..8e4f86a34 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ ifndef CONFIG_HOST $(error Please run ./configure) endif +CFLAGS+=-I./include +LDFLAGS+=-L. + #Ultrasparc64 users experiencing SIGBUS should try the following gcc options #(thanks to Robert Gibbon) PLATOPTS_SPARC64=-mcpu=ultrasparc -pipe -fomit-frame-pointer -ffast-math -finline-functions -fweb -frename-registers -mapp-regs diff --git a/config.mak.in b/config.mak.in index 997e8e843..92b833c2e 100644 --- a/config.mak.in +++ b/config.mak.in @@ -6,7 +6,7 @@ PACKAGE_VERSION=@PACKAGE_VERSION@ CC=@CC@ AR=@AR@ WINDRES=@WINDRES@ -CFLAGS=@CFLAGS@ -I./include -LDFLAGS=@LDFLAGS@ -L. +CFLAGS=@CFLAGS@ +LDFLAGS=@LDFLAGS@ LDLIBS_EXTRA=@LIBS@ TOOLS_ADDITIONAL=@TOOLS_ADDITIONAL@ diff --git a/scripts/hack_fakeautoconf.sh b/scripts/hack_fakeautoconf.sh index 7cbd38554..3744a2288 100755 --- a/scripts/hack_fakeautoconf.sh +++ b/scripts/hack_fakeautoconf.sh @@ -21,8 +21,8 @@ CONFIG_HOST=x86_64-w64-mingw32 CC=gcc AR=ar WINDRES=windres -CFLAGS=$CFLAGS -g -O2 -I./include -LDFLAGS=$LDFLAGS -L. +CFLAGS=$CFLAGS -g -O2 +LDFLAGS=$LDFLAGS LDLIBS_EXTRA=$LDLIBS EOF From a0c2af5f783c02d7fd60187305ce896f0e7aacf2 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 08:55:19 +0100 Subject: [PATCH 31/82] Remove define that no longer does anything --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 625d73c3e..574f6ef4c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -63,7 +63,7 @@ jobs: --enable-cap \ --enable-pcap \ --with-zstd \ - CFLAGS="-O3 -DN2N_OPTION_USE_PORTMAPPING" + CFLAGS="-O3" make test lint: From 594272668566c8492dd863bbc49516d4159e7cc5 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 25 Jun 2023 15:56:53 +0100 Subject: [PATCH 32/82] Address some windows compile warnings --- win32/wintap.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/win32/wintap.c b/win32/wintap.c index 66fb08ddb..d1f77a208 100644 --- a/win32/wintap.c +++ b/win32/wintap.c @@ -50,8 +50,7 @@ static void iterate_win_network_adapters( void *userdata) { HKEY key, key2; char regpath[1024]; - long len, rc; - int found = 0; + int rc; int err, i; struct win_adapter_info adapter; @@ -66,7 +65,7 @@ static void iterate_win_network_adapters( } for (i = 0; ; i++) { - len = sizeof(adapter.adapterid); + long unsigned int len = sizeof(adapter.adapterid); if(RegEnumKeyEx(key, i, (LPTSTR)adapter.adapterid, &len, 0, 0, 0, NULL)) break; @@ -77,7 +76,7 @@ static void iterate_win_network_adapters( continue; len = sizeof(adapter.adaptername); - err = RegQueryValueEx(key2, "Name", 0, 0, adapter.adaptername, &len); + err = RegQueryValueEx(key2, "Name", 0, 0, (unsigned char *)adapter.adaptername, &len); RegCloseKey(key2); @@ -117,7 +116,7 @@ void win_print_available_adapters() { static int lookup_adapter_info_reg(const char *target_adapter, char *regpath, size_t regpath_size) { HKEY key, key2; - long len, rc; + int rc; char index[16]; int err, i; devstr_t adapter_name; @@ -129,7 +128,7 @@ static int lookup_adapter_info_reg(const char *target_adapter, char *regpath, si } for(i = 0; ; i++) { - len = sizeof(index); + long unsigned int len = sizeof(index); if(RegEnumKeyEx(key, i, (LPTSTR)index, &len, 0, 0, 0, NULL)) break; @@ -138,7 +137,7 @@ static int lookup_adapter_info_reg(const char *target_adapter, char *regpath, si continue; len = sizeof(adapter_name); - err = RegQueryValueEx(key2, "NetCfgInstanceId", 0, 0, adapter_name, &len); + err = RegQueryValueEx(key2, "NetCfgInstanceId", 0, 0, (unsigned char *)adapter_name, &len); RegCloseKey(key2); @@ -162,9 +161,6 @@ static void set_interface_mac(struct tuntap_dev *device, const char *mac_str) { char mac_buf[18]; char adapter_info_reg[1024]; - uint64_t mac = 0; - uint8_t *ptr = (uint8_t*)&mac; - if(strlen(mac_str) != 17) { printf("Invalid MAC: %s\n", mac_str); exit(EXIT_FAILURE); @@ -387,7 +383,8 @@ int open_wintap(struct tuntap_dev *device, int tuntap_read(struct tuntap_dev *tuntap, unsigned char *buf, int len) { - DWORD read_size, last_err; + DWORD read_size; + int last_err; ResetEvent(tuntap->overlap_read.hEvent); if (ReadFile(tuntap->device_handle, buf, len, &read_size, &tuntap->overlap_read)) { From 041233dc8b482863fb92b86d0e34a2a755d68c03 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 28 Jun 2023 22:39:27 +0100 Subject: [PATCH 33/82] Address more windows compile warnings --- src/edge_utils.c | 8 ++++---- src/n2n.c | 5 ++++- src/sn_utils.c | 2 +- tools/n2n-portfwd.c | 7 +++++++ tools/n2n-route.c | 8 +++++++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/edge_utils.c b/src/edge_utils.c index 85ef0db8a..f256272b6 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -1140,7 +1140,7 @@ static void sendto_sock (n2n_edge_t *eee, const void * buf, // if the connection is tcp, i.e. not the regular sock... if(eee->conf.connect_tcp) { - setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); + setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, (void *)&value, sizeof(value)); value = 1; #ifdef LINUX setsockopt(eee->sock, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); @@ -1159,7 +1159,7 @@ static void sendto_sock (n2n_edge_t *eee, const void * buf, // if the connection is tcp, i.e. not the regular sock... if(eee->conf.connect_tcp) { value = 1; /* value should still be set to 1 */ - setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); + setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, (void *)&value, sizeof(value)); #ifdef LINUX value = 0; setsockopt(eee->sock, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); @@ -2791,7 +2791,7 @@ int fetch_and_eventually_process_data (n2n_edge_t *eee, SOCKET sock, #endif ) { // udp - bread = recvfrom(sock, pktbuf, N2N_PKT_BUF_SIZE, 0 /*flags*/, + bread = recvfrom(sock, (void *)pktbuf, N2N_PKT_BUF_SIZE, 0 /*flags*/, sender_sock, &ss_size); if((bread < 0) @@ -2817,7 +2817,7 @@ int fetch_and_eventually_process_data (n2n_edge_t *eee, SOCKET sock, } else { // tcp bread = recvfrom(sock, - pktbuf + *position, *expected - *position, 0 /*flags*/, + (void *)(pktbuf + *position), *expected - *position, 0 /*flags*/, sender_sock, &ss_size); if((bread <= 0) && (errno)) { traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); diff --git a/src/n2n.c b/src/n2n.c index 9b8689f2e..026a12063 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -82,7 +82,10 @@ SOCKET open_socket (int local_port, in_addr_t address, int type /* 0 = UDP, TCP static int traceLevel = 2 /* NORMAL */; -static int useSyslog = 0, syslog_opened = 0; +static int useSyslog = 0; +#ifndef WIN32 +static int syslog_opened = 0; +#endif static FILE *traceFile = NULL; int getTraceLevel () { diff --git a/src/sn_utils.c b/src/sn_utils.c index 88686f7e7..7f8e806d1 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -566,7 +566,7 @@ static ssize_t sendto_sock(n2n_sn_t *sss, // if the connection is tcp, i.e. not the regular sock... if((socket_fd >= 0) && (socket_fd != sss->sock)) { value = 1; /* value should still be set to 1 */ - setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); + setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, (void *)&value, sizeof(value)); #ifdef LINUX value = 0; setsockopt(socket_fd, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); diff --git a/tools/n2n-portfwd.c b/tools/n2n-portfwd.c index 89dabcc43..1b6a7e908 100644 --- a/tools/n2n-portfwd.c +++ b/tools/n2n-portfwd.c @@ -50,8 +50,10 @@ // REVISIT: may become obsolete #ifdef WIN32 +#ifndef STDIN_FILENO #define STDIN_FILENO _fileno(stdin) #endif +#endif typedef struct n2n_portfwd_conf { @@ -197,6 +199,11 @@ int _kbhit () { return FD_ISSET(STDIN_FILENO, &fds); } +#else +// A dummy definition to avoid compile errors on windows +int _kbhit () { + return 0; +} #endif diff --git a/tools/n2n-route.c b/tools/n2n-route.c index a7d3cddcb..aeaa49dcb 100644 --- a/tools/n2n-route.c +++ b/tools/n2n-route.c @@ -75,8 +75,10 @@ // REVISIT: may become obsolete #ifdef WIN32 +#ifndef STDIN_FILENO #define STDIN_FILENO _fileno(stdin) #endif +#endif typedef struct n2n_route { @@ -496,7 +498,6 @@ void handle_route (n2n_route_t* in_route, int verb) { #elif defined(WIN32) // REVISIT: use 'CreateIpForwardEntry()' and 'DeleteIpForwardEntry()' [iphlpapi.h] - struct in_addr net_addr, gateway; char c_net_addr[32]; char c_gateway[32]; char c_interface[32]; @@ -657,6 +658,11 @@ int _kbhit () { return FD_ISSET(STDIN_FILENO, &fds); } +#else +// A dummy definition to avoid compile errors on windows +int _kbhit () { + return 0; +} #endif From 473b89c963c600ee7d1c446ee7e7648787f4c38c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 28 Jun 2023 23:24:49 +0100 Subject: [PATCH 34/82] Simplify build system by using standard macro Most environments have predefined macros that identify the environment to the source code. If we use these macros instead of defining our own then there is one less parameter difference to keep track of with different builds cf: http://web.archive.org/web/20191012035921/http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system https://sourceforge.net/p/predef/wiki/OperatingSystems/ --- Makefile | 2 +- include/n2n.h | 14 ++++----- include/n2n_define.h | 2 +- include/n2n_typedefs.h | 14 ++++----- include/n2n_wire.h | 6 ++-- include/random_numbers.h | 2 +- src/edge.c | 58 ++++++++++++++++++------------------ src/edge_management.c | 2 +- src/edge_utils.c | 32 ++++++++++---------- src/edge_utils_win32.c | 2 +- src/example_edge_embed.c | 2 +- src/example_sn_embed.c | 2 +- src/management.c | 2 +- src/management.h | 2 +- src/n2n.c | 14 ++++----- src/network_traffic_filter.c | 2 +- src/random_numbers.c | 2 +- src/sn_management.c | 2 +- src/sn_utils.c | 14 ++++----- src/supernode.c | 26 ++++++++-------- src/wire.c | 2 +- tools/n2n-decode.c | 6 ++-- tools/n2n-portfwd.c | 14 ++++----- tools/n2n-route.c | 28 ++++++++--------- win32/getopt.c | 6 ++-- 25 files changed, 129 insertions(+), 129 deletions(-) diff --git a/Makefile b/Makefile index 8e4f86a34..efa9fc40f 100644 --- a/Makefile +++ b/Makefile @@ -169,7 +169,7 @@ LDLIBS+=-lsocket -lnsl endif ifeq ($(CONFIG_TARGET),mingw) -CFLAGS+=-I. -I./win32 -DWIN32 +CFLAGS+=-I. -I./win32 LDLIBS+=$(abspath win32/n2n_win32.a) LDLIBS+=-lnetapi32 -lws2_32 -liphlpapi N2N_DEPS+=win32/n2n_win32.a diff --git a/include/n2n.h b/include/n2n.h index f41f2a4d4..f86805f37 100644 --- a/include/n2n.h +++ b/include/n2n.h @@ -42,12 +42,12 @@ #include "config.h" /* Visual C++ */ /* Moved here to define _CRT_SECURE_NO_WARNINGS before all the including takes place */ -#ifdef WIN32 +#ifdef _WIN32 #define N2N_CAN_NAME_IFACE 1 #undef N2N_HAVE_DAEMON #undef N2N_HAVE_TCP /* as explained on https://github.com/ntop/n2n/pull/627#issuecomment-782093706 */ #undef N2N_HAVE_SETUID -#endif /* WIN32 */ +#endif /* _WIN32 */ #include @@ -55,7 +55,7 @@ #include "n2n_define.h" #include "n2n_typedefs.h" -#ifdef WIN32 +#ifdef _WIN32 #include /* for tcp */ #include /* for privilege check in tools/n2n-route */ #include /* for privilege check in tools/n2n-route */ @@ -63,9 +63,9 @@ #include /* for privilege check in tools/n2n-route */ #include "wintap.h" #define SHUT_RDWR SD_BOTH /* for tcp */ -#endif /* #ifdef WIN32 */ +#endif /* #ifdef _WIN32 */ -#ifndef WIN32 +#ifndef _WIN32 #include // for in_addr (ptr only), in_addr_t #include #include // for uint8_t, uint64_t, uint32_t, uint16_t @@ -89,7 +89,7 @@ #include #include #endif -#endif /* #ifndef WIN32 */ +#endif /* #ifndef _WIN32 */ @@ -129,7 +129,7 @@ void _traceEvent (int eventTraceLevel, char* file, int line, char * format, ...) /* Tuntap API */ int tuntap_open (struct tuntap_dev *device, char *dev, const char *address_mode, char *device_ip, char *device_mask, const char * device_mac, int mtu -#ifdef WIN32 +#ifdef _WIN32 , int metric #endif ); diff --git a/include/n2n_define.h b/include/n2n_define.h index 27113b993..12c5dc965 100644 --- a/include/n2n_define.h +++ b/include/n2n_define.h @@ -190,7 +190,7 @@ enum skip_add {SN_ADD = 0, SN_ADD_SKIP = 1, SN_ADD_ADDED = 2}; #define N2N_MULTICAST_PORT 1968 #define N2N_MULTICAST_GROUP "224.0.0.68" -#ifdef WIN32 +#ifdef _WIN32 #define N2N_IFNAMSIZ 64 #else #define N2N_IFNAMSIZ 16 /* 15 chars * NULL */ diff --git a/include/n2n_typedefs.h b/include/n2n_typedefs.h index 4951aa47e..0b34f32e6 100644 --- a/include/n2n_typedefs.h +++ b/include/n2n_typedefs.h @@ -21,7 +21,7 @@ #include #include // for uint8_t and friends -#ifndef WIN32 +#ifndef _WIN32 #include // for in_addr_t #include // for sockaddr #endif @@ -84,7 +84,7 @@ typedef unsigned long in_addr_t; #endif #endif -#ifdef WIN32 +#ifdef _WIN32 #ifndef __LITTLE_ENDIAN__ #define __LITTLE_ENDIAN__ 1 #endif @@ -231,7 +231,7 @@ typedef char dec_ip_bit_str_t[N2N_NETMASK_STR_SIZE + 4]; typedef char devstr_t[N2N_IFNAMSIZ]; -#ifndef WIN32 +#ifndef _WIN32 typedef struct tuntap_dev { int fd; int if_idx; @@ -243,9 +243,9 @@ typedef struct tuntap_dev { } tuntap_dev; #define SOCKET int -#else /* #ifndef WIN32 */ +#else /* #ifndef _WIN32 */ typedef u_short sa_family_t; -#endif /* #ifndef WIN32 */ +#endif /* #ifndef _WIN32 */ typedef struct speck_context_t he_context_t; @@ -574,7 +574,7 @@ typedef struct n2n_tuntap_priv_config { int mtu; int metric; uint8_t daemon; -#ifndef WIN32 +#ifndef _WIN32 uid_t userid; gid_t groupid; #endif @@ -849,7 +849,7 @@ typedef struct n2n_sn { int mgmt_sock; /* management socket. */ n2n_ip_subnet_t min_auto_ip_net; /* Address range of auto_ip service. */ n2n_ip_subnet_t max_auto_ip_net; /* Address range of auto_ip service. */ -#ifndef WIN32 +#ifndef _WIN32 uid_t userid; gid_t groupid; #endif diff --git a/include/n2n_wire.h b/include/n2n_wire.h index 3e2313254..0151bc984 100644 --- a/include/n2n_wire.h +++ b/include/n2n_wire.h @@ -25,12 +25,12 @@ #include #endif -#if defined(WIN32) +#ifdef _WIN32 #include "n2n_win32.h" -#else /* #if defined(WIN32) */ +#else /* #ifdef _WIN32 */ #include #include /* AF_INET and AF_INET6 */ -#endif /* #if defined(WIN32) */ +#endif /* #ifdef _WIN32 */ #include "sn_selection.h" diff --git a/include/random_numbers.h b/include/random_numbers.h index 2c7eba49c..bd7c6ce79 100644 --- a/include/random_numbers.h +++ b/include/random_numbers.h @@ -38,7 +38,7 @@ #include /* _rdrand64_step, rdseed4_step */ #endif -#if defined (WIN32) +#ifdef _WIN32 #include // HCTYPTPROV, Crypt*-functions #endif diff --git a/src/edge.c b/src/edge.c index 5e76ab52a..ae9115b19 100644 --- a/src/edge.c +++ b/src/edge.c @@ -42,7 +42,7 @@ #include "speck.h" // for speck_init, speck_context_t #include "uthash.h" // for UT_hash_handle, HASH_ADD, HASH_C... -#ifdef WIN32 +#ifdef _WIN32 #include #include #else @@ -230,12 +230,12 @@ static void help (int level) { "[-J ] " "[-P ] " "[-R ] " -#ifdef WIN32 +#ifdef _WIN32 "\n " "[-x ] " #endif "\n\n local options " -#ifndef WIN32 +#ifndef _WIN32 "[-f] " #endif "[-t ] " @@ -243,7 +243,7 @@ static void help (int level) { "\n " "[-v] " "[-V] " -#ifndef WIN32 +#ifndef _WIN32 "\n " "[-u ] " "[-g ] " @@ -266,7 +266,7 @@ static void help (int level) { "\n [-E] accept multicast MAC addresses" "\n [--select-rtt] select supernode by round trip time" "\n [--select-mac] select supernode by MAC address" -#ifndef WIN32 +#ifndef _WIN32 "\n [-f] do not fork but run in foreground" #endif "\n [-v] make more verbose, repeat as required" @@ -351,14 +351,14 @@ static void help (int level) { printf(" | rule format: 'src_ip/n:[s_port,e_port],...\n" " | |on same| ...dst_ip/n:[s_port,e_port],...\n" " | | line | ...TCP+/-,UDP+/-,ICMP+/-'\n"); -#ifdef WIN32 +#ifdef _WIN32 printf(" -x | set TAP interface metric, defaults to 0 (auto),\n" " | e.g. set to 1 for better multiplayer game detection\n"); #endif printf ("\n"); printf (" LOCAL OPTIONS\n"); printf (" -------------\n\n"); -#ifndef WIN32 +#ifndef _WIN32 printf(" -f | do not fork and run as a daemon, rather run in foreground\n"); #endif printf(" -t | management UDP port, for multiple edges on a machine,\n" @@ -367,7 +367,7 @@ static void help (int level) { " ...password | \n", N2N_MGMT_PASSWORD); printf(" -v | make more verbose, repeat as required\n"); printf(" -V | make less verbose, repeat as required\n"); -#ifndef WIN32 +#ifndef _WIN32 printf(" -u | numeric user ID to use when privileges are dropped\n"); printf(" -g | numeric group ID to use when privileges are dropped\n"); #endif @@ -378,7 +378,7 @@ static void help (int level) { printf(" N2N_COMMUNITY | community name (ASCII), overwritten by '-c ...'\n"); printf(" N2N_PASSWORD | password (ASCII) for user-password authentication,\n" " | overwritten by '-J ...'\n"); -#ifdef WIN32 +#ifdef _WIN32 printf ("\n"); printf (" AVAILABLE TAP ADAPTERS\n"); printf (" ----------------------\n\n"); @@ -490,7 +490,7 @@ static int setOption (int optkey, char *optargument, n2n_tuntap_priv_config_t *e break; } -#ifndef WIN32 +#ifndef _WIN32 case 'u': /* unprivileged uid */ { ec->userid = atoi(optargument); break; @@ -502,12 +502,12 @@ static int setOption (int optkey, char *optargument, n2n_tuntap_priv_config_t *e } #endif -#ifndef WIN32 +#ifndef _WIN32 case 'f' : /* do not fork as daemon */ { ec->daemon = 0; break; } -#endif /* #ifndef WIN32 */ +#endif /* #ifndef _WIN32 */ case 'm' : /* TUNTAP MAC address */ { strncpy(ec->device_mac, optargument, N2N_MACNAMSIZ); @@ -785,7 +785,7 @@ static int setOption (int optkey, char *optargument, n2n_tuntap_priv_config_t *e } break; } -#ifdef WIN32 +#ifdef _WIN32 case 'x': { conf->metric = atoi(optargument); ec->metric = atoi(optargument); @@ -831,7 +831,7 @@ static int loadFromCLI (int argc, char *argv[], n2n_edge_conf_t *conf, n2n_tunta #ifdef __linux__ "T:" #endif -#ifdef WIN32 +#ifdef _WIN32 "x:" #endif , @@ -912,7 +912,7 @@ static int loadFromFile (const char *path, n2n_edge_conf_t *conf, n2n_tuntap_pri /* ************************************** */ -#ifndef WIN32 +#ifndef _WIN32 static void daemonize () { int childpid; @@ -961,8 +961,8 @@ static void daemonize () { static bool keep_on_running = true; -#if defined(__linux__) || defined(WIN32) -#ifdef WIN32 +#if defined(__linux__) || defined(_WIN32) +#ifdef _WIN32 BOOL WINAPI term_handler(DWORD sig) #else static void term_handler(int sig) @@ -979,7 +979,7 @@ BOOL WINAPI term_handler(DWORD sig) } keep_on_running = false; -#ifdef WIN32 +#ifdef _WIN32 switch (sig) { case CTRL_CLOSE_EVENT: case CTRL_LOGOFF_EVENT: @@ -990,7 +990,7 @@ BOOL WINAPI term_handler(DWORD sig) return(TRUE); #endif } -#endif /* defined(__linux__) || defined(WIN32) */ +#endif /* defined(__linux__) || defined(_WIN32) */ /* *************************************************** */ @@ -1015,13 +1015,13 @@ int main (int argc, char* argv[]) { uint8_t pktbuf[N2N_SN_PKTBUF_SIZE + sizeof(uint16_t)]; /* buffer + prepended buffer length in case of tcp */ -#ifndef WIN32 +#ifndef _WIN32 struct passwd *pw = NULL; #endif #ifdef HAVE_LIBCAP cap_t caps; #endif -#ifdef WIN32 +#ifdef _WIN32 initWin32(); #endif @@ -1031,7 +1031,7 @@ int main (int argc, char* argv[]) { ec.mtu = DEFAULT_MTU; ec.daemon = 1; /* By default run in daemon mode. */ -#ifndef WIN32 +#ifndef _WIN32 if(((pw = getpwnam("n2n")) != NULL) || ((pw = getpwnam("nobody")) != NULL)) { ec.userid = pw->pw_uid; @@ -1039,7 +1039,7 @@ int main (int argc, char* argv[]) { } #endif -#ifdef WIN32 +#ifdef _WIN32 ec.tuntap_dev_name[0] = '\0'; ec.metric = 0; #else @@ -1055,7 +1055,7 @@ int main (int argc, char* argv[]) { rc = loadFromCLI(argc, argv, &conf, &ec); else -#ifdef WIN32 +#ifdef _WIN32 // load from current directory rc = loadFromFile("edge.conf", &conf, &ec); #else @@ -1119,7 +1119,7 @@ int main (int argc, char* argv[]) { /* Random seed */ n2n_srand (n2n_seed()); -#ifndef WIN32 +#ifndef _WIN32 /* If running suid root then we need to setuid before using the force. */ if(setuid(0) != 0) traceEvent(TRACE_ERROR, "unable to become root [%u/%s]", errno, strerror(errno)); @@ -1247,7 +1247,7 @@ int main (int argc, char* argv[]) { if(tuntap_open(&tuntap, eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, eee->tuntap_priv_conf.ip_addr, eee->tuntap_priv_conf.netmask, eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu -#ifdef WIN32 +#ifdef _WIN32 , eee->tuntap_priv_conf.metric #endif ) < 0) @@ -1298,7 +1298,7 @@ int main (int argc, char* argv[]) { eee->sn_wait = 1; eee->last_register_req = 0; -#ifndef WIN32 +#ifndef _WIN32 if(eee->tuntap_priv_conf.daemon) { setUseSyslog(1); /* traceEvent output now goes to syslog. */ daemonize(); @@ -1340,7 +1340,7 @@ int main (int argc, char* argv[]) { signal(SIGTERM, term_handler); signal(SIGINT, term_handler); #endif -#ifdef WIN32 +#ifdef _WIN32 SetConsoleCtrlHandler(term_handler, TRUE); #endif @@ -1365,7 +1365,7 @@ int main (int argc, char* argv[]) { tuntap_close(&eee->device); edge_term(eee); -#ifdef WIN32 +#ifdef _WIN32 destroyWin32(); #endif diff --git a/src/edge_management.c b/src/edge_management.c index ebf2cfadf..4884525f7 100644 --- a/src/edge_management.c +++ b/src/edge_management.c @@ -35,7 +35,7 @@ #include "strbuf.h" // for strbuf_t, STRBUF_INIT #include "uthash.h" // for UT_hash_handle, HASH_ITER -#ifdef WIN32 +#ifdef _WIN32 #include #include #else diff --git a/src/edge_utils.c b/src/edge_utils.c index f256272b6..c10711e7f 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -40,7 +40,7 @@ #include "speck.h" // for speck_128_decrypt, speck_128_enc... #include "uthash.h" // for UT_hash_handle, HASH_COUNT, HASH... -#ifdef WIN32 +#ifdef _WIN32 #include #include #include "edge_utils_win32.h" @@ -307,7 +307,7 @@ int supernode_connect (n2n_edge_t *eee) { // set tcp socket to O_NONBLOCK so connect does not hang // requires checking the socket for readiness before sending and receving if(eee->conf.connect_tcp) { -#ifdef WIN32 +#ifdef _WIN32 u_long value = 1; ioctlsocket(eee->sock, FIONBIO, &value); #else @@ -705,7 +705,7 @@ static void register_with_new_peer (n2n_edge_t *eee, */ if(eee->conf.register_ttl == 1) { /* We are DMZ host or port is directly accessible. Just let peer to send back the ack */ -#ifndef WIN32 +#ifndef _WIN32 } else if(eee->conf.register_ttl > 1) { /* Setting register_ttl usually implies that the edge knows the internal net topology * clearly, we can apply aggressive port prediction to support incoming Symmetric NAT @@ -1086,7 +1086,7 @@ static ssize_t sendto_fd (n2n_edge_t *eee, const void *buf, traceEvent(level, "sendto(%s) failed (%d) %s", sock_to_cstr(sockbuf, n2ndest), errno, errstr); -#ifdef WIN32 +#ifdef _WIN32 traceEvent(level, "WSAGetLastError(): %u", WSAGetLastError()); #endif @@ -1182,7 +1182,7 @@ static void check_join_multicast_group (n2n_edge_t *eee) { if(!eee->multicast_joined) { struct ip_mreq mreq; mreq.imr_multiaddr.s_addr = inet_addr(N2N_MULTICAST_GROUP); -#ifdef WIN32 +#ifdef _WIN32 dec_ip_str_t ip_addr; get_best_interface_ip(eee, &ip_addr); mreq.imr_interface.s_addr = inet_addr(ip_addr); @@ -1194,7 +1194,7 @@ static void check_join_multicast_group (n2n_edge_t *eee) { traceEvent(TRACE_WARNING, "failed to bind to local multicast group %s:%u [errno %u]", N2N_MULTICAST_GROUP, N2N_MULTICAST_PORT, errno); -#ifdef WIN32 +#ifdef _WIN32 traceEvent(TRACE_WARNING, "WSAGetLastError(): %u", WSAGetLastError()); #endif } else { @@ -1851,7 +1851,7 @@ static int handle_PACKET (n2n_edge_t * eee, #if 0 -#ifndef WIN32 +#ifndef _WIN32 static char *get_ip_from_arp (dec_ip_str_t buf, const n2n_mac_t req_mac) { @@ -2183,7 +2183,7 @@ void edge_read_from_tap (n2n_edge_t * eee) { tuntap_close(&(eee->device)); tuntap_open(&(eee->device), eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, eee->tuntap_priv_conf.ip_addr, eee->tuntap_priv_conf.netmask, eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu -#ifdef WIN32 +#ifdef _WIN32 ,eee->tuntap_priv_conf.metric #endif ); @@ -2795,14 +2795,14 @@ int fetch_and_eventually_process_data (n2n_edge_t *eee, SOCKET sock, sender_sock, &ss_size); if((bread < 0) -#ifdef WIN32 +#ifdef _WIN32 && (WSAGetLastError() != WSAECONNRESET) #endif ) { /* For UDP bread of zero just means no data (unlike TCP). */ /* The fd is no good now. Maybe we lost our interface. */ traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 +#ifdef _WIN32 traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); #endif return -1; @@ -2821,7 +2821,7 @@ int fetch_and_eventually_process_data (n2n_edge_t *eee, SOCKET sock, sender_sock, &ss_size); if((bread <= 0) && (errno)) { traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 +#ifdef _WIN32 traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); #endif supernode_disconnect(eee); @@ -2889,7 +2889,7 @@ int run_edge_loop (n2n_edge_t *eee) { uint16_t position = 0; uint8_t pktbuf[N2N_PKT_BUF_SIZE + sizeof(uint16_t)]; /* buffer + prepended buffer length in case of tcp */ -#ifdef WIN32 +#ifdef _WIN32 struct tunread_arg arg; arg.eee = eee; HANDLE tun_read_thread = startTunReadThread(&arg); @@ -2929,7 +2929,7 @@ int run_edge_loop (n2n_edge_t *eee) { } #endif -#ifndef WIN32 +#ifndef _WIN32 FD_SET(eee->device.fd, &socket_mask); max_sock = max(max_sock, eee->device.fd); #endif @@ -2989,7 +2989,7 @@ int run_edge_loop (n2n_edge_t *eee) { break; } -#ifndef WIN32 +#ifndef _WIN32 if(FD_ISSET(eee->device.fd, &socket_mask)) { // read an ethernet frame from the TAP socket; write on the IP socket edge_read_from_tap(eee); @@ -3055,7 +3055,7 @@ int run_edge_loop (n2n_edge_t *eee) { send_unregister_super(eee); -#ifdef WIN32 +#ifdef _WIN32 WaitForSingleObject(tun_read_thread, INFINITE); #endif @@ -3296,7 +3296,7 @@ int quick_edge_init (char *device_name, char *community_name, if(tuntap_open(&tuntap, device_name, "static", local_ip_address, "255.255.255.0", device_mac, DEFAULT_MTU -#ifdef WIN32 +#ifdef _WIN32 , 0 #endif ) < 0) diff --git a/src/edge_utils_win32.c b/src/edge_utils_win32.c index b65c44cd8..5f5ea8245 100644 --- a/src/edge_utils_win32.c +++ b/src/edge_utils_win32.c @@ -16,7 +16,7 @@ * */ -#ifdef WIN32 +#ifdef _WIN32 #include diff --git a/src/example_edge_embed.c b/src/example_edge_embed.c index 2b3226943..c9d2919b9 100644 --- a/src/example_edge_embed.c +++ b/src/example_edge_embed.c @@ -59,7 +59,7 @@ int main() { "255.255.255.0", // Netmask to use "DE:AD:BE:EF:01:10", // Set mac address DEFAULT_MTU // MTU to use -#ifdef WIN32 +#ifdef _WIN32 , 0 #endif ) < 0) diff --git a/src/example_sn_embed.c b/src/example_sn_embed.c index cdd16ed2d..7050e40b5 100644 --- a/src/example_sn_embed.c +++ b/src/example_sn_embed.c @@ -21,7 +21,7 @@ #include // for exit #include "n2n.h" // for n2n_sn_t, open_socket, run_sn_loop, sn_init -#ifdef WIN32 +#ifdef _WIN32 #include #else #include // for INADDR_ANY, INADDR_LOOPBACK diff --git a/src/management.c b/src/management.c index 6f914b5db..0aa73b369 100644 --- a/src/management.c +++ b/src/management.c @@ -12,7 +12,7 @@ #include "management.h" #include "n2n.h" // for TRACE_DEBUG, traceEvent -#ifndef WIN32 +#ifndef _WIN32 #include // for getnameinfo, NI_NUMERICHOST, NI_NUMERICSERV #include // for sendto, sockaddr #endif diff --git a/src/management.h b/src/management.h index 53592bdbf..3377a983a 100644 --- a/src/management.h +++ b/src/management.h @@ -16,7 +16,7 @@ #include "n2n_define.h" // for n2n_event_topic #include "strbuf.h" -#ifdef WIN32 +#ifdef _WIN32 #include #else #include // for sockaddr, sockaddr_storage, socklen_t diff --git a/src/n2n.c b/src/n2n.c index 026a12063..bf9df3c8d 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -34,7 +34,7 @@ #include #endif -#ifdef WIN32 +#ifdef _WIN32 #include #include #include @@ -60,7 +60,7 @@ SOCKET open_socket (int local_port, in_addr_t address, int type /* 0 = UDP, TCP return(-1); } -#ifndef WIN32 +#ifndef _WIN32 /* fcntl(sock_fd, F_SETFL, O_NONBLOCK); */ #endif @@ -83,7 +83,7 @@ SOCKET open_socket (int local_port, in_addr_t address, int type /* 0 = UDP, TCP static int traceLevel = 2 /* NORMAL */; static int useSyslog = 0; -#ifndef WIN32 +#ifndef _WIN32 static int syslog_opened = 0; #endif static FILE *traceFile = NULL; @@ -113,7 +113,7 @@ void closeTraceFile () { if((traceFile != NULL) && (traceFile != stdout)) { fclose(traceFile); } -#ifndef WIN32 +#ifndef _WIN32 if(useSyslog && syslog_opened) { closelog(); syslog_opened = 0; @@ -161,7 +161,7 @@ void _traceEvent (int eventTraceLevel, char* file, int line, char * format, ...) buf[strlen(buf) - 1] = '\0'; } -#ifndef WIN32 +#ifndef _WIN32 if(useSyslog) { if(!syslog_opened) { openlog("n2n", LOG_PID, LOG_DAEMON); @@ -181,7 +181,7 @@ void _traceEvent (int eventTraceLevel, char* file, int line, char * format, ...) snprintf(out_buf, sizeof(out_buf), "%s [%s:%d] %s%s", theDate, &file[i], line, extra_msg, buf); fprintf(traceFile, "%s\n", out_buf); fflush(traceFile); -#ifndef WIN32 +#ifndef _WIN32 } #endif } @@ -844,7 +844,7 @@ int memxor (uint8_t *destination, const uint8_t *source, size_t len) { /* *********************************************** */ -#if defined(WIN32) +#ifdef _WIN32 int gettimeofday (struct timeval *tp, void *tzp) { time_t clock; diff --git a/src/network_traffic_filter.c b/src/network_traffic_filter.c index 4ba0d0bdc..ec840a011 100644 --- a/src/network_traffic_filter.c +++ b/src/network_traffic_filter.c @@ -25,7 +25,7 @@ #include "network_traffic_filter.h" // for create_network_traffic_filter #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_DEL -#ifdef WIN32 +#ifdef _WIN32 #include #include #else diff --git a/src/random_numbers.c b/src/random_numbers.c index ed6ca8c24..67a1b9848 100644 --- a/src/random_numbers.c +++ b/src/random_numbers.c @@ -178,7 +178,7 @@ uint64_t n2n_seed (void) { #endif #endif -#ifdef WIN32 +#ifdef _WIN32 HCRYPTPROV crypto_provider; CryptAcquireContext (&crypto_provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); diff --git a/src/sn_management.c b/src/sn_management.c index 2ef8f4151..7b3abe4e4 100644 --- a/src/sn_management.c +++ b/src/sn_management.c @@ -35,7 +35,7 @@ #include "strbuf.h" // for strbuf_t, STRBUF_INIT #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_COUNT -#ifdef WIN32 +#ifdef _WIN32 #include #else #include // for sendto, socklen_t diff --git a/src/sn_utils.c b/src/sn_utils.c index 7f8e806d1..f6092fe4f 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -40,7 +40,7 @@ #include "speck.h" // for speck_128_encrypt, speck_context_t #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_DEL -#ifdef WIN32 +#ifdef _WIN32 #include #include #else @@ -512,7 +512,7 @@ static ssize_t sendto_fd (n2n_sn_t *sss, if((sent <= 0) && (errno)) { char * c = strerror(errno); traceEvent(TRACE_ERROR, "sendto failed (%d) %s", errno, c); -#ifdef WIN32 +#ifdef _WIN32 traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); #endif // if the erroneous connection is tcp, i.e. not the regular sock... @@ -768,7 +768,7 @@ int sn_init_defaults (n2n_sn_t *sss) { char *tmp_string; -#ifdef WIN32 +#ifdef _WIN32 initWin32(); #endif @@ -904,7 +904,7 @@ void sn_term (n2n_sn_t *sss) { if(sss->community_file) free(sss->community_file); -#ifdef WIN32 +#ifdef _WIN32 destroyWin32(); #endif } @@ -2642,14 +2642,14 @@ int run_sn_loop (n2n_sn_t *sss) { sender_sock, &ss_size); if((bread < 0) -#ifdef WIN32 +#ifdef _WIN32 && (WSAGetLastError() != WSAECONNRESET) #endif ) { /* For UDP bread of zero just means no data (unlike TCP). */ /* The fd is no good now. Maybe we lost our interface. */ traceEvent(TRACE_ERROR, "recvfrom() failed %d errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 +#ifdef _WIN32 traceEvent(TRACE_ERROR, "WSAGetLastError(): %u", WSAGetLastError()); #endif *sss->keep_running = false; @@ -2688,7 +2688,7 @@ int run_sn_loop (n2n_sn_t *sss) { if(bread <= 0) { traceEvent(TRACE_INFO, "closing tcp connection to [%s]", sock_to_cstr(sockbuf, (n2n_sock_t*)sender_sock)); traceEvent(TRACE_DEBUG, "recvfrom() returns %d and sees errno %d (%s)", bread, errno, strerror(errno)); -#ifdef WIN32 +#ifdef _WIN32 traceEvent(TRACE_DEBUG, "WSAGetLastError(): %u", WSAGetLastError()); #endif close_tcp_connection(sss, conn); diff --git a/src/supernode.c b/src/supernode.c index 2f604162a..8d39a4c06 100644 --- a/src/supernode.c +++ b/src/supernode.c @@ -35,7 +35,7 @@ #include "pearson.h" // for pearson_hash_64 #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_ADD_STR -#ifdef WIN32 +#ifdef _WIN32 #include #include #else @@ -107,7 +107,7 @@ static void help (int level) { "\n " "[--management-password ] " "[-v] " -#ifndef WIN32 +#ifndef _WIN32 "\n " "[-u ]" "[-g ]" @@ -168,7 +168,7 @@ static void help (int level) { printf(" --management_... | management port password, defaults to '%s'\n" " ...password | \n", N2N_MGMT_PASSWORD); printf(" -v | make more verbose, repeat as required\n"); -#ifndef WIN32 +#ifndef _WIN32 printf(" -u | numeric user ID to use when privileges are dropped\n"); printf(" -g | numeric group ID to use when privileges are dropped\n"); #endif @@ -324,7 +324,7 @@ static int setOption (int optkey, char *_optarg, n2n_sn_t *sss) { break; } -#ifndef WIN32 +#ifndef _WIN32 case 'u': /* unprivileged uid */ sss->userid = atoi(_optarg); break; @@ -425,7 +425,7 @@ static int loadFromCLI (int argc, char * const argv[], n2n_sn_t *sss) { #if defined(N2N_HAVE_DAEMON) "f" #endif -#ifndef WIN32 +#ifndef _WIN32 "u:g:" #endif , @@ -567,8 +567,8 @@ static void dump_registrations (int signo) { static bool keep_running = true; -#if defined(__linux__) || defined(WIN32) -#ifdef WIN32 +#if defined(__linux__) || defined(_WIN32) +#ifdef _WIN32 BOOL WINAPI term_handler (DWORD sig) #else static void term_handler(int sig) @@ -585,11 +585,11 @@ BOOL WINAPI term_handler (DWORD sig) } keep_running = false; -#ifdef WIN32 +#ifdef _WIN32 return(TRUE); #endif } -#endif /* defined(__linux__) || defined(WIN32) */ +#endif /* defined(__linux__) || defined(_WIN32) */ /* *************************************************** */ @@ -597,7 +597,7 @@ BOOL WINAPI term_handler (DWORD sig) int main (int argc, char * const argv[]) { int rc; -#ifndef WIN32 +#ifndef _WIN32 struct passwd *pw = NULL; #endif struct peer_info *scan, *tmp; @@ -615,7 +615,7 @@ int main (int argc, char * const argv[]) { rc = loadFromCLI(argc, argv, &sss_node); } else -#ifdef WIN32 +#ifdef _WIN32 // load from current directory rc = loadFromFile("supernode.conf", &sss_node); #else @@ -689,7 +689,7 @@ int main (int argc, char * const argv[]) { HASH_ITER(hh, sss_node.federation->edges, scan, tmp) scan->socket_fd = sss_node.sock; -#ifndef WIN32 +#ifndef _WIN32 /* * If no uid/gid is specified on the commandline, use the uid/gid of the * first found out of user "n2n" or "nobody" @@ -734,7 +734,7 @@ int main (int argc, char * const argv[]) { signal(SIGINT, term_handler); signal(SIGHUP, dump_registrations); #endif -#ifdef WIN32 +#ifdef _WIN32 SetConsoleCtrlHandler(term_handler, TRUE); #endif diff --git a/src/wire.c b/src/wire.c index 485020f8d..995efe841 100644 --- a/src/wire.c +++ b/src/wire.c @@ -33,7 +33,7 @@ #include "n2n.h" // for n2n_sock_t, n2n_common_t, n2n_auth_t, n2n_RE... #include "n2n_wire.h" // for decode_PACKET, decode_PEER_INFO, decode_QUER... -#ifdef WIN32 +#ifdef _WIN32 #include #include #else diff --git a/tools/n2n-decode.c b/tools/n2n-decode.c index cf5844b25..c11211ca1 100644 --- a/tools/n2n-decode.c +++ b/tools/n2n-decode.c @@ -58,7 +58,7 @@ static void help() { /* *************************************************** */ -#ifdef WIN32 +#ifdef _WIN32 BOOL WINAPI term_handler(DWORD sig) #else static void term_handler(int sig) @@ -75,7 +75,7 @@ static void term_handler(int sig) } running = 0; -#ifdef WIN32 +#ifdef _WIN32 return(TRUE); #endif } @@ -349,7 +349,7 @@ int main(int argc, char* argv[]) { return(5); } -#ifdef WIN32 +#ifdef _WIN32 SetConsoleCtrlHandler(term_handler, TRUE); #else signal(SIGTERM, term_handler); diff --git a/tools/n2n-portfwd.c b/tools/n2n-portfwd.c index 1b6a7e908..dce283a16 100644 --- a/tools/n2n-portfwd.c +++ b/tools/n2n-portfwd.c @@ -33,7 +33,7 @@ #include "n2n_port_mapping.h" // for n2n_del_port_mapping, n2n_set_port_map... #include "random_numbers.h" // for n2n_rand, n2n_seed, n2n_srand -#ifdef WIN32 +#ifdef _WIN32 #include #include #else @@ -49,7 +49,7 @@ #define INFO_INTERVAL 5 // REVISIT: may become obsolete -#ifdef WIN32 +#ifdef _WIN32 #ifndef STDIN_FILENO #define STDIN_FILENO _fileno(stdin) #endif @@ -75,13 +75,13 @@ void set_term_handler(const void *handler) { signal(SIGTERM, handler); signal(SIGINT, handler); #endif -#ifdef WIN32 +#ifdef _WIN32 SetConsoleCtrlHandler(handler, TRUE); #endif } -#ifdef WIN32 +#ifdef _WIN32 BOOL WINAPI term_handler (DWORD sig) { #else static void term_handler (int sig) { @@ -98,7 +98,7 @@ static void term_handler (int sig) { } keep_running = false; -#ifdef WIN32 +#ifdef _WIN32 return TRUE; #endif } @@ -113,7 +113,7 @@ SOCKET connect_to_management_port (n2n_portfwd_conf_t *ppp) { SOCKET ret; struct sockaddr_in sock_addr; -#if defined(WIN32) +#ifdef _WIN32 // Windows requires a call to WSAStartup() before it can work with sockets WORD wVersionRequested; WSADATA wsaData; @@ -184,7 +184,7 @@ int get_port_from_json (uint16_t *port, json_object_t *json, char *key, int tag, // PLATFORM-DEPENDANT CODE -#if !defined(WIN32) +#ifndef _WIN32 // taken from https://web.archive.org/web/20170407122137/http://cc.byexamples.com/2007/04/08/non-blocking-user-input-in-loop-without-ncurses/ int _kbhit () { diff --git a/tools/n2n-route.c b/tools/n2n-route.c index aeaa49dcb..fa63fa23d 100644 --- a/tools/n2n-route.c +++ b/tools/n2n-route.c @@ -38,7 +38,7 @@ #include // for RTA_DATA, rtmsg, RTA_GATEWAY, RTA_NEXT #endif -#ifdef WIN32 +#ifdef _WIN32 #include #include #else @@ -51,7 +51,7 @@ #include // for send, socket, AF_INET, recv, connect #endif -#if defined (__linux__) || defined(WIN32) /* currently, Linux and Windows only */ +#if defined (__linux__) || defined(_WIN32) /* currently, Linux and Windows only */ #define WITH_ADDRESS 1 @@ -74,7 +74,7 @@ #define AUTO_DETECT 1 // REVISIT: may become obsolete -#ifdef WIN32 +#ifdef _WIN32 #ifndef STDIN_FILENO #define STDIN_FILENO _fileno(stdin) #endif @@ -117,7 +117,7 @@ int is_privileged (void) { return euid == 0; -#elif defined(WIN32) +#elif defined(_WIN32) // taken from https://stackoverflow.com/a/10553065 int result; DWORD rc; @@ -148,13 +148,13 @@ void set_term_handler(const void *handler) { signal(SIGPIPE, SIG_IGN); signal(SIGTERM, handler); signal(SIGINT, handler); -#elif defined(WIN32) +#elif defined(_WIN32) SetConsoleCtrlHandler(handler, TRUE); #endif } -#if !defined(WIN32) +#ifndef _WIN32 static void term_handler (int sig) { #else BOOL WINAPI term_handler (DWORD sig) { @@ -171,7 +171,7 @@ BOOL WINAPI term_handler (DWORD sig) { } keep_running = false; -#if defined(WIN32) +#ifdef _WIN32 return TRUE; #endif } @@ -317,7 +317,7 @@ int find_default_gateway (struct in_addr *gateway_addr, struct in_addr *exclude) closesocket(sock); return ret; -#elif defined(WIN32) +#elif defined(_WIN32) // taken from (and modified) // https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-createipforwardentry @@ -376,7 +376,7 @@ int find_default_gateway (struct in_addr *gateway_addr, struct in_addr *exclude) // PLATFORM-DEPENDANT CODE -#if defined(WIN32) +#ifdef _WIN32 DWORD get_interface_index (struct in_addr addr) { // taken from (and modified) // https://docs.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-createipforwardentry @@ -496,7 +496,7 @@ void handle_route (n2n_route_t* in_route, int verb) { closesocket(sock); -#elif defined(WIN32) +#elif defined(_WIN32) // REVISIT: use 'CreateIpForwardEntry()' and 'DeleteIpForwardEntry()' [iphlpapi.h] char c_net_addr[32]; char c_gateway[32]; @@ -573,7 +573,7 @@ SOCKET connect_to_management_port (n2n_route_conf_t *rrr) { SOCKET ret; struct sockaddr_in sock_addr; -#if defined(WIN32) +#ifdef _WIN32 // Windows requires a call to WSAStartup() before it can work with sockets WORD wVersionRequested; WSADATA wsaData; @@ -643,7 +643,7 @@ int get_addr_from_json (struct in_addr *addr, json_object_t *json, char *key, in // PLATFORM-DEPENDANT CODE -#if !defined(WIN32) +#ifndef _WIN32 // taken from https://web.archive.org/web/20170407122137/http://cc.byexamples.com/2007/04/08/non-blocking-user-input-in-loop-without-ncurses/ int _kbhit () { @@ -1088,7 +1088,7 @@ int main (int argc, char* argv[]) { } -#else /* if defined(__linux__) || defined(WIN32) -- currently, Linux and Windows only */ +#else /* if defined(__linux__) || defined(_WIN32) -- currently, Linux and Windows only */ int main (int argc, char* argv[]) { @@ -1100,4 +1100,4 @@ int main (int argc, char* argv[]) { } -#endif /* if defined (__linux__) || defined(WIN32) -- currently, Linux and Windows only */ +#endif /* if defined (__linux__) || defined(_WIN32) -- currently, Linux and Windows only */ diff --git a/win32/getopt.c b/win32/getopt.c index f34b53a93..3e5154582 100644 --- a/win32/getopt.c +++ b/win32/getopt.c @@ -58,7 +58,7 @@ #endif #include -#ifdef WIN32 +#ifdef _WIN32 #include #endif @@ -171,7 +171,7 @@ static char *nextchar; for unrecognized options. */ #ifndef DARWIN -#ifdef WIN32 +#ifdef _WIN32 int opterr = 0; #else int opterr = 1; @@ -231,7 +231,7 @@ static char *posixly_correct; # define my_index strchr #else -#ifndef WIN32 +#ifndef _WIN32 # if HAVE_STRING_H # include # else From f05c24b259a964e637173bbda061e02568b6c273 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 28 Jun 2023 23:55:43 +0100 Subject: [PATCH 35/82] Fix openssl support and add it to tests --- .github/workflows/tests.yml | 1 + src/aes.c | 3 +++ src/cc20.c | 1 + 3 files changed, 5 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 574f6ef4c..d81713cbb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -62,6 +62,7 @@ jobs: --enable-natpmp \ --enable-cap \ --enable-pcap \ + --with-openssl \ --with-zstd \ CFLAGS="-O3" make test diff --git a/src/aes.c b/src/aes.c index 2d4ec03d7..8469f4f9d 100644 --- a/src/aes.c +++ b/src/aes.c @@ -16,6 +16,7 @@ * */ +#include "config.h" #include // for uint32_t, uint8_t #include // for calloc, free @@ -27,6 +28,8 @@ #if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 --------------------------------------------------------------------- +#include // for ERR_print_errors +#include // for EVP_EncryptInit_ex, EVP_CIPHER_CTX_set_p... // get any erorr message out of openssl // taken from https://en.wikibooks.org/wiki/OpenSSL/Error_handling diff --git a/src/cc20.c b/src/cc20.c index 6a4ae1f5b..09c484494 100644 --- a/src/cc20.c +++ b/src/cc20.c @@ -21,6 +21,7 @@ #include // for memcpy #include "cc20.h" #include "config.h" // HAVE_OPENSSL_1_1 +#include "n2n.h" // for TRACE_ERROR, traceEvent #include "portable_endian.h" // for htole32 From 433b14c52fdec59672f5963249526b646d991b62 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 1 Jul 2023 13:15:16 +0100 Subject: [PATCH 36/82] Simplify openssl library detection and macros --- configure.ac | 6 +----- include/aes.h | 2 +- include/cc20.h | 4 ++-- include/n2n.h | 2 +- src/aes.c | 2 +- src/cc20.c | 8 ++++---- src/edge.c | 2 +- 7 files changed, 11 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 95fb826c7..8b1bae88b 100644 --- a/configure.ac +++ b/configure.ac @@ -39,11 +39,7 @@ AC_ARG_WITH([openssl], [AS_HELP_STRING([--with-openssl], [enable support for OpenSSL])], [], [with_openssl=no]) AS_IF([test "x$with_openssl" != xno], - [AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset], - [ - AC_DEFINE([HAVE_OPENSSL_1_1], [1], [OpenSSL 1.1 is present]) - LIBS="-lcrypto ${LIBS}" - ], + [AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_reset],, [AC_MSG_ERROR([openssl library not found])] )], ) diff --git a/include/aes.h b/include/aes.h index 4604a165d..9c804ec5a 100644 --- a/include/aes.h +++ b/include/aes.h @@ -34,7 +34,7 @@ #define AES128_KEY_BYTES (128/8) -#if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 --------------------------------------------------------------------- +#ifdef HAVE_LIBCRYPTO // openSSL 1.1 --------------------------------------------------------------------- #include #include diff --git a/include/cc20.h b/include/cc20.h index 51f44258d..b59ee0637 100644 --- a/include/cc20.h +++ b/include/cc20.h @@ -23,14 +23,14 @@ #include // for size_t #include // for uint32_t, uint8_t -#include "config.h" // HAVE_OPENSSL_1_1 +#include "config.h" // HAVE_LIBCRYPTO #define CC20_IV_SIZE 16 #define CC20_KEY_BYTES (256/8) -#ifdef HAVE_OPENSSL_1_1 // openSSL 1.1 ---------------------------------------------------------------------------- +#ifdef HAVE_LIBCRYPTO // openSSL 1.1 ---------------------------------------------------------------------------- #include diff --git a/include/n2n.h b/include/n2n.h index f86805f37..d8b9b3a67 100644 --- a/include/n2n.h +++ b/include/n2n.h @@ -85,7 +85,7 @@ #include #endif -#if defined (HAVE_OPENSSL_1_1) +#ifdef HAVE_LIBCRYPTO #include #include #endif diff --git a/src/aes.c b/src/aes.c index 8469f4f9d..de702c6d0 100644 --- a/src/aes.c +++ b/src/aes.c @@ -26,7 +26,7 @@ #include "portable_endian.h" // for be32toh, htobe32 -#if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 --------------------------------------------------------------------- +#ifdef HAVE_LIBCRYPTO // openSSL 1.1 --------------------------------------------------------------------- #include // for ERR_print_errors #include // for EVP_EncryptInit_ex, EVP_CIPHER_CTX_set_p... diff --git a/src/cc20.c b/src/cc20.c index 09c484494..d0e277432 100644 --- a/src/cc20.c +++ b/src/cc20.c @@ -20,12 +20,12 @@ #include // for calloc, free, size_t #include // for memcpy #include "cc20.h" -#include "config.h" // HAVE_OPENSSL_1_1 +#include "config.h" // HAVE_LIBCRYPTO #include "n2n.h" // for TRACE_ERROR, traceEvent #include "portable_endian.h" // for htole32 -#if defined (HAVE_OPENSSL_1_1) // openSSL 1.1 --------------------------------------------------------------------- +#ifdef HAVE_LIBCRYPTO // openSSL 1.1 --------------------------------------------------------------------- // get any erorr message out of openssl @@ -406,7 +406,7 @@ int cc20_init (const unsigned char *key, cc20_context_t **ctx) { *ctx = (cc20_context_t*)calloc(1, sizeof(cc20_context_t)); if(!(*ctx)) return -1; -#if defined (HAVE_OPENSSL_1_1) +#ifdef HAVE_LIBCRYPTO if(!((*ctx)->ctx = EVP_CIPHER_CTX_new())) { traceEvent(TRACE_ERROR, "cc20_init openssl's evp_* encryption context creation failed: %s", openssl_err_as_string()); @@ -423,7 +423,7 @@ int cc20_init (const unsigned char *key, cc20_context_t **ctx) { int cc20_deinit (cc20_context_t *ctx) { -#if defined (HAVE_OPENSSL_1_1) +#ifdef HAVE_LIBCRYPTO if(ctx->ctx) EVP_CIPHER_CTX_free(ctx->ctx); #endif free(ctx); diff --git a/src/edge.c b/src/edge.c index ae9115b19..3a18d5b20 100644 --- a/src/edge.c +++ b/src/edge.c @@ -1109,7 +1109,7 @@ int main (int argc, char* argv[]) { traceEvent(TRACE_NORMAL, "starting n2n edge %s %s", PACKAGE_VERSION, PACKAGE_BUILDDATE); -#if defined(HAVE_OPENSSL_1_1) +#ifdef HAVE_LIBCRYPTO traceEvent(TRACE_NORMAL, "using %s", OpenSSL_version(0)); #endif From 8dcc879ca0cb590e6840daf87231428ba36687b9 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 1 Jul 2023 13:39:02 +0100 Subject: [PATCH 37/82] Simplify config and build process for libpcap tool --- Makefile | 1 - config.mak.in | 1 - configure.ac | 15 +-------------- scripts/hack_fakeautoconf.sh | 4 ---- tools/Makefile | 7 ++----- tools/n2n-decode.c | 15 +++++++++++++++ 6 files changed, 18 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index efa9fc40f..fb64d4d49 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,6 @@ export AR export CFLAGS export LDFLAGS export LDLIBS -export TOOLS_ADDITIONAL -include config.mak diff --git a/config.mak.in b/config.mak.in index 92b833c2e..7db29d236 100644 --- a/config.mak.in +++ b/config.mak.in @@ -9,4 +9,3 @@ WINDRES=@WINDRES@ CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ LDLIBS_EXTRA=@LIBS@ -TOOLS_ADDITIONAL=@TOOLS_ADDITIONAL@ diff --git a/configure.ac b/configure.ac index 8b1bae88b..354eebe7e 100644 --- a/configure.ac +++ b/configure.ac @@ -66,19 +66,7 @@ AC_ARG_ENABLE([pcap], [AS_HELP_STRING([--enable-pcap], [support for pcap])], [], [enable_pcap=no]) AS_IF([test "x$enable_pcap" != xno], - [AC_CHECK_LIB([pcap], [pcap_open_live], - [ - AC_DEFINE([N2N_HAVE_PCAP], [1], [Have PCAP library]) - LIBS="-lpcap ${LIBS}" - TOOLS_ADDITIONAL="$TOOLS_ADDITIONAL n2n-decode" - - # TODO - # - pcap_set_immediate_mode has been available since libpcap 1.5 - # in 2013 - probably should remove this check - AC_CHECK_LIB([pcap], [pcap_set_immediate_mode], - AC_DEFINE([HAVE_PCAP_IMMEDIATE_MODE], [1], [Have pcap_immediate_mode]) - ) - ], + [AC_CHECK_LIB([pcap], [pcap_set_immediate_mode],, [AC_MSG_ERROR([pcap library not found])] )], ) @@ -104,7 +92,6 @@ AS_IF([test "x$enable_pthread" != xno], AC_SUBST(host) AC_SUBST(WINDRES) -AC_SUBST(TOOLS_ADDITIONAL) AC_CONFIG_HEADERS(include/config.h) AC_CONFIG_FILES(config.mak) diff --git a/scripts/hack_fakeautoconf.sh b/scripts/hack_fakeautoconf.sh index 3744a2288..414c0c9e7 100755 --- a/scripts/hack_fakeautoconf.sh +++ b/scripts/hack_fakeautoconf.sh @@ -26,10 +26,6 @@ LDFLAGS=$LDFLAGS LDLIBS_EXTRA=$LDLIBS EOF -cat >tools/config.mak <include/config.h #define PACKAGE_VERSION "FIXME" #define PACKAGE_BUILDDATE "$(date)" diff --git a/tools/Makefile b/tools/Makefile index 8a49cdd16..1de221c93 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -15,8 +15,7 @@ LDFLAGS+=-L.. N2N_LIB=../libn2n.a -TOOLS=n2n-benchmark n2n-keygen n2n-route n2n-portfwd -TOOLS+=$(TOOLS_ADDITIONAL) +TOOLS=n2n-benchmark n2n-keygen n2n-route n2n-portfwd n2n-decode TESTS=tests-compress tests-elliptic tests-hashing tests-transform TESTS+=tests-wire @@ -29,9 +28,7 @@ n2n-benchmark.o: $(N2N_LIB) $(HEADERS) ../config.mak n2n-keygen.o: $(N2N_LIB) $(HEADERS) ../config.mak n2n-route.o: $(N2N_LIB) $(HEADERS) ../config.mak n2n-portfwd.o: $(N2N_LIB) $(HEADERS) ../config.mak - -n2n-decode: n2n-decode.c $(N2N_LIB) $(HEADERS) ../config.mak - $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDLIBS) -lpcap -o $@ +n2n-decode.o: $(N2N_LIB) $(HEADERS) ../config.mak # See comments in the topdir Makefile about how to generate coverage # data. diff --git a/tools/n2n-decode.c b/tools/n2n-decode.c index c11211ca1..a8c17dc41 100644 --- a/tools/n2n-decode.c +++ b/tools/n2n-decode.c @@ -16,6 +16,10 @@ * */ +#include "config.h" + +#ifdef HAVE_LIBPCAP + #include // for errno #include #include // for signal, SIGINT, SIGTERM @@ -372,3 +376,14 @@ int main(int argc, char* argv[]) { return(rv); } + +#else + +#include + +int main() { + printf("n2n was compiled without libpcap support"); + return -1; +} + +#endif /* HAVE_LIBPCAP */ From 15fe4f786fa5d8eb5e719a497cd68dc770e4e274 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 15:31:44 +0100 Subject: [PATCH 38/82] Move OpenSolaris special config to the configure script --- Makefile | 7 ------- configure.ac | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index fb64d4d49..6683fb1f1 100644 --- a/Makefile +++ b/Makefile @@ -49,8 +49,6 @@ ifeq ($(shell uname -o),Msys) CONFIG_TARGET=mingw else ifeq ($(shell uname -s),Darwin) CONFIG_TARGET=darwin -else ifeq ($(shell uname), SunOS) -CONFIG_TARGET=sunos else CONFIG_TARGET=generic endif @@ -162,11 +160,6 @@ LINT_CCODE=\ LDLIBS+=-ln2n LDLIBS+=$(LDLIBS_EXTRA) -#For OpenSolaris (Solaris too?) -ifeq ($(CONFIG_TARGET), sunos) -LDLIBS+=-lsocket -lnsl -endif - ifeq ($(CONFIG_TARGET),mingw) CFLAGS+=-I. -I./win32 LDLIBS+=$(abspath win32/n2n_win32.a) diff --git a/configure.ac b/configure.ac index 354eebe7e..b4c560463 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,14 @@ AC_PROG_CC AC_CHECK_TOOL([AR], [ar], [false]) AC_CHECK_TOOL([WINDRES], [windres], [windres]) +case "$host_os" in + *-solaris*) + # Was in Makefile with the test `uname` -eq "SunOS" + # and comment "For OpenSolaris (Solaris too?)" + LIBS="-lsocket -lnsl $LIBS" + ;; +esac + # TODO: ideally, should use AC_ARG_ENABLE AC_ARG_WITH([edgex], AS_HELP_STRING([--with-edgex], [Build for Ubiquity-X]), From 4b4311e2fa6c1f6da9b39916fb4c2bbde1bdc724 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 15:49:51 +0100 Subject: [PATCH 39/82] Move the macos default install path config. There is a minor change - after this, the macos man pages are also installed into the /usr/local PREFIX. This seems like the correct location to me. Longer term, the usual autotools process of installing everything into /usr/local should be used. Files installed in /usr should be done by a package management tool, so this default makes sense to use. --- Makefile | 8 ++------ config.mak.in | 2 ++ configure.ac | 13 ++++++++++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 6683fb1f1..cf890c7fc 100644 --- a/Makefile +++ b/Makefile @@ -66,13 +66,9 @@ INSTALL_PROG=$(INSTALL) -m755 INSTALL_DOC=$(INSTALL) -m644 # DESTDIR set in debian make system -PREFIX?=$(DESTDIR)/usr -ifeq ($(CONFIG_TARGET),darwin) -SBINDIR=$(PREFIX)/local/sbin -else -SBINDIR=$(PREFIX)/sbin -endif +PREFIX?=$(DESTDIR)/$(CONFIG_PREFIX) +SBINDIR=$(PREFIX)/sbin MANDIR?=$(PREFIX)/share/man MAN1DIR=$(MANDIR)/man1 MAN7DIR=$(MANDIR)/man7 diff --git a/config.mak.in b/config.mak.in index 7db29d236..8e4f24314 100644 --- a/config.mak.in +++ b/config.mak.in @@ -2,6 +2,8 @@ # @configure_input@ CONFIG_HOST=@host@ +CONFIG_PREFIX=@prefix@ + PACKAGE_VERSION=@PACKAGE_VERSION@ CC=@CC@ AR=@AR@ diff --git a/configure.ac b/configure.ac index b4c560463..b22449a45 100644 --- a/configure.ac +++ b/configure.ac @@ -13,13 +13,24 @@ AC_CHECK_TOOL([AR], [ar], [false]) AC_CHECK_TOOL([WINDRES], [windres], [windres]) case "$host_os" in - *-solaris*) + solaris*) # Was in Makefile with the test `uname` -eq "SunOS" # and comment "For OpenSolaris (Solaris too?)" LIBS="-lsocket -lnsl $LIBS" ;; esac +# This replicates the old config logic from the Makefile. +# TODO: remove all this and just use the autotools default prefix +# (which is "/usr/local") +case "$host_os" in + darwin*) + ;; + *) + AC_PREFIX_DEFAULT(/usr) + ;; +esac + # TODO: ideally, should use AC_ARG_ENABLE AC_ARG_WITH([edgex], AS_HELP_STRING([--with-edgex], [Build for Ubiquity-X]), From 85c8ab536c9a1218378b6a856f4cbf6dd893729a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 16:09:40 +0100 Subject: [PATCH 40/82] Convert final user of TARGET==darwin to use the cross-compile variables instead --- .github/workflows/tests.yml | 8 -------- Makefile | 24 +++++++++++++----------- config.mak.in | 1 + configure.ac | 1 + 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d81713cbb..82db48b4d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -346,14 +346,6 @@ jobs: run: | git fetch --force --tags - - - name: generate a makefile and use it to install more packages - run: | - # This is a pretty big hammer, but gets the windows compile moving - ./scripts/hack_fakeautoconf.sh - make build-dep - shell: bash - - name: Run a configure step run: | export CFLAGS="-fprofile-arcs -ftest-coverage" diff --git a/Makefile b/Makefile index cf890c7fc..c4204e11b 100644 --- a/Makefile +++ b/Makefile @@ -47,10 +47,6 @@ export CONFIG_TARGET ifndef CONFIG_TARGET ifeq ($(shell uname -o),Msys) CONFIG_TARGET=mingw -else ifeq ($(shell uname -s),Darwin) -CONFIG_TARGET=darwin -else -CONFIG_TARGET=generic endif endif @@ -172,7 +168,7 @@ APPS+=example_sn_embed DOCS=edge.8.gz supernode.1.gz n2n.7.gz -# This is the superset of all packages that might be needed during the build. +# This is the list of Debian/Ubuntu packages that are needed during the build. # Mostly of use in automated build systems. BUILD_DEP:=\ autoconf \ @@ -282,15 +278,21 @@ gcov: # This is a convinent target to use during development or from a CI/CD system .PHONY: build-dep -build-dep: -ifeq ($(CONFIG_TARGET),generic) - sudo apt install $(BUILD_DEP) -else ifeq ($(CONFIG_TARGET),darwin) - brew install automake gcovr + +ifneq (,$(findstring darwin,$(CONFIG_HOST_OS))) +build-dep: build-dep-brew else - echo Not attempting to install dependancies for system $(CONFIG_TARGET) +build-dep: build-dep-dpkg endif +.PHONY: build-dep-dpkg +build-dep-dpkg: + sudo apt install $(BUILD_DEP) + +.PHONY: build-dep-brew +build-dep-brew: + brew install automake gcovr + .PHONY: clean clean: rm -f src/edge.o src/supernode.o src/example_edge_embed.o src/example_edge_embed_quick_edge_init.o src/example_sn_embed.o diff --git a/config.mak.in b/config.mak.in index 8e4f24314..29af36822 100644 --- a/config.mak.in +++ b/config.mak.in @@ -2,6 +2,7 @@ # @configure_input@ CONFIG_HOST=@host@ +CONFIG_HOST_OS=@host_os@ CONFIG_PREFIX=@prefix@ PACKAGE_VERSION=@PACKAGE_VERSION@ diff --git a/configure.ac b/configure.ac index b22449a45..f79d15432 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,7 @@ AS_IF([test "x$enable_pthread" != xno], AC_SUBST(host) +AC_SUBST(host_os) AC_SUBST(WINDRES) AC_CONFIG_HEADERS(include/config.h) AC_CONFIG_FILES(config.mak) From e79616dc8b52a638aef55d5013efcab0b70fd7e8 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 16:55:56 +0100 Subject: [PATCH 41/82] Dont include unneeded headers --- include/n2n.h | 1 - include/n2n_wire.h | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/n2n.h b/include/n2n.h index d8b9b3a67..3b5c12d8f 100644 --- a/include/n2n.h +++ b/include/n2n.h @@ -61,7 +61,6 @@ #include /* for privilege check in tools/n2n-route */ #include #include /* for privilege check in tools/n2n-route */ -#include "wintap.h" #define SHUT_RDWR SD_BOTH /* for tcp */ #endif /* #ifdef _WIN32 */ diff --git a/include/n2n_wire.h b/include/n2n_wire.h index 0151bc984..037d67439 100644 --- a/include/n2n_wire.h +++ b/include/n2n_wire.h @@ -25,12 +25,10 @@ #include #endif -#ifdef _WIN32 -#include "n2n_win32.h" -#else /* #ifdef _WIN32 */ +#ifndef _WIN32 #include #include /* AF_INET and AF_INET6 */ -#endif /* #ifdef _WIN32 */ +#endif /* #ifndef _WIN32 */ #include "sn_selection.h" From b22c57a16f12a4e11e18358b270b1a1ec32edc12 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 16:56:41 +0100 Subject: [PATCH 42/82] Dont require special build flags for just one header --- Makefile | 1 - include/n2n_typedefs.h | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c4204e11b..2457a4371 100644 --- a/Makefile +++ b/Makefile @@ -153,7 +153,6 @@ LDLIBS+=-ln2n LDLIBS+=$(LDLIBS_EXTRA) ifeq ($(CONFIG_TARGET),mingw) -CFLAGS+=-I. -I./win32 LDLIBS+=$(abspath win32/n2n_win32.a) LDLIBS+=-lnetapi32 -lws2_32 -liphlpapi N2N_DEPS+=win32/n2n_win32.a diff --git a/include/n2n_typedefs.h b/include/n2n_typedefs.h index 0b34f32e6..303e1b433 100644 --- a/include/n2n_typedefs.h +++ b/include/n2n_typedefs.h @@ -52,8 +52,8 @@ typedef int ssize_t; typedef unsigned long in_addr_t; -#include "n2n_win32.h" -// FIXME - the above include is from a different subdir +#include "../win32/n2n_win32.h" +// FIXME - continue untangling the build and includes - dont have a ".." here #endif /* #if defined(_MSC_VER) || defined(__MINGW32__) */ From 59ecadcab2f3e3067c77d2435efb741500c0d964 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 16:58:42 +0100 Subject: [PATCH 43/82] Move the special windows lib config into the configure script --- Makefile | 1 - configure.ac | 3 +++ scripts/hack_fakeautoconf.sh | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2457a4371..e1b9b0a22 100644 --- a/Makefile +++ b/Makefile @@ -154,7 +154,6 @@ LDLIBS+=$(LDLIBS_EXTRA) ifeq ($(CONFIG_TARGET),mingw) LDLIBS+=$(abspath win32/n2n_win32.a) -LDLIBS+=-lnetapi32 -lws2_32 -liphlpapi N2N_DEPS+=win32/n2n_win32.a SUBDIRS+=win32 endif diff --git a/configure.ac b/configure.ac index f79d15432..641fdafef 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,9 @@ case "$host_os" in # and comment "For OpenSolaris (Solaris too?)" LIBS="-lsocket -lnsl $LIBS" ;; + mingw*) + LIBS="-lnetapi32 -lws2_32 -liphlpapi $LIBS" + ;; esac # This replicates the old config logic from the Makefile. diff --git a/scripts/hack_fakeautoconf.sh b/scripts/hack_fakeautoconf.sh index 414c0c9e7..c36a93333 100755 --- a/scripts/hack_fakeautoconf.sh +++ b/scripts/hack_fakeautoconf.sh @@ -18,12 +18,15 @@ chmod a+x configure cat >config.mak <include/config.h From 1e8a085f1edb3fcd6a7d5ba941bfd2ff4669cabb Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 17:01:28 +0100 Subject: [PATCH 44/82] Refactor to use the host triplet instead of CONFIG_TARGET --- Makefile | 16 ++-------------- tools/Makefile | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index e1b9b0a22..5b345e05e 100644 --- a/Makefile +++ b/Makefile @@ -38,18 +38,6 @@ ifndef UNAME_S $(error Could not run uname command, cannot continue) endif -# Any compile environment that needs different flags, libraries, includes or -# other settings will get its own CONFIG_TARGET value. For cross compiling, -# this might be set externally to the Makefile, but if not set we try to -# set a reasonable default. - -export CONFIG_TARGET -ifndef CONFIG_TARGET -ifeq ($(shell uname -o),Msys) -CONFIG_TARGET=mingw -endif -endif - export MKDIR export INSTALL export INSTALL_PROG @@ -152,7 +140,7 @@ LINT_CCODE=\ LDLIBS+=-ln2n LDLIBS+=$(LDLIBS_EXTRA) -ifeq ($(CONFIG_TARGET),mingw) +ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) LDLIBS+=$(abspath win32/n2n_win32.a) N2N_DEPS+=win32/n2n_win32.a SUBDIRS+=win32 @@ -216,7 +204,7 @@ src/example_edge_embed_quick_edge_init: $(N2N_LIB) src/example_sn_embed: $(N2N_LIB) src/example_edge_embed: $(N2N_LIB) -ifeq ($(CONFIG_TARGET), mingw) +ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) src/edge: win32/edge_rc.o endif diff --git a/tools/Makefile b/tools/Makefile index 1de221c93..02fe68c9b 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -7,7 +7,7 @@ DEBUG?=-g3 HEADERS=$(wildcard include/*.h) CFLAGS+=-I../include -ifeq ($(CONFIG_TARGET),mingw) +ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) CFLAGS+=-I../win32 endif CFLAGS+=$(DEBUG) From 4d2e92ac810861396bf2f0051e871f033c3a431c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 17:11:12 +0100 Subject: [PATCH 45/82] Ensure library is included in correct order It looks to me that the correct way to address this build wrinkle is simply to add the win32 functions to the libn2n when building a win32 output, then there is no additional magic library juggling required for the win32 case --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5b345e05e..840a120dc 100644 --- a/Makefile +++ b/Makefile @@ -136,12 +136,13 @@ LINT_CCODE=\ tools/tests-transform.c \ tools/tests-wire.c \ - LDLIBS+=-ln2n +ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) +LDLIBS+=$(abspath win32/n2n_win32.a) +endif LDLIBS+=$(LDLIBS_EXTRA) ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) -LDLIBS+=$(abspath win32/n2n_win32.a) N2N_DEPS+=win32/n2n_win32.a SUBDIRS+=win32 endif From 0b662fc0f4d85077cbd8b03e5d04de8c3629dd36 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 17:40:11 +0100 Subject: [PATCH 46/82] A bunch of hacks to allow builds to understand the stupid windows filenames --- Makefile | 11 ++++++----- config.mak.in | 3 +++ configure.ac | 5 +++++ tools/Makefile | 21 ++++++++++++++++----- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 840a120dc..628b8fc80 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ all: export CC export AR +export EXE export CFLAGS export LDFLAGS export LDLIBS @@ -147,11 +148,11 @@ N2N_DEPS+=win32/n2n_win32.a SUBDIRS+=win32 endif -APPS=edge -APPS+=supernode -APPS+=example_edge_embed_quick_edge_init -APPS+=example_edge_embed -APPS+=example_sn_embed +APPS=edge$(EXE) +APPS+=supernode$(EXE) +APPS+=example_edge_embed_quick_edge_init$(EXE) +APPS+=example_edge_embed$(EXE) +APPS+=example_sn_embed$(EXE) DOCS=edge.8.gz supernode.1.gz n2n.7.gz diff --git a/config.mak.in b/config.mak.in index 29af36822..1ea0bfab2 100644 --- a/config.mak.in +++ b/config.mak.in @@ -6,9 +6,12 @@ CONFIG_HOST_OS=@host_os@ CONFIG_PREFIX=@prefix@ PACKAGE_VERSION=@PACKAGE_VERSION@ + CC=@CC@ AR=@AR@ WINDRES=@WINDRES@ +EXE=@EXE@ + CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ LDLIBS_EXTRA=@LIBS@ diff --git a/configure.ac b/configure.ac index 641fdafef..05a18775d 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,10 @@ case "$host_os" in ;; mingw*) LIBS="-lnetapi32 -lws2_32 -liphlpapi $LIBS" + EXE=".exe" + ;; + *) + EXE="" ;; esac @@ -114,6 +118,7 @@ AS_IF([test "x$enable_pthread" != xno], AC_SUBST(host) AC_SUBST(host_os) +AC_SUBST(EXE) AC_SUBST(WINDRES) AC_CONFIG_HEADERS(include/config.h) AC_CONFIG_FILES(config.mak) diff --git a/tools/Makefile b/tools/Makefile index 02fe68c9b..96b6695bb 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -15,11 +15,18 @@ LDFLAGS+=-L.. N2N_LIB=../libn2n.a -TOOLS=n2n-benchmark n2n-keygen n2n-route n2n-portfwd n2n-decode - -TESTS=tests-compress tests-elliptic tests-hashing tests-transform -TESTS+=tests-wire -TESTS+=tests-auth +TOOLS+=n2n-benchmark$(EXE) +TOOLS+=n2n-keygen$(EXE) +TOOLS+=n2n-route$(EXE) +TOOLS+=n2n-portfwd$(EXE) +TOOLS+=n2n-decode$(EXE) + +TESTS=tests-compress$(EXE) +TESTS+=tests-elliptic$(EXE) +TESTS+=tests-hashing$(EXE) +TESTS+=tests-transform$(EXE) +TESTS+=tests-wire$(EXE) +TESTS+=tests-auth$(EXE) .PHONY: all clean install all: $(TOOLS) $(TESTS) @@ -30,6 +37,10 @@ n2n-route.o: $(N2N_LIB) $(HEADERS) ../config.mak n2n-portfwd.o: $(N2N_LIB) $(HEADERS) ../config.mak n2n-decode.o: $(N2N_LIB) $(HEADERS) ../config.mak +# HACK for windows. +%.exe: % + cp $< $@ + # See comments in the topdir Makefile about how to generate coverage # data. gcov: From e16911d6ece4a3bab9a14b02fb7899c569e4b78b Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 17:42:27 +0100 Subject: [PATCH 47/82] The arm64 build has now been tested on real hardware --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 82db48b4d..a07460b09 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -702,12 +702,12 @@ jobs: matrix: arch: - arm-linux-gnueabi + - aarch64-linux-gnu # I assume these architectures produce working code, but this has # not been directly confirmed. # They are compiled dynamically against normal libc, so will not # work on openwrt. - - aarch64-linux-gnu - mips-linux-gnu - mipsel-linux-gnu From 84dac6220b4c36cb15235cace856a69b4088bcde Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 17:46:06 +0100 Subject: [PATCH 48/82] Add a cross-compiled 64bit windows build to CI --- .github/workflows/tests.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a07460b09..cb9d8718b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -700,16 +700,21 @@ jobs: strategy: fail-fast: true matrix: - arch: - - arm-linux-gnueabi - - aarch64-linux-gnu + include: + - arch: arm-linux-gnueabi + - arch: aarch64-linux-gnu + + # Unfortunately, the ubnuts mingw package names dont follow the + # same naming convention as every other cross-compiler. + - arch: x86_64-w64-mingw32 + package_suffix: mingw-w64-x86-64 # I assume these architectures produce working code, but this has # not been directly confirmed. # They are compiled dynamically against normal libc, so will not # work on openwrt. - - mips-linux-gnu - - mipsel-linux-gnu + - arch: mips-linux-gnu + - arch: mipsel-linux-gnu steps: - uses: actions/checkout@v3 @@ -724,8 +729,8 @@ jobs: run: | sudo apt-get update sudo apt-get install \ - binutils-${{ matrix.arch }} \ - gcc-${{ matrix.arch }} + binutils-${{ matrix.package_suffix || matrix.arch }} \ + gcc-${{ matrix.package_suffix || matrix.arch }} - name: Configure and Build shell: bash From 183e0c969a76686909306820e0756b290f0aee72 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 2 Jul 2023 18:03:27 +0100 Subject: [PATCH 49/82] Hack around the "helpful" exe file suffix If there is a way to turn off the mingw insistence that it will rewrite the filename it was given in the "-o" options, I have not been able to find it. I could easily handle all the moves or renames at the end of the build process if I could turn off this feature. Especially since it means that make often thinks that the file has not been built (the filename that make knows about is not the file that actually gets built by the mingw gcc, so the if-newer tests that make applies will always fail) --- Makefile | 12 +++++++++--- tools/Makefile | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 628b8fc80..0d14421c7 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ export EXE export CFLAGS export LDFLAGS export LDLIBS +export CONFIG_HOST_OS -include config.mak @@ -208,6 +209,11 @@ src/example_edge_embed: $(N2N_LIB) ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) src/edge: win32/edge_rc.o +src/edge.exe: src/edge +src/supernode.exe: src/supernode +src/example_edge_embed_quick_edge_init.exe: src/example_edge_embed_quick_edge_init +src/example_sn_embed.exe: src/example_sn_embed +src/example_edge_embed.exe: src/example_edge_embed endif %: src/% @@ -300,11 +306,11 @@ distclean: rm -f $(addprefix src/,$(APPS)) .PHONY: install -install: edge supernode edge.8.gz supernode.1.gz n2n.7.gz +install: edge$(EXE) supernode$(EXE) edge.8.gz supernode.1.gz n2n.7.gz echo "MANDIR=$(MANDIR)" $(MKDIR) $(SBINDIR) $(MAN1DIR) $(MAN7DIR) $(MAN8DIR) - $(INSTALL_PROG) supernode $(SBINDIR)/ - $(INSTALL_PROG) edge $(SBINDIR)/ + $(INSTALL_PROG) supernode$(EXE) $(SBINDIR)/ + $(INSTALL_PROG) edge$(EXE) $(SBINDIR)/ $(INSTALL_DOC) edge.8.gz $(MAN8DIR)/ $(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/ $(INSTALL_DOC) n2n.7.gz $(MAN7DIR)/ diff --git a/tools/Makefile b/tools/Makefile index 96b6695bb..08c4a7e59 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -37,9 +37,20 @@ n2n-route.o: $(N2N_LIB) $(HEADERS) ../config.mak n2n-portfwd.o: $(N2N_LIB) $(HEADERS) ../config.mak n2n-decode.o: $(N2N_LIB) $(HEADERS) ../config.mak +ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) # HACK for windows. -%.exe: % - cp $< $@ +n2n-benchmark.exe: n2n-benchmark +n2n-keygen.exe: n2n-keygen +n2n-route.exe: n2n-route +n2n-portfwd.exe: n2n-portfwd +n2n-decode.exe: n2n-decode +tests-compress.exe: tests-compress +tests-elliptic.exe: tests-elliptic +tests-hashing.exe: tests-hashing +tests-transform.exe: tests-transform +tests-wire.exe: tests-wire +tests-auth.exe: tests-auth +endif # See comments in the topdir Makefile about how to generate coverage # data. From 6957b16537153b34b77a8668270d9007ad5e6f38 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Tue, 4 Jul 2023 08:17:49 +0100 Subject: [PATCH 50/82] Address compiler warning on older gcc --- src/n2n.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/n2n.c b/src/n2n.c index bf9df3c8d..938fbb176 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -742,7 +742,7 @@ extern char * sock_to_cstr (n2n_sock_str_t out, memset(out, 0, N2N_SOCKBUF_SIZE); if(AF_INET6 == sock->family) { - char tmp[sizeof(n2n_sock_str_t)]; + char tmp[INET6_ADDRSTRLEN+1]; tmp[0] = '\0'; inet_ntop(AF_INET6, sock->addr.v6, tmp, sizeof(n2n_sock_str_t)); From 83078c8104ae7b0f3069de24909d4e5b55ef5be2 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 5 Jul 2023 20:19:55 +0100 Subject: [PATCH 51/82] Simplify win32 build process When building on win32 systems, simply add the win32 specific functions to the libn2n.a, which simplifies the commands needed. By moving the win32 source code into the src directory, the source code is better consolidated. --- Makefile | 26 +++++++------------ include/n2n_typedefs.h | 2 +- {win32 => src/win32}/DotNet/n2n.sln | 0 {win32 => src/win32}/DotNet/n2n.suo | Bin {win32 => src/win32}/DotNet/n2n.vcproj | 0 {win32 => src/win32}/DotNet/supernode.vcproj | 0 {win32 => src/win32}/edge.manifest | 0 {win32 => src/win32}/edge.rc | 0 {win32 => src/win32}/getopt.c | 0 {win32 => src/win32}/getopt.h | 0 {win32 => src/win32}/getopt1.c | 0 {win32 => src/win32}/n2n_win32.h | 0 {win32 => src/win32}/wintap.c | 0 {win32 => src/win32}/wintap.h | 0 tools/Makefile | 3 --- win32/Makefile | 19 -------------- 16 files changed, 10 insertions(+), 40 deletions(-) rename {win32 => src/win32}/DotNet/n2n.sln (100%) rename {win32 => src/win32}/DotNet/n2n.suo (100%) rename {win32 => src/win32}/DotNet/n2n.vcproj (100%) rename {win32 => src/win32}/DotNet/supernode.vcproj (100%) rename {win32 => src/win32}/edge.manifest (100%) rename {win32 => src/win32}/edge.rc (100%) rename {win32 => src/win32}/getopt.c (100%) rename {win32 => src/win32}/getopt.h (100%) rename {win32 => src/win32}/getopt1.c (100%) rename {win32 => src/win32}/n2n_win32.h (100%) rename {win32 => src/win32}/wintap.c (100%) rename {win32 => src/win32}/wintap.h (100%) delete mode 100644 win32/Makefile diff --git a/Makefile b/Makefile index 0d14421c7..c7f7fabf1 100644 --- a/Makefile +++ b/Makefile @@ -139,16 +139,8 @@ LINT_CCODE=\ tools/tests-wire.c \ LDLIBS+=-ln2n -ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) -LDLIBS+=$(abspath win32/n2n_win32.a) -endif LDLIBS+=$(LDLIBS_EXTRA) -ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) -N2N_DEPS+=win32/n2n_win32.a -SUBDIRS+=win32 -endif - APPS=edge$(EXE) APPS+=supernode$(EXE) APPS+=example_edge_embed_quick_edge_init$(EXE) @@ -189,12 +181,6 @@ version: tools: $(N2N_LIB) $(MAKE) -C $@ -win32: - $(MAKE) -C $@ - -win32/edge_rc.o: win32/edge.rc win32/edge.manifest - $(WINDRES) win32/edge.rc -O coff -o win32/edge_rc.o - src/edge.o: $(N2N_DEPS) src/supernode.o: $(N2N_DEPS) src/example_edge_embed_quick_edge_init.o: $(N2N_DEPS) @@ -208,7 +194,15 @@ src/example_sn_embed: $(N2N_LIB) src/example_edge_embed: $(N2N_LIB) ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) -src/edge: win32/edge_rc.o +N2N_OBJS+=src/win32/getopt1.o +N2N_OBJS+=src/win32/getopt.o +N2N_OBJS+=src/win32/wintap.o + +src/win32/edge.rc: src/win32/edge.manifest +src/win32/edge_rc.o: src/win32/edge.rc + $(WINDRES) $< -O coff -o $@ + +src/edge: src/win32/edge_rc.o src/edge.exe: src/edge src/supernode.exe: src/supernode src/example_edge_embed_quick_edge_init.exe: src/example_edge_embed_quick_edge_init @@ -226,8 +220,6 @@ $(N2N_LIB): $(N2N_OBJS) $(AR) rcs $(N2N_LIB) $(N2N_OBJS) # $(RANLIB) $@ -win32/n2n_win32.a: win32 - .PHONY: test test.units test.integration test: test.units test.integration diff --git a/include/n2n_typedefs.h b/include/n2n_typedefs.h index 303e1b433..f28ab6584 100644 --- a/include/n2n_typedefs.h +++ b/include/n2n_typedefs.h @@ -52,7 +52,7 @@ typedef int ssize_t; typedef unsigned long in_addr_t; -#include "../win32/n2n_win32.h" +#include "../src/win32/n2n_win32.h" // FIXME - continue untangling the build and includes - dont have a ".." here #endif /* #if defined(_MSC_VER) || defined(__MINGW32__) */ diff --git a/win32/DotNet/n2n.sln b/src/win32/DotNet/n2n.sln similarity index 100% rename from win32/DotNet/n2n.sln rename to src/win32/DotNet/n2n.sln diff --git a/win32/DotNet/n2n.suo b/src/win32/DotNet/n2n.suo similarity index 100% rename from win32/DotNet/n2n.suo rename to src/win32/DotNet/n2n.suo diff --git a/win32/DotNet/n2n.vcproj b/src/win32/DotNet/n2n.vcproj similarity index 100% rename from win32/DotNet/n2n.vcproj rename to src/win32/DotNet/n2n.vcproj diff --git a/win32/DotNet/supernode.vcproj b/src/win32/DotNet/supernode.vcproj similarity index 100% rename from win32/DotNet/supernode.vcproj rename to src/win32/DotNet/supernode.vcproj diff --git a/win32/edge.manifest b/src/win32/edge.manifest similarity index 100% rename from win32/edge.manifest rename to src/win32/edge.manifest diff --git a/win32/edge.rc b/src/win32/edge.rc similarity index 100% rename from win32/edge.rc rename to src/win32/edge.rc diff --git a/win32/getopt.c b/src/win32/getopt.c similarity index 100% rename from win32/getopt.c rename to src/win32/getopt.c diff --git a/win32/getopt.h b/src/win32/getopt.h similarity index 100% rename from win32/getopt.h rename to src/win32/getopt.h diff --git a/win32/getopt1.c b/src/win32/getopt1.c similarity index 100% rename from win32/getopt1.c rename to src/win32/getopt1.c diff --git a/win32/n2n_win32.h b/src/win32/n2n_win32.h similarity index 100% rename from win32/n2n_win32.h rename to src/win32/n2n_win32.h diff --git a/win32/wintap.c b/src/win32/wintap.c similarity index 100% rename from win32/wintap.c rename to src/win32/wintap.c diff --git a/win32/wintap.h b/src/win32/wintap.h similarity index 100% rename from win32/wintap.h rename to src/win32/wintap.h diff --git a/tools/Makefile b/tools/Makefile index 08c4a7e59..3a0ba9839 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -7,9 +7,6 @@ DEBUG?=-g3 HEADERS=$(wildcard include/*.h) CFLAGS+=-I../include -ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) -CFLAGS+=-I../win32 -endif CFLAGS+=$(DEBUG) LDFLAGS+=-L.. diff --git a/win32/Makefile b/win32/Makefile deleted file mode 100644 index 832b6bf11..000000000 --- a/win32/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# This is not a standalone makefile, it must be called from the toplevel -# makefile to inherit the correct environment - -CFLAGS+=-I../include -I. -LDFLAGS+=-L.. - -.PHONY: all clean install - -all: n2n_win32.a - -n2n_win32.a: getopt1.o getopt.o wintap.o - $(AR) rcs $@ $+ - -clean: - rm -rf n2n_win32.a *.o *.gcno *.gcda - -install: - true From 6ddaaaa91724e3461c73e938e9b5e981d222cfa8 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 5 Jul 2023 20:26:55 +0100 Subject: [PATCH 52/82] Move win32 specific file to the right dir --- Makefile | 6 +++--- src/edge_utils.c | 2 +- src/{ => win32}/edge_utils_win32.c | 6 ------ {include => src/win32}/edge_utils_win32.h | 0 4 files changed, 4 insertions(+), 10 deletions(-) rename src/{ => win32}/edge_utils_win32.c (99%) rename {include => src/win32}/edge_utils_win32.h (100%) diff --git a/Makefile b/Makefile index c7f7fabf1..d6f7feca2 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,6 @@ N2N_OBJS=\ src/curve25519.o \ src/edge_management.o \ src/edge_utils.o \ - src/edge_utils_win32.o \ src/header_encryption.o \ src/hexdump.o \ src/json.o \ @@ -104,7 +103,6 @@ N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) config.mak # is passing the linter tests, this can be refactored) LINT_CCODE=\ include/curve25519.h \ - include/edge_utils_win32.h \ include/header_encryption.h \ include/hexdump.h \ include/n2n_define.h \ @@ -116,7 +114,6 @@ LINT_CCODE=\ include/speck.h \ include/tf.h \ src/edge_management.c \ - src/edge_utils_win32.c \ src/example_edge_embed_quick_edge_init.c \ src/header_encryption.c \ src/management.c \ @@ -130,6 +127,8 @@ LINT_CCODE=\ src/tuntap_linux.c \ src/tuntap_netbsd.c \ src/tuntap_osx.c \ + src/win32/edge_utils_win32.c \ + src/win32/edge_utils_win32.h \ src/wire.c \ tools/tests-auth.c \ tools/tests-compress.c \ @@ -194,6 +193,7 @@ src/example_sn_embed: $(N2N_LIB) src/example_edge_embed: $(N2N_LIB) ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) +N2N_OBJS+=src/win32/edge_utils_win32.o N2N_OBJS+=src/win32/getopt1.o N2N_OBJS+=src/win32/getopt.o N2N_OBJS+=src/win32/wintap.o diff --git a/src/edge_utils.c b/src/edge_utils.c index c10711e7f..c0fe416d2 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -43,7 +43,7 @@ #ifdef _WIN32 #include #include -#include "edge_utils_win32.h" +#include "win32/edge_utils_win32.h" #else #include // for inet_ntoa, inet_addr, inet_ntop #include // for sockaddr_in, ntohl, IPPROTO_IP diff --git a/src/edge_utils_win32.c b/src/win32/edge_utils_win32.c similarity index 99% rename from src/edge_utils_win32.c rename to src/win32/edge_utils_win32.c index 5f5ea8245..fa76ab973 100644 --- a/src/edge_utils_win32.c +++ b/src/win32/edge_utils_win32.c @@ -16,8 +16,6 @@ * */ -#ifdef _WIN32 - #include #include "edge_utils_win32.h" @@ -107,7 +105,3 @@ int get_best_interface_ip (n2n_edge_t * eee, dec_ip_str_t *ip_addr){ } return 0; } - - -#endif - diff --git a/include/edge_utils_win32.h b/src/win32/edge_utils_win32.h similarity index 100% rename from include/edge_utils_win32.h rename to src/win32/edge_utils_win32.h From 6b8ba8aa947f22f09da999d3553ce35c94636309 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 5 Jul 2023 20:53:05 +0100 Subject: [PATCH 53/82] Move the examples to their own directory --- Makefile | 19 ++++-------------- examples/Makefile | 20 +++++++++++++++++++ {src => examples}/example_edge_embed.c | 0 .../example_edge_embed_quick_edge_init.c | 0 {src => examples}/example_sn_embed.c | 0 5 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 examples/Makefile rename {src => examples}/example_edge_embed.c (100%) rename {src => examples}/example_edge_embed_quick_edge_init.c (100%) rename {src => examples}/example_sn_embed.c (100%) diff --git a/Makefile b/Makefile index d6f7feca2..86a82e55c 100644 --- a/Makefile +++ b/Makefile @@ -102,6 +102,7 @@ N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) config.mak # As source files pass the linter, they can be added here (If all the source # is passing the linter tests, this can be refactored) LINT_CCODE=\ + examples/example_edge_embed_quick_edge_init.c \ include/curve25519.h \ include/header_encryption.h \ include/hexdump.h \ @@ -114,7 +115,6 @@ LINT_CCODE=\ include/speck.h \ include/tf.h \ src/edge_management.c \ - src/example_edge_embed_quick_edge_init.c \ src/header_encryption.c \ src/management.c \ src/management.h \ @@ -142,9 +142,6 @@ LDLIBS+=$(LDLIBS_EXTRA) APPS=edge$(EXE) APPS+=supernode$(EXE) -APPS+=example_edge_embed_quick_edge_init$(EXE) -APPS+=example_edge_embed$(EXE) -APPS+=example_sn_embed$(EXE) DOCS=edge.8.gz supernode.1.gz n2n.7.gz @@ -162,6 +159,7 @@ BUILD_DEP:=\ yamllint \ SUBDIRS+=tools +SUBDIRS+=examples COVERAGEDIR?=coverage @@ -177,20 +175,14 @@ version: @echo -n "Build for version: " @scripts/version.sh -tools: $(N2N_LIB) +examples tools: $(N2N_LIB) $(MAKE) -C $@ src/edge.o: $(N2N_DEPS) src/supernode.o: $(N2N_DEPS) -src/example_edge_embed_quick_edge_init.o: $(N2N_DEPS) -src/example_sn_embed.o: $(N2N_DEPS) -src/example_edge_embed.o: $(N2N_DEPS) src/edge: $(N2N_LIB) src/supernode: $(N2N_LIB) -src/example_edge_embed_quick_edge_init: $(N2N_LIB) -src/example_sn_embed: $(N2N_LIB) -src/example_edge_embed: $(N2N_LIB) ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) N2N_OBJS+=src/win32/edge_utils_win32.o @@ -205,9 +197,6 @@ src/win32/edge_rc.o: src/win32/edge.rc src/edge: src/win32/edge_rc.o src/edge.exe: src/edge src/supernode.exe: src/supernode -src/example_edge_embed_quick_edge_init.exe: src/example_edge_embed_quick_edge_init -src/example_sn_embed.exe: src/example_sn_embed -src/example_edge_embed.exe: src/example_edge_embed endif %: src/% @@ -281,7 +270,7 @@ build-dep-brew: .PHONY: clean clean: - rm -f src/edge.o src/supernode.o src/example_edge_embed.o src/example_edge_embed_quick_edge_init.o src/example_sn_embed.o + rm -f src/edge.o src/supernode.o rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) $(COVERAGEDIR)/ *.dSYM *~ rm -f tests/*.out src/*.gcno src/*.gcda for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done diff --git a/examples/Makefile b/examples/Makefile new file mode 100644 index 000000000..3d4dd1de2 --- /dev/null +++ b/examples/Makefile @@ -0,0 +1,20 @@ +# +# These examples are intended to show how to use the libn2n as an embedded +# service within other software. +# + +EXAMPLES+=example_edge_embed_quick_edge_init +EXAMPLES+=example_edge_embed +EXAMPLES+=example_sn_embed + +all: $(EXAMPLES) + +CFLAGS+=-I../include +LDFLAGS+=-L../ + +example_edge_embed_quick_edge_init: ../libn2n.a +example_sn_embed: ../libn2n.a +example_edge_embed: ../libn2n.a + +clean: + rm -f $(EXAMPLES) diff --git a/src/example_edge_embed.c b/examples/example_edge_embed.c similarity index 100% rename from src/example_edge_embed.c rename to examples/example_edge_embed.c diff --git a/src/example_edge_embed_quick_edge_init.c b/examples/example_edge_embed_quick_edge_init.c similarity index 100% rename from src/example_edge_embed_quick_edge_init.c rename to examples/example_edge_embed_quick_edge_init.c diff --git a/src/example_sn_embed.c b/examples/example_sn_embed.c similarity index 100% rename from src/example_sn_embed.c rename to examples/example_sn_embed.c From 439939dc7bb0eda49e2cb744716ce25bccf0c72b Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 2 Aug 2023 18:17:47 +0100 Subject: [PATCH 54/82] Simplify tuntap_open by using one function prototype for all OS --- examples/example_edge_embed.c | 6 ++---- include/n2n.h | 6 +----- src/edge.c | 7 ++----- src/edge_utils.c | 13 ++++--------- src/tuntap_freebsd.c | 3 ++- src/tuntap_linux.c | 3 ++- src/tuntap_netbsd.c | 3 ++- src/tuntap_osx.c | 3 ++- 8 files changed, 17 insertions(+), 27 deletions(-) diff --git a/examples/example_edge_embed.c b/examples/example_edge_embed.c index c9d2919b9..559ad386b 100644 --- a/examples/example_edge_embed.c +++ b/examples/example_edge_embed.c @@ -58,10 +58,8 @@ int main() { "10.0.0.1", // Set ip address "255.255.255.0", // Netmask to use "DE:AD:BE:EF:01:10", // Set mac address - DEFAULT_MTU // MTU to use -#ifdef _WIN32 - , 0 -#endif + DEFAULT_MTU, // MTU to use + 0 // Metric - unused in n2n on most OS ) < 0) { return -1; diff --git a/include/n2n.h b/include/n2n.h index 3b5c12d8f..dd3d474cc 100644 --- a/include/n2n.h +++ b/include/n2n.h @@ -127,11 +127,7 @@ void _traceEvent (int eventTraceLevel, char* file, int line, char * format, ...) /* Tuntap API */ int tuntap_open (struct tuntap_dev *device, char *dev, const char *address_mode, char *device_ip, - char *device_mask, const char * device_mac, int mtu -#ifdef _WIN32 - , int metric -#endif - ); + char *device_mask, const char * device_mac, int mtu, int metric); int tuntap_read (struct tuntap_dev *tuntap, unsigned char *buf, int len); int tuntap_write (struct tuntap_dev *tuntap, unsigned char *buf, int len); void tuntap_close (struct tuntap_dev *tuntap); diff --git a/src/edge.c b/src/edge.c index 3a18d5b20..e1b868a71 100644 --- a/src/edge.c +++ b/src/edge.c @@ -1246,11 +1246,8 @@ int main (int argc, char* argv[]) { if(runlevel == 4) { /* configure the TUNTAP device, including routes */ if(tuntap_open(&tuntap, eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, eee->tuntap_priv_conf.ip_addr, eee->tuntap_priv_conf.netmask, - eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu -#ifdef _WIN32 - , eee->tuntap_priv_conf.metric -#endif - ) < 0) + eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu, + eee->tuntap_priv_conf.metric) < 0) exit(1); memcpy(&eee->device, &tuntap, sizeof(tuntap)); traceEvent(TRACE_NORMAL, "created local tap device IP: %s, Mask: %s, MAC: %s", diff --git a/src/edge_utils.c b/src/edge_utils.c index c0fe416d2..2f784df7d 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -2182,10 +2182,8 @@ void edge_read_from_tap (n2n_edge_t * eee) { sleep(3); tuntap_close(&(eee->device)); tuntap_open(&(eee->device), eee->tuntap_priv_conf.tuntap_dev_name, eee->tuntap_priv_conf.ip_mode, eee->tuntap_priv_conf.ip_addr, - eee->tuntap_priv_conf.netmask, eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu -#ifdef _WIN32 - ,eee->tuntap_priv_conf.metric -#endif + eee->tuntap_priv_conf.netmask, eee->tuntap_priv_conf.device_mac, eee->tuntap_priv_conf.mtu, + eee->tuntap_priv_conf.metric ); } else { const uint8_t * mac = eth_pkt; @@ -3295,11 +3293,8 @@ int quick_edge_init (char *device_name, char *community_name, /* Open the tuntap device */ if(tuntap_open(&tuntap, device_name, "static", local_ip_address, "255.255.255.0", - device_mac, DEFAULT_MTU -#ifdef _WIN32 - , 0 -#endif - ) < 0) + device_mac, DEFAULT_MTU, + 0) < 0) return(-2); /* Init edge */ diff --git a/src/tuntap_freebsd.c b/src/tuntap_freebsd.c index 9ccdf0e90..70f700be4 100644 --- a/src/tuntap_freebsd.c +++ b/src/tuntap_freebsd.c @@ -36,7 +36,8 @@ int tuntap_open (tuntap_dev *device /* ignored */, char *device_ip, char *device_mask, const char * device_mac, - int mtu) { + int mtu, + int ignored) { int i; char tap_device[N2N_FREEBSD_TAPDEVICE_SIZE]; diff --git a/src/tuntap_linux.c b/src/tuntap_linux.c index 863684fc7..9b6d1db3c 100644 --- a/src/tuntap_linux.c +++ b/src/tuntap_linux.c @@ -120,7 +120,8 @@ int tuntap_open (tuntap_dev *device, char *device_ip, char *device_mask, const char * device_mac, - int mtu) { + int mtu, + int ignored) { char *tuntap_device = "/dev/net/tun"; int ioctl_fd; diff --git a/src/tuntap_netbsd.c b/src/tuntap_netbsd.c index 430289778..015812705 100644 --- a/src/tuntap_netbsd.c +++ b/src/tuntap_netbsd.c @@ -40,7 +40,8 @@ int tuntap_open (tuntap_dev *device /* ignored */, char *device_ip, char *device_mask, const char * device_mac, - int mtu) { + int mtu, + int ignored) { char tap_device[N2N_NETBSD_TAPDEVICE_SIZE]; struct ifreq req; diff --git a/src/tuntap_osx.c b/src/tuntap_osx.c index e46755dc5..0377f708f 100644 --- a/src/tuntap_osx.c +++ b/src/tuntap_osx.c @@ -36,7 +36,8 @@ int tuntap_open (tuntap_dev *device /* ignored */, char *device_ip, char *device_mask, const char * device_mac, - int mtu) { + int mtu, + int ignored) { int i; char tap_device[N2N_OSX_TAPDEVICE_SIZE]; From 3bf584c580cd7876d0ea80f4c67ccfd68a7cf1d6 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 2 Aug 2023 18:53:13 +0100 Subject: [PATCH 55/82] Add tweaks to support windows XP --- src/win32/edge_utils_win32.c | 1 + src/win32/wintap.c | 16 ++++++++++++++++ tools/n2n-route.c | 15 +++++++++++---- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/win32/edge_utils_win32.c b/src/win32/edge_utils_win32.c index fa76ab973..5c47efba6 100644 --- a/src/win32/edge_utils_win32.c +++ b/src/win32/edge_utils_win32.c @@ -17,6 +17,7 @@ */ #include +#include #include "edge_utils_win32.h" diff --git a/src/win32/wintap.c b/src/win32/wintap.c index d1f77a208..1feb8c5c0 100644 --- a/src/win32/wintap.c +++ b/src/win32/wintap.c @@ -2,6 +2,9 @@ (C) 2007-22 - Luca Deri */ +#include +#include + #include "n2n.h" #include "n2n_win32.h" @@ -333,6 +336,15 @@ int open_wintap(struct tuntap_dev *device, /* ****************** */ +#ifdef _WIN64 + /* Setting the metric is not actually 64-bit specific. + * The assumption here is that anyone needing a metric set will also + * need a new enough OS that they will be on 64-bit. + * + * The alternative is that people trying to run old games are probably on + * Windows XP and are probably 32-bit. + */ + /* metric */ PMIB_IPINTERFACE_ROW Row; @@ -357,6 +369,7 @@ int open_wintap(struct tuntap_dev *device, free(Row); } +#endif /* _WIN64 */ /* ****************** */ @@ -452,6 +465,8 @@ int tuntap_open(struct tuntap_dev *device, void tuntap_close(struct tuntap_dev *tuntap) { +#ifdef _WIN64 + /* See comment in open_wintap for notes about this ifdef */ PMIB_IPINTERFACE_ROW Row; if(tuntap->metric) { /* only required if a value has been given (and thus stored) */ @@ -471,6 +486,7 @@ void tuntap_close(struct tuntap_dev *tuntap) { free(Row); } +#endif /* _WIN64 */ CloseHandle(tuntap->device_handle); } diff --git a/tools/n2n-route.c b/tools/n2n-route.c index fa63fa23d..8ff14b58c 100644 --- a/tools/n2n-route.c +++ b/tools/n2n-route.c @@ -51,7 +51,14 @@ #include // for send, socket, AF_INET, recv, connect #endif -#if defined (__linux__) || defined(_WIN32) /* currently, Linux and Windows only */ +#if defined (__linux__) || defined(_WIN64) /* currently, Linux and Windows only */ +/* Technically, this could be supported on some 32-bit windows. + * The assumption here is that a version of Windows new enough to + * support the features needed is probably running with 64-bit. + * + * The alternative is that people trying to run old games are probably on + * Windows XP and are probably 32-bit. + */ #define WITH_ADDRESS 1 @@ -1088,16 +1095,16 @@ int main (int argc, char* argv[]) { } -#else /* if defined(__linux__) || defined(_WIN32) -- currently, Linux and Windows only */ +#else /* if defined(__linux__) || defined(_WIN64) -- currently, Linux and Windows only */ int main (int argc, char* argv[]) { - traceEvent(TRACE_WARNING, "currently, only Linux and Windows are supported"); + traceEvent(TRACE_WARNING, "currently, only Linux and 64-bit Windows are supported"); traceEvent(TRACE_WARNING, "if you want to port to other OS, please find the source code having clearly marked the platform-dependant portions"); return 0; } -#endif /* if defined (__linux__) || defined(_WIN32) -- currently, Linux and Windows only */ +#endif /* if defined (__linux__) || defined(_WIN64) -- currently, Linux and Windows only */ From 567ae8db6b2c91fc2aa8532699427f09dc52a93c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 2 Aug 2023 19:00:53 +0100 Subject: [PATCH 56/82] Try to simplify and improve windows objs definitions --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 86a82e55c..ee9f5410d 100644 --- a/Makefile +++ b/Makefile @@ -189,15 +189,15 @@ N2N_OBJS+=src/win32/edge_utils_win32.o N2N_OBJS+=src/win32/getopt1.o N2N_OBJS+=src/win32/getopt.o N2N_OBJS+=src/win32/wintap.o +N2N_OBJS+=src/win32/edge_rc.o +endif src/win32/edge.rc: src/win32/edge.manifest src/win32/edge_rc.o: src/win32/edge.rc $(WINDRES) $< -O coff -o $@ -src/edge: src/win32/edge_rc.o src/edge.exe: src/edge src/supernode.exe: src/supernode -endif %: src/% cp $< $@ From 5eaf7fca8b8169237afaf9e02594412815bebceb Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 2 Aug 2023 19:02:21 +0100 Subject: [PATCH 57/82] Add windows XP to regular cross-compile tests --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cb9d8718b..5ba54db62 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -706,6 +706,8 @@ jobs: # Unfortunately, the ubnuts mingw package names dont follow the # same naming convention as every other cross-compiler. + - arch: i686-w64-mingw32 + package_suffix: mingw-w64-i686 - arch: x86_64-w64-mingw32 package_suffix: mingw-w64-x86-64 From 5514d919762676269f6bcae63d0edd9c46e53b12 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 2 Aug 2023 19:09:33 +0100 Subject: [PATCH 58/82] For some reason, these headers dont work for 64bit - windows is strange --- src/win32/wintap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/win32/wintap.c b/src/win32/wintap.c index 1feb8c5c0..4b2aa037d 100644 --- a/src/win32/wintap.c +++ b/src/win32/wintap.c @@ -2,8 +2,10 @@ (C) 2007-22 - Luca Deri */ +#ifndef _WIN64 #include #include +#endif #include "n2n.h" #include "n2n_win32.h" From 65359c791653a19c0d1465a25a5400bd76f4863d Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 2 Aug 2023 19:40:03 +0100 Subject: [PATCH 59/82] Add a missing library function --- src/win32/edge_utils_win32.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/win32/edge_utils_win32.c b/src/win32/edge_utils_win32.c index 5c47efba6..1ce6f2167 100644 --- a/src/win32/edge_utils_win32.c +++ b/src/win32/edge_utils_win32.c @@ -23,6 +23,39 @@ /* ************************************** */ +#ifndef _WIN64 +/* + * This function was not included in windows until after Windows XP + */ + +const char *inet_ntop (int af, const void *src, char *dst, socklen_t size) { + if(af == AF_INET) { + struct sockaddr_in in; + memset(&in, 0, sizeof(in)); + + in.sin_family = AF_INET; + memcpy(&in.sin_addr, src, sizeof(in.sin_addr)); + getnameinfo((struct sockaddr *)&in,sizeof(in),dst,size,NULL,0,NI_NUMERICHOST); + return dst; + } + + if(af == AF_INET6) { + struct sockaddr_in6 in6; + memset(&in6, 0, sizeof(in6)); + + in6.sin6_family = AF_INET6; + memcpy(&in6.sin6_addr, src, sizeof(in6.sin6_addr)); + getnameinfo((struct sockaddr *)&in6,sizeof(in6),dst,size,NULL,0,NI_NUMERICHOST); + return dst; + } + + return NULL; +} + +#endif /* _WIN64 */ + +/* ************************************** */ + static DWORD* tunReadThread (LPVOID lpArg) { struct tunread_arg *arg = (struct tunread_arg*)lpArg; From f79153166b5d94ce7f336bd3c84e4709afba20a6 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 2 Aug 2023 21:10:24 +0100 Subject: [PATCH 60/82] Concentrate more windows wierdness in one place - allowing proper ordering of crazy defs and includes --- src/edge.c | 3 +-- src/edge_management.c | 3 +-- src/edge_utils.c | 3 +-- src/management.c | 4 +++- src/n2n.c | 3 +-- src/network_traffic_filter.c | 3 +-- src/sn_management.c | 2 +- src/sn_utils.c | 3 +-- src/supernode.c | 3 +-- src/win32/defs.h | 27 +++++++++++++++++++++++++++ src/win32/edge_utils_win32.c | 4 ++-- src/win32/n2n_win32.h | 15 --------------- src/win32/wintap.c | 2 +- src/wire.c | 3 +-- 14 files changed, 42 insertions(+), 36 deletions(-) create mode 100644 src/win32/defs.h diff --git a/src/edge.c b/src/edge.c index e1b868a71..f8b7bdc0f 100644 --- a/src/edge.c +++ b/src/edge.c @@ -43,8 +43,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ADD, HASH_C... #ifdef _WIN32 -#include -#include +#include "win32/defs.h" #else #include // for inet_addr, inet_ntop #include // for INADDR_ANY, INADDR_NONE, ntohl diff --git a/src/edge_management.c b/src/edge_management.c index 4884525f7..27d9ca986 100644 --- a/src/edge_management.c +++ b/src/edge_management.c @@ -36,8 +36,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER #ifdef _WIN32 -#include -#include +#include "win32/defs.h" #else #include // for inet_ntoa #include // for in_addr, htonl, in_addr_t diff --git a/src/edge_utils.c b/src/edge_utils.c index 2f784df7d..9592e5146 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -41,8 +41,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_COUNT, HASH... #ifdef _WIN32 -#include -#include +#include "win32/defs.h" #include "win32/edge_utils_win32.h" #else #include // for inet_ntoa, inet_addr, inet_ntop diff --git a/src/management.c b/src/management.c index 0aa73b369..a36f084bc 100644 --- a/src/management.c +++ b/src/management.c @@ -12,7 +12,9 @@ #include "management.h" #include "n2n.h" // for TRACE_DEBUG, traceEvent -#ifndef _WIN32 +#ifdef _WIN32 +#include "win32/defs.h" +#else #include // for getnameinfo, NI_NUMERICHOST, NI_NUMERICSERV #include // for sendto, sockaddr #endif diff --git a/src/n2n.c b/src/n2n.c index 938fbb176..5d48ebf22 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -35,9 +35,8 @@ #endif #ifdef _WIN32 -#include +#include "win32/defs.h" #include -#include #else #include // for inet_ntop #include // for addrinfo, freeaddrinfo, gai_strerror diff --git a/src/network_traffic_filter.c b/src/network_traffic_filter.c index ec840a011..04703cdc2 100644 --- a/src/network_traffic_filter.c +++ b/src/network_traffic_filter.c @@ -26,8 +26,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_DEL #ifdef _WIN32 -#include -#include +#include "win32/defs.h" #else #include // for inet_ntoa, inet_addr #include // for in_addr, in_addr_t, ntohs, ntohl diff --git a/src/sn_management.c b/src/sn_management.c index 7b3abe4e4..00f87736d 100644 --- a/src/sn_management.c +++ b/src/sn_management.c @@ -36,7 +36,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_COUNT #ifdef _WIN32 -#include +#include "win32/defs.h" #else #include // for sendto, socklen_t #endif diff --git a/src/sn_utils.c b/src/sn_utils.c index f6092fe4f..62ca05300 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -41,8 +41,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_DEL #ifdef _WIN32 -#include -#include +#include "win32/defs.h" #else #include // for inet_addr, inet_ntoa #include // for ntohl, in_addr_t, sockaddr_in, INADDR... diff --git a/src/supernode.c b/src/supernode.c index 8d39a4c06..831dbc08d 100644 --- a/src/supernode.c +++ b/src/supernode.c @@ -36,8 +36,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_ADD_STR #ifdef _WIN32 -#include -#include +#include "win32/defs.h" #else #include // for inet_addr #include // for ntohl, INADDR_ANY, INADDR_NONE, in_addr_t diff --git a/src/win32/defs.h b/src/win32/defs.h new file mode 100644 index 000000000..b2fd3bb6d --- /dev/null +++ b/src/win32/defs.h @@ -0,0 +1,27 @@ +/* + * Basic definitions needed for any windows compile + * + */ + +#ifndef _WIN32_DEFS_H_ +#define _WIN32_DEFS_H_ + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + +#define WIN32_LEAN_AND_MEAN + +#ifndef _WIN64 +/* needs to be defined before winsock gets included */ +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x501 + +const char *subst_inet_ntop (int, const void *, char *, int); +#define inet_ntop subst_inet_ntop +#endif + +#include +#include + +#endif diff --git a/src/win32/edge_utils_win32.c b/src/win32/edge_utils_win32.c index 1ce6f2167..d11057362 100644 --- a/src/win32/edge_utils_win32.c +++ b/src/win32/edge_utils_win32.c @@ -16,7 +16,7 @@ * */ -#include +#include "defs.h" #include #include "edge_utils_win32.h" @@ -28,7 +28,7 @@ * This function was not included in windows until after Windows XP */ -const char *inet_ntop (int af, const void *src, char *dst, socklen_t size) { +const char *subst_inet_ntop (int af, const void *src, char *dst, int size) { if(af == AF_INET) { struct sockaddr_in in; memset(&in, 0, sizeof(in)); diff --git a/src/win32/n2n_win32.h b/src/win32/n2n_win32.h index e1a0104b1..6d6d5ba80 100644 --- a/src/win32/n2n_win32.h +++ b/src/win32/n2n_win32.h @@ -7,21 +7,6 @@ #ifndef _N2N_WIN32_H_ #define _N2N_WIN32_H_ -#ifndef _CRT_SECURE_NO_WARNINGS -#define _CRT_SECURE_NO_WARNINGS -#endif - -#define WIN32_LEAN_AND_MEAN - -#if defined(__MINGW32__) -/* should be defined here and before winsock gets included */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x501 //Otherwise the linker doesnt find getaddrinfo -#endif /* #ifndef _WIN32_WINNT */ -#include -#endif /* #if defined(__MINGW32__) */ - - #include #include #include diff --git a/src/win32/wintap.c b/src/win32/wintap.c index 4b2aa037d..21ab977bf 100644 --- a/src/win32/wintap.c +++ b/src/win32/wintap.c @@ -2,8 +2,8 @@ (C) 2007-22 - Luca Deri */ +#include "defs.h" #ifndef _WIN64 -#include #include #endif diff --git a/src/wire.c b/src/wire.c index 995efe841..537ae1541 100644 --- a/src/wire.c +++ b/src/wire.c @@ -34,8 +34,7 @@ #include "n2n_wire.h" // for decode_PACKET, decode_PEER_INFO, decode_QUER... #ifdef _WIN32 -#include -#include +#include "win32/defs.h" #else #include // for sockaddr_in, sockaddr_in6, in6_addr, in_addr #include // for AF_INET, AF_INET6, SOCK_STREAM, SOCK_DGRAM From 7c107887f4cca7ee37fa7328d2a23f83247f6d4e Mon Sep 17 00:00:00 2001 From: shaxxx Date: Tue, 1 Aug 2023 12:00:51 +0200 Subject: [PATCH 61/82] Fix auto IP tracking --- src/sn_utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sn_utils.c b/src/sn_utils.c index 62ca05300..5f9e81e99 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -1145,6 +1145,9 @@ static int update_edge (n2n_sn_t *sss, /* Known */ if(auth_edge(&(scan->auth), &(reg->auth), answer_auth, comm) == 0) { if(!sock_equal(sender_sock, &(scan->sock))) { + scan->dev_addr.net_addr = reg->dev_addr.net_addr; + scan->dev_addr.net_bitlen = reg->dev_addr.net_bitlen; + memcpy((char*)scan->dev_desc, reg->dev_desc, N2N_DESC_SIZE); memcpy(&(scan->sock), sender_sock, sizeof(n2n_sock_t)); scan->socket_fd = socket_fd; scan->last_cookie = reg->cookie; From ecb869517e7637a60e4239686a6a3a4fec93874a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 12:48:36 +0100 Subject: [PATCH 62/82] Remove static definition from deb package builder --- packages/debian/configure.in | 2 -- packages/debian/debian/changelog.in | 2 +- packages/debian/debian/rules.in | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/debian/configure.in b/packages/debian/configure.in index e01e987d3..3bf94b0c8 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -39,10 +39,8 @@ if test "${with_edgex+set}" = set; then EXTN="mipsel" fi -APP=n2n DATE=`date -R` -AC_SUBST(APP) AC_SUBST(N2N_VERSION) AC_SUBST(EXTN) AC_SUBST(DATE) diff --git a/packages/debian/debian/changelog.in b/packages/debian/debian/changelog.in index 56695665f..c2271e883 100644 --- a/packages/debian/debian/changelog.in +++ b/packages/debian/debian/changelog.in @@ -1,4 +1,4 @@ -@APP@ (@N2N_VERSION@) table; urgency=high +n2n (@N2N_VERSION@) table; urgency=high * Last packaged version -- Luca Deri @DATE@ diff --git a/packages/debian/debian/rules.in b/packages/debian/debian/rules.in index 4e879b917..49685bb1a 100755 --- a/packages/debian/debian/rules.in +++ b/packages/debian/debian/rules.in @@ -12,7 +12,7 @@ # http://www.tin.org/bin/man.cgi?section=7&topic=debhelper # -package=@APP@ +package=n2n build: build-stamp build-stamp: From 3cb57e2a6ee8fff7e04358426f2c4832c90cfce3 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 12:48:56 +0100 Subject: [PATCH 63/82] Use dh_shlibdeps to calculate depends This may impact builds on Debian 8, but that version has been out of support for over three years. I didnt test it, but since using this helper is the preferred method it may actually help builds on older versions. --- packages/debian/configure.in | 8 -------- packages/debian/debian/control.in | 2 +- packages/debian/debian/rules.in | 1 + 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 3bf94b0c8..78e799a8f 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -5,13 +5,6 @@ AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X]) # NOTE: this file is not actually used. You need to edit configure as well! N2N_VERSION=$(../../scripts/version.sh) -DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l` - -EXTRA_DEP="" -if test $DEBIAN_VERSION = "0"; then -EXTRA_DEP=", libzstd1" -fi - if test "${EXTN+set}" != set; then MACHINE=`uname -m` SHORT_MACHINE=`echo $MACHINE | cut -b1-3` @@ -44,7 +37,6 @@ DATE=`date -R` AC_SUBST(N2N_VERSION) AC_SUBST(EXTN) AC_SUBST(DATE) -AC_SUBST(EXTRA_DEP) AC_CONFIG_FILES(debian/changelog) AC_CONFIG_FILES(debian/files) diff --git a/packages/debian/debian/control.in b/packages/debian/debian/control.in index 73031198b..780fded66 100644 --- a/packages/debian/debian/control.in +++ b/packages/debian/debian/control.in @@ -8,7 +8,7 @@ Build-Depends: Package: n2n Architecture: @EXTN@ Suggests: uml-utilities -Depends: ${shlibs:Depends}, ${misc:Depends} @EXTRA_DEP@ +Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: n2n (<< 2.1.0-1) Replaces: n2n (<< 2.1.0-1) Description: a layer-two peer-to-peer virtual private network (VPN) diff --git a/packages/debian/debian/rules.in b/packages/debian/debian/rules.in index 49685bb1a..b8368b633 100755 --- a/packages/debian/debian/rules.in +++ b/packages/debian/debian/rules.in @@ -50,6 +50,7 @@ binary-arch: build install cp -r ../etc debian/n2n find debian/n2n -name "*.in" -exec /bin/rm {} ';' find debian/n2n -name "*~" -exec /bin/rm {} ';' + dh_shlibdeps dh_link dh_gencontrol dh_md5sums From 0385d4fcbed4506de2aca975c2f5e3ee2e177523 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 13:15:23 +0100 Subject: [PATCH 64/82] Automatically generate debian changelog --- .github/workflows/tests.yml | 1 + .gitignore | 1 - packages/debian/Makefile.in | 1 + packages/debian/README | 2 +- packages/debian/configure.in | 4 ---- packages/debian/debian/changelog | 4 ++++ packages/debian/debian/changelog.in | 4 ---- 7 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 packages/debian/debian/changelog delete mode 100644 packages/debian/debian/changelog.in diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5ba54db62..0586b31f4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -410,6 +410,7 @@ jobs: run: | sudo apt-get update sudo apt-get install debhelper build-essential \ + devscripts \ crossbuild-essential-${{ matrix.arch }} - name: Configure diff --git a/.gitignore b/.gitignore index 4c2c448d2..8ce9c65c9 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,6 @@ build .idea .vscode .vs -packages/debian/debian/changelog packages/debian/debian/control packages/debian/debian/files packages/debian/debian/rules diff --git a/packages/debian/Makefile.in b/packages/debian/Makefile.in index 8b8b993f4..902718c55 100644 --- a/packages/debian/Makefile.in +++ b/packages/debian/Makefile.in @@ -19,6 +19,7 @@ pkg: install -m644 ../../community.list ${N2N_BUILD}/usr/share/doc/n2n/examples/ install -m644 ../../doc/*.md ${N2N_BUILD}/usr/share/doc/n2n/ @/bin/rm -f ../n2n*.deb + DEBEMAIL=builder@example.com dch -v @N2N_VERSION@ --no-auto-nmu Auto Build dpkg-buildpackage -rfakeroot -d -us -uc -a@EXTN@ -dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb @\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes diff --git a/packages/debian/README b/packages/debian/README index 915a7c152..f500d7f47 100644 --- a/packages/debian/README +++ b/packages/debian/README @@ -1,6 +1,6 @@ Prerequisites ------------- -apt-get install debhelper fakeroot dpkg-sig +apt-get install debhelper fakeroot dpkg-sig devscripts EdgeOS ------ diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 78e799a8f..9f1949659 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -32,13 +32,9 @@ if test "${with_edgex+set}" = set; then EXTN="mipsel" fi -DATE=`date -R` - AC_SUBST(N2N_VERSION) AC_SUBST(EXTN) -AC_SUBST(DATE) -AC_CONFIG_FILES(debian/changelog) AC_CONFIG_FILES(debian/files) AC_CONFIG_FILES(debian/control) AC_CONFIG_FILES(debian/rules) diff --git a/packages/debian/debian/changelog b/packages/debian/debian/changelog new file mode 100644 index 000000000..9861f54fc --- /dev/null +++ b/packages/debian/debian/changelog @@ -0,0 +1,4 @@ +n2n (3.0) table; urgency=high + * Last stable release + + -- Luca Deri Wed, 27 Oct 2021 20:43:08 +0200 diff --git a/packages/debian/debian/changelog.in b/packages/debian/debian/changelog.in deleted file mode 100644 index c2271e883..000000000 --- a/packages/debian/debian/changelog.in +++ /dev/null @@ -1,4 +0,0 @@ -n2n (@N2N_VERSION@) table; urgency=high - * Last packaged version - - -- Luca Deri @DATE@ From 50748f210afd52990649091f4a2fd1c8ae4f8954 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 13:20:43 +0100 Subject: [PATCH 65/82] Remove unneeded templating of debian/rules --- .gitignore | 1 - packages/debian/configure.in | 1 - packages/debian/debian/{rules.in => rules} | 0 3 files changed, 2 deletions(-) rename packages/debian/debian/{rules.in => rules} (100%) diff --git a/.gitignore b/.gitignore index 8ce9c65c9..4e4832a7b 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,6 @@ build .vs packages/debian/debian/control packages/debian/debian/files -packages/debian/debian/rules packages/etc/systemd/system/edge-ntopng@.service packages/etc/systemd/system/edge.service packages/etc/systemd/system/edge@.service diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 9f1949659..7086093f2 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -37,7 +37,6 @@ AC_SUBST(EXTN) AC_CONFIG_FILES(debian/files) AC_CONFIG_FILES(debian/control) -AC_CONFIG_FILES(debian/rules) AC_CONFIG_FILES(../etc/systemd/system/edge.service) AC_CONFIG_FILES(../etc/systemd/system/edge@.service) AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) diff --git a/packages/debian/debian/rules.in b/packages/debian/debian/rules similarity index 100% rename from packages/debian/debian/rules.in rename to packages/debian/debian/rules From c2f08642c0544e52664d21b67e24a36edb154f53 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 13:25:53 +0100 Subject: [PATCH 66/82] Remove unneeded templating of systemd units --- .gitignore | 4 ---- packages/debian/configure.in | 4 ---- .../system/{edge-ntopng@.service.in => edge-ntopng@.service} | 0 packages/etc/systemd/system/{edge.service.in => edge.service} | 0 .../etc/systemd/system/{edge@.service.in => edge@.service} | 0 .../system/{supernode.service.in => supernode.service} | 0 packages/rpm/configure.in | 4 ---- 7 files changed, 12 deletions(-) rename packages/etc/systemd/system/{edge-ntopng@.service.in => edge-ntopng@.service} (100%) rename packages/etc/systemd/system/{edge.service.in => edge.service} (100%) rename packages/etc/systemd/system/{edge@.service.in => edge@.service} (100%) rename packages/etc/systemd/system/{supernode.service.in => supernode.service} (100%) diff --git a/.gitignore b/.gitignore index 4e4832a7b..d2eade049 100644 --- a/.gitignore +++ b/.gitignore @@ -26,10 +26,6 @@ build .vs packages/debian/debian/control packages/debian/debian/files -packages/etc/systemd/system/edge-ntopng@.service -packages/etc/systemd/system/edge.service -packages/etc/systemd/system/edge@.service -packages/etc/systemd/system/supernode.service *dSYM* __pycache__ diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 7086093f2..1dbfef56a 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -37,9 +37,5 @@ AC_SUBST(EXTN) AC_CONFIG_FILES(debian/files) AC_CONFIG_FILES(debian/control) -AC_CONFIG_FILES(../etc/systemd/system/edge.service) -AC_CONFIG_FILES(../etc/systemd/system/edge@.service) -AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) -AC_CONFIG_FILES(../etc/systemd/system/supernode.service) AC_CONFIG_FILES(Makefile) AC_OUTPUT diff --git a/packages/etc/systemd/system/edge-ntopng@.service.in b/packages/etc/systemd/system/edge-ntopng@.service similarity index 100% rename from packages/etc/systemd/system/edge-ntopng@.service.in rename to packages/etc/systemd/system/edge-ntopng@.service diff --git a/packages/etc/systemd/system/edge.service.in b/packages/etc/systemd/system/edge.service similarity index 100% rename from packages/etc/systemd/system/edge.service.in rename to packages/etc/systemd/system/edge.service diff --git a/packages/etc/systemd/system/edge@.service.in b/packages/etc/systemd/system/edge@.service similarity index 100% rename from packages/etc/systemd/system/edge@.service.in rename to packages/etc/systemd/system/edge@.service diff --git a/packages/etc/systemd/system/supernode.service.in b/packages/etc/systemd/system/supernode.service similarity index 100% rename from packages/etc/systemd/system/supernode.service.in rename to packages/etc/systemd/system/supernode.service diff --git a/packages/rpm/configure.in b/packages/rpm/configure.in index e65d3c054..a10a389d9 100644 --- a/packages/rpm/configure.in +++ b/packages/rpm/configure.in @@ -48,9 +48,5 @@ AC_SUBST(DATE) AC_SUBST(RPM_SIGN_CMD) AC_CONFIG_FILES(n2n.spec) -AC_CONFIG_FILES(../etc/systemd/system/edge.service) -AC_CONFIG_FILES(../etc/systemd/system/edge@.service) -AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service) -AC_CONFIG_FILES(../etc/systemd/system/supernode.service) AC_CONFIG_FILES(Makefile) AC_OUTPUT From 1b862513fffd5299d6c116a9a7f3099e038e8f01 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 13:27:51 +0100 Subject: [PATCH 67/82] Regenerate packages configure scripts --- packages/debian/configure | 703 +++++++++++++++++++------------------- packages/rpm/configure | 678 ++++++++++++++++++------------------ 2 files changed, 706 insertions(+), 675 deletions(-) diff --git a/packages/debian/configure b/packages/debian/configure index b1048d9a0..a096a867c 100755 --- a/packages/debian/configure +++ b/packages/debian/configure @@ -1,9 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Makefile.in 1.0. +# Generated by GNU Autoconf 2.71 for Makefile.in 1.0. # # -# 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 @@ -14,14 +15,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 ;; #( @@ -31,46 +34,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 || @@ -79,13 +82,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 #(( @@ -94,8 +90,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 @@ -107,30 +107,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. @@ -152,20 +132,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 ;; #( @@ -185,41 +167,52 @@ 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" - 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 @@ -227,14 +220,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 @@ -252,18 +252,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 about your system, + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org 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." @@ -290,6 +291,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -307,6 +309,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 # ------------- @@ -321,7 +331,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" @@ -330,7 +340,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 @@ -369,12 +379,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 @@ -386,18 +397,27 @@ 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_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -409,9 +429,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 @@ -438,7 +458,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 @@ -482,7 +502,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 @@ -496,6 +516,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*) @@ -509,6 +533,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 @@ -583,11 +614,8 @@ PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS -EXTRA_DEP -DATE EXTN N2N_VERSION -APP target_alias host_alias build_alias @@ -703,8 +731,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 ;; @@ -745,9 +771,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" @@ -771,9 +797,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" @@ -984,9 +1010,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" @@ -1000,9 +1026,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" @@ -1046,9 +1072,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}" ;; @@ -1064,7 +1090,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 @@ -1128,7 +1154,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 @@ -1272,9 +1298,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/ ;; @@ -1302,7 +1328,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 @@ -1310,7 +1337,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 @@ -1320,9 +1347,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Makefile.in configure 1.0 -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 @@ -1332,14 +1359,34 @@ fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## +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 Makefile.in $as_me 1.0, 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 @@ -1372,8 +1419,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 @@ -1408,7 +1459,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'" ;; @@ -1443,11 +1494,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 @@ -1458,8 +1511,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) ;; #( @@ -1483,7 +1536,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -1491,14 +1544,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 @@ -1506,15 +1559,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 @@ -1522,8 +1575,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 && @@ -1537,63 +1590,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 @@ -1603,16 +1641,16 @@ 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 @@ -1626,12 +1664,12 @@ for ac_var in $ac_precious_vars; do 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;} + { 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) - { $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;} + { 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=: ;; ,);; *) @@ -1640,24 +1678,24 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} 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 @@ -1667,11 +1705,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. ## @@ -1687,7 +1726,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --with-edgex was given. -if test "${with_edgex+set}" = set; then : +if test ${with_edgex+y} +then : withval=$with_edgex; fi @@ -1695,13 +1735,6 @@ fi # NOTE: this file is not actually used. You need to edit configure as well! N2N_VERSION=$(../../scripts/version.sh) -DEBIAN_VERSION=`cat /etc/debian_version | grep "^8" | wc -l` - -EXTRA_DEP="" -if test $DEBIAN_VERSION = "0"; then -EXTRA_DEP=", libzstd1" -fi - if test "${EXTN+set}" != set; then MACHINE=`uname -m` SHORT_MACHINE=`echo $MACHINE | cut -b1-3` @@ -1729,31 +1762,13 @@ if test "${with_edgex+set}" = set; then EXTN="mipsel" fi -APP=n2n -DATE=`date -R` - - - - -ac_config_files="$ac_config_files debian/changelog" - ac_config_files="$ac_config_files debian/files" ac_config_files="$ac_config_files debian/control" -ac_config_files="$ac_config_files debian/rules" - -ac_config_files="$ac_config_files ../etc/systemd/system/edge.service" - -ac_config_files="$ac_config_files ../etc/systemd/system/edge@.service" - -ac_config_files="$ac_config_files ../etc/systemd/system/edge-ntopng@.service" - -ac_config_files="$ac_config_files ../etc/systemd/system/supernode.service" - ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -1783,8 +1798,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) ;; #( @@ -1814,15 +1829,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 @@ -1836,8 +1851,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 @@ -1890,7 +1905,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" @@ -1906,8 +1921,8 @@ LTLIBOBJS=$ac_ltlibobjs 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 @@ -1930,14 +1945,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 ;; #( @@ -1947,46 +1964,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 || @@ -1995,13 +2012,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 #(( @@ -2010,8 +2020,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 @@ -2023,30 +2037,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] @@ -2059,13 +2053,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. @@ -2092,18 +2087,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 @@ -2115,12 +2112,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` @@ -2151,7 +2149,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 @@ -2173,6 +2171,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*) @@ -2186,6 +2188,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 @@ -2227,7 +2235,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" @@ -2236,7 +2244,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 @@ -2299,7 +2307,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by Makefile.in $as_me 1.0, 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 @@ -2348,14 +2356,16 @@ $config_files Report bugs to the package provider." _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="\\ Makefile.in config.status 1.0 -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." @@ -2392,21 +2402,21 @@ 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'" ac_need_defaults=false;; --he | --h | --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=: ;; @@ -2434,7 +2444,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 "\$@" @@ -2448,7 +2458,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 @@ -2461,14 +2471,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "debian/changelog") CONFIG_FILES="$CONFIG_FILES debian/changelog" ;; "debian/files") CONFIG_FILES="$CONFIG_FILES debian/files" ;; "debian/control") CONFIG_FILES="$CONFIG_FILES debian/control" ;; - "debian/rules") CONFIG_FILES="$CONFIG_FILES debian/rules" ;; - "../etc/systemd/system/edge.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge.service" ;; - "../etc/systemd/system/edge@.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge@.service" ;; - "../etc/systemd/system/edge-ntopng@.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge-ntopng@.service" ;; - "../etc/systemd/system/supernode.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/supernode.service" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -2481,7 +2485,7 @@ 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_FILES+y} || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree @@ -2709,7 +2713,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 @@ -2717,17 +2721,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 @@ -2744,7 +2748,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 @@ -2768,9 +2772,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/ ;; @@ -2823,8 +2827,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=' @@ -2866,9 +2870,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" @@ -2915,7 +2919,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 + diff --git a/packages/rpm/configure b/packages/rpm/configure index dc8a37d68..d6e6f9728 100755 --- a/packages/rpm/configure +++ b/packages/rpm/configure @@ -1,9 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Makefile.in 1.0. +# Generated by GNU Autoconf 2.71 for Makefile.in 1.0. # # -# 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 @@ -14,14 +15,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 ;; #( @@ -31,46 +34,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 || @@ -79,13 +82,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 #(( @@ -94,8 +90,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 @@ -107,30 +107,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. @@ -152,20 +132,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 ;; #( @@ -185,41 +167,52 @@ 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" - 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 @@ -227,14 +220,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 @@ -252,18 +252,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 about your system, + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org 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." @@ -290,6 +291,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -307,6 +309,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 # ------------- @@ -321,7 +331,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" @@ -330,7 +340,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 @@ -369,12 +379,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 @@ -386,18 +397,27 @@ 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_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -409,9 +429,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 @@ -438,7 +458,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 @@ -482,7 +502,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 @@ -496,6 +516,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*) @@ -509,6 +533,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 @@ -703,8 +734,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 ;; @@ -745,9 +774,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" @@ -771,9 +800,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" @@ -984,9 +1013,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" @@ -1000,9 +1029,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" @@ -1046,9 +1075,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}" ;; @@ -1064,7 +1093,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 @@ -1128,7 +1157,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 @@ -1267,9 +1296,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/ ;; @@ -1297,7 +1326,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 @@ -1305,7 +1335,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 @@ -1315,9 +1345,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Makefile.in configure 1.0 -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 @@ -1327,14 +1357,34 @@ fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## +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 Makefile.in $as_me 1.0, 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 @@ -1367,8 +1417,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 @@ -1403,7 +1457,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'" ;; @@ -1438,11 +1492,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 @@ -1453,8 +1509,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) ;; #( @@ -1478,7 +1534,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -1486,14 +1542,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 @@ -1501,15 +1557,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 @@ -1517,8 +1573,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 && @@ -1532,63 +1588,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 @@ -1598,16 +1639,16 @@ 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 @@ -1621,12 +1662,12 @@ for ac_var in $ac_precious_vars; do 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;} + { 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) - { $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;} + { 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=: ;; ,);; *) @@ -1635,24 +1676,24 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} 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 @@ -1662,11 +1703,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. ## @@ -1729,14 +1771,6 @@ fi ac_config_files="$ac_config_files n2n.spec" -ac_config_files="$ac_config_files ../etc/systemd/system/edge.service" - -ac_config_files="$ac_config_files ../etc/systemd/system/edge@.service" - -ac_config_files="$ac_config_files ../etc/systemd/system/edge-ntopng@.service" - -ac_config_files="$ac_config_files ../etc/systemd/system/supernode.service" - ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -1766,8 +1800,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) ;; #( @@ -1797,15 +1831,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 @@ -1819,8 +1853,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 @@ -1873,7 +1907,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" @@ -1889,8 +1923,8 @@ LTLIBOBJS=$ac_ltlibobjs 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 @@ -1913,14 +1947,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 ;; #( @@ -1930,46 +1966,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 || @@ -1978,13 +2014,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 #(( @@ -1993,8 +2022,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 @@ -2006,30 +2039,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] @@ -2042,13 +2055,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. @@ -2075,18 +2089,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 @@ -2098,12 +2114,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` @@ -2134,7 +2151,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 @@ -2156,6 +2173,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*) @@ -2169,6 +2190,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 @@ -2210,7 +2237,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" @@ -2219,7 +2246,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 @@ -2282,7 +2309,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by Makefile.in $as_me 1.0, 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 @@ -2331,14 +2358,16 @@ $config_files Report bugs to the package provider." _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="\\ Makefile.in config.status 1.0 -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." @@ -2375,21 +2404,21 @@ 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'" ac_need_defaults=false;; --he | --h | --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=: ;; @@ -2417,7 +2446,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 "\$@" @@ -2431,7 +2460,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 @@ -2445,10 +2474,6 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "n2n.spec") CONFIG_FILES="$CONFIG_FILES n2n.spec" ;; - "../etc/systemd/system/edge.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge.service" ;; - "../etc/systemd/system/edge@.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge@.service" ;; - "../etc/systemd/system/edge-ntopng@.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge-ntopng@.service" ;; - "../etc/systemd/system/supernode.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/supernode.service" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; @@ -2461,7 +2486,7 @@ 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_FILES+y} || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree @@ -2689,7 +2714,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 @@ -2697,17 +2722,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 @@ -2724,7 +2749,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 @@ -2748,9 +2773,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/ ;; @@ -2803,8 +2828,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=' @@ -2846,9 +2871,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" @@ -2895,7 +2920,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 + From 231f4d9ed02d20e02c0c7994ad1dea41aa48b1f9 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 13:49:12 +0100 Subject: [PATCH 68/82] Remove unneeded debian/files - it is autogenerated --- packages/debian/configure.in | 1 - packages/debian/debian/files.in | 1 - 2 files changed, 2 deletions(-) delete mode 100644 packages/debian/debian/files.in diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 1dbfef56a..60986f047 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -35,7 +35,6 @@ fi AC_SUBST(N2N_VERSION) AC_SUBST(EXTN) -AC_CONFIG_FILES(debian/files) AC_CONFIG_FILES(debian/control) AC_CONFIG_FILES(Makefile) AC_OUTPUT diff --git a/packages/debian/debian/files.in b/packages/debian/debian/files.in deleted file mode 100644 index 510512c25..000000000 --- a/packages/debian/debian/files.in +++ /dev/null @@ -1 +0,0 @@ -n2n_@N2N_VERSION@_@EXTN@.deb free optional From f2597e8f4234fe8289a4203af704fd4cf90909ac Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 13:54:06 +0100 Subject: [PATCH 69/82] Install some packages for cross compiling --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0586b31f4..a5c432680 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -408,9 +408,11 @@ jobs: - name: Install packages needed for build run: | + sudo dpkg --add-architecture ${{ matrix.arch }} sudo apt-get update sudo apt-get install debhelper build-essential \ devscripts \ + libc6:${{ matrix.arch }} \ crossbuild-essential-${{ matrix.arch }} - name: Configure From cee0431a61f4cb0ab818131fc438034ebd6a4b6c Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 14:31:07 +0100 Subject: [PATCH 70/82] Work around ubuntu build environment TODO: - dont just ignore missing info, have something to fill it in even when the require arch binaries are missing --- .github/workflows/tests.yml | 2 -- packages/debian/debian/rules | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a5c432680..0586b31f4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -408,11 +408,9 @@ jobs: - name: Install packages needed for build run: | - sudo dpkg --add-architecture ${{ matrix.arch }} sudo apt-get update sudo apt-get install debhelper build-essential \ devscripts \ - libc6:${{ matrix.arch }} \ crossbuild-essential-${{ matrix.arch }} - name: Configure diff --git a/packages/debian/debian/rules b/packages/debian/debian/rules index b8368b633..391dfd47d 100755 --- a/packages/debian/debian/rules +++ b/packages/debian/debian/rules @@ -50,7 +50,7 @@ binary-arch: build install cp -r ../etc debian/n2n find debian/n2n -name "*.in" -exec /bin/rm {} ';' find debian/n2n -name "*~" -exec /bin/rm {} ';' - dh_shlibdeps + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info dh_link dh_gencontrol dh_md5sums From 9d4f68fce2d207bcfc5fbca7c0ed7d7db80f6267 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 15:05:42 +0100 Subject: [PATCH 71/82] Regenerate packages configure scripts --- packages/debian/configure | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/debian/configure b/packages/debian/configure index a096a867c..4d632b01f 100755 --- a/packages/debian/configure +++ b/packages/debian/configure @@ -1765,8 +1765,6 @@ fi -ac_config_files="$ac_config_files debian/files" - ac_config_files="$ac_config_files debian/control" ac_config_files="$ac_config_files Makefile" @@ -2471,7 +2469,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "debian/files") CONFIG_FILES="$CONFIG_FILES debian/files" ;; "debian/control") CONFIG_FILES="$CONFIG_FILES debian/control" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; From d7eff5313bddf31ee37539637fb9c39010a76e3e Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 15:34:17 +0100 Subject: [PATCH 72/82] Add a hack for the github builders --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0586b31f4..d4e66d6dd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -413,6 +413,10 @@ jobs: devscripts \ crossbuild-essential-${{ matrix.arch }} + - name: Hack dpkg-shlibdeps + run: | + echo '#!/bin/bash' | sudo tee /usr/bin/dpkg-shlibdeps + - name: Configure # The HOST_TRIPLET line is not easily foldable # yamllint disable rule:line-length From 018add0280b719a7c06461b50edf891a31264436 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 17:30:59 +0100 Subject: [PATCH 73/82] Use a simple debian/control Architecture By switching to the "any" architecture, we no longer need to template the debian/control file. This simply claims that the package can be built on any known debian arch - which we currently think is true - so it will help future portability. --- .gitignore | 1 - packages/debian/configure | 3 --- packages/debian/configure.in | 1 - packages/debian/debian/{control.in => control} | 2 +- 4 files changed, 1 insertion(+), 6 deletions(-) rename packages/debian/debian/{control.in => control} (97%) diff --git a/.gitignore b/.gitignore index d2eade049..38224e1f0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,6 @@ build .idea .vscode .vs -packages/debian/debian/control packages/debian/debian/files *dSYM* diff --git a/packages/debian/configure b/packages/debian/configure index 4d632b01f..38c2268bf 100755 --- a/packages/debian/configure +++ b/packages/debian/configure @@ -1765,8 +1765,6 @@ fi -ac_config_files="$ac_config_files debian/control" - ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -2469,7 +2467,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 for ac_config_target in $ac_config_targets do case $ac_config_target in - "debian/control") CONFIG_FILES="$CONFIG_FILES debian/control" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 60986f047..961be27e7 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -35,6 +35,5 @@ fi AC_SUBST(N2N_VERSION) AC_SUBST(EXTN) -AC_CONFIG_FILES(debian/control) AC_CONFIG_FILES(Makefile) AC_OUTPUT diff --git a/packages/debian/debian/control.in b/packages/debian/debian/control similarity index 97% rename from packages/debian/debian/control.in rename to packages/debian/debian/control index 780fded66..266a17c5a 100644 --- a/packages/debian/debian/control.in +++ b/packages/debian/debian/control @@ -6,7 +6,7 @@ Standards-Version: 4.6.0 Build-Depends: Package: n2n -Architecture: @EXTN@ +Architecture: any Suggests: uml-utilities Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: n2n (<< 2.1.0-1) From b0d742b3f5433ed20ce801eb86cc37f4537b4124 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Mon, 28 Aug 2023 17:53:18 +0100 Subject: [PATCH 74/82] Remove the need for autoconf in the debian package Continuing to try and simplify the build system, calculate the remaining two autoconf variables from the existing config.mak. For the moment, leave a configure and configure.ac file in place to allow any old build systems to continue to function without errors. --- .github/workflows/tests.yml | 2 - packages/debian/{Makefile.in => Makefile} | 11 +- packages/debian/configure | 2923 +-------------------- packages/debian/configure.ac | 3 + packages/debian/configure.in | 39 - 5 files changed, 15 insertions(+), 2963 deletions(-) rename packages/debian/{Makefile.in => Makefile} (74%) create mode 100644 packages/debian/configure.ac delete mode 100644 packages/debian/configure.in diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d4e66d6dd..59cebd58f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -425,8 +425,6 @@ jobs: HOST_TRIPLET=$(dpkg-architecture -a${{ matrix.arch }} -q DEB_HOST_GNU_TYPE) ./autogen.sh ./configure --host $HOST_TRIPLET - cd packages/debian/ - ./configure EXTN=${{ matrix.arch }} # yamllint enable rule:line-length - name: Build diff --git a/packages/debian/Makefile.in b/packages/debian/Makefile similarity index 74% rename from packages/debian/Makefile.in rename to packages/debian/Makefile index 902718c55..abbaf26c4 100644 --- a/packages/debian/Makefile.in +++ b/packages/debian/Makefile @@ -4,6 +4,13 @@ N2N_HOME=$(PWD)/../.. N2N_BUILD=${N2N_HOME}/packages/debian/n2n +include ${N2N_HOME}/config.mak + +# TODO: continue to untangle the version generation +# we either should not need to override the config.mak here or +# should never set the version in config.mak and always calculate it +PACKAGE_VERSION := $(shell ${N2N_HOME}/scripts/version.sh) + all: clean pkg pkg: @@ -19,8 +26,8 @@ pkg: install -m644 ../../community.list ${N2N_BUILD}/usr/share/doc/n2n/examples/ install -m644 ../../doc/*.md ${N2N_BUILD}/usr/share/doc/n2n/ @/bin/rm -f ../n2n*.deb - DEBEMAIL=builder@example.com dch -v @N2N_VERSION@ --no-auto-nmu Auto Build - dpkg-buildpackage -rfakeroot -d -us -uc -a@EXTN@ + DEBEMAIL=builder@example.com dch -v ${PACKAGE_VERSION} --no-auto-nmu Auto Build + dpkg-buildpackage -rfakeroot -d -us -uc --host-type ${CONFIG_HOST} -dpkg-sig --sign builder -k D1EB60BE ../n2n_*deb @\rm -f ../n2n_*dsc ../n2n_*.gz ../n2n_*changes @/bin/mv ../n2n_*deb . diff --git a/packages/debian/configure b/packages/debian/configure index 38c2268bf..530a8a022 100755 --- a/packages/debian/configure +++ b/packages/debian/configure @@ -1,2920 +1,3 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for Makefile.in 1.0. -# -# -# 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" - 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 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_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='Makefile.in' -PACKAGE_TARNAME='makefile-in' -PACKAGE_VERSION='1.0' -PACKAGE_STRING='Makefile.in 1.0' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' - -ac_subst_vars='LTLIBOBJS -LIBOBJS -EXTN -N2N_VERSION -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' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -with_edgex -' - ac_precious_vars='build_alias -host_alias -target_alias' - - -# 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 Makefile.in 1.0 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/makefile-in] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of Makefile.in 1.0:";; - esac - cat <<\_ACEOF - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-edgex Build for Ubiquity-X - -Report bugs to the package provider. -_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 -Makefile.in configure 1.0 -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_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 Makefile.in $as_me 1.0, 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 - -# 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 - - - - -# Check whether --with-edgex was given. -if test ${with_edgex+y} -then : - withval=$with_edgex; -fi - - -# NOTE: this file is not actually used. You need to edit configure as well! -N2N_VERSION=$(../../scripts/version.sh) - -if test "${EXTN+set}" != set; then - MACHINE=`uname -m` - SHORT_MACHINE=`echo $MACHINE | cut -b1-3` - - if test $MACHINE = "x86_64"; then - EXTN="amd64" - else - if test $SHORT_MACHINE = "aar"; then - EXTN="arm64" - else - if test $SHORT_MACHINE = "arm"; then - EXTN="armhf" - else - if test $SHORT_MACHINE = "mip"; then - EXTN="mips" - else - EXTN="i386" - fi - fi - fi - fi -fi - -if test "${with_edgex+set}" = set; then - EXTN="mipsel" -fi - - - - -ac_config_files="$ac_config_files 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}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.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 - - - -: "${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 Makefile.in $as_me 1.0, 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 - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_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 - -Configuration files: -$config_files - -Report bugs to the package provider." - -_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="\\ -Makefile.in config.status 1.0 -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' -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;; - --he | --h | --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 -_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 - "Makefile") CONFIG_FILES="$CONFIG_FILES 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 -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" - - -eval set X " :F $CONFIG_FILES " -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 - # - -_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 -$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 - ;; - - - - 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 - - +#!/bin/bash +# TODO: Remove this file before the next stable release +echo "This configure script is no longer needed, update your build system" diff --git a/packages/debian/configure.ac b/packages/debian/configure.ac new file mode 100644 index 000000000..2e3ae7364 --- /dev/null +++ b/packages/debian/configure.ac @@ -0,0 +1,3 @@ +AC_INIT([Makefile.in], 1.0) +# TODO: Remove this file before the next stable release +echo "This configure script is no longer needed, update your build system" diff --git a/packages/debian/configure.in b/packages/debian/configure.in deleted file mode 100644 index 961be27e7..000000000 --- a/packages/debian/configure.in +++ /dev/null @@ -1,39 +0,0 @@ -AC_INIT([Makefile.in], 1.0) - -AC_ARG_WITH(edgex, [ --with-edgex Build for Ubiquity-X]) - -# NOTE: this file is not actually used. You need to edit configure as well! -N2N_VERSION=$(../../scripts/version.sh) - -if test "${EXTN+set}" != set; then - MACHINE=`uname -m` - SHORT_MACHINE=`echo $MACHINE | cut -b1-3` - - if test $MACHINE = "x86_64"; then - EXTN="amd64" - else - if test $SHORT_MACHINE = "aar"; then - EXTN="arm64" - else - if test $SHORT_MACHINE = "arm"; then - EXTN="armhf" - else - if test $SHORT_MACHINE = "mip"; then - EXTN="mips" - else - EXTN="i386" - fi - fi - fi - fi -fi - -if test "${with_edgex+set}" = set; then - EXTN="mipsel" -fi - -AC_SUBST(N2N_VERSION) -AC_SUBST(EXTN) - -AC_CONFIG_FILES(Makefile) -AC_OUTPUT From cd7b3b46614875de5485ecc6de15cd8840b2fbb1 Mon Sep 17 00:00:00 2001 From: Luca Deri Date: Thu, 31 Aug 2023 08:19:34 +0200 Subject: [PATCH 75/82] Added prerequisite --- packages/debian/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/debian/Makefile b/packages/debian/Makefile index abbaf26c4..d458b3daa 100644 --- a/packages/debian/Makefile +++ b/packages/debian/Makefile @@ -1,6 +1,9 @@ # # Change it according to your setup # +# Prerequisite: apt-get install devscripts +# +# N2N_HOME=$(PWD)/../.. N2N_BUILD=${N2N_HOME}/packages/debian/n2n From 4f54649eeb13ee50a9799ac49680444f0759673f Mon Sep 17 00:00:00 2001 From: Alfredo Cardigliano Date: Thu, 19 Oct 2023 09:32:52 +0200 Subject: [PATCH 76/82] PR template --- .github/PULL_REQUEST_TEMPLATE.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..64cfff156 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +Please sign (check) the below before submitting the Pull Request: + +- [ ] I have signed the ntop Contributor License Agreement at https://github.com/ntop/legal/blob/main/individual-contributor-licence-agreement.md +- [ ] I have updated the documentation (in doc/) to reflect the changes made (if applicable) + +Link to the related [issue](https://github.com/ntop/n2n/issues): + + +Describe changes: + + From e9659e3b9a4aea2a10e0b465b9d5eeed7def8509 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 6 Sep 2023 09:00:23 +0100 Subject: [PATCH 77/82] Add a last_seen column to n2n-ctl with human readable values --- scripts/n2n-ctl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/n2n-ctl b/scripts/n2n-ctl index e389ecb48..c60c824d4 100755 --- a/scripts/n2n-ctl +++ b/scripts/n2n-ctl @@ -7,6 +7,7 @@ import argparse import socket import json import collections +import time class JsonUDP(): @@ -171,6 +172,24 @@ def str_table(rows, columns, orderby): return ''.join(result) +def num2timestr(seconds): + """Convert a number of seconds into a human time""" + days, seconds = divmod(seconds, (60*60*24)) + hours, seconds = divmod(seconds, (60*60)) + minutes, seconds = divmod(seconds, 60) + + r = [] + if days: + r += [f"{days}d"] + if hours: + r += [f"{hours}h"] + if minutes: + r += [f"{minutes}m"] + if seconds: + r += [f"{seconds}s"] + return "".join(r) + + def subcmd_show_supernodes(rpc, args): rows = rpc.read('supernodes') columns = [ @@ -179,8 +198,13 @@ def subcmd_show_supernodes(rpc, args): 'macaddr', 'sockaddr', 'uptime', + 'last_seen', ] + now = int(time.time()) + for row in rows: + row["last_seen"] = num2timestr(now - row["last_seen"]) + return str_table(rows, columns, args.orderby) @@ -192,8 +216,13 @@ def subcmd_show_edges(rpc, args): 'macaddr', 'sockaddr', 'desc', + 'last_seen', ] + now = int(time.time()) + for row in rows: + row["last_seen"] = num2timestr(now - row["last_seen"]) + return str_table(rows, columns, args.orderby) From 1a598fa43b9ae79a575eee9eea4689de9c074b05 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 6 Sep 2023 13:32:36 +0100 Subject: [PATCH 78/82] Ensure that we initialise the purgeability of peer structures when we allocate them --- src/edge_utils.c | 2 ++ src/n2n.c | 1 + 2 files changed, 3 insertions(+) diff --git a/src/edge_utils.c b/src/edge_utils.c index 9592e5146..4afdb64fa 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -683,6 +683,7 @@ static void register_with_new_peer (n2n_edge_t *eee, scan->sock = *peer; scan->timeout = eee->conf.register_interval; /* TODO: should correspond to the peer supernode registration timeout */ scan->last_valid_time_stamp = initial_time_stamp(); + scan->purgeable = true; if(via_multicast) scan->local = 1; @@ -1903,6 +1904,7 @@ static int check_query_peer_info (n2n_edge_t *eee, time_t now, n2n_mac_t mac) { scan->timeout = eee->conf.register_interval; /* TODO: should correspond to the peer supernode registration timeout */ scan->last_seen = now; /* Don't change this it marks the pending peer for removal. */ scan->last_valid_time_stamp = initial_time_stamp(); + scan->purgeable = true; HASH_ADD_PEER(eee->pending_peers, scan); } diff --git a/src/n2n.c b/src/n2n.c index 5d48ebf22..c4e31ebe6 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -528,6 +528,7 @@ struct peer_info* add_sn_to_list_by_mac_or_sock (struct peer_info **sn_list, n2n if(peer) { sn_selection_criterion_default(&(peer->selection_criterion)); peer->last_valid_time_stamp = initial_time_stamp(); + peer->purgeable = true; memcpy(&(peer->sock), sock, sizeof(n2n_sock_t)); memcpy(peer->mac_addr, mac, sizeof(n2n_mac_t)); HASH_ADD_PEER(*sn_list, peer); From beb14c8d70bfd0e151f772f8a452721864a3563e Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 6 Sep 2023 13:34:41 +0100 Subject: [PATCH 79/82] Dont treat bools as a magic number and simplify negated tests where possible --- src/edge_management.c | 2 +- src/n2n.c | 2 +- src/sn_management.c | 4 ++-- src/sn_utils.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/edge_management.c b/src/edge_management.c index 27d9ca986..2207066cc 100644 --- a/src/edge_management.c +++ b/src/edge_management.c @@ -607,7 +607,7 @@ void readFromMgmtSocket (n2n_edge_t *eee) { msg_len += snprintf((char *) (udp_buf + msg_len), (N2N_PKT_BUF_SIZE - msg_len), "%-19s %1s%1s | %-17s | %-21s | %-15s | %9s | %10s\n", peer->version, - (peer->purgeable == false) ? "l" : "", + (peer->purgeable) ? "" : "l", (peer == eee->curr_sn) ? (eee->sn_wait ? "." : "*" ) : "", is_null_mac(peer->mac_addr) ? "" : macaddr_str(mac_buf, peer->mac_addr), sock_to_cstr(sockbuf, &(peer->sock)), diff --git a/src/n2n.c b/src/n2n.c index c4e31ebe6..dc1622970 100644 --- a/src/n2n.c +++ b/src/n2n.c @@ -688,7 +688,7 @@ size_t clear_peer_list (struct peer_info ** peer_list) { size_t retval = 0; HASH_ITER(hh, *peer_list, scan, tmp) { - if (scan->purgeable == false && scan->ip_addr) { + if (!scan->purgeable && scan->ip_addr) { free(scan->ip_addr); } HASH_DEL(*peer_list, scan); diff --git a/src/sn_management.c b/src/sn_management.c index 00f87736d..62c199478 100644 --- a/src/sn_management.c +++ b/src/sn_management.c @@ -371,7 +371,7 @@ int process_mgmt (n2n_sn_t *sss, ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, "%s '%s'\n", - (community->is_federation) ? "FEDERATION" : ((community->purgeable == false) ? "FIXED NAME COMMUNITY" : "COMMUNITY"), + (community->is_federation) ? "FEDERATION" : ((community->purgeable) ? "COMMUNITY" : "FIXED NAME COMMUNITY"), (community->is_federation) ? "-/-" : community->community); sendto_mgmt(sss, sender_sock, sock_size, (const uint8_t *) resbuf, ressize); ressize = 0; @@ -382,7 +382,7 @@ int process_mgmt (n2n_sn_t *sss, ressize += snprintf(resbuf + ressize, N2N_SN_PKTBUF_SIZE - ressize, "%4u | %-19s | %-17s | %-21s %-3s | %-15s | %9s\n", ++num, - (peer->dev_addr.net_addr == 0) ? ((peer->purgeable == false) ? "-l" : "") : ip_subnet_to_str(ip_bit_str, &peer->dev_addr), + (peer->dev_addr.net_addr == 0) ? ((peer->purgeable) ? "" : "-l") : ip_subnet_to_str(ip_bit_str, &peer->dev_addr), (is_null_mac(peer->mac_addr)) ? "" : macaddr_str(mac_buf, peer->mac_addr), sock_to_cstr(sockbuf, &(peer->sock)), ((peer->socket_fd >= 0) && (peer->socket_fd != sss->sock)) ? "TCP" : "", diff --git a/src/sn_utils.c b/src/sn_utils.c index 5f9e81e99..13ac267ec 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -1483,7 +1483,7 @@ static int purge_expired_communities (n2n_sn_t *sss, } } - if((comm->edges == NULL) && (comm->purgeable == true)) { + if((comm->edges == NULL) && (comm->purgeable)) { traceEvent(TRACE_INFO, "purging idle community %s", comm->community); if(NULL != comm->header_encryption_ctx_static) { /* this should not happen as 'purgeable' and thus only communities w/o encrypted header here */ From c552db6443d39e4cd27f6d0b84467a4f35c6e43b Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 6 Sep 2023 13:38:18 +0100 Subject: [PATCH 80/82] Fix last seen edge case --- scripts/n2n-ctl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/n2n-ctl b/scripts/n2n-ctl index c60c824d4..17f6ef90b 100755 --- a/scripts/n2n-ctl +++ b/scripts/n2n-ctl @@ -174,6 +174,10 @@ def str_table(rows, columns, orderby): def num2timestr(seconds): """Convert a number of seconds into a human time""" + + if seconds == 0: + return "now" + days, seconds = divmod(seconds, (60*60*24)) hours, seconds = divmod(seconds, (60*60)) minutes, seconds = divmod(seconds, 60) From d2bafa716ded4f75e2d9af6ed86fe6cc12678155 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 16 Sep 2023 09:36:10 +0100 Subject: [PATCH 81/82] Fix API initialisation to actually ignore invalid packets or passwords --- src/edge_management.c | 5 ++++- src/management.c | 14 ++++++++------ src/management.h | 2 +- src/sn_management.c | 5 ++++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/edge_management.c b/src/edge_management.c index 2207066cc..7b4a82186 100644 --- a/src/edge_management.c +++ b/src/edge_management.c @@ -381,7 +381,10 @@ static void handleMgmtJson (mgmt_req_t *req, char *udp_buf, const int recvlen) { /* we reuse the buffer already on the stack for all our strings */ STRBUF_INIT(buf, udp_buf, N2N_SN_PKTBUF_SIZE); - mgmt_req_init2(req, buf, (char *)&cmdlinebuf); + if (!mgmt_req_init2(req, buf, (char *)&cmdlinebuf)) { + // if anything failed during init + return; + } if(req->type == N2N_MGMT_SUB) { int handler; diff --git a/src/management.c b/src/management.c index a36f084bc..1466d4728 100644 --- a/src/management.c +++ b/src/management.c @@ -210,7 +210,7 @@ int mgmt_auth (mgmt_req_t *req, char *auth) { /* * Handle the common and shred parts of the mgmt_req_t initialisation */ -void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { +bool mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { char *typechar; char *options; char *flagstr; @@ -226,7 +226,7 @@ void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { if(!typechar) { /* should not happen */ mgmt_error(req, buf, "notype"); - return; + return false; } if(*typechar == 'r') { req->type=N2N_MGMT_READ; @@ -236,20 +236,20 @@ void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { req->type=N2N_MGMT_SUB; } else { mgmt_error(req, buf, "badtype"); - return; + return false; } /* Extract the tag to use in all reply packets */ options = strtok(NULL, " \r\n"); if(!options) { mgmt_error(req, buf, "nooptions"); - return; + return false; } req->argv0 = strtok(NULL, " \r\n"); if(!req->argv0) { mgmt_error(req, buf, "nocmd"); - return; + return false; } /* @@ -281,6 +281,8 @@ void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline) { if(!mgmt_auth(req, auth)) { mgmt_error(req, buf, "badauth"); - return; + return false; } + + return true; } diff --git a/src/management.h b/src/management.h index 3377a983a..8bdc378f2 100644 --- a/src/management.h +++ b/src/management.h @@ -109,6 +109,6 @@ void mgmt_event_post2 (enum n2n_event_topic topic, int data0, void *data1, mgmt_ void mgmt_help_row (mgmt_req_t *req, strbuf_t *buf, char *cmd, char *help); void mgmt_help_events_row (mgmt_req_t *req, strbuf_t *buf, mgmt_req_t *sub, char *cmd, char *help); int mgmt_auth (mgmt_req_t *req, char *auth); -void mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline); +bool mgmt_req_init2 (mgmt_req_t *req, strbuf_t *buf, char *cmdline); #endif diff --git a/src/sn_management.c b/src/sn_management.c index 62c199478..bc580a35a 100644 --- a/src/sn_management.c +++ b/src/sn_management.c @@ -241,7 +241,10 @@ static void handleMgmtJson (mgmt_req_t *req, char *udp_buf, const int recvlen) { // xx STRBUF_INIT(buf, udp_buf, N2N_SN_PKTBUF_SIZE); - mgmt_req_init2(req, buf, (char *)&cmdlinebuf); + if (!mgmt_req_init2(req, buf, (char *)&cmdlinebuf)) { + // if anything failed during init + return; + } int handler; lookup_handler(handler, mgmt_handlers, req->argv0); From fff50a7d80728069ca101a262d1543d85ac5313f Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sat, 16 Sep 2023 10:00:43 +0100 Subject: [PATCH 82/82] Ensure the code style is kept --- src/edge_management.c | 2 +- src/sn_management.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/edge_management.c b/src/edge_management.c index 7b4a82186..b061fc1d9 100644 --- a/src/edge_management.c +++ b/src/edge_management.c @@ -381,7 +381,7 @@ static void handleMgmtJson (mgmt_req_t *req, char *udp_buf, const int recvlen) { /* we reuse the buffer already on the stack for all our strings */ STRBUF_INIT(buf, udp_buf, N2N_SN_PKTBUF_SIZE); - if (!mgmt_req_init2(req, buf, (char *)&cmdlinebuf)) { + if(!mgmt_req_init2(req, buf, (char *)&cmdlinebuf)) { // if anything failed during init return; } diff --git a/src/sn_management.c b/src/sn_management.c index bc580a35a..88946d9f5 100644 --- a/src/sn_management.c +++ b/src/sn_management.c @@ -241,7 +241,7 @@ static void handleMgmtJson (mgmt_req_t *req, char *udp_buf, const int recvlen) { // xx STRBUF_INIT(buf, udp_buf, N2N_SN_PKTBUF_SIZE); - if (!mgmt_req_init2(req, buf, (char *)&cmdlinebuf)) { + if(!mgmt_req_init2(req, buf, (char *)&cmdlinebuf)) { // if anything failed during init return; }