make check attempts to start cld, but cannot find it if it is not
already in PATH. This patch uses CLDC_PREFIX, possibly from
pkg-config, to detect the location of cld with configure.

Signed-off-by: Matthew Farrellee <[email protected]>
---
 configure.ac              |   19 +++++++++++++++++++
 test/Makefile.am          |    1 +
 test/start-daemon         |   20 +-------------------
 test/start-daemon.real.in |   20 ++++++++++++++++++++
 4 files changed, 41 insertions(+), 19 deletions(-)
 create mode 100644 test/start-daemon.real.in

diff --git a/configure.ac b/configure.ac
index 7e51b84..942d446 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,24 @@ AC_CHECK_LIB(argp, argp_parse, ARGP_LIBS=-largp)
 AC_CHECK_LIB(socket, bind, SOCKET_LIBS=-lsocket)
 PKG_CHECK_MODULES(CLDC, libcldc)
 
+dnl -----------------------------
+dnl Check for cld program, used
+dnl in the test process.
+dnl
+dnl Either use pkg-config or
+dnl define CLDC_PREFIX in
+dnl configure's environment.
+dnl -----------------------------
+_PKG_CONFIG([CLDC_PREFIX], [variable=prefix], [libcldc])
+AS_IF([test "x$pkg_failed" = xyes],
+ [AC_WARN([No CLDC_PREFIX defined, using /usr])
+  CLDC_PREFIX="/usr"],
+ [CLDC_PREFIX=$pkg_cv_CLDC_PREFIX])
+AC_PATH_PROG([CLDC_CMD], [cld], [no],
+             
[$PATH$PATH_SEPARATOR$CLDC_PREFIX/bin$PATH_SEPARATOR$CLDC_PREFIX/sbin$PATH_SEPARATOR$CLDC_PREFIX/libexec])
+AS_IF([test "x$CLDC_CMD" = xno],
+  [AC_MSG_ERROR([Missing cld program])])
+
 dnl -------------------------------------
 dnl Checks for optional library functions
 dnl -------------------------------------
@@ -111,5 +129,6 @@ AC_CONFIG_FILES([doc/Makefile
                 include/Makefile
                 server/Makefile
                 test/Makefile
+                test/start-daemon.real
                 Makefile])
 AC_OUTPUT
diff --git a/test/Makefile.am b/test/Makefile.am
index cc84187..4221b9f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -7,6 +7,7 @@ EXTRA_DIST =                    \
        server-test.cfg         \
        prep-db                 \
        start-daemon            \
+       start-daemon.real       \
        pid-exists              \
        daemon-running          \
        stop-daemon             \
diff --git a/test/start-daemon b/test/start-daemon
index 7d21e2f..74333d9 100755
--- a/test/start-daemon
+++ b/test/start-daemon
@@ -1,21 +1,3 @@
 #!/bin/sh
 
-if [ -f cld.pid ]
-then
-       echo "cld.pid file found.  daemon still running?"
-       exit 1
-fi
-if [ -f chunkd.pid ]
-then
-       echo "chunkd.pid file found.  daemon still running?"
-       exit 1
-fi
-
-# May be different on Solaris... like /usr/libexec or such.
-cld -d data/cld -P cld.pid -p 18081
-
-../server/chunkd -C $top_srcdir/test/server-test.cfg -E $*
-
-sleep 3
-
-exit 0
+exec sh ./start-daemon.real
diff --git a/test/start-daemon.real.in b/test/start-daemon.real.in
new file mode 100644
index 0000000..2e1df1d
--- /dev/null
+++ b/test/start-daemon.real.in
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [ -f cld.pid ]
+then
+       echo "cld.pid file found.  daemon still running?"
+       exit 1
+fi
+if [ -f chunkd.pid ]
+then
+       echo "chunkd.pid file found.  daemon still running?"
+       exit 1
+fi
+
+...@cldc_cmd@ -d data/cld -P cld.pid -p 18081
+
+../server/chunkd -C $top_srcdir/test/server-test.cfg -E $*
+
+sleep 3
+
+exit 0
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to