+ cfgwrite ""
+
+ cfgwrite "# avoid a gstep-make warning"
+ cfgwrite "PATH:=\$(GNUSTEP_SYSTEM_ROOT)/Tools:\$(PATH)"
+}
+
+function checkLinking() {
+ local oldpwd=$PWD
+ local tmpdir=".configure-test-$$"
+
+ mkdir $tmpdir
+ cd $tmpdir
+ cp ../maintenance/dummytool.m .
+
+ tmpmake="GNUmakefile"
+ echo >$tmpmake "include ../config.make"
+ echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/common.make"
+ echo >>$tmpmake "TOOL_NAME := linktest"
+ echo >>$tmpmake "linktest_OBJC_FILES := dummytool.m"
+ echo >>$tmpmake "linktest_TOOL_LIBS += -l$1"
+ echo >>$tmpmake "SYSTEM_LIB_DIR += ${LINK_SYSLIBDIRS}"
+ echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/tool.make"
+
+ make -s messages=yes -f $tmpmake linktest >out.log 2>err.log
+ LINK_RESULT=$?
+
+ if test $LINK_RESULT = 0; then
+ echo "$2 library found: $1"
+ else
+ if test "x$2" = "xrequired"; then
+ echo "failed to link $2 library: $1"
+ rm ../config.make
+ exit 1
+ else
+ echo "failed to link $2 library: $1"
+ fi
+ fi
+
+ cd $oldpwd
+ rm -rf $tmpdir
+}
+
+function checkDependencies() {
+ checkLinking "xml2" required;
+ checkLinking "ldap" required;
+ checkLinking "ssl" required; # TODO: make optional
+ checkLinking "pq" required; # TODO: make optional