From 8ac3f324acfab33841efdba01187e19892c324f4 Mon Sep 17 00:00:00 2001 From: ng0 Date: Thu, 21 Nov 2019 14:33:38 +0000 Subject: gnunet-bugreport: fix compiling tests, add usage with -h --- contrib/scripts/gnunet-bugreport | 67 ++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 19 deletions(-) (limited to 'contrib') diff --git a/contrib/scripts/gnunet-bugreport b/contrib/scripts/gnunet-bugreport index 5f090a350..f6a28fded 100755 --- a/contrib/scripts/gnunet-bugreport +++ b/contrib/scripts/gnunet-bugreport @@ -230,7 +230,7 @@ gnunet010x_check() TEST=`$WHICH gnunet-arm | grep -v "not found" 2>/dev/null` if test -n "$TEST"; then VER=`gnunet-arm -v | sed -e "s/v//" 2>/dev/null | awk '{print $2}'` - VER9=`echo $VER | grep ^0\.10\.` + VER10=`echo $VER | grep ^0\.10\.` if test -n "$VER10"; then warningmsg "GNUnet 0.10 : $VER" else @@ -470,8 +470,9 @@ gnurl_check() libmicrohttpd_check() { - TMPFILE=`mktemp /tmp/mhd-version-testXXXXXX` - cat - >$TMPFILE.c <$TMPFILE < #include int main() @@ -480,17 +481,24 @@ int main() return 0; } EOF - VER="Not found" - gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && VER=`$TMPFILE` - cc -o $TMPFILE $TMPFILE.c 2> /dev/null && VER=`$TMPFILE` - rm -f $TMPFILE $TMPFILE.bin + if test -x `$WHICH gcc | awk '{print $NF}'`; then + gcc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin "$TMPFILE" + VER=`./"$TMPFILE".bin` + elif test -x `$WHICH cc | awk '{print $NF}'`; then + cc $CPPFLAGS $CFLAGS -o $TMPFILE.bin $TMPFILE + VER=`./$TMPFILE.bin` + else + VER="Not found" + fi infomsg "libmicrohttpd : $VER" + rm -f $TMPFILE.c $TMPFILE $TMPFILE.bin } glpk_check() { - TMPFILE=`mktemp /tmp/glpk-version-testXXXXXX` - cat - >$TMPFILE.c <$TMPFILE < #include int main() @@ -499,17 +507,24 @@ int main() return 0; } EOF - VER="Not found" - gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && VER=`$TMPFILE` - cc -o $TMPFILE $TMPFILE.c 2> /dev/null && VER=`$TMPFILE` - rm -f $TMPFILE $TMPFILE.bin + if test -x `$WHICH gcc | awk '{print $NF}'`; then + gcc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin $TMPFILE + VER=`./$TMPFILE.bin` + elif test -x `$WHICH cc | awk '{print $NF}'`; then + cc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin $TMPFILE + VER=`./"$TMPFILE".bin` + else + VER="Not found" + fi infomsg "GNU GLPK : $VER" + rm -f $TMPFILE.c $TMPFILE $TMPFILE.bin } gnutls_check() { - TMPFILE=`mktemp /tmp/gnutls-version-testXXXXXX` - cat - >$TMPFILE.c <$TMPFILE < #include int main() @@ -518,15 +533,29 @@ int main() return 0; } EOF - VER="Not found" - gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && VER=`$TMPFILE` - cc -o $TMPFILE $TMPFILE.c 2> /dev/null && VER=`$TMPFILE` - rm -f $TMPFILE $TMPFILE.bin + if test -x `$WHICH gcc | awk '{print $NF}'`; then + gcc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin $TMPFILE + VER=`./"$TMPFILE".bin` + elif test -x `$WHICH cc | awk '{print $NF}'`; then + cc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin $TMPFILE + VER=`./"$TMPFILE".bin` + else + VER="Not found" + fi infomsg "GnuTLS : $VER" + rm -f $TMPFILE.c $TMPFILE $TMPFILE.bin } main() { + if test -n "$1" -a "$1" = "-h"; then + echo "Usage: ${progname} [-h]" + echo "If CPPFLAGS and LDFLAGS are unset, try:" + echo "CPPFLAGS='-I/usr/pkg/include' LDFLAGS='-L/usr/pkg/lib' ${progname}" + return 0 + fi + echo $LDFLAGS + echo $CPPFLAGS infomsg "${progname} 0.11.0" infomsg infomsg "Please submit the following" -- cgit v1.2.3