File: has_cppunit.m4

package info (click to toggle)
nurbs++ 3.0.11-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,012 kB
  • ctags: 3,023
  • sloc: cpp: 26,461; sh: 16,989; makefile: 317; ansic: 27
file content (50 lines) | stat: -rw-r--r-- 1,033 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
dnl WITH_CPPUNIT
dnl
dnl Whether CppUnit is defined in this system.
AC_DEFUN(WITH_CPPUNIT,
[
AC_REQUIRE([AC_PROG_CXX])

AC_CACHE_VAL(has_cppunit,
[
 AC_CHECK_PROG([has_cppunit],[cppunit-config],[yes],[no])
 if test "$has_cppunit" = no; then
   AC_MSG_RESULT($has_cppunit)
 fi

 if test x"$has_cppunit" = xyes; then
  AC_MSG_CHECKING(whether you can use cppunit)
  AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  CPPUNIT_CPPFLAGS=`cppunit-config --cflags`
  CPPUNIT_LIBS=`cppunit-config --libs`
  SAVE_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="$CPPFLAGS $CPPUNIT_CPPFLAGS"
  SAVE_LIBS="$LIBS"
  LIBS="$LIBS $CPPUNIT_LIBS"

  AC_TRY_COMPILE([
	 #include <cppunit/TestCase.h>
	 ],
	[return 1;],
	[ has_cppunit=yes],
	[ has_cppunit=no])
 
  CPPFLAGS="$SAVE_CPPFLAGS"
  LDFLAGS="$SAVE_LDFLAGS"
  LIBS="$SAVE_LIBS"
  AC_LANG_RESTORE
 fi
])

AC_MSG_RESULT($has_cppunit)
if test x"$has_cppunit" = xyes; then
   AC_DEFINE(HAS_CPPUNIT)
   AC_SUBST(CPPUNIT_CPPFLAGS)
   AC_SUBST(CPPUNIT_LIBS)
fi

AM_CONDITIONAL(BUILD_CPPUNIT_TESTS,test x"$has_cppunit" = xyes)

])