TIVI-506: QA needs v0.9.8
[profile/ivi/check.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 # Prelude.
5 AC_PREREQ([2.59])
6
7 AC_INIT([Check], [0.9.8], [check-devel at lists dot sourceforge dot net])
8 CHECK_MAJOR_VERSION=0
9 CHECK_MINOR_VERSION=9
10 CHECK_MICRO_VERSION=8
11 CHECK_VERSION=$CHECK_MAJOR_VERSION.$CHECK_MINOR_VERSION.$CHECK_MICRO_VERSION
12
13 # unique source file --- primitive safety check 
14 AC_CONFIG_SRCDIR([src/check.c])
15
16 # place where extra autoconf macros are kept
17 AC_CONFIG_MACRO_DIR([m4])
18
19 # place where portability library functions are kept
20 AC_CONFIG_LIBOBJ_DIR([lib])
21
22 # place to put some extra build scripts installed
23 AC_CONFIG_AUX_DIR([build-aux])
24
25 # define things like _GNU_SOURCE appropriately
26 AC_USE_SYSTEM_EXTENSIONS
27
28 # really severe build strictness
29 AM_INIT_AUTOMAKE([-Wall -Werror gnits 1.9.6])
30
31 # FIXME: find the other places this stuff is used
32
33 AC_SUBST(CHECK_MAJOR_VERSION)
34 AC_SUBST(CHECK_MINOR_VERSION)
35 AC_SUBST(CHECK_MICRO_VERSION)
36 AC_SUBST(CHECK_VERSION)
37
38 # Configure options.
39
40 AC_ARG_ENABLE(gcov,
41 AC_HELP_STRING([--enable-gcov],
42                [turn on test coverage @<:@default=no@:>@]),
43 [case "${enableval}" in
44   yes) enable_gcov=true ;;
45   no)  enable_gcov=false ;;
46   *)   AC_MSG_ERROR(bad value ${enableval} for --enable-gcov) ;;
47 esac], [enable_gcov=false ])
48
49 if test x$enable_gcov = xtrue ; then
50   if test -n "$GCC"; then
51     AC_MSG_ERROR([gcov only works if gcc is used])
52   fi
53
54   GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
55   AC_SUBST(GCOV_CFLAGS)
56
57   dnl libtool 1.5.22 and lower strip -fprofile-arcs from the flags
58   dnl passed to the linker, which is a bug; -fprofile-arcs implicitly
59   dnl links in -lgcov, so we do it explicitly here for the same effect
60   GCOV_LIBS=-lgcov
61   AC_SUBST(GCOV_LIBS)
62 fi
63
64 AM_CONDITIONAL(ENABLE_GCOV, test x"$enable_gcov" = "xtrue")
65
66 AC_ARG_ENABLE(timeout-tests,
67 AC_HELP_STRING([--enable-timeout-tests],
68                [turn on timeout tests @<:@default=yes@:>@]),
69 [case "${enableval}" in
70   yes) enable_timeout_tests=true ;;
71   no)  enable_timeout_tests=false ;;
72   *)   AC_MSG_ERROR(bad value ${enableval} for --enable-timeout-tests) ;;
73 esac], [enable_timeout_tests=true ])
74
75 AM_CONDITIONAL(NO_TIMEOUT_TESTS, test x"$enable_timeout_tests" = "xfalse")
76
77 AC_ARG_ENABLE(subunit,
78 AC_HELP_STRING([--enable-subunit],
79                [enable support for the subunit test protocol @<:@default=autodetect@:>@]),
80 [case "${enableval}" in
81   yes)
82     enable_subunit=true
83     echo "Enabled subunit support"
84     ;;
85   no)
86     enable_subunit=false
87     echoo "Disabled subunit support"
88     ;;
89   autodetect)
90     echo "Subunit support will enable automatically."
91     ;;
92   *)   AC_MSG_ERROR(bad value ${enableval} for --enable-subunit) ;;
93 esac], 
94 [echo "Subunit support will enable automatically."
95  enable_subunit=autodetect])
96
97 # Checks for programs.
98 AC_PROG_AWK
99 AC_PROG_CC
100 # Automake wants this for per-target CFLAGS
101 AM_PROG_CC_C_O
102 AC_PROG_INSTALL
103 AC_PROG_LN_S
104 AC_PROG_LIBTOOL
105
106 # add these options to CFLAGS if the compiler supports them
107 AC_DEFUN([AX_CFLAGS_ADD],[AX_C_CHECK_FLAG($1, , , CFLAGS="$CFLAGS $1")])
108 AX_CFLAGS_WARN_ALL_ANSI
109 AX_CFLAGS_ADD([-Wextra])
110 AX_CFLAGS_ADD([-Wstrict-prototypes])
111 AX_CFLAGS_ADD([-Wmissing-prototypes])
112 AX_CFLAGS_ADD([-Wwrite-strings])
113 AX_CFLAGS_ADD([-Wno-variadic-macros])
114
115 AC_CHECK_PROGS(GCOV, gcov, false)
116 AC_CHECK_PROGS(LCOV, lcov, false)
117 AC_CHECK_PROGS(GENHTML, genhtml, false)
118 AC_CHECK_PROGS(TEX, tex, false)
119 if test -n "$TEX"; then
120     # Make it [somewhat] clear to maintainers that tex is missing. Not an error
121     # though because 'make install' (which users need) does not build the docs
122     # anyway.
123     AC_MSG_WARN(tex not installed: cannot rebuild HTML documentation.)
124 fi
125
126 # Checks for libraries.
127
128 # Checks for header files.
129 AC_HEADER_STDC
130 AC_HEADER_SYS_WAIT
131 AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
132
133 if test xfalse != x"$enable_subunit"; then
134 AC_CHECK_LIB(subunit, subunit_test_start, ,
135 [case "$enable_subunit" in
136  autodetect)
137    enable_subunit=false
138    ;;
139  true)
140    AC_MSG_ERROR([libsubunit is required for subunit protocol support. The homepage for subunit is https://launchpad.net/subunit/])
141    ;;
142  esac
143 ])
144 fi
145 if test xfalse != x"$enable_subunit"; then
146 AC_CHECK_HEADER([subunit/child.h], ,
147 [case "$enable_subunit" in
148  autodetect)
149    enable_subunit=false
150    ;;
151  true)
152    AC_MSG_ERROR([The header subunit/child.h could not be succesfully included and is required for subunit protocol support. The homepage for subunit is https://launchpad.net/subunit/])
153    ;;
154  esac
155 ])
156 fi
157 if test xfalse = x"$enable_subunit"; then
158 ENABLE_SUBUNIT="0"
159 else
160 ENABLE_SUBUNIT="1"
161 fi
162 AC_SUBST(ENABLE_SUBUNIT)
163 AC_DEFINE_UNQUOTED(ENABLE_SUBUNIT, $ENABLE_SUBUNIT, [Subunit protocol result output])
164
165 AM_CONDITIONAL(SUBUNIT, test x"$enable_subunit" != "xfalse")
166
167
168
169 # Checks for typedefs, structures, and compiler characteristics.
170 AC_C_CONST
171 AC_TYPE_PID_T
172 AC_TYPE_SIZE_T
173 AC_HEADER_TIME
174 AC_STRUCT_TM
175
176 AC_CHECK_SIZEOF(int, 4)
177 AC_CHECK_SIZEOF(short, 2)
178 AC_CHECK_SIZEOF(long, 4)
179
180 # Checks for library functions.
181 AC_FUNC_MALLOC
182 AC_FUNC_REALLOC
183 AC_REPLACE_FUNCS([fileno localtime_r pipe putenv setenv sleep strdup strsignal unsetenv])
184 AC_CHECK_DECLS([fileno, localtime_r, pipe, putenv, setenv, sleep, strdup, strsignal, unsetenv])
185
186 # Checks for pthread implementation.
187 ACX_PTHREAD
188 CC="$PTHREAD_CC"
189
190 # Output files
191 AC_CONFIG_HEADERS([config.h])
192
193 AC_CONFIG_FILES([check.pc
194                  Makefile
195                  doc/Makefile
196                  lib/Makefile
197                  src/check.h
198                  src/Makefile
199                  tests/Makefile
200                  tests/test_vars])
201
202 AC_OUTPUT