91b68f0218d30637b1f6674951bb3f627e9d8177
[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 m4_define([firm_major_version], [1])
13 m4_define([firm_minor_version], [18])
14 m4_define([firm_micro_version], [1])
15 m4_define([firm_version],
16           [firm_major_version.firm_minor_version.firm_micro_version])
17 AC_INIT([libfirm], [firm_version], [firm@ipd.info.uni-karlsruhe.de])
18 AC_CONFIG_SRCDIR([ir/common/firm.c])
19 AM_INIT_AUTOMAKE([foreign dist-bzip2 1.9])
20
21 # see libtool manual on what version numbers mean!
22 LT_VERSION=0:0:0
23 AC_SUBST([LT_VERSION])
24
25 AC_DEFINE([libfirm_VERSION_MAJOR], [firm_major_version], [Firms major version number])
26 AC_DEFINE([libfirm_VERSION_MINOR], [firm_minor_version], [Firms minor version number])
27 AC_DEFINE([libfirm_VERSION_MICRO], [firm_micro_version], [Firms micro version number])
28
29 dnl enable libtool
30 LT_INIT([win32-dll])
31
32 dnl generate the config header file
33 AC_CONFIG_HEADER([config.h])
34
35 dnl keep track of the environment set by the user
36 libfirm_conf_env="${CC+CC='$CC'} ${CFLAGS+CFLAGS='$CFLAGS'} ${CPP+CPP='$CPP'} ${CPPFLAGS+CPPFLAGS='$CPPFLAGS'} ${LDFLAGS+LDFLAGS='$LDFLAGS'} ${LIBS+LIBS='$LIBS -lm'}"
37 AC_SUBST(libfirm_conf_env)
38
39 dnl enable visibility hidden
40 CFLAGS="-fvisibility=hidden"
41
42 dnl Package options
43 dnl ===============
44
45 dnl check for additional include dirs
46 AC_ARG_WITH(includedir, [  --with-includedir=add   colon seperated list of directories to include search path],
47     CPPFLAGS=$CPPFLAGS" -I"`echo $withval|sed 's;\:; -I;g'`)
48
49 dnl check for additional library dirs
50 AC_ARG_WITH(libdir, [  --with-libdir=add       colon seperated list of directories to linker search path],
51     LDFLAGS=$LDFLAGS" -L"`echo $withval|sed 's;\:; -L;g'`)
52
53 dnl set debugging
54 dnl -------------
55 AC_ARG_ENABLE([debug],
56 [AS_HELP_STRING([--disable-debug], [disable verifiers and additional debugging routines])],
57 [enable_debug_libfirm="$enableval"], [enable_debug_libfirm="yes"])
58 if test "$enable_debug_libfirm" = yes; then
59         AC_DEFINE([DEBUG_libfirm], [], [define to enable debug mode and checks])
60 fi
61
62 AC_ARG_ENABLE([assert],
63 [AS_HELP_STRING([--disable-assert], [disable assertions])],
64 [enable_assert="$enableval"], [enable_assert="yes"])
65 if test "$enable_assert" = no; then
66   AC_DEFINE([NDEBUG], [], [define to disable asserts])
67 fi
68 AC_SUBST([enable_assert])
69
70 dnl set profiling
71 dnl -------------
72 AC_ARG_ENABLE([profile],
73 [AS_HELP_STRING([--enable-profile], [enable profiling])],
74 [enable_profile_libfirm="$enableval"], [enable_profile_libfirm="no"])
75
76 AC_SUBST([enable_profile_libfirm])
77
78 dnl enable Firm statistics
79 dnl -------------
80 AC_ARG_ENABLE([statistics],
81 [AS_HELP_STRING([--enable-statistics], [enable Firm statistics])],
82 [enable_statistics="$enableval"], [enable_statistics="yes"])
83
84 if test "$enable_statistics" = yes; then
85         FIRMCONFIG_FIRM_STATISTICS="#define FIRMCONFIG_FIRM_STATISTICS"
86 fi
87 AC_SUBST([FIRMCONFIG_FIRM_STATISTICS])
88 AC_SUBST([enable_statistics])
89
90 dnl enable ILP solver support
91 dnl --------------------------------
92 AC_ARG_ENABLE([ilp],
93 [AS_HELP_STRING([--enable-ilp], [enable ilp solver])],
94 [enable_ilp="$enableval"], [enable_ilp="no"])
95
96 if test "$enable_ilp" = yes; then
97   FIRMCONFIG_WITH_ILP="#define FIRMCONFIG_WITH_ILP"
98   AC_DEFINE([WITH_ILP], [], [enable to build code using ilp solvers])
99 fi
100
101 dnl disable backend
102 dnl ---------------
103 AC_ARG_ENABLE([backend],
104 [AS_HELP_STRING([--disable-backend], [disable backends])],
105 [enable_backend="$enableval"], [enable_backend="yes"])
106
107 AC_SUBST(enable_backend)
108
109 dnl Checks for programs.
110 dnl ====================
111
112 dnl check for a C compiler
113 dnl ----------------------
114 AC_PROG_CC
115
116 AC_PATH_PROGS(PERL, perl perl5)
117
118 dnl check for awk
119 dnl -------------
120 AC_PROG_AWK
121
122 dnl Checks for header files.
123 dnl ========================
124
125 AC_HEADER_STDC
126 AC_CHECK_HEADERS([math.h], , AC_MSG_ERROR("math header file not found"))
127 AC_CHECK_HEADERS([alloca.h])
128
129 dnl Checks for libraries.
130 dnl =====================
131
132 AC_CHECK_LIB(m, main, ac_m_library="yes", ac_m_library="no")
133 if test "$ac_m_library" != yes; then
134   dnl std math library not found.
135   AC_MSG_ERROR("standard math library not found")
136 fi
137
138 dnl Checks for typedefs, structures, and compiler characteristics.
139 dnl ==============================================================
140 AC_C_CONST
141 AC_C_VOLATILE
142 AC_C_INLINE
143 AC_C_BIGENDIAN(,,,)
144 AC_C_LONG_DOUBLE
145
146 dnl Checks for library functions.
147 dnl =============================
148
149 AC_FUNC_STRTOLD
150
151 dnl Error messaging
152 dnl ===============
153
154
155 dnl Output results
156 AC_CONFIG_FILES([
157         Makefile
158         ir/Makefile
159         include/libfirm/Makefile
160         libfirm.pc
161 ])
162
163 #always do inlining
164 AC_DEFINE([INLINE], [inline], [define inline to compiler inline keyword])
165
166 BACKENDS=""
167 if test "$enable_backend" = yes; then
168         BACKENDS="arm ia32 mips ppc32 sparc amd64"
169 fi
170 AC_SUBST([BACKENDS])
171
172 AC_OUTPUT
173
174 dnl output summary of firm configuration
175 echo ""
176 echo "firm configuration summary:"
177 echo "     backends              $BACKENDS"
178 echo "     profiling             $enable_profile_libfirm"
179 echo "     debug/verifiers       $enable_debug_libfirm"
180 echo "     assertions            $enable_assert"
181 echo "     statistics            $enable_statistics"
182 echo "     ilp                   $enable_ilp"
183 echo ""