Add a --verbose option to configure to aid debugging.

This commit is contained in:
Josh Elsasser 2006-06-20 23:29:11 +00:00
parent c5955ed7ef
commit c6e2e1406f
1 changed files with 42 additions and 10 deletions

52
configure vendored
View File

@ -17,6 +17,7 @@ CFLAGS="${CFLAGS}"
CXX="${CXX-c++}" CXX="${CXX-c++}"
CXXFLAGS="${CXXFLAGS}" CXXFLAGS="${CXXFLAGS}"
LDFLAGS="${LDFLAGS}" LDFLAGS="${LDFLAGS}"
VERBOSE=no
# #
# Functions # Functions
@ -29,6 +30,7 @@ Options:
--disable-openssl Disable OpenSSL, use built-in SHA1 implementation --disable-openssl Disable OpenSSL, use built-in SHA1 implementation
--disable-gtk Don't build the GTK+ GUI --disable-gtk Don't build the GTK+ GUI
--prefix=PATH Installation path --prefix=PATH Installation path
--verbose Display additional information for debugging
Some influential environment variables: Some influential environment variables:
CC C compiler command CC C compiler command
@ -40,15 +42,37 @@ Some influential environment variables:
EOF EOF
} }
runcmd()
{
if [ "$VERBOSE" = yes ]
then
echo "$@" >&2
"$@"
else
"$@" > /dev/null 2>&1
fi
return $!
}
verbose()
{
if [ "$VERBOSE" = yes ]
then
echo "$@"
fi
}
cc_test() cc_test()
{ {
verbose cc_test
cat > testconf.c <<EOF cat > testconf.c <<EOF
int main() int main()
{ {
return 0; return 0;
} }
EOF EOF
if ! $CC -o testconf testconf.c > /dev/null 2>&1; then if ! runcmd $CC -o testconf testconf.c
then
rm -f testconf.c testconf rm -f testconf.c testconf
echo "Could not find a working compiler" echo "Could not find a working compiler"
exit 1 exit 1
@ -58,6 +82,7 @@ EOF
openssl_test() openssl_test()
{ {
verbose openssl_test
cat > testconf.c << EOF cat > testconf.c << EOF
#include <stdio.h> #include <stdio.h>
#include <openssl/sha.h> #include <openssl/sha.h>
@ -66,7 +91,7 @@ openssl_test()
SHA1( 0, 0, 0 ); SHA1( 0, 0, 0 );
} }
EOF EOF
if $CC $CFLAGS $LDFLAGS -o testconf testconf.c -lcrypto > /dev/null 2>&1 if runcmd $CC $CFLAGS $LDFLAGS -o testconf testconf.c -lcrypto
then then
echo "yes" echo "yes"
OPENSSL=yes OPENSSL=yes
@ -79,15 +104,16 @@ EOF
lm_test() lm_test()
{ {
verbose lm_test
cat > testconf.c << EOF cat > testconf.c << EOF
int main() int main()
{ {
return cos( 42 ); return cos( 42 );
} }
EOF EOF
if ! $CC -o testconf testconf.c > /dev/null 2>&1 if ! runcmd $CC -o testconf testconf.c
then then
if $CC -o testconf testconf.c -lm > /dev/null 2>&1 if runcmd $CC -o testconf testconf.c -lm
then then
LDFLAGS="$LDFLAGS -lm" LDFLAGS="$LDFLAGS -lm"
fi fi
@ -97,13 +123,14 @@ EOF
lrintf_test() lrintf_test()
{ {
verbose lrintf_test
cat > testconf.c << EOF cat > testconf.c << EOF
int main() int main()
{ {
return ( lrintf( 3.14 ) != 3 ); return ( lrintf( 3.14 ) != 3 );
} }
EOF EOF
if ( $CC -o testconf testconf.c $LDFLAGS && ./testconf ) > /dev/null 2>&1 if runcmd $CC -o testconf testconf.c $LDFLAGS && runcmd ./testconf
then then
CFLAGS="$CFLAGS -DHAVE_LRINTF" CFLAGS="$CFLAGS -DHAVE_LRINTF"
fi fi
@ -112,6 +139,7 @@ EOF
gettext_test() gettext_test()
{ {
verbose gettext_test
cat > testconf.c <<EOF cat > testconf.c <<EOF
#include <libintl.h> #include <libintl.h>
int main() int main()
@ -120,7 +148,7 @@ gettext_test()
} }
EOF EOF
if $CC $CFLAGS_GTK $LDFLAGS_GTK -o testconf testconf.c > /dev/null 2>&1 if runcmd $CC $CFLAGS_GTK $LDFLAGS_GTK -o testconf testconf.c
then then
rm -f testconf.c testconf rm -f testconf.c testconf
return 0 return 0
@ -129,7 +157,7 @@ EOF
for intl_testdir in $PREFIX/include \ for intl_testdir in $PREFIX/include \
/usr/local/include /usr/X11R6/include /usr/pkg/include /usr/local/include /usr/X11R6/include /usr/pkg/include
do do
if $CC $CFLAGS_GTK -I$intl_testdir $LDFLAGS_GTK -o testconf testconf.c > /dev/null 2>&1 if runcmd $CC $CFLAGS_GTK -I$intl_testdir $LDFLAGS_GTK -o testconf testconf.c
then then
CFLAGS_GTK="CFLAGS_GTK -I$intl_testdir" CFLAGS_GTK="CFLAGS_GTK -I$intl_testdir"
rm -f testconf.c testconf rm -f testconf.c testconf
@ -142,9 +170,10 @@ EOF
gtk_test() gtk_test()
{ {
if pkg-config gtk+-2.0 > /dev/null 2>&1 verbose gtk_test
if runcmd pkg-config gtk+-2.0
then then
if expr `pkg-config --modversion gtk+-2.0` '>=' 2.6.0 > /dev/null 2>&1 if runcmd expr `pkg-config --modversion gtk+-2.0` '>=' 2.6.0
then then
cat > testconf.c << EOF cat > testconf.c << EOF
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -153,7 +182,7 @@ gtk_test()
gtk_main(); gtk_main();
} }
EOF EOF
if $CC `pkg-config gtk+-2.0 --cflags --libs` -o testconf testconf.c > /dev/null 2>&1 if runcmd $CC `pkg-config gtk+-2.0 --cflags --libs` -o testconf testconf.c
then then
CFLAGS_GTK=`pkg-config gtk+-2.0 --cflags` CFLAGS_GTK=`pkg-config gtk+-2.0 --cflags`
LDFLAGS_GTK=`pkg-config gtk+-2.0 --libs` LDFLAGS_GTK=`pkg-config gtk+-2.0 --libs`
@ -198,6 +227,9 @@ while [ $# -ne 0 ]; do
x--prefix=*) x--prefix=*)
PREFIX="$param" PREFIX="$param"
;; ;;
x--verbose)
VERBOSE=yes
;;
x--help) x--help)
usage usage
exit 0 exit 0