From 172540a4a29fa4c0c5f0431bb5bf5b3d08ec92c0 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Fri, 8 Feb 2019 05:13:11 +0000 Subject: New upstream version 0.17 --- configure | 305 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100755 configure (limited to 'configure') diff --git a/configure b/configure new file mode 100755 index 0000000..43a79ff --- /dev/null +++ b/configure @@ -0,0 +1,305 @@ +#!/bin/sh +# +# This file was generated by confgen version 2. +# Do not edit. +# + +PREFIX='/usr' +#EXECPREFIX='$PREFIX' +INSTALLROOT='' +BINMODE='755' +#DAEMONMODE='$BINMODE' +MANMODE='644' + +while [ x$1 != x ]; do case $1 in + + --help) + cat < __conftest.c + int main() { int class=0; return class; } +EOF + +if [ x"$CC" = x ]; then + echo -n 'Looking for a C compiler... ' + for TRY in egcs gcc g++ CC c++ cc; do + ( + $TRY __conftest.c -o __conftest || exit 1; + ./__conftest || exit 1; + ) >/dev/null 2>&1 || continue; + CC=$TRY + break; + done + if [ x"$CC" = x ]; then + echo 'failed.' + echo 'Cannot find a C compiler. Run configure with --with-c-compiler.' + rm -f __conftest* + exit + fi + echo "$CC" +else + echo -n 'Checking if C compiler works... ' + if ( + $CC __conftest.c -o __conftest || exit 1 + ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'yes' + else + echo 'no' + echo 'Compiler '"$CC"' does not exist or cannot compile C; try another.' + rm -f __conftest* + exit + fi +fi + +echo -n "Checking if $CC accepts gcc warnings... " +if ( + $CC $WARNINGS __conftest.c -o __conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'yes' + CC_WARNINGS=1 +else + echo 'no' +fi + +if [ x$DEBUG = x ]; then + echo -n "Checking if $CC accepts -O2... " + if ( + $CC -O2 __conftest.c -o __conftest + ) >/dev/null 2>&1; then + echo 'yes' + CFLAGS="$CFLAGS -O2" + else + echo 'no' + echo -n "Checking if $CC accepts -O... " + if ( + $CC -O __conftest.c -o __conftest + ) >/dev/null 2>&1; then + echo 'yes' + CFLAGS="$CFLAGS -O" + else + echo 'no' + fi + fi + +else + echo -n "Checking if $CC accepts -g... " + if ( + $CC -g __conftest.c -o __conftest + ) >/dev/null 2>&1; then + echo 'yes' + CFLAGS="$CFLAGS -g" + else + echo 'no' + fi + +fi + +LDFLAGS= +LIBS= + +rm -f __conftest* + +################################################## + +echo -n 'Checking for socklen_t... ' +cat <__conftest.c +#include +#include +#include +int main() { + struct sockaddr_in sn; + socklen_t len = sizeof(sn); + getpeername(0, (struct sockaddr *)&sn, &len); + return 0; +} + +EOF +if ( + $CC $CFLAGS __conftest.c -o __conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'yes' +else + if ( + $CC $CFLAGS -Dsocklen_t=int __conftest.c -o __conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'int' + CFLAGS="$CFLAGS -Dsocklen_t=int" + else + if ( + $CC $CFLAGS -Dsocklen_t=size_t __conftest.c -o __conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'size_t' + CFLAGS="$CFLAGS -Dsocklen_t=size_t" + else + echo 'no' + echo 'Cannot work out what to use for socklen_t. Help...' + rm -f __conftest* + exit + fi + fi +fi +rm -f __conftest* + +################################################## + +echo -n 'Checking for snprintf declaration... ' +cat <__conftest.c +#include +int main() { + void *x = (void *)snprintf; + printf("%lx", (long)x); + return 0; +} + +EOF +if ( + $CC $CFLAGS __conftest.c -o __conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'ok' +else + if ( + $CC $CFLAGS -D_GNU_SOURCE __conftest.c -o __conftest || exit 1 + ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo '-D_GNU_SOURCE' + CFLAGS="$CFLAGS -D_GNU_SOURCE" + else + echo 'manual' + CFLAGS="$CFLAGS -DDECLARE_SNPRINTF" + fi +fi +rm -f __conftest* + +echo -n 'Checking for snprintf implementation... ' +cat <__conftest.c +#include +#include +#ifdef DECLARE_SNPRINTF +#ifdef __cplusplus +extern "C" +#endif /*__cplusplus*/ +int snprintf(char *, int, const char *, ...); +#endif /*DECLARE_SNPRINTF*/ +int main() { + char buf[32]; + snprintf(buf, 8, "%s", "1234567890"); + if (strlen(buf)!=7) return 1; + return 0; +} + +EOF +if ( + $CC $CFLAGS __conftest.c $LIBBSD -o __conftest || exit 1 + ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo 'ok' +else + if ( + $CC $CFLAGS __conftest.c -lsnprintf $LIBBSD -o __conftest || exit 1 + ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo '-lsnprintf' + LIBS="$LIBS -lsnprintf" + else + if ( + $CC $CFLAGS __conftest.c -ldb $LIBBSD -o __conftest || exit 1 + ./__conftest || exit 1 + ) >/dev/null 2>&1; then + echo '-ldb' + LIBS="$LIBS -ldb" + else + echo 'missing' + echo 'This package requires snprintf.' + rm -f __conftest* + exit + fi + fi +fi +rm -f __conftest* + +################################################## + +## libbsd should go last in case it's broken +if [ "x$LIBBSD" != x ]; then + LIBS="$LIBS $LIBBSD" +fi + +echo 'Generating MCONFIG...' +( + echo -n '# Generated by configure (confgen version 2) on ' + date + echo '#' + echo + + echo "BINDIR=$BINDIR" + echo "SBINDIR=$SBINDIR" + echo "MANDIR=$MANDIR" + echo "BINMODE=$BINMODE" + echo "DAEMONMODE=$DAEMONMODE" + echo "MANMODE=$MANMODE" + echo "PREFIX=$PREFIX" + echo "EXECPREFIX=$EXECPREFIX" + echo "INSTALLROOT=$INSTALLROOT" + echo "CC=$CC" + if [ x$CC_WARNINGS != x ]; then + CFLAGS="$CFLAGS $WARNINGS" + fi + + echo "CFLAGS=$CFLAGS" | sed 's/= */=/' + echo "LDFLAGS=$LDFLAGS" | sed 's/= */=/' + echo "LIBS=$LIBS" | sed 's/= */=/' + +) > MCONFIG + -- cgit v1.2.3