configure.in 7.72 KB
Newer Older
1
dnl Applied patch to handle AC_ARG_ENABLE targets (Patch 1250604) - Provided by Andrew Kephart <andrew.kephart@alereon.com
anilsaharan's avatar
anilsaharan committed
2

tlh2000's avatar
tlh2000 committed
3 4
AC_INIT(CUnit, 2.1-2)
AM_INIT_AUTOMAKE(CUnit, 2.1-2)
5

jds2's avatar
jds2 committed
6
dnl Package version information
7 8
PACKAGE=CUnit
VERSION_MAJOR=2
jds2's avatar
jds2 committed
9
VERSION_MINOR=1
10
VERSION=${VERSION_MAJOR}.${VERSION_MINOR}
tlh2000's avatar
tlh2000 committed
11
RELEASE=2
jds2's avatar
jds2 committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25

dnl Shared library version information
dnl
dnl Current  = interface version (increment when change user interface to lib)
dnl Revision = revision number (increment when change implementation, reset to 0 for new interface)
dnl Age      = number of previous interfaces this one is compatible with (i.e. is a superset of)
dnl
dnl Suffix1  = [Current - Age] (on Linux, anyway, soname suffix is [C-A].A.R)
dnl
LIBTOOL_CURRENT=1
LIBTOOL_REVISION=1
LIBTOOL_AGE=0
LIBTOOL_SUFFIX1=1
LIBTOOL_SUFFIX=${LIBTOOL_SUFFIX1}.${LIBTOOL_AGE}.${LIBTOOL_REVISION}
anilsaharan's avatar
anilsaharan committed
26

27
TOPDIR=`pwd`
anilsaharan's avatar
anilsaharan committed
28

29
CFLAGS="$CFLAGS -DRELEASE=@RELEASE@ -Wall -W -pedantic -Wshadow -ansi -I${PWD}/CUnit/Headers -std=c99"
30
LDFLAGS="$LDFLAGS -L${PWD}/CUnit/Sources"
anilsaharan's avatar
anilsaharan committed
31

32
AC_ARG_ENABLE(debug,
jds2's avatar
jds2 committed
33
  [AS_HELP_STRING([--enable-debug],[enable debugging [default=no]])],
34 35 36 37
  [cu_do_debug=$enableval],
  [cu_do_debug="no"])
if test x"$cu_do_debug" = xyes ; then
	echo "++++++++++ Enabling debug mode compilation."
38
	CFLAGS="$CFLAGS -D_DEBUG -g3 -O0 -Wall"
39
	LDFLAGS="$LDFLAGS -g"
40
	ENABLE_DEBUG="TRUE"
41 42
else
	echo "---------- Disabling debug mode compilation."
43
	ENABLE_DEBUG="FALSE"
44 45 46
fi


jds2's avatar
jds2 committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60
AC_ARG_ENABLE(automated,
  [AS_HELP_STRING([--enable-automated],[compile CUnit automated interface [default=yes]])],
  [cu_do_automated=$enableval],
  [cu_do_automated="yes"])
if test x"$cu_do_automated" = xyes ; then
	echo "++++++++++ Enabling automated(XML) mode compilation"
	BUILD_AUTOMATED="TRUE"
else
	echo "---------- Disabling automated(XML) mode compilation"
	BUILD_AUTOMATED="FALSE"
fi
AM_CONDITIONAL(ENABLE_AUTOMATED, test x"$cu_do_automated" = xyes)


61
AC_ARG_ENABLE(basic,
jds2's avatar
jds2 committed
62
  [AS_HELP_STRING([--enable-basic],[compile CUnit basic interface [default=yes]])],
63
  [cu_do_basic=$enableval],
64
  [cu_do_basic="yes"])
65 66
if test x"$cu_do_basic" = xyes ; then
	echo "++++++++++ Enabling basic mode compilation"
jds2's avatar
jds2 committed
67
	BUILD_BASIC="TRUE"
68 69
else
	echo "---------- Disabling basic mode compilation"
jds2's avatar
jds2 committed
70
	BUILD_BASIC="FALSE"
71
fi
72
AM_CONDITIONAL(ENABLE_BASIC, test x"$cu_do_basic" = xyes)
73 74 75


AC_ARG_ENABLE(console,
jds2's avatar
jds2 committed
76
  [AS_HELP_STRING([--enable-console],[compile CUnit console interface [default=yes]])],
77
  [cu_do_console=$enableval],
78
  [cu_do_console="yes"])
79 80
if test x"$cu_do_console" = xyes ; then
	echo "++++++++++ Enabling console mode compilation"
jds2's avatar
jds2 committed
81
	BUILD_CONSOLE="TRUE"
82 83
else
	echo "---------- Disabling console mode compilation"
jds2's avatar
jds2 committed
84
	BUILD_CONSOLE="FALSE"
