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