Get rid of configure.seed as it comes with some disadvantages. (#1328)

* using Autotools best-practices to achieve (hopefully) the same result

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
Toni
2021-10-10 13:13:52 +02:00
committed by GitHub
parent 6ff67b5043
commit cf931fda6b
4 changed files with 54 additions and 82 deletions
+20 -26
View File
@@ -139,6 +139,7 @@ jobs:
if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64') if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64')
run: | run: |
brew install autoconf automake libtool pkg-config gettext json-c brew install autoconf automake libtool pkg-config gettext json-c
brew install coreutils
- name: Install MacOS Prerequisites (libgcrypt) - name: Install MacOS Prerequisites (libgcrypt)
if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64') && !startsWith(matrix.gcrypt, '--disable-gcrypt') if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64') && !startsWith(matrix.gcrypt, '--disable-gcrypt')
run: | run: |
@@ -171,11 +172,13 @@ jobs:
if: startsWith(matrix.arch, 'x86_64') if: startsWith(matrix.arch, 'x86_64')
run: | run: |
make all make all
cd example make -C example ndpiSimpleIntegration
make ndpiSimpleIntegration make -C python
cd ../python - name: Install nDPI
make if: startsWith(matrix.arch, 'x86_64')
cd .. run: |
make install DESTDIR=$(realpath _install)
ls -alhHR _install
- name: Test nDPI [DIFF] - name: Test nDPI [DIFF]
if: startsWith(matrix.arch, 'x86_64') if: startsWith(matrix.arch, 'x86_64')
run: | run: |
@@ -215,13 +218,10 @@ jobs:
apt-get -y install git autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev libgcrypt20-dev libpcre3-dev libmaxminddb-dev && apt-get -y install git autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev libgcrypt20-dev libpcre3-dev libmaxminddb-dev &&
env CC=gcc CFLAGS='-Werror' ./autogen.sh --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} && env CC=gcc CFLAGS='-Werror' ./autogen.sh --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} &&
make all && make all &&
cd example && make -C example ndpiSimpleIntegration &&
make ndpiSimpleIntegration && make -C python &&
cd ../python && ./tests/do.sh &&
make && ./tests/do-unit.sh
cd ../tests &&
./do.sh &&
./do-unit.sh
" "
- name: Display qemu specified architecture (armhf - little endian) - name: Display qemu specified architecture (armhf - little endian)
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'armhf') if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'armhf')
@@ -242,13 +242,10 @@ jobs:
apt-get -y install git autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev libgcrypt20-dev libpcre3-dev libmaxminddb-dev && apt-get -y install git autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev libgcrypt20-dev libpcre3-dev libmaxminddb-dev &&
env CC=gcc CFLAGS='-Werror' ./autogen.sh --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} && env CC=gcc CFLAGS='-Werror' ./autogen.sh --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} &&
make all && make all &&
cd example && make -C example ndpiSimpleIntegration &&
make ndpiSimpleIntegration && make -C python &&
cd ../python && ./tests/do.sh &&
make && ./tests/do-unit.sh
cd ../tests &&
./do.sh &&
./do-unit.sh
" "
- name: Display qemu specified architecture (s390x - big endian) - name: Display qemu specified architecture (s390x - big endian)
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 's390x') if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 's390x')
@@ -269,11 +266,8 @@ jobs:
apt-get -y install git autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev libgcrypt20-dev libpcre3-dev libmaxminddb-dev && apt-get -y install git autoconf automake libtool pkg-config gettext libjson-c-dev flex bison libpcap-dev libgcrypt20-dev libpcre3-dev libmaxminddb-dev &&
env CC=gcc CFLAGS='-Werror' ./autogen.sh --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} && env CC=gcc CFLAGS='-Werror' ./autogen.sh --enable-debug-messages ${{ matrix.gcrypt }} ${{ matrix.msan }} ${{ matrix.pcre }} ${{ matrix.maxminddb }} &&
make all && make all &&
cd example && make -C example ndpiSimpleIntegration &&
make ndpiSimpleIntegration && make -C python &&
cd ../python && ./tests/do.sh &&
make && ./tests/do-unit.sh
cd ../tests &&
./do.sh &&
./do-unit.sh
" "
-1
View File
@@ -11,7 +11,6 @@ compile
/config.status /config.status
/config.sub /config.sub
/configure /configure
/configure.ac
/configure.tmp /configure.tmp
.cproject .cproject
/depcomp /depcomp
-21
View File
@@ -1,10 +1,5 @@
#!/bin/sh #!/bin/sh
NDPI_MAJOR="4"
NDPI_MINOR="1"
NDPI_PATCH="0"
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
rm -f configure config.h config.h.in rm -f configure config.h config.h.in
AUTOCONF=$(command -v autoconf) AUTOCONF=$(command -v autoconf)
@@ -13,16 +8,10 @@ LIBTOOL=$(command -v libtool)
LIBTOOLIZE=$(command -v libtoolize) LIBTOOLIZE=$(command -v libtoolize)
AUTORECONF=$(command -v autoreconf) AUTORECONF=$(command -v autoreconf)
PKG_CONFIG=$(command -v pkg-config) PKG_CONFIG=$(command -v pkg-config)
FUZZY=
if test -z $AUTOCONF; then if test -z $AUTOCONF; then
echo "autoconf is missing: please install it and try again" echo "autoconf is missing: please install it and try again"
exit exit
else
V=`autoconf --version | head -1 | cut -d ' ' -f 4`
if [ "$V" = '2.63' ]; then
FUZZY="dnl> "
fi
fi fi
if test -z $AUTOMAKE; then if test -z $AUTOMAKE; then
@@ -45,17 +34,7 @@ if test -z $PKG_CONFIG; then
exit exit
fi fi
cat configure.seed | sed \
-e "s/@NDPI_MAJOR@/$NDPI_MAJOR/g" \
-e "s/@NDPI_MINOR@/$NDPI_MINOR/g" \
-e "s/@NDPI_PATCH@/$NDPI_PATCH/g" \
-e "s/@NDPI_VERSION_SHORT@/$NDPI_VERSION_SHORT/g" \
-e "s/@FUZZY@/$FUZZY/g" \
> configure.ac
autoreconf -ivf autoreconf -ivf
cat configure | sed "s/#define PACKAGE/#define NDPI_PACKAGE/g" | sed "s/#define VERSION/#define NDPI_VERSION/g" > configure.tmp
cat configure.tmp > configure
echo "./configure $@" echo "./configure $@"
chmod +x configure chmod +x configure
+34 -34
View File
@@ -1,4 +1,4 @@
AC_INIT([libndpi], [@NDPI_VERSION_SHORT@]) AC_INIT([libndpi], [4.1.0])
AC_CONFIG_AUX_DIR([.]) AC_CONFIG_AUX_DIR([.])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
@@ -43,10 +43,10 @@ dnl> AC_PROG_CC
fi fi
AC_LANG_WERROR AC_LANG_WERROR
NDPI_VERSION_SHORT="@NDPI_VERSION_SHORT@" NDPI_MAJOR=`echo "${PACKAGE_VERSION}" | cut -d . -f 1`
NDPI_MAJOR="@NDPI_MAJOR@" NDPI_MINOR=`echo "${PACKAGE_VERSION}" | cut -d . -f 2`
NDPI_MINOR="@NDPI_MINOR@" NDPI_PATCH=`echo "${PACKAGE_VERSION}" | cut -d . -f 3`
NDPI_PATCH="@NDPI_PATCH@" NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
AC_DEFINE_UNQUOTED(NDPI_MAJOR_RELEASE, "${NDPI_MAJOR}", [nDPI major release]) AC_DEFINE_UNQUOTED(NDPI_MAJOR_RELEASE, "${NDPI_MAJOR}", [nDPI major release])
AC_DEFINE_UNQUOTED(NDPI_MINOR_RELEASE, "${NDPI_MINOR}", [nDPI minor release]) AC_DEFINE_UNQUOTED(NDPI_MINOR_RELEASE, "${NDPI_MINOR}", [nDPI minor release])
@@ -185,35 +185,35 @@ AC_ARG_ENABLE([debug-messages],
AS_HELP_STRING([--enable-debug-messages], [Define NDPI_ENABLE_DEBUG_MESSAGES=1]), [ AS_HELP_STRING([--enable-debug-messages], [Define NDPI_ENABLE_DEBUG_MESSAGES=1]), [
AC_DEFINE(NDPI_ENABLE_DEBUG_MESSAGES, 1, [Enable ndpi_debug_messages]) ]) AC_DEFINE(NDPI_ENABLE_DEBUG_MESSAGES, 1, [Enable ndpi_debug_messages]) ])
@FUZZY@ AS_IF([test "x$enable_fuzztargets" = "xyes"], [ AS_IF([test "x$enable_fuzztargets" = "xyes"], [
@FUZZY@ AC_PROG_CXX AC_PROG_CXX
@FUZZY@ AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
@FUZZY@ tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS
@FUZZY@ AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer],, AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer],,
@FUZZY@ [AC_MSG_ERROR([--enable-fuzztargets requires -fsanitize=fuzzer which is only supported by LLVM])], [AC_MSG_ERROR([--enable-fuzztargets requires -fsanitize=fuzzer which is only supported by LLVM])],
@FUZZY@ [-Werror]) [-Werror])
@FUZZY@ AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [ AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [
@FUZZY@ LIB_FUZZING_ENGINE=-fsanitize=fuzzer LIB_FUZZING_ENGINE=-fsanitize=fuzzer
@FUZZY@ AC_SUBST(LIB_FUZZING_ENGINE) AC_SUBST(LIB_FUZZING_ENGINE)
@FUZZY@ ]) ])
@FUZZY@ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE" _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE"
@FUZZY@ AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE]) AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE])
@FUZZY@ AC_LINK_IFELSE([AC_LANG_SOURCE([[ AC_LINK_IFELSE([AC_LANG_SOURCE([[
@FUZZY@ #include <sys/types.h> #include <sys/types.h>
@FUZZY@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size); extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size);
@FUZZY@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) { extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) {
@FUZZY@ (void)Data; (void)Data;
@FUZZY@ (void)Size; (void)Size;
@FUZZY@ return 0; return 0;
@FUZZY@ } }
@FUZZY@ ]])], ]])],
@FUZZY@ [ AC_MSG_RESULT(yes) [ AC_MSG_RESULT(yes)
@FUZZY@ has_sanitizefuzzer=yes], has_sanitizefuzzer=yes],
@FUZZY@ [ AC_MSG_RESULT(no) ] [ AC_MSG_RESULT(no) ]
@FUZZY@ ) )
@FUZZY@ _AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags _AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
@FUZZY@ AC_LANG_POP() AC_LANG_POP()
@FUZZY@ ]) ])
AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"]) AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np])) AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))