From f1b51c8e6316b892e0a048ada2823ca49e59404d Mon Sep 17 00:00:00 2001 From: prascle Date: Mon, 10 Oct 2005 09:26:03 +0000 Subject: [PATCH] PR: check cppunit library --- configure.in.base | 12 +- salome_adm/unix/config_files/check_cppunit.m4 | 108 ++++++++++++++++++ salome_adm/unix/make_commence.in | 5 + src/Basics/Test/Makefile.in | 6 +- src/LifeCycleCORBA/Test/Makefile.in | 10 +- src/Logger/Test/Makefile.in | 6 +- src/Makefile.in | 21 ++-- src/SALOMELocalTrace/Test/Makefile.in | 9 +- src/SALOMETraceCollector/Test/Makefile.in | 10 +- src/UnitTests/Makefile.in | 7 +- src/Utils/Test/Makefile.in | 9 +- 11 files changed, 175 insertions(+), 28 deletions(-) create mode 100644 salome_adm/unix/config_files/check_cppunit.m4 diff --git a/configure.in.base b/configure.in.base index 1bfead651..81cde052a 100644 --- a/configure.in.base +++ b/configure.in.base @@ -212,8 +212,6 @@ WITH_BATCH=no test x$openpbs_ok = xyes || test x$lsf_ok = xyes && WITH_BATCH=yes AC_SUBST(WITH_BATCH) - - echo echo --------------------------------------------- echo testing LEX \& YACC @@ -287,6 +285,14 @@ echo CHECK_QT +echo +echo ---------------------------------------------- +echo testing CPPUNIT only required for unit testing +echo ---------------------------------------------- +echo + +CHECK_CPPUNIT + if test "X$WITHIHM" = "Xyes"; then echo echo --------------------------------------------- @@ -371,7 +377,7 @@ do fi done echo "---Optional:" -variables="openpbs_ok lsf_ok" +variables="cppunit_ok openpbs_ok lsf_ok" for var in $variables do diff --git a/salome_adm/unix/config_files/check_cppunit.m4 b/salome_adm/unix/config_files/check_cppunit.m4 new file mode 100644 index 000000000..10c91812d --- /dev/null +++ b/salome_adm/unix/config_files/check_cppunit.m4 @@ -0,0 +1,108 @@ + +AC_DEFUN([CHECK_CPPUNIT],[ + +AC_CHECKING(for cppunit) + +cppunit_ok=yes + +dnl were is cppunit ? + +AC_ARG_WITH(cppunit, + [ --with-cppunit=DIR directory path to CPPUNIT installation ], + [CPPUNITHOME="$withval" + AC_MSG_RESULT("select $withval as path to CPPUNIT") + ]) + +AC_ARG_WITH(cppunit_inc, + [ --with-cppunit_inc=DIR directory path to CPPUNIT includes ], + [CPPUNIT_INCLUDES="$withval" + AC_MSG_RESULT("select $withval as path to CPPUNIT includes") + ]) + +if test -z $CPPUNITHOME; then + AC_MSG_RESULT(CPPUNITHOME not defined) + exits_ok=no + if test "x$exits_ok" = "xno"; then + for d in /usr/local /usr ; do + AC_CHECK_FILE(${d}/lib/libcppunit.so,exits_ok=yes,exits_ok=no) + if test "x$exits_ok" = "xyes"; then + CPPUNITHOME=$d + AC_MSG_RESULT(libcppunit.so detected in $d/lib) + fi + done + fi + if test "x$exits_ok" = "xno"; then + for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do + if test -f $d/libcppunit.so ; then + AC_MSG_RESULT(libcppunit.so detected in $d) + CPPUNITHOME=$d + CPPUNITHOME=`echo ${CPPUNITHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` + exits_ok=yes + break + fi + done + fi + if test "x$exits_ok" = "xyes"; then + if test -z $CPPUNIT_INCLUDES; then + CPPUNIT_INCLUDES=$CPPUNITHOME"/include" + fi + fi +else + if test -z $CPPUNIT_INCLUDES; then + CPPUNIT_INCLUDES="$CPPUNITHOME/include" + fi +fi + +if test "x$cppunit_ok" = xno -o ! -d "$CPPUNITHOME" ; then + AC_MSG_RESULT(no) + AC_MSG_WARN(cppunit not found) + cppunit_ok=no +else + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + CPPFLAGS_old=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$CPPUNIT_INCLUDES" + CPPFLAGS="$CPPFLAGS $QT_INCLUDES" + + AC_CHECK_HEADER(cppunit/extensions/HelperMacros.h,cppunit_ok=yes,cppunit_ok=no) + + CPPFLAGS=$CPPFLAGS_old + + if test "x$cppunit_ok" = xno ; then + AC_MSG_RESULT(no) + AC_MSG_WARN(cppunit not found) + else + cppunit_ok=yes + fi + + if test "x$cppunit_ok" = "xno" + then + AC_MSG_RESULT(unable to found cppunit headers and library) + AC_MSG_RESULT(CPPUNITHOME environment variable may be wrong) + else + if test "x$CPPUNIT_INCLUDES" = "x/usr/include" + then + CPPUNIT_INCLUDES="" + else + CPPUNIT_INCLUDES="-I$CPPUNIT_INCLUDES" + fi + if test "x$CPPUNITHOME" = "x/usr" + then + CPPUNIT_LIBS=" -lcppunit" + else + CPPUNIT_LIBS="-L$CPPUNITHOME/lib -lcppunit" + fi + + AC_SUBST(CPPUNIT_INCLUDES) + AC_SUBST(CPPUNIT_LIBS) + AC_SUBST(cppunit_ok) + + AC_MSG_RESULT(yes) + fi + +fi + +AC_LANG_RESTORE + +])dnl +dnl \ No newline at end of file diff --git a/salome_adm/unix/make_commence.in b/salome_adm/unix/make_commence.in index 6d62bc743..8cc3f4c46 100644 --- a/salome_adm/unix/make_commence.in +++ b/salome_adm/unix/make_commence.in @@ -55,6 +55,11 @@ LSF_INCLUDES = @LSF_INCLUDES@ LSF_LIBDIR = @LSF_LDFLAGS@ LSF_LIBS = @LSF_LIBS@ +# CPPUNIT + +CPPUNIT_INCLUDES = @CPPUNIT_INCLUDES@ +CPPUNIT_LIBS = @CPPUNIT_LIBS@ + # JAVA #JAVA_INCLUDES = @JAVA_INCLUDES@ diff --git a/src/Basics/Test/Makefile.in b/src/Basics/Test/Makefile.in index a4de9de02..c98aadb0c 100644 --- a/src/Basics/Test/Makefile.in +++ b/src/Basics/Test/Makefile.in @@ -49,7 +49,11 @@ LIB_SRC = BIN = BIN_SRC = -LIBS= @LIBS@ +CXXFLAGS += @CPPUNIT_INCLUDES@ +CPPFLAGS += @CPPUNIT_INCLUDES@ + +LIBS= @LIBS@ @CPPUNIT_LIBS@ + LDFLAGS+= LDFLAGSFORBIN+= diff --git a/src/LifeCycleCORBA/Test/Makefile.in b/src/LifeCycleCORBA/Test/Makefile.in index 425a816a1..dff2dac82 100644 --- a/src/LifeCycleCORBA/Test/Makefile.in +++ b/src/LifeCycleCORBA/Test/Makefile.in @@ -51,7 +51,11 @@ LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \ BIN = TestLifeCycleCORBA BIN_SRC = -LIBS= @LIBS@ +CXXFLAGS += @CPPUNIT_INCLUDES@ +CPPFLAGS += @CPPUNIT_INCLUDES@ + +LIBS= @LIBS@ @CPPUNIT_LIBS@ + LDFLAGS+= LDFLAGSFORBIN+= \ @@ -60,7 +64,7 @@ LDFLAGSFORBIN+= \ -lUtilsTest -lOpUtil \ -lSalomeNS -lSalomeContainer -lSalomeResourcesManager \ -lRegistry -lSalomeNotification \ - -lLifeCycleCORBATest -lSalomeLifeCycleCORBA \ - -lcppunit + -lLifeCycleCORBATest -lSalomeLifeCycleCORBA + @CONCLUDE@ diff --git a/src/Logger/Test/Makefile.in b/src/Logger/Test/Makefile.in index 23060427d..2ff5e398b 100644 --- a/src/Logger/Test/Makefile.in +++ b/src/Logger/Test/Makefile.in @@ -49,7 +49,11 @@ LIB_SRC = BIN = BIN_SRC = -LIBS= @LIBS@ +CXXFLAGS += @CPPUNIT_INCLUDES@ +CPPFLAGS += @CPPUNIT_INCLUDES@ + +LIBS= @LIBS@ @CPPUNIT_LIBS@ + LDFLAGS+= LDFLAGSFORBIN+= diff --git a/src/Makefile.in b/src/Makefile.in index 9db15f0e3..2b5bb4c7d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -59,15 +59,7 @@ SUBDIRS = \ SALOMEDS \ KERNEL_PY \ ModuleGenerator \ - Communication \ - \ - Basics/Test \ - SALOMELocalTrace/Test \ - Logger/Test \ - SALOMETraceCollector/Test \ - Utils/Test \ - LifeCycleCORBA/Test \ - UnitTests + Communication ifeq (@mpi_ok@,yes) SUBDIRS+= MPIContainer TestMPIContainer @@ -77,5 +69,16 @@ ifeq (@WITH_BATCH@,yes) SUBDIRS += Batch Batch_SWIG endif +ifeq (@cppunit_ok@,yes) + SUBDIRS+= \ + Basics/Test \ + SALOMELocalTrace/Test \ + Logger/Test \ + SALOMETraceCollector/Test \ + Utils/Test \ + LifeCycleCORBA/Test \ + UnitTests +endif + @MODULE@ diff --git a/src/SALOMELocalTrace/Test/Makefile.in b/src/SALOMELocalTrace/Test/Makefile.in index d10b2e7d7..172313ee3 100644 --- a/src/SALOMELocalTrace/Test/Makefile.in +++ b/src/SALOMELocalTrace/Test/Makefile.in @@ -49,11 +49,14 @@ LIB_SRC = SALOMELocalTraceTest.cxx BIN = TestSALOMELocalTrace BIN_SRC = -LIBS= @LIBS@ +CXXFLAGS += @CPPUNIT_INCLUDES@ +CPPFLAGS += @CPPUNIT_INCLUDES@ + +LIBS= @LIBS@ @CPPUNIT_LIBS@ + LDFLAGS+= -lSALOMELocalTrace LDFLAGSFORBIN+= \ - -lSALOMELocalTraceTest -lSALOMELocalTrace -lSALOMEBasics \ - -lcppunit + -lSALOMELocalTraceTest -lSALOMELocalTrace -lSALOMEBasics @CONCLUDE@ diff --git a/src/SALOMETraceCollector/Test/Makefile.in b/src/SALOMETraceCollector/Test/Makefile.in index b12f5bf90..ddc7c53ca 100644 --- a/src/SALOMETraceCollector/Test/Makefile.in +++ b/src/SALOMETraceCollector/Test/Makefile.in @@ -49,12 +49,16 @@ LIB_SRC = SALOMETraceCollectorTest.cxx BIN = TestSALOMETraceCollector BIN_SRC = -LIBS= @LIBS@ + +CXXFLAGS += @CPPUNIT_INCLUDES@ +CPPFLAGS += @CPPUNIT_INCLUDES@ + +LIBS= @LIBS@ @CPPUNIT_LIBS@ + LDFLAGS+= LDFLAGSFORBIN+= \ -lSALOMELocalTraceTest -lSALOMELocalTrace -lSALOMEBasics \ - -lSALOMETraceCollectorTest \ - -lcppunit + -lSALOMETraceCollectorTest @CONCLUDE@ diff --git a/src/UnitTests/Makefile.in b/src/UnitTests/Makefile.in index 0f69aafcb..a0c154083 100644 --- a/src/UnitTests/Makefile.in +++ b/src/UnitTests/Makefile.in @@ -50,8 +50,11 @@ BIN_SRC = BIN_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \ SALOME_Exception.idl +CXXFLAGS += @CPPUNIT_INCLUDES@ +CPPFLAGS += @CPPUNIT_INCLUDES@ + +LIBS= @LIBS@ @CPPUNIT_LIBS@ -LIBS= @LIBS@ LDFLAGSFORBIN+= \ -lSALOMELocalTraceTest -lSALOMELocalTrace -lSALOMEBasics \ -lSALOMETraceCollectorTest \ @@ -59,7 +62,7 @@ LDFLAGSFORBIN+= \ -lSalomeNS -lSalomeContainer -lSalomeResourcesManager \ -lRegistry -lSalomeNotification \ -lLifeCycleCORBATest -lSalomeLifeCycleCORBA \ - -lcppunit + @CONCLUDE@ diff --git a/src/Utils/Test/Makefile.in b/src/Utils/Test/Makefile.in index 67241ca7f..c01a6a22e 100644 --- a/src/Utils/Test/Makefile.in +++ b/src/Utils/Test/Makefile.in @@ -49,13 +49,16 @@ LIB_SRC = UtilsTest.cxx BIN = TestUtils BIN_SRC = -LIBS= @LIBS@ +CXXFLAGS += @CPPUNIT_INCLUDES@ +CPPFLAGS += @CPPUNIT_INCLUDES@ + +LIBS= @LIBS@ @CPPUNIT_LIBS@ + LDFLAGS+= LDFLAGSFORBIN+= \ -lSALOMELocalTraceTest -lSALOMELocalTrace -lSALOMEBasics \ -lSALOMETraceCollectorTest \ - -lUtilsTest -lOpUtil \ - -lcppunit + -lUtilsTest -lOpUtil @CONCLUDE@ -- 2.39.2