85
fi
86
AM_CONDITIONAL(ENABLE_CONSOLE, test x"$cu_do_console" = xyes)
87 88


89
AC_ARG_ENABLE(curses,
jds2's avatar
jds2 committed
90
  [AS_HELP_STRING([--enable-curses],[compile CUnit curses interface [default=no]])],
91 92 93 94 95 96
  [cu_do_curses=$enableval],
  [cu_do_curses="no"])
if test x"$cu_do_curses" = xyes ; then
	echo "++++++++++ Enabling curses mode compilation"
else
	echo "---------- Disabling curses mode compilation"
jds2's avatar
jds2 committed
97
	BUILD_CURSES="FALSE"
98
fi
99

100

101
AC_ARG_ENABLE(examples,
jds2's avatar
jds2 committed
102
  [AS_HELP_STRING([--enable-examples],[compile CUnit example programs [default=no]])],
103 104 105 106
  [cu_do_examples=$enableval],
  [cu_do_examples="no"])
if test x"$cu_do_examples" = xyes ; then
	echo "++++++++++ Enabling examples mode compilation"
jds2's avatar
jds2 committed
107
	BUILD_EXAMPLES="TRUE"
108 109
else
	echo "---------- Disabling examples mode compilation"
jds2's avatar
jds2 committed
110
	BUILD_EXAMPLES="FALSE"
111
fi
112 113
AM_CONDITIONAL(ENABLE_EXAMPLES, test x"$cu_do_examples" = xyes)

114 115

AC_ARG_ENABLE(test,
jds2's avatar
jds2 committed
116
  [AS_HELP_STRING([--enable-test],[compile CUnit internal test program [default=no]])],
117 118 119 120
  [cu_do_test=$enableval],
  [cu_do_test="no"])
if test x"$cu_do_test" = xyes ; then
	echo "++++++++++ Enabling test mode compilation"
jds2's avatar
jds2 committed
121
	BUILD_TEST="TRUE"
122 123
else
	echo "---------- Disabling test mode compilation"
jds2's avatar
jds2 committed
124
	BUILD_TEST="FALSE"
125
fi
126 127
AM_CONDITIONAL(ENABLE_TEST, test x"$cu_do_test" = xyes)

128

129
AC_ARG_ENABLE(memtrace,
jds2's avatar
jds2 committed
130
  [AS_HELP_STRING([--enable-memtrace],[enable CUnit internal memory tracking [default=no]])],
131 132 133
  [cu_do_memtrace=$enableval],
  [cu_do_memtrace="no"])
if  test x"$cu_do_memtrace" = xyes ; then
jds2's avatar
jds2 committed
134
	echo "++++++++++ Enabling memtrace functionality at compile time"
135
	CFLAGS="$CFLAGS -DMEMTRACE"
136
	ENABLE_MEMTRACE="TRUE"
137
else
jds2's avatar
jds2 committed
138
	echo "---------- Disabling memtrace functionality at compile time"
139 140 141 142 143
	ENABLE_MEMTRACE="FALSE"
fi


AC_ARG_ENABLE(deprecated,
jds2's avatar
jds2 committed
144
  [AS_HELP_STRING([--enable-deprecated],[enable use of deprecated v1.1 names [default=no]])],
145 146 147
  [cu_do_deprecated=$enableval],
  [cu_do_deprecated="no"])
if test x"$cu_do_deprecated" = xyes ; then
jds2's avatar
jds2 committed
148
	echo "++++++++++ Enabling use of deprecated v1.1 names"
149 150 151
	CFLAGS="$CFLAGS -DUSE_DEPRECATED_CUNIT_NAMES"
	ENABLE_DEPRECATED="TRUE"
else
jds2's avatar
jds2 committed
152
	echo "---------- Disabling use of deprecated v1.1 names"
153
	ENABLE_DEPRECATED="FALSE"
154
fi
155

jds2's avatar
jds2 committed
156

157
dnl Check for programs.
anilsaharan's avatar
anilsaharan committed
158 159 160
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
Simon Morlat's avatar
Simon Morlat committed
161
LT_INIT(disable-static win32-dll)
anilsaharan's avatar
anilsaharan committed
162

163 164
dnl Check for libraries
AC_CHECK_LIB(c, main)
165

jds2's avatar
jds2 committed
166
dnl TODO: We should provide a --with-curses=PREFIX option to allow user to point to curses lib
167
if test x"$cu_do_curses" = xyes ; then
jds2's avatar
jds2 committed
168 169 170 171 172 173 174 175 176 177 178 179
	AC_CHECK_LIB([ncurses], [initscr], [cu_have_curses="ncurses"], [cu_have_curses="no"])
	if test x"$cu_have_curses" = xno ; then
		AC_CHECK_LIB([curses], [initscr], [cu_have_curses="curses"], [cu_have_curses="no"])
	fi
	if test x"$cu_have_curses" = xno ; then
		echo "---------- Disabling curses mode compilation (lib not found)"
		cu_do_curses="no"
		BUILD_CURSES=FALSE
	else
		BUILD_CURSES=TRUE
	fi
	CURSES_LIB=$cu_have_curses
