#!/bin/sh
+progname=${0##*/}
+
+statusmsg()
+{
+ echo " $@"
+}
+
+infomsg()
+{
+ statusmsg "INFO: $@"
+}
+
+warningmsg()
+{
+ statusmsg "WARNING: $@"
+}
+
+errormsg()
+{
+ statusmsg "ERROR: $@"
+}
+
+linemsg()
+{
+ statusmsg "========================================="
+}
+
+# It is okay to assume which(1) here because we provide
+# more than 1 fallback.
TEST=`type type|grep not`
if test -n "$TEST"; then
WHICH=which
WHICH=type
fi
-echo "Please submit the following information with your bug report: "
-echo "--------------------------------------------------------------"
-OS=`uname -s 2>/dev/null`
-echo "OS : $OS"
-REL=`uname -r 2>/dev/null`
-echo "OS RELEASE : $REL"
-HW=`uname -m 2>/dev/null`
-echo "HARDWARE : $HW"
+os_check()
+{
+ OS=`uname -s 2>/dev/null`
+ infomsg "OS : $OS"
+ REL=`uname -r 2>/dev/null`
+ infomsg "OS RELEASE : $REL"
+ HW=`uname -m 2>/dev/null`
+ infomsg "HARDWARE : $HW"
+}
-TEST=`$WHICH gcc 2>/dev/null`
-if test -n "$TEST"; then
- VERS=`gcc --version 2>/dev/null | head -n 1`
- echo "gcc : $VERS"
-else
- echo "gcc : Not Found";
-fi
+# We shouldn't use awk to test for awk... but if
+# awk isn't there it can't be found.
+awk_check()
+{
+ if test -n "`awk 2>&1 | tail -1 | awk '{print $1}'`"; then
+ infomsg "awk : Found"
+ else
+ warningmsg "awk : Not found!"
+ fi
+}
-TEST=`$WHICH cc 2>/dev/null`
-if test -n "$TEST"; then
- VERS=`cc --version 2>/dev/null | head -n 1`
- echo "cc : $VERS"
-else
- echo "cc : Not Found";
-fi
+gcc_check()
+{
+ TEST=`$WHICH gcc 2>/dev/null`
+ if test -n "$TEST"; then
+ VERS=`gcc --version 2>/dev/null | head -n 1`
+ infomsg "gcc : $VERS"
+ # The elif will work in bourne shells, no other shells tested.
+ elif test -n "`gcc 2>&1 | tail -1 | awk '{print $1}'`"; then
+ VERS=`gcc --version 2>/dev/null | head -n 1`
+ infomsg "gcc : $VERS"
+ else
+ warningmsg "gcc : Not Found";
+ fi
+}
-TEST=`$WHICH c++ 2>/dev/null`
-if test -n "$TEST"; then
- VERS=`c++ --version 2>/dev/null | head -n 1`
- echo "c++ : $VERS"
-else
- echo "c++ : Not Found";
-fi
+cc_check()
+{
+ TEST=`$WHICH cc 2>/dev/null`
+ if test -n "$TEST"; then
+ VERS=`cc --version 2>/dev/null | head -n 1`
+ infomsg "cc : $VERS"
+ else
+ warningmsg "cc : Not Found";
+ fi
+}
-TEST=`$WHICH gmake 2>/dev/null`
-if test -n "$TEST" ; then
- gmake --version 2>/dev/null |\
- awk -F, '{print $1}' |\
- awk '/GNU Make/{print "GNU gmake :",$NF}'
-else
- TEST=`make --version 2>/dev/null`
- if test -n "$TEST"; then
- make --version 2>/dev/null |\
- awk -F, '{print $1}' |\
- awk '/GNU Make/{print "make :",$NF}'
- else
- echo "make : Not Found"
- fi
-fi
+cplusplus_check()
+{
+ TEST=`$WHICH c++ 2>/dev/null`
+ if test -n "$TEST"; then
+ VERS=`c++ --version 2>/dev/null | head -n 1`
+ infomsg "c++ : $VERS"
+ else
+ warningmsg "c++ : Not Found";
+ fi
+}
-TEST=`$WHICH autoconf 2>/dev/null`
-if test -n "$TEST"; then
- autoconf --version |\
- head -n 1 |\
- awk '{\
+gmake_check()
+{
+ TEST=`$WHICH gmake 2>/dev/null`
+ if test -n "$TEST" ; then
+ gmake --version 2>/dev/null |\
+ awk -F, '{print $1}' |\
+ awk '/GNU Make/{print "GNU gmake :",$NF}'
+ else
+ # FIX this test.
+ TEST=`make --version 2>/dev/null`
+ if test -n "$TEST"; then
+ make --version 2>/dev/null |\
+ awk -F, '{print $1}' |\
+ awk '/GNU Make/{print "gmake :",$NF}'
+ else
+ warningmsg "gmake : Not Found"
+ fi
+ fi
+}
+
+# Applies for NetBSD make and possibly every make.
+make_check()
+{
+ if test -n "`make 2>/dev/null`"; then
+ infomsg "make : Found"
+ else
+ warningmsg "make : Not Found"
+ fi
+}
+
+autoconf_check()
+{
+ TEST=`$WHICH autoconf 2>/dev/null`
+ if test -n "$TEST"; then
+ autoconf --version |\
+ head -n 1 |\
+ awk '{\
if (length($4) == 0) {\
print "autoconf : "$3\
} else {\
print "autoconf : "$4\
}}'
-else
- echo "autoconf : Not Found"
-fi
+ else
+ warningmsg "autoconf : Not Found"
+ fi
+}
-TEST=`$WHICH automake 2>/dev/null`
-if test -n "$TEST"; then
- automake --version 2>/dev/null |\
- head -n 1 |\
- awk '{print "automake : "$4}'
-else
- echo "automake : Not Found"
-fi
+automake_check()
+{
+ TEST=`$WHICH automake 2>/dev/null`
+ if test -n "$TEST"; then
+ automake --version 2>/dev/null |\
+ head -n 1 |\
+ awk '{print "automake : "$4}'
+ else
+ warningmsg "automake : Not Found"
+ fi
+}
-TEST=`$WHICH libtool 2>/dev/null`
-if test -n "$TEST"; then
- libtool --version 2>/dev/null |\
- head -n 1 |\
- awk '{print "libtool : "$4}'
-else
- echo "libtool : Not Found"
-fi
+# TODO: More libtool variants.
+libtool_check()
+{
+ TEST=`$WHICH libtool 2>/dev/null`
+ if test -n "$TEST"; then
+ libtool --version 2>/dev/null |\
+ head -n 1 |\
+ awk '{print "libtool : "$4}'
+ else
+ warningmsg "libtool : Not Found"
+ fi
+}
-TEST=`$WHICH extract 2>/dev/null`
-if test -n "$TEST"; then
- extract -v 2>/dev/null |\
- head -n 1 |\
- awk '{print "libextractor : "$2}'
-else
- echo "libextractor : Not Found"
-fi
+libextractor_check()
+{
+ TEST=`$WHICH extract 2>/dev/null`
+ if test -n "$TEST"; then
+ extract -v 2>/dev/null |\
+ head -n 1 |\
+ awk '{print "libextractor : "$2}'
+ else
+ warningmsg "libextractor : Not Found"
+ fi
+}
-if test -x gnunetd; then
- gnunetd -v | sed -e "s/v//" 2>/dev/null |\
- awk '{print "GNUnet 0.8 : "$2 (may conflict!)}'
-else
- echo "GNUnet 0.8 : Not Found (good)"
-fi
+gnunet08_check()
+{
+ if test -x gnunetd; then
+ gnunetd -v | sed -e "s/v//" 2>/dev/null |\
+ awk '{print "GNUnet 0.8 : "$2 (may conflict!)}'
+ else
+ infomsg "GNUnet 0.8 : Not Found (good)"
+ fi
+}
-TEST=`$WHICH gnunet-arm 2>/dev/null`
-if test -n "$TEST"; then
- gnunet-arm -v | sed -e "s/v//" 2>/dev/null |\
- awk '{print "GNUnet 0.9 : "$2}'
-else
- echo "GNUnet 0.9 : Not Found"
-fi
+gnunet09x_check()
+{
+ TEST=`$WHICH gnunet-arm 2>/dev/null`
+ if test -n "$TEST"; then
+ gnunet-arm -v | sed -e "s/v//" 2>/dev/null |\
+ awk '{print "GNUnet 0.9 : "$2}'
+ else
+ infomsg "GNUnet 0.9 : Not Found (good)"
+ fi
+}
-TEST=`$WHICH libgcrypt-config 2> /dev/null`
-if test -n "$TEST"; then
- libgcrypt-config --version 2> /dev/null | \
- awk '{print "libgcrypt : "$1}'
-else
- echo "libgcrypt : Not Found"
-fi
+gnunet011x_check()
+{
+ TEST=`$WHICH gnunet-arm 2>/dev/null`
+ if test -n "$TEST"; then
+ gnunet-arm -v | sed -e "s/v//" 2>/dev/null |\
+ awk '{print "GNUnet 0.11.x : "$2}'
+ else
+ warningmsg "GNUnet 0.11.x : Not Found"
+ fi
+}
-TEST=`$WHICH mysql_config 2> /dev/null`
-if test -n "$TEST"; then
- mysql_config --version 2> /dev/null | \
- awk '{print "mysql : "$1}'
-else
- echo "mysql : Not Found"
-fi
+gcrypt_check()
+{
+ TEST=`$WHICH libgcrypt-config 2> /dev/null`
+ if test -n "$TEST"; then
+ libgcrypt-config --version 2> /dev/null | \
+ awk '{print "libgcrypt : "$1}'
+ else
+ warningmsg "libgcrypt : Not Found"
+ fi
+}
-TEST=`$WHICH pkg-config 2> /dev/null`
-if test -n "$TEST"; then
- pkg-config --version 2> /dev/null | \
- awk '{print "pkg-config : "$1}'
-else
- echo "pkg-config : Not Found"
-fi
+mysql_check()
+{
+ TEST=`$WHICH mysql_config 2> /dev/null`
+ if test -n "$TEST"; then
+ mysql_config --version 2> /dev/null | \
+ awk '{print "mysql : "$1}'
+ else
+ infomsg "mysql : Not Found"
+ fi
+}
-TEST=`$WHICH pkg-config 2> /dev/null`
-if test -n "$TEST"; then
- pkg-config --modversion glib-2.0 2> /dev/null | \
- awk '{print "glib2 : "$1}'
-else
- echo "glib2 : Not Found"
-fi
+pkgconf_check()
+{
+ TEST=`$WHICH pkgconf 2> /dev/null`
+ if test -n "$TEST"; then
+ pkgconf --version 2> /dev/null | awk '{print "pkgconf : "$1}'
+ else
+ infomsg "pkgconf : Not Found"
+ fi
+}
+
+pkgconfig_check()
+{
+ TEST=`$WHICH pkg-config 2> /dev/null`
+ if test -n "$TEST"; then
+ pkg-config --version 2> /dev/null | \
+ awk '{print "pkg-config : "$1}'
+ else
+ infomsg "pkg-config : Not Found"
+ fi
+}
-TEST=`$WHICH pkg-config 2> /dev/null`
-if test -n "$TEST"; then
- pkg-config --modversion gtk+-2.0 2> /dev/null | \
- awk '{print "gtk2+ : "$1}'
-else
- echo "gtk2+ : Not Found"
-fi
+glib2_check()
+{
+ TEST=`$WHICH pkg-config 2> /dev/null`
+ if test -n "$TEST"; then
+ pkg-config --modversion glib-2.0 2> /dev/null | \
+ awk '{print "glib2 : "$1}'
+ else
+ infomsg "glib2 : Not Found"
+ fi
+}
-TEST=`$WHICH dpkg 2> /dev/null`
-if test -n "$TEST"; then
- LINES=`dpkg -s libgmp-dev | grep Version | wc -l 2> /dev/null`
- if test "$LINES" = "1"
- then
- VERSION=`dpkg -s libgmp-dev | grep Version | awk '{print $2}'`
- echo "GMP : libgmp-dev-$VERSION.deb"
- else
- echo "GMP : dpkg: libgmp-dev not installed"
- fi
-else
- TEST=`$WHICH rpm 2> /dev/null`
- if test -n "$TEST"; then
- rpm -q gmp | sed -e "s/gmp-//" 2> /dev/null | \
- awk '{print "GMP : "$1.rpm}'
- else
- echo "GMP : Test not available"
- fi
-fi
+gtk2_check()
+{
+ TEST=`$WHICH pkg-config 2> /dev/null`
+ if test -n "$TEST"; then
+ pkg-config --modversion gtk+-2.0 2> /dev/null | \
+ awk '{print "gtk2+ : "$1}'
+ else
+ infomsg "gtk2+ : Not Found"
+ fi
+}
-TEST=`$WHICH dpkg 2> /dev/null`
-if test -n "$TEST"; then
- LINES=`dpkg -s libunistring-dev | grep Version | wc -l`
- if test "$LINES" = "1"
- then
- VERSION=`dpkg -s libunistring-dev | grep Version | awk '{print $2}'`
- echo "libunistring : libunistring3-dev-$VERSION.deb"
- else
- echo "libunistring : dpkg: libunistring3-dev not installed"
- fi
-else
- TEST=`$WHICH rpm 2> /dev/null`
- if test -n "$TEST"; then
- rpm -q unistring | sed -e "s/unistring-//" 2> /dev/null | \
- awk '{print "libunistring : "$1.rpm}'
- else
- echo "libunistring : Test not available"
- fi
-fi
+gmp_check()
+{
+ TEST=`$WHICH dpkg 2> /dev/null`
+ if test -n "$TEST"; then
+ LINES=`dpkg -s libgmp-dev | grep Version | wc -l 2> /dev/null`
+ if test "$LINES" = "1"
+ then
+ VERSION=`dpkg -s libgmp-dev | grep Version | awk '{print $2}'`
+ infomsg "GMP : libgmp-dev-$VERSION.deb"
+ else
+ errormsg "GMP : dpkg: libgmp-dev not installed"
+ fi
+ fi
+ TEST=`$WHICH rpm 2> /dev/null`
+ if test -n "$TEST"; then
+ rpm -q gmp | sed -e "s/gmp-//" 2> /dev/null | \
+ awk '{print "GMP : "$1.rpm}'
+ else
+ warningmsg "GMP : Test not available"
+ fi
+}
-TEST=`$WHICH pkg_add 2> /dev/null`
-if test -n "$TEST"; then
- VERSION_UNISTRING=`pkg_info -Nb libunistring`
- VERSION_GMP=`pkg_info -Nb gmp`
- echo "libunistring :"
- echo "$VERSION_UNISTRING"
- echo "GMP :"
- echo "$VERSION_GMP"
-fi
+libunistring_check()
+{
+ TEST=`$WHICH dpkg 2> /dev/null`
+ if test -n "$TEST"; then
+ LINES=`dpkg -s libunistring-dev | grep Version | wc -l`
+ if test "$LINES" = "1"
+ then
+ VERSION=`dpkg -s libunistring-dev | grep Version | awk '{print $2}'`
+ infomsg "libunistring : libunistring3-dev-$VERSION.deb"
+ else
+ errormsg "libunistring : dpkg: libunistring3-dev not installed"
+ fi
+ else
+ TEST=`$WHICH rpm 2> /dev/null`
+ if test -n "$TEST"; then
+ rpm -q unistring | sed -e "s/unistring-//" 2> /dev/null | \
+ awk '{print "libunistring : "$1.rpm}'
+ else
+ infomsg "libunistring : Test not available"
+ fi
+ fi
+}
-TEST=`$WHICH gettext 2> /dev/null`
-if test -n "$TEST"; then
- gettext --version | head -n1 2> /dev/null | \
- awk '{print "GNU gettext : "$4}'
-else
- echo "GNU gettext : Not found"
-fi
+pkgadd_check()
+{
+ TEST=`$WHICH pkg_add 2> /dev/null`
+ if test -n "$TEST"; then
+ VERSION_UNISTRING=`pkg_info -Nb libunistring`
+ VERSION_GMP=`pkg_info -Nb gmp`
+ echo "libunistring :"
+ echo "$VERSION_UNISTRING"
+ echo "GMP :"
+ echo "$VERSION_GMP"
+ fi
+}
+gettext_check()
+{
+ TEST=`$WHICH gettext 2> /dev/null`
+ if test -n "$TEST"; then
+ gettext --version | head -n1 2> /dev/null | \
+ awk '{print "GNU gettext : "$4}'
+ else
+ errormsg "GNU gettext : Not found"
+ fi
+}
-TEST=`$WHICH curl-config 2> /dev/null`
-if test -n "$TEST"; then
- curl-config --version | head -n1 2> /dev/null | \
- awk '{print "libcurl : "$2}'
-else
- echo "libcurl : Not found"
-fi
+# Merge curl_check + gnurl_check -> error if neither is
+# found (yes those systems exist)
+curl_check()
+{
+ TEST=`$WHICH curl-config 2> /dev/null`
+ if test -n "$TEST"; then
+ curl-config --version | head -n1 2> /dev/null | \
+ awk '{print "libcurl : "$2}'
+ else
+ infomsg "libcurl : Not found"
+ fi
+}
-TEST=`$WHICH gnurl-config 2> /dev/null`
-if test -n "$TEST"; then
- gnurl-config --version | head -n1 2> /dev/null | \
- awk '{print "libgnurl : "$2}'
-else
- echo "libgnurl : Not found"
-fi
+gnurl_check()
+{
+ TEST=`$WHICH gnurl-config 2> /dev/null`
+ if test -n "$TEST"; then
+ gnurl-config --version | head -n1 2> /dev/null | \
+ awk '{print "libgnurl : "$2}'
+ else
+ infomsg "libgnurl : Not found"
+ fi
+}
-echo -n "libmicrohttpd : "
-TMPFILE=`mktemp /tmp/mhd-version-testXXXXXX`
-cat - >$TMPFILE.c <<EOF
+libmicrohttpd_check()
+{
+ echo -n "libmicrohttpd : "
+ TMPFILE=`mktemp /tmp/mhd-version-testXXXXXX`
+ cat - >$TMPFILE.c <<EOF
#include <microhttpd.h>
#include <stdio.h>
int main()
}
EOF
-gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
-rm -f $TMPFILE $TMPFILE.bin
-
+ gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
+ cc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
+ rm -f $TMPFILE $TMPFILE.bin
+}
-echo -n "GNU GLPK : "
-TMPFILE=`mktemp /tmp/glpk-version-testXXXXXX`
-cat - >$TMPFILE.c <<EOF
+glpk_check()
+{
+ echo -n "GNU GLPK : "
+ TMPFILE=`mktemp /tmp/glpk-version-testXXXXXX`
+ cat - >$TMPFILE.c <<EOF
#include <glpk.h>
#include <stdio.h>
int main()
}
EOF
-gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
-rm -f $TMPFILE $TMPFILE.bin
-
+ gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
+ cc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
+ rm -f $TMPFILE $TMPFILE.bin
+}
-echo -n "GnuTLS : "
-TMPFILE=`mktemp /tmp/gnutls-version-testXXXXXX`
-cat - >$TMPFILE.c <<EOF
+gnutls_check()
+{
+ echo -n "GnuTLS : "
+ TMPFILE=`mktemp /tmp/gnutls-version-testXXXXXX`
+ cat - >$TMPFILE.c <<EOF
#include <gnutls/gnutls.h>
#include <stdio.h>
int main()
}
EOF
-gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
-rm -f $TMPFILE $TMPFILE.bin
+ gcc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
+ cc -o $TMPFILE $TMPFILE.c 2> /dev/null && $TMPFILE || echo "Not found"
+ rm -f $TMPFILE $TMPFILE.bin
+}
+main()
+{
+ infomsg "${progname} 0.11.0"
+ infomsg
+ infomsg "Please submit the following"
+ infomsg "information with your bug report:"
+ linemsg
+ os_check
+ awk_check
+ gcc_check
+ cc_check
+ cplusplus_check
+ gmake_check
+ make_check
+ autoconf_check
+ automake_check
+ libtool_check
+ libextractor_check
+ gnunet08_check
+ gnunet09x_check
+ gnunet011x_check
+ gcrypt_check
+ mysql_check
+ pkgconf_check
+ pkgconfig_check
+ glib2_check
+ gtk2_check
+ gmp_check
+ libunistring_check
+ pkgadd_check
+ gettext_check
+ curl_check
+ gnurl_check
+ libmicrohttpd_check
+ glpk_check
+ gnutls_check
+ linemsg
+ infomsg "Bug report saved in ./my_gnunet_bugreport.log"
+}
-echo "--------------------------------------------------------------"
+main "$@" 2>&1 | tee "my_gnunet_bugreport.log"