introduce versioning magic into auto* build
[libfirm] / configure.ac
1 dnl
2 dnl Project:     libFIRM
3 dnl File name:   configure.in
4 dnl Purpose:
5 dnl Author:      Matthias Braun
6 dnl CVS-ID:      $Id$
7 dnl Copyright:   (c) 2002-2007 University of Karlsruhe
8 dnl Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
9 dnl
10 AC_PREREQ([2.54])
11 AC_REVISION([$Id$])
12
13 dnl Firm Versions
14 dnl * Increment major/minor/micro version as you see fit. These 3 numbers
15 dnl   are intended for humans and are independent from the libtool versions
16 m4_define([firm_major_version], [1])
17 m4_define([firm_minor_version], [19])
18 m4_define([firm_micro_version], [0])
19 m4_define([firm_version],
20           [firm_major_version.firm_minor_version.firm_micro_version])
21
22 dnl Libtool versions
23 dnl
24 dnl * If any code has changed at all (i.e. bugfixes) increment revision
25 dnl * If any interface has been added, removed or changed increment
26 dnl   current, set revision to 0
27 dnl * If any interface has been added increment age
28 dnl * If any interfaces have been remove set age to 0
29 dnl * use lt_release if substantial things have been changed. The release can be
30 dnl   thought of as part of the library name. So changing the release creates
31 dnl   a new library.
32 m4_define([lt_current],  [1])
33 m4_define([lt_revision], [0])
34 m4_define([lt_age],      [0])
35 dnl we use firm major version as release
36 m4_define([lt_release],  [firm_major_version])
37
38 AC_INIT([libfirm], [firm_version], [firm@ipd.info.uni-karlsruhe.de])
39 AC_CONFIG_SRCDIR([ir/common/firm.c])
40 AM_INIT_AUTOMAKE([foreign dist-bzip2 1.9])
41
42 AC_DEFINE([libfirm_VERSION_MAJOR], [firm_major_version], [Firms major version number])
43 AC_DEFINE([libfirm_VERSION_MINOR], [firm_minor_version], [Firms minor version number])
44 AC_DEFINE([libfirm_VERSION_MICRO], [firm_micro_version], [Firms micro version number])
45
46 LT_VERSION="lt_current:lt_revision:lt_age"
47 AC_SUBST([LT_VERSION])
48 LT_RELEASE="lt_release"
49 AC_SUBST([LT_RELEASE])
50
51 dnl enable libtool
52 LT_INIT([win32-dll])
53 AC_SUBST([LIBTOOL_DEPS])
54
55 dnl generate the config header file
56 AC_CONFIG_HEADER([config.h])
57
58 dnl keep track of the environment set by the user
59 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS -lm'}"
60 AC_SUBST(libfirm_conf_env)
61
62 dnl enable visibility hidden
63 CFLAGS="-fvisibility=hidden"
64 AC_DEFINE([FIRM_BUILD], [], [Defined when firm library is built])
65 AC_DEFINE([FIRM_DLL], [], [Define when a dynamically loadable shared library is built])
66
67 dnl Package options
68 dnl ===============
69
70 dnl check for additional include dirs
71 AC_ARG_WITH(includedir, [  --with-includedir=add   colon seperated list of directories to include search path],
72     CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`)
73
74 dnl check for additional library dirs
75 AC_ARG_WITH(libdir, [  --with-libdir=add       colon seperated list of directories to linker search path],
76     LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`)
77
78 dnl set debugging
79 dnl -------------
80 AC_ARG_ENABLE([debug],
81 [AS_HELP_STRING([--disable-debug], [disable verifiers and additional debugging routines])],
82 [enable_debug_libfirm="$enableval"], [enable_debug_libfirm="yes"])
83 if test "$enable_debug_libfirm" = yes; then
84         AC_DEFINE([DEBUG_libfirm], [], [define to enable debug mode and checks])
85 fi
86
87 AC_ARG_ENABLE([assert],
88 [AS_HELP_STRING([--disable-assert], [disable assertions])],
89 [enable_assert="$enableval"], [enable_assert="yes"])
90 if test "$enable_assert" = no; then
91   AC_DEFINE([NDEBUG], [], [define to disable asserts])
92 fi
93 AC_SUBST([enable_assert])
94
95 dnl set profiling
96 dnl -------------
97 AC_ARG_ENABLE([profile],
98 [AS_HELP_STRING([--enable-profile], [enable profiling])],
99 [enable_profile_libfirm="$enableval"], [enable_profile_libfirm="no"])
100
101 AC_SUBST([enable_profile_libfirm])
102
103 dnl enable Firm statistics
104 dnl -------------
105 AC_ARG_ENABLE([statistics],
106 [AS_HELP_STRING([--enable-statistics], [enable Firm statistics])],
107 [enable_statistics="$enableval"], [enable_statistics="yes"])
108
109 if test "$enable_statistics" = yes; then
110         FIRMCONFIG_FIRM_STATISTICS="#define FIRMCONFIG_FIRM_STATISTICS"
111 fi
112 AC_SUBST([FIRMCONFIG_FIRM_STATISTICS])
113 AC_SUBST([enable_statistics])
114
115 dnl enable ILP solver support
116 dnl --------------------------------
117 AC_ARG_ENABLE([ilp],
118 [AS_HELP_STRING([--enable-ilp], [enable ilp solver])],
119 [enable_ilp="$enableval"], [enable_ilp="no"])
120
121 if test "$enable_ilp" = yes; then
122   FIRMCONFIG_WITH_ILP="#define FIRMCONFIG_WITH_ILP"
123   AC_DEFINE([WITH_ILP], [], [enable to build code using ilp solvers])
124 fi
125
126 dnl disable backend
127 dnl ---------------
128 AC_ARG_ENABLE([backend],
129 [AS_HELP_STRING([--disable-backend], [disable backends])],
130 [enable_backend="$enableval"], [enable_backend="yes"])
131
132 AC_SUBST(enable_backend)
133
134 dnl Checks for programs.
135 dnl ====================
136
137 dnl check for a C compiler
138 dnl ----------------------
139 AC_PROG_CC
140
141 AC_PATH_PROGS(PERL, perl perl5)
142
143 dnl check for awk
144 dnl -------------
145 AC_PROG_AWK
146
147 dnl Checks for header files.
148 dnl ========================
149
150 AC_HEADER_STDC
151 AC_CHECK_HEADERS([math.h], , AC_MSG_ERROR("math header file not found"))
152 AC_CHECK_HEADERS([alloca.h])
153
154 dnl Checks for libraries.
155 dnl =====================
156
157 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
158 if test "$ac_m_library" != yes; then
159   dnl std math library not found.
160   AC_MSG_ERROR("standard math library not found")
161 fi
162
163 dnl Checks for typedefs, structures, and compiler characteristics.
164 dnl ==============================================================
165 AC_C_CONST
166 AC_C_VOLATILE
167 AC_C_INLINE
168 AC_C_BIGENDIAN(,,,)
169 AC_C_LONG_DOUBLE
170
171 dnl Checks for library functions.
172 dnl =============================
173
174 AC_FUNC_STRTOLD
175
176 dnl Error messaging
177 dnl ===============
178
179
180 dnl Output results
181 AC_CONFIG_FILES([
182         Makefile
183         ir/Makefile
184         include/libfirm/Makefile
185         libfirm.pc
186 ])
187
188 #always do inlining
189 AC_DEFINE([INLINE], [inline], [define inline to compiler inline keyword])
190
191 BACKENDS=""
192 if test "$enable_backend" = yes; then
193         BACKENDS="arm ia32 mips ppc32 sparc amd64"
194 fi
195 AC_SUBST([BACKENDS])
196
197 AC_OUTPUT
198
199 dnl output summary of firm configuration
200 echo ""
201 echo "firm configuration summary:"
202 echo "     backends              $BACKENDS"
203 echo "     profiling             $enable_profile_libfirm"
204 echo "     debug/verifiers       $enable_debug_libfirm"
205 echo "     assertions            $enable_assert"
206 echo "     statistics            $enable_statistics"
207 echo "     ilp                   $enable_ilp"
208 echo ""