180
fi
jds2's avatar
jds2 committed
181
AM_CONDITIONAL(ENABLE_CURSES, test x"$cu_do_curses" = xyes)
anilsaharan's avatar
anilsaharan committed
182

183
dnl Check for standard functions
184 185 186 187 188 189 190 191 192 193 194
AC_CHECK_FUNC(malloc, [], [echo malloc not found; exit 1])
AC_CHECK_FUNC(free, [], [echo free not found; exit 1])
AC_CHECK_FUNC(calloc, [], [echo calloc not found; exit 1])
AC_CHECK_FUNC(realloc, [], [echo realloc not found; exit 1])

AC_CHECK_FUNC(strcpy, [], [echo strcpy not found; exit 1])
AC_CHECK_FUNC(strerror, [], [echo strerror not found; exit 1])

AC_CHECK_FUNC(fopen, [], [echo fopen not found; exit 1])
AC_CHECK_FUNC(fclose, [], [echo fclose not found; exit 1])
AC_CHECK_FUNC(fprintf, [], [echo fprintf not found; exit 1])
195
AC_CHECK_FUNC(snprintf, [], [echo snprintf not found; exit 1])
196 197 198 199 200
AC_CHECK_FUNC(setvbuf, [], [echo setvbuf not found; exit 1])

AC_CHECK_FUNC(time, [], [echo time not found; exit 1])
AC_CHECK_FUNC(ctime, [], [echo ctime not found; exit 1])

201
dnl Check for header files.
anilsaharan's avatar
anilsaharan committed
202
AC_HEADER_STDC
anilsaharan's avatar
anilsaharan committed
203 204 205
AC_CHECK_HEADERS(assert.h)
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(math.h)
206
AC_CHECK_HEADERS(file.h)
anilsaharan's avatar
anilsaharan committed
207 208 209
AC_CHECK_HEADERS(stdio.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(string.h)
anilsaharan's avatar
anilsaharan committed
210

211
AM_CONFIG_HEADER(config.h)
212

213
dnl Check for typedefs, structures, and compiler characteristics.
anilsaharan's avatar
anilsaharan committed
214 215
AC_C_CONST

216
dnl Set environment variables.
217 218
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
jds2's avatar
jds2 committed
219 220
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
221
AC_SUBST(RELEASE)
jds2's avatar
jds2 committed
222 223 224 225 226
AC_SUBST(LIBTOOL_CURRENT)
AC_SUBST(LIBTOOL_REVISION)
AC_SUBST(LIBTOOL_AGE)
AC_SUBST(LIBTOOL_SUFFIX1)
AC_SUBST(LIBTOOL_SUFFIX)
227 228 229
AC_SUBST(ENABLE_DEBUG)
AC_SUBST(ENABLE_MEMTRACE)
AC_SUBST(ENABLE_DEPRECATED)
jds2's avatar
jds2 committed
230 231 232 233 234 235 236
AC_SUBST(BUILD_AUTOMATED)
AC_SUBST(BUILD_BASIC)
AC_SUBST(BUILD_CONSOLE)
AC_SUBST(BUILD_CURSES)
AC_SUBST(CURSES_LIB)
AC_SUBST(BUILD_EXAMPLES)
AC_SUBST(BUILD_TEST)
237 238 239

dnl Configure Jamrules for user environment
AC_CONFIG_FILES([Jamrules:Jamrules.in])
240

241
dnl Configure Makefile set.
Simon Morlat's avatar
Simon Morlat committed
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
AC_CONFIG_FILES( Makefile 
		CUnit.spec 
		cunit.pc 
		CUnit/Makefile 
		CUnit/Headers/Makefile 
		CUnit/Headers/CUnit.h 
		CUnit/Sources/Makefile 
		CUnit/Sources/Framework/Makefile 
		CUnit/Sources/Automated/Makefile 
		CUnit/Sources/Basic/Makefile 
		CUnit/Sources/Console/Makefile 
		CUnit/Sources/Curses/Makefile 
		CUnit/Sources/Test/Makefile 
		doc/Makefile 
		doc/headers/Makefile 
		Examples/Makefile 
		Examples/AutomatedTest/Makefile 
		Examples/BasicTest/Makefile 
		Examples/ConsoleTest/Makefile 
		Examples/CursesTest/Makefile 
		Man/Makefile 
		Man/man3/Makefile 
264 265 266 267
		Share/Makefile )

AC_OUTPUT