1# Process this file with autoconf to create configure.
2
3AC_PREREQ([2.65])
4
5# ====================
6# Version informations
7# ====================
8m4_define([cppunit_version_major],[1])
9m4_define([cppunit_version_minor],[14])
10m4_define([cppunit_version_micro],[0])
11m4_define([cppunit_version],[cppunit_version_major.cppunit_version_minor.cppunit_version_micro])
12m4_define([cppunit_interface_age], [0])
13m4_define([cppunit_binary_age], [0])
14
15# =============
16# Automake init
17# =============
18AC_INIT([cppunit],[cppunit_version])
19AC_CONFIG_MACRO_DIR([m4])
20AM_INIT_AUTOMAKE([1.11 foreign dist-xz dist-bzip2])
21AM_SILENT_RULES([yes])
22AC_LANG([C++])
23
24# ===========================
25# Find required base packages
26# ===========================
27AC_PROG_CPP
28AC_PROG_CXX
29AC_PROG_INSTALL
30AC_PROG_LN_S
31AC_PROG_MAKE_SET
32AC_PROG_LIBTOOL
33AC_LIBTOOL_WIN32_DLL
34
35# ======================================
36# Check for various headers and settings
37# ======================================
38AC_HEADER_STDC
39AC_LTDL_DLLIB
40AC_CHECK_HEADERS(cmath,[],[],[/**/])
41AX_CXX_HAVE_ISFINITE
42AC_CHECK_FUNCS(finite)
43AX_CXX_HAVE_SSTREAM
44AC_CXX_HAVE_STRSTREAM
45
46# Enable doxygen
47BB_ENABLE_DOXYGEN
48
49# Compiler characteristics
50AX_CXX_GCC_ABI_DEMANGLE
51AC_CXX_STRING_COMPARE_STRING_FIRST
52AX_CXX_COMPILE_STDCXX_11(noext, mandatory)
53
54# =================================
55# Libtool/Version Makefile settings
56# =================================
57AC_SUBST(CPPUNIT_MAJOR_VERSION, [cppunit_version_major])
58AC_SUBST(CPPUNIT_MINOR_VERSION, [cppunit_version_minor])
59AC_SUBST(CPPUNIT_MICRO_VERSION, [cppunit_version_micro])
60AC_SUBST(CPPUNIT_BINARY_AGE, [cppunit_binary_age])
61AC_SUBST(CPPUNIT_INTERFACE_AGE, [cppunit_interface_age])
62LT_RELEASE=$CPPUNIT_MAJOR_VERSION.$CPPUNIT_MINOR_VERSION
63LT_CURRENT=`expr $CPPUNIT_MICRO_VERSION - $CPPUNIT_INTERFACE_AGE`
64LT_AGE=`expr $CPPUNIT_BINARY_AGE - $CPPUNIT_INTERFACE_AGE`
65
66AC_SUBST(LT_RELEASE)
67AC_SUBST(LT_CURRENT)
68AC_SUBST(LT_REVISION, [cppunit_interface_age])
69AC_SUBST(LT_AGE)
70
71
72# ================
73# Check for cflags
74# ================
75
76# =====
77# Debug
78# =====
79AC_ARG_ENABLE(debug,
80	AS_HELP_STRING([--enable-debug], [Build with debug symbols.]),
81	[enable_debug="$enableval"],
82	[enable_debug=no]
83)
84AS_IF([test "x$enable_debug" != "xno"], [
85	CFLAGS="$CFLAGS -g"
86	CXXFLAGS="$CXXFLAGS -g"
87], [
88	AC_DEFINE([NDEBUG], [], [Disable debugging information])
89])
90
91AC_ARG_ENABLE([werror],
92	[AS_HELP_STRING([--disable-werror], [Treat all warnings as errors, useful for development])],
93	[enable_werror="$enableval"],
94	[enable_werror=yes]
95)
96AS_IF([test x"$enable_werror" != "xno"], [
97	CFLAGS="$CFLAGS -Werror"
98	CXXFLAGS="$CXXFLAGS -Werror"
99])
100AS_IF([test x"$GCC" = xyes], [
101	# Be tough with warnings and produce less careless code
102	# Weffc++ currently prints too much warnings
103	CFLAGS="$CFLAGS -Wall -Wextra -pedantic"
104	CXXFLAGS="$CXXFLAGS -Wall -Wextra -pedantic" # -Weffc++"
105])
106CPPUNIT_CXXFLAGS="$CPPUNIT_CFLAGS"
107AC_SUBST(CPPUNIT_CXXFLAGS)
108
109# ==============
110# Setup config.h
111# ==============
112AC_CONFIG_HEADERS([config.h])
113AX_PREFIX_CONFIG_H([include/cppunit/config-auto.h])
114
115# =====================
116# Prepare all .in files
117# =====================
118AC_CONFIG_FILES([
119	Makefile
120	cppunit.pc
121	cppunit.spec
122	src/Makefile
123	src/DllPlugInTester/Makefile
124	src/cppunit/Makefile
125	include/Makefile
126	include/cppunit/Makefile
127	include/cppunit/config/Makefile
128	include/cppunit/extensions/Makefile
129	include/cppunit/plugin/Makefile
130	include/cppunit/portability/Makefile
131	include/cppunit/tools/Makefile
132	include/cppunit/ui/Makefile
133	include/cppunit/ui/text/Makefile
134	doc/Makefile
135	doc/Doxyfile
136	examples/Makefile
137	examples/simple/Makefile
138	examples/hierarchy/Makefile
139	examples/cppunittest/Makefile
140	examples/ClockerPlugIn/Makefile
141	examples/DumperPlugIn/Makefile
142	examples/money/Makefile
143])
144AC_OUTPUT
145
146# ==============================================
147# Display final informations about configuration
148# ==============================================
149AC_MSG_NOTICE([
150==============================================================================
151Build configuration:
152	debug:              ${enable_debug}
153	docs:               ${enable_doc}
154	werror:             ${enable_werror}
155==============================================================================
156])
157