blob: f721310db2c8a47d6e710cf6a72929d9ae5ac13d [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001dnl Process this file with autoconf to produce a configure script.
2dnl Configure input file for elfutils. -*-autoconf-*-
3dnl
4dnl Copyright (C) 1996-2002, 2003, 2004, 2005 Red Hat, Inc.
5dnl
6dnl This program is free software; you can redistribute it and/or modify
7dnl it under the terms of the GNU General Public License as published by
8dnl the Free Software Foundation, version 2.
9dnl
10dnl This program is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13dnl GNU General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU General Public License
16dnl along with this program; if not, write to the Free Software Foundation,
17dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18dnl
Ulrich Drepper490063e2005-08-28 02:46:32 +000019AC_INIT([Red Hat elfutils],[0.115],[http://bugzilla.redhat.com/bugzilla/],
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000020 [elfutils])
21
22AC_CONFIG_AUX_DIR([config])
23AC_CONFIG_FILES([config/Makefile])
24
25AC_COPYRIGHT([Copyright (C) 1996-2003, 2004, 2005 Red Hat, Inc.])
26AC_PREREQ(2.59) dnl Minimum Autoconf version required.
27
28AM_INIT_AUTOMAKE([gnits 1.7])
29
30dnl Unique ID for this build.
31MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)"
32AC_SUBST([MODVERSION])
33AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
34AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
35
36AC_CONFIG_SRCDIR([libelf/libelf.h])
37AC_CONFIG_FILES([Makefile])
38AC_CONFIG_HEADERS([config.h])
39
40AC_CONFIG_MACRO_DIR([m4])
41AC_CONFIG_FILES([m4/Makefile])
42
43dnl The RPM spec file. We substitute a few values in the file.
44AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in])
45
46
47AC_CANONICAL_HOST
48
49AC_ARG_ENABLE([tls],
50AS_HELP_STRING([--enable-tls], [enable use of thread local storage]),
51AC_DEFINE(USE_TLS))
52AH_TEMPLATE([USE_TLS], [Defined if thread local storage should be used.])
53
54dnl Add all the languages for which translations are available.
55ALL_LINGUAS=
56
57AC_PROG_CC
58AC_PROG_RANLIB
59AC_PROG_YACC
60AM_PROG_LEX
61
62AC_CACHE_CHECK([for gcc with C99 support], ac_cv_c99, [dnl
63old_CFLAGS="$CFLAGS"
64CFLAGS="$CFLAGS -std=gnu99"
65AC_COMPILE_IFELSE([dnl
66int foo (int a) { for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; }],
67 ac_cv_c99=yes, ac_cv_c99=no)
68CFLAGS="$old_CFLAGS"])
69AS_IF([test "x$ac_cv_c99" != xyes],
70 AC_MSG_ERROR([gcc with C99 support required]))
71
72LOCALEDIR=$datadir
73AC_SUBST(LOCALEDIR)
74AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR")
75AH_TEMPLATE([LOCALEDIR], [Directory to place translation files in.])
76
77DATADIRNAME=$datadir
78AC_SUBST(DATADIRNAME)
79
80dnl This test must come as early as possible after the compiler configuration
81dnl tests, because the choice of the file model can (in principle) affect
82dnl whether functions and headers are available, whether they work, etc.
83AC_SYS_LARGEFILE
84
85dnl Enable the linker to be build as a native-only linker. By default it
86dnl can handle all architectures but this comes at a cost. A native
87dnl will be slightly faster, small, and has fewer dependencies.
88native_ld=no
89AC_ARG_ENABLE([generic],
90AS_HELP_STRING([--disable-generic], [do not build generic linker]), [dnl
91if test "$enable_generic" = no; then
92 case "$host_cpu" in
93 i?86)
94 AC_DEFINE(NATIVE_ELF, 32)
95 native_ld=yes
96 base_cpu=i386
97 ;;
98 *)
99 AC_MSG_ERROR([no machine-specific linker for this configuration available])
100 ;;
101 esac
102fi])
103AH_TEMPLATE([NATIVE_ELF],
104[Define to 32 or 64 if a specific implementation is wanted.])
105AM_CONDITIONAL(NATIVE_LD, test "$native_ld" = yes)
106dnl The automake generated Makefile cannot deal with macros in the name
107dnl of files if at any time there is no such file, even if the filename
108dnl would not be used.
109AS_IF([test -z "$base_cpu"], [base_cpu=none])
110AC_SUBST(base_cpu)
111
112dnl Enable debugging via mudflap. This option will cause most libraries
113dnl to be built as archives which are statically linked into the applications.
114dnl All code, as far as possible, is compiled instrumented to catch all
115dnl the bugs valgrind is able to catch.
116use_mudflap=no
117AC_ARG_ENABLE([mudflap],
118AS_HELP_STRING([--enable-mudflap],
119[build binaries with mudflap instrumentation]), [dnl
120if test "x$enable_mudflap" = xyes; then
121 # Check whether the compiler support -fmudflap.
122 old_CFLAGS="$CFLAGS"
123 CFLAGS="$CFLAGS -fmudflap"
124 AC_TRY_COMPILE([], [], use_mudflap=yes, use_mudflap=fail)
125 CFLAGS="$old_CFLAGS"
126fi])
127if test "$use_mudflap" = fail; then
128 AC_MSG_FAILURE([--enable-mudflap requires a compiler which understands this option])
129fi
130AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes)
131
Ulrich Drepper47be7952005-08-07 04:41:39 +0000132# Enable gprof suport.
133AC_ARG_ENABLE([gprof],
134AC_HELP_STRING([--enable-gprof],
135[build binaries with gprof support]), [use_gprof=yes], [use_gprof=no])
136if test "$use_gprof" = yes; then
137 CFLAGS="$CFLAGS -pg"
138 LDFLAGS="$LDFLAGS -pg"
139fi
140AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
Ulrich Drepper3d413d42005-08-28 16:18:57 +0000141
142# Enable gcov suport.
143AC_ARG_ENABLE([gcov],
144AC_HELP_STRING([--enable-gcov],
145[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no])
146if test "$use_gcov" = yes; then
147 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
148 LDFLAGS="$LDFLAGS -fprofile-arcs"
149fi
150AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
151
Ulrich Drepper47be7952005-08-07 04:41:39 +0000152AM_CONDITIONAL(BUILD_STATIC, [dnl
Ulrich Drepper3d413d42005-08-28 16:18:57 +0000153test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
Ulrich Drepper47be7952005-08-07 04:41:39 +0000154
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000155LIBEBL_SUBDIR="$PACKAGE"
156AC_ARG_ENABLE([libebl-subdir],
157AS_HELP_STRING([--enable-libebl-subdir=DIR],
158[install libebl_CPU modules in $(libdir)/DIR]), [dnl
159LIBEBL_SUBDIR="$enable_libebl_subdir"])
160AC_SUBST([LIBEBL_SUBDIR])
161AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
162AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
163
164dnl The directories with content.
165
166dnl Documentation.
167dnl Commented out for now.
168dnl AC_CONFIG_FILES([doc/Makefile])
169
170dnl Support library.
171AC_CONFIG_FILES([lib/Makefile])
172
173dnl ELF library.
174AC_CONFIG_FILES([libelf/Makefile libelf-po/Makefile.in])
175
176dnl Higher-level ELF support library.
177AC_CONFIG_FILES([libebl/Makefile])
178
179dnl DWARF library.
180AC_CONFIG_FILES([libdw/Makefile])
181
182dnl Higher-level DWARF support library.
183AC_CONFIG_FILES([libdwfl/Makefile])
184
185dnl CPU handling library.
186AC_CONFIG_FILES([libcpu/Makefile])
187
188dnl Assembler library.
189AC_CONFIG_FILES([libasm/Makefile])
190
191dnl Tools.
192AC_CONFIG_FILES([src/Makefile po/Makefile.in])
193
194dnl Test suite.
195AC_CONFIG_FILES([tests/Makefile])
196
197# Get the definitions necessary to create the Makefiles in the po
198# subdirectories. This is a small subset of the gettext rules.
199AC_SUBST(USE_NLS, yes)
200AM_PO_SUBDIRS
201
202
203dnl Test of the config.h file. We hide all kinds of configuration magic
204dnl in there.
205AH_BOTTOM([
206/* Eventually we will allow multi-threaded applications to use the
207 libraries. Therefore we will add the necessary locking although
208 the macros used expand to nothing for now. */
209#define lock_lock(lock) ((void) (lock))
210#define rwlock_define(class,name) class int name
211#define rwlock_init(lock) ((void) (lock))
212#define rwlock_fini(lock) ((void) (lock))
213#define rwlock_rdlock(lock) ((void) (lock))
214#define rwlock_wrlock(lock) ((void) (lock))
215#define rwlock_unlock(lock) ((void) (lock))
216#define tls_key_t void *
217#define key_create(keyp, freefct) (1)
218#define getspecific(key) key
219#define setspecific(key,val) key = val
220#define once_define(class,name) class int name
221#define once_execute(name,fct) \
222 do { \
223 if (name == 0) \
224 fct (); \
225 name = 1; \
226 } while (0)
227
228/* gettext helper macro. */
229#define N_(Str) Str
230
231/* Compiler-specific definitions. */
232#define strong_alias(name, aliasname) \
233 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
234
235#ifdef __i386__
236# define internal_function_def __attribute__ ((regparm (3), stdcall))
237#else
238# define internal_function_def /* nothing */
239#endif
240
241# define internal_function \
242 internal_function_def __attribute__ ((visibility ("internal")))
243# define internal_strong_alias(name, aliasname) \
244 extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def;
245
246#define attribute_hidden \
247 __attribute__ ((visibility ("hidden")))
248
249/* Define ALLOW_UNALIGNED if the architecture allows operations on
250 unaligned memory locations. */
251#if defined __i386__ || defined __alpha__ || defined __x86_64__ || defined __ia64__
252# define ALLOW_UNALIGNED 1
253#else
254# define ALLOW_UNALIGNED 0
255#endif
256
257#define unlikely(expr) __builtin_expect (expr, 0)
258#define likely(expr) __builtin_expect (expr, 1)
259
260#define obstack_calloc(ob, size) \
261 ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); })
262#define obstack_strdup(ob, str) \
263 ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); })
264#define obstack_strndup(ob, str, n) \
265 ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); })
266
267#if __STDC_VERSION__ >= 199901L
268# define flexarr_size /* empty */
269#else
270# define flexarr_size 0
271#endif
272
273/* Calling conventions. */
274#ifdef __i386__
275# define CALLING_CONVENTION regparm (3), stdcall
276# define AND_CALLING_CONVENTION , regparm (3), stdcall
277#else
278# define CALLING_CONVENTION
279# define AND_CALLING_CONVENTION
280#endif
281
282/* Avoid PLT entries. */
283#ifdef PIC
284# define INTUSE(name) _INTUSE(name)
285# define _INTUSE(name) __##name##_internal
286# define INTDEF(name) _INTDEF(name)
287# define _INTDEF(name) \
288 extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name)));
289# define INTDECL(name) _INTDECL(name)
290# define _INTDECL(name) \
291 extern __typeof__ (name) __##name##_internal attribute_hidden;
292#else
293# define INTUSE(name) name
294# define INTDEF(name) /* empty */
295# define INTDECL(name) /* empty */
296#endif
297])
298
299AC_OUTPUT