summaryrefslogtreecommitdiff
path: root/genqrcode/tests/test_configure.sh
diff options
context:
space:
mode:
Diffstat (limited to 'genqrcode/tests/test_configure.sh')
-rwxr-xr-xgenqrcode/tests/test_configure.sh61
1 files changed, 61 insertions, 0 deletions
diff --git a/genqrcode/tests/test_configure.sh b/genqrcode/tests/test_configure.sh
new file mode 100755
index 0000000000..4a301259a0
--- /dev/null
+++ b/genqrcode/tests/test_configure.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+BASEDIR=..
+
+CONFIG_H_IN="$BASEDIR/config.h.in"
+CONFIG_H="$BASEDIR/config.h"
+LIBQRENCODE_PC_IN="$BASEDIR/libqrencode.pc.in"
+LIBQRENCODE_PC="$BASEDIR/libqrencode.pc"
+
+echo "Testing configure scripts..."
+
+(cd $BASEDIR; ./autogen.sh)
+
+# test config.h.in
+grep "#undef HAVE_LIBPTHREAD" $CONFIG_H_IN > /dev/null
+if test ! $? -eq 0; then
+ echo "HAVE_LIBPTHREAD undefined in config.h.in."
+ exit 1
+fi
+
+# test libqrencode.pc.in
+grep "Libs.private: @LIBPTHREAD@" $LIBQRENCODE_PC_IN > /dev/null
+if test ! $? -eq 0; then
+ echo "Pthread is not handled in libqrencode.pc.in."
+ exit 1
+fi
+
+# test pthread checks in configure
+(cd $BASEDIR; ./configure --with-tests --enable-thread-safety > /dev/null)
+grep "#define HAVE_LIBPTHREAD 1" $CONFIG_H > /dev/null
+if test ! $? -eq 0; then
+ echo "HAVE_LIBPTHREAD undefined in config.h."
+ exit 1
+fi
+
+grep "Libs.private: -lpthread" $LIBQRENCODE_PC > /dev/null
+if test ! $? -eq 0; then
+ echo "Pthread is not handled in libqrencode.pc."
+ exit 1
+fi
+
+(cd $BASEDIR; ./configure --with-tests --disable-thread-safety > /dev/null)
+grep "#define HAVE_LIBPTHREAD 1" $CONFIG_H > /dev/null
+if test ! $? -eq 1; then
+ echo "HAVE_LIBPTHREAD incorrectly defined in config.h."
+ exit 1
+fi
+
+grep "Libs.private: -lpthread" $LIBQRENCODE_PC > /dev/null
+if test ! $? -eq 1; then
+ echo "Pthread is incorrectly handled in libqrencode.pc."
+ exit 1
+fi
+
+echo "All tests of configure script passed. Now reconfiguring..."
+
+(cd $BASEDIR; ./configure --with-tests > /dev/null)
+
+echo "Done."
+
+exit 0