1dnl Applied patch to handle AC_ARG_ENABLE targets (Patch 1250604) - Provided by Andrew Kephart <andrew.kephart@alereon.com
2
3AC_INIT(CUnit, 2.1-3)
4AM_INIT_AUTOMAKE(CUnit, 2.1-3)
5
6dnl Package version information
7PACKAGE=CUnit
8VERSION_MAJOR=2
9VERSION_MINOR=1
10VERSION=${VERSION_MAJOR}.${VERSION_MINOR}
11RELEASE=3
12
13dnl Shared library version information
14dnl
15dnl Current  = interface version (increment when change user interface to lib)
16dnl Revision = revision number (increment when change implementation, reset to 0 for new interface)
17dnl Age      = number of previous interfaces this one is compatible with (i.e. is a superset of)
18dnl
19dnl Suffix1  = [Current - Age] (on Linux, anyway, soname suffix is [C-A].A.R)
20dnl
21LIBTOOL_CURRENT=1
22LIBTOOL_REVISION=1
23LIBTOOL_AGE=0
24LIBTOOL_SUFFIX1=1
25LIBTOOL_SUFFIX=${LIBTOOL_SUFFIX1}.${LIBTOOL_AGE}.${LIBTOOL_REVISION}
26
27TOPDIR=`pwd`
28
29CFLAGS="$CFLAGS -DRELEASE=@RELEASE@ -Wall -W -pedantic -Wshadow -ansi -I${PWD}/CUnit/Headers -std=c99"
30LDFLAGS="$LDFLAGS -L${PWD}/CUnit/Sources"
31
32AC_ARG_ENABLE(debug,
33  [AS_HELP_STRING([--enable-debug],[enable debugging [default=no]])],
34  [cu_do_debug=$enableval],
35  [cu_do_debug="no"])
36if test x"$cu_do_debug" = xyes ; then
37	echo "++++++++++ Enabling debug mode compilation."
38	CFLAGS="$CFLAGS -D_DEBUG -g3 -Wall"
39	LDFLAGS="$LDFLAGS -g"
40	ENABLE_DEBUG="TRUE"
41else
42	echo "---------- Disabling debug mode compilation."
43	ENABLE_DEBUG="FALSE"
44fi
45
46
47AC_ARG_ENABLE(automated,
48  [AS_HELP_STRING([--enable-automated],[compile CUnit automated interface [default=yes]])],
49  [cu_do_automated=$enableval],
50  [cu_do_automated="yes"])
51if test x"$cu_do_automated" = xyes ; then
52	echo "++++++++++ Enabling automated(XML) mode compilation"
53	BUILD_AUTOMATED="TRUE"
54else
55	echo "---------- Disabling automated(XML) mode compilation"
56	BUILD_AUTOMATED="FALSE"
57fi
58AM_CONDITIONAL(ENABLE_AUTOMATED, test x"$cu_do_automated" = xyes)
59
60
61AC_ARG_ENABLE(basic,
62  [AS_HELP_STRING([--enable-basic],[compile CUnit basic interface [default=yes]])],
63  [cu_do_basic=$enableval],
64  [cu_do_basic="yes"])
65if test x"$cu_do_basic" = xyes ; then
66	echo "++++++++++ Enabling basic mode compilation"
67	BUILD_BASIC="TRUE"
68else
69	echo "---------- Disabling basic mode compilation"
70	BUILD_BASIC="FALSE"
71fi
72AM_CONDITIONAL(ENABLE_BASIC, test x"$cu_do_basic" = xyes)
73
74
75AC_ARG_ENABLE(console,
76  [AS_HELP_STRING([--enable-console],[compile CUnit console interface [default=yes]])],
77  [cu_do_console=$enableval],
78  [cu_do_console="yes"])
79if test x"$cu_do_console" = xyes ; then
80	echo "++++++++++ Enabling console mode compilation"
81	BUILD_CONSOLE="TRUE"
82else
83	echo "---------- Disabling console mode compilation"
84	BUILD_CONSOLE="FALSE"
85fi
86AM_CONDITIONAL(ENABLE_CONSOLE, test x"$cu_do_console" = xyes)
87
88
89AC_ARG_ENABLE(curses,
90  [AS_HELP_STRING([--enable-curses],[compile CUnit curses interface [default=no]])],
91  [cu_do_curses=$enableval],
92  [cu_do_curses="no"])
93if test x"$cu_do_curses" = xyes ; then
94	echo "++++++++++ Enabling curses mode compilation"
95else
96	echo "---------- Disabling curses mode compilation"
97	BUILD_CURSES="FALSE"
98fi
99
100
101AC_ARG_ENABLE(examples,
102  [AS_HELP_STRING([--enable-examples],[compile CUnit example programs [default=no]])],
103  [cu_do_examples=$enableval],
104  [cu_do_examples="no"])
105if test x"$cu_do_examples" = xyes ; then
106	echo "++++++++++ Enabling examples mode compilation"
107	BUILD_EXAMPLES="TRUE"
108else
109	echo "---------- Disabling examples mode compilation"
110	BUILD_EXAMPLES="FALSE"
111fi
112AM_CONDITIONAL(ENABLE_EXAMPLES, test x"$cu_do_examples" = xyes)
113
114
115AC_ARG_ENABLE(test,
116  [AS_HELP_STRING([--enable-test],[compile CUnit internal test program [default=no]])],
117  [cu_do_test=$enableval],
118  [cu_do_test="no"])
119if test x"$cu_do_test" = xyes ; then
120	echo "++++++++++ Enabling test mode compilation"
121	BUILD_TEST="TRUE"
122else
123	echo "---------- Disabling test mode compilation"
124	BUILD_TEST="FALSE"
125fi
126AM_CONDITIONAL(ENABLE_TEST, test x"$cu_do_test" = xyes)
127
128
129AC_ARG_ENABLE(memtrace,
130  [AS_HELP_STRING([--enable-memtrace],[enable CUnit internal memory tracking [default=no]])],
131  [cu_do_memtrace=$enableval],
132  [cu_do_memtrace="no"])
133if  test x"$cu_do_memtrace" = xyes ; then
134	echo "++++++++++ Enabling memtrace functionality at compile time"
135	CFLAGS="$CFLAGS -DMEMTRACE"
136	ENABLE_MEMTRACE="TRUE"
137else
138	echo "---------- Disabling memtrace functionality at compile time"
139	ENABLE_MEMTRACE="FALSE"
140fi
141
142
143AC_ARG_ENABLE(deprecated,
144  [AS_HELP_STRING([--enable-deprecated],[enable use of deprecated v1.1 names [default=no]])],
145  [cu_do_deprecated=$enableval],
146  [cu_do_deprecated="no"])
147if test x"$cu_do_deprecated" = xyes ; then
148	echo "++++++++++ Enabling use of deprecated v1.1 names"
149	CFLAGS="$CFLAGS -DUSE_DEPRECATED_CUNIT_NAMES"
150	ENABLE_DEPRECATED="TRUE"
151else
152	echo "---------- Disabling use of deprecated v1.1 names"
153	ENABLE_DEPRECATED="FALSE"
154fi
155
156
157dnl Check for programs.
158AC_PROG_CC
159AC_PROG_INSTALL
160AC_PROG_MAKE_SET
161AC_PROG_LIBTOOL
162
163dnl Check for libraries
164AC_CHECK_LIB(c, main)
165
166dnl TODO: We should provide a --with-curses=PREFIX option to allow user to point to curses lib
167if test x"$cu_do_curses" = xyes ; then
168	AC_CHECK_LIB([ncurses], [initscr], [cu_have_curses="ncurses"], [cu_have_curses="no"])
169	if test x"$cu_have_curses" = xno ; then
170		AC_CHECK_LIB([curses], [initscr], [cu_have_curses="curses"], [cu_have_curses="no"])
171	fi
172	if test x"$cu_have_curses" = xno ; then
173		echo "---------- Disabling curses mode compilation (lib not found)"
174		cu_do_curses="no"
175		BUILD_CURSES=FALSE
176	else
177		BUILD_CURSES=TRUE
178	fi
179	CURSES_LIB=$cu_have_curses
180fi
181AM_CONDITIONAL(ENABLE_CURSES, test x"$cu_do_curses" = xyes)
182
183dnl Check for standard functions
184AC_CHECK_FUNC(malloc, [], [echo malloc not found; exit 1])
185AC_CHECK_FUNC(free, [], [echo free not found; exit 1])
186AC_CHECK_FUNC(calloc, [], [echo calloc not found; exit 1])
187AC_CHECK_FUNC(realloc, [], [echo realloc not found; exit 1])
188
189AC_CHECK_FUNC(strcpy, [], [echo strcpy not found; exit 1])
190AC_CHECK_FUNC(strerror, [], [echo strerror not found; exit 1])
191
192AC_CHECK_FUNC(fopen, [], [echo fopen not found; exit 1])
193AC_CHECK_FUNC(fclose, [], [echo fclose not found; exit 1])
194AC_CHECK_FUNC(fprintf, [], [echo fprintf not found; exit 1])
195AC_CHECK_FUNC(snprintf, [], [echo snprintf not found; exit 1])
196AC_CHECK_FUNC(setvbuf, [], [echo setvbuf not found; exit 1])
197
198AC_CHECK_FUNC(time, [], [echo time not found; exit 1])
199AC_CHECK_FUNC(ctime, [], [echo ctime not found; exit 1])
200
201dnl Check for header files.
202AC_HEADER_STDC
203AC_CHECK_HEADERS(assert.h)
204AC_CHECK_HEADERS(ctype.h)
205AC_CHECK_HEADERS(math.h)
206AC_CHECK_HEADERS(file.h)
207AC_CHECK_HEADERS(stdio.h)
208AC_CHECK_HEADERS(stdlib.h)
209AC_CHECK_HEADERS(string.h)
210
211AM_CONFIG_HEADER(config.h)
212
213dnl Check for typedefs, structures, and compiler characteristics.
214AC_C_CONST
215
216dnl Set environment variables.
217AC_SUBST(PACKAGE)
218AC_SUBST(VERSION)
219AC_SUBST(VERSION_MAJOR)
220AC_SUBST(VERSION_MINOR)
221AC_SUBST(RELEASE)
222AC_SUBST(LIBTOOL_CURRENT)
223AC_SUBST(LIBTOOL_REVISION)
224AC_SUBST(LIBTOOL_AGE)
225AC_SUBST(LIBTOOL_SUFFIX1)
226AC_SUBST(LIBTOOL_SUFFIX)
227AC_SUBST(ENABLE_DEBUG)
228AC_SUBST(ENABLE_MEMTRACE)
229AC_SUBST(ENABLE_DEPRECATED)
230AC_SUBST(BUILD_AUTOMATED)
231AC_SUBST(BUILD_BASIC)
232AC_SUBST(BUILD_CONSOLE)
233AC_SUBST(BUILD_CURSES)
234AC_SUBST(CURSES_LIB)
235AC_SUBST(BUILD_EXAMPLES)
236AC_SUBST(BUILD_TEST)
237
238dnl Configure Jamrules for user environment
239AC_CONFIG_FILES([Jamrules:Jamrules.in])
240
241dnl Configure Makefile set.
242AC_CONFIG_FILES( Makefile \
243		CUnit.spec \
244		cunit.pc \
245		CUnit/Makefile \
246		CUnit/Headers/Makefile \
247		CUnit/Headers/CUnit.h \
248		CUnit/Sources/Makefile \
249		CUnit/Sources/Framework/Makefile \
250		CUnit/Sources/Automated/Makefile \
251		CUnit/Sources/Basic/Makefile \
252		CUnit/Sources/Console/Makefile \
253		CUnit/Sources/Curses/Makefile \
254		CUnit/Sources/Test/Makefile \
255		doc/Makefile \
256		doc/headers/Makefile \
257		Examples/Makefile \
258		Examples/AutomatedTest/Makefile \
259		Examples/BasicTest/Makefile \
260		Examples/ConsoleTest/Makefile \
261		Examples/CursesTest/Makefile \
262		Man/Makefile \
263		Man/man3/Makefile \
264		Share/Makefile )
265
266AC_OUTPUT
267
268