Browse Source

Check unit test framework can be disabled

using --disable-check configure option
Yann Weber 6 years ago
parent
commit
4d2fed6c92
2 changed files with 22 additions and 6 deletions
  1. 5
    1
      Makefile.am
  2. 17
    5
      configure.ac

+ 5
- 1
Makefile.am View File

@@ -7,6 +7,10 @@ docs:
7 7
 .PHONY: docs
8 8
 endif
9 9
 
10
-SUBDIRS += src . tests
10
+SUBDIRS += src .
11
+
12
+if CHECK
13
+SUBDIRS += tests
14
+endif
11 15
 CLEANFILES = 
12 16
 

+ 17
- 5
configure.ac View File

@@ -21,6 +21,15 @@ AC_ARG_ENABLE([debug],[  --enable-debug turn on debugging],
21 21
 esac],[debug=false])
22 22
 AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
23 23
 
24
+AC_ARG_ENABLE([check],[  --disable-check disable unit test support],
25
+[case "${enableval}" in
26
+	yes) check=true ;;
27
+	no)  check=false ;;
28
+	*) AC_MSG_ERROR([bad value ${enableval} for --enable-check]) ;;
29
+esac],[check=true])
30
+AM_CONDITIONAL([CHECK], [test x$check = xtrue])
31
+
32
+
24 33
 AC_CONFIG_HEADERS([src/include/config.h])
25 34
 AC_CONFIG_SRCDIR([src/main.c])
26 35
 AC_CONFIG_MACRO_DIR([m4])
@@ -51,11 +60,14 @@ else
51 60
 fi
52 61
 
53 62
 # Checks for libraries.
54
-AC_SEARCH_LIBS([dlopen], [dl dld], [], [
55
-	AC_MSG_ERROR([unable to find the dlopen() function])
56
-])
57
-PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) 
58
-AS_IF([test x$debug = xtrue], [CK_FORK=no],[])
63
+if test x$check = xtrue
64
+then
65
+	PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [],
66
+	AC_MSG_FAILURE([Unable to locate (check unit test c framework).
67
+You can run ./configure --disable-check if you do not need unit tests.
68
+])) 
69
+	AS_IF([test x$debug = xtrue], [CK_FORK=no],[])
70
+fi
59 71
 
60 72
 # Checks for header files.
61 73
 AC_CHECK_HEADERS([stdlib.h string.h])

Loading…
Cancel
Save