blob: f8d4ef35aa01befa059f5eb472cf68652852276b [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 Drepper5d832292005-08-15 21:36:27 +000019AC_INIT([Red Hat elfutils],[0.114],[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)
141AM_CONDITIONAL(BUILD_STATIC, [dnl
142test "$use_mudflap" = yes -o "$use_gprof" = yes])
143
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000144LIBEBL_SUBDIR="$PACKAGE"
145AC_ARG_ENABLE([libebl-subdir],
146AS_HELP_STRING([--enable-libebl-subdir=DIR],
147[install libebl_CPU modules in $(libdir)/DIR]), [dnl
148LIBEBL_SUBDIR="$enable_libebl_subdir"])
149AC_SUBST([LIBEBL_SUBDIR])
150AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
151AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
152
153dnl The directories with content.
154
155dnl Documentation.
156dnl Commented out for now.
157dnl AC_CONFIG_FILES([doc/Makefile])
158
159dnl Support library.
160AC_CONFIG_FILES([lib/Makefile])
161
162dnl ELF library.
163AC_CONFIG_FILES([libelf/Makefile libelf-po/Makefile.in])
164
165dnl Higher-level ELF support library.
166AC_CONFIG_FILES([libebl/Makefile])
167
168dnl DWARF library.
169AC_CONFIG_FILES([libdw/Makefile])
170
171dnl Higher-level DWARF support library.
172AC_CONFIG_FILES([libdwfl/Makefile])
173
174dnl CPU handling library.
175AC_CONFIG_FILES([libcpu/Makefile])
176
177dnl Assembler library.
178AC_CONFIG_FILES([libasm/Makefile])
179
180dnl Tools.
181AC_CONFIG_FILES([src/Makefile po/Makefile.in])
182
183dnl Test suite.
184AC_CONFIG_FILES([tests/Makefile])
185
186# Get the definitions necessary to create the Makefiles in the po
187# subdirectories. This is a small subset of the gettext rules.
188AC_SUBST(USE_NLS, yes)
189AM_PO_SUBDIRS
190
191
192dnl Test of the config.h file. We hide all kinds of configuration magic
193dnl in there.
194AH_BOTTOM([
195/* Eventually we will allow multi-threaded applications to use the
196 libraries. Therefore we will add the necessary locking although
197 the macros used expand to nothing for now. */
198#define lock_lock(lock) ((void) (lock))
199#define rwlock_define(class,name) class int name
200#define rwlock_init(lock) ((void) (lock))
201#define rwlock_fini(lock) ((void) (lock))
202#define rwlock_rdlock(lock) ((void) (lock))
203#define rwlock_wrlock(lock) ((void) (lock))
204#define rwlock_unlock(lock) ((void) (lock))
205#define tls_key_t void *
206#define key_create(keyp, freefct) (1)
207#define getspecific(key) key
208#define setspecific(key,val) key = val
209#define once_define(class,name) class int name
210#define once_execute(name,fct) \
211 do { \
212 if (name == 0) \
213 fct (); \
214 name = 1; \
215 } while (0)
216
217/* gettext helper macro. */
218#define N_(Str) Str
219
220/* Compiler-specific definitions. */
221#define strong_alias(name, aliasname) \
222 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
223
224#ifdef __i386__
225# define internal_function_def __attribute__ ((regparm (3), stdcall))
226#else
227# define internal_function_def /* nothing */
228#endif
229
230# define internal_function \
231 internal_function_def __attribute__ ((visibility ("internal")))
232# define internal_strong_alias(name, aliasname) \
233 extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def;
234
235#define attribute_hidden \
236 __attribute__ ((visibility ("hidden")))
237
238/* Define ALLOW_UNALIGNED if the architecture allows operations on
239 unaligned memory locations. */
240#if defined __i386__ || defined __alpha__ || defined __x86_64__ || defined __ia64__
241# define ALLOW_UNALIGNED 1
242#else
243# define ALLOW_UNALIGNED 0
244#endif
245
246#define unlikely(expr) __builtin_expect (expr, 0)
247#define likely(expr) __builtin_expect (expr, 1)
248
249#define obstack_calloc(ob, size) \
250 ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); })
251#define obstack_strdup(ob, str) \
252 ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); })
253#define obstack_strndup(ob, str, n) \
254 ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); })
255
256#if __STDC_VERSION__ >= 199901L
257# define flexarr_size /* empty */
258#else
259# define flexarr_size 0
260#endif
261
262/* Calling conventions. */
263#ifdef __i386__
264# define CALLING_CONVENTION regparm (3), stdcall
265# define AND_CALLING_CONVENTION , regparm (3), stdcall
266#else
267# define CALLING_CONVENTION
268# define AND_CALLING_CONVENTION
269#endif
270
271/* Avoid PLT entries. */
272#ifdef PIC
273# define INTUSE(name) _INTUSE(name)
274# define _INTUSE(name) __##name##_internal
275# define INTDEF(name) _INTDEF(name)
276# define _INTDEF(name) \
277 extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name)));
278# define INTDECL(name) _INTDECL(name)
279# define _INTDECL(name) \
280 extern __typeof__ (name) __##name##_internal attribute_hidden;
281#else
282# define INTUSE(name) name
283# define INTDEF(name) /* empty */
284# define INTDECL(name) /* empty */
285#endif
286])
287
288AC_OUTPUT