blob: 9d4c6ae36a2d64d0eddb7e4480cfdad7832d7e1b [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,
Ulrich Drepper1e9ef502006-04-04 22:29:06 +000017dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000018dnl
Ulrich Drepper82c345d2006-04-04 22:07:54 +000019AC_INIT([Red Hat elfutils],[0.120],[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
Ulrich Drepper82c345d2006-04-04 22:07:54 +000025AC_COPYRIGHT([Copyright (C) 1996-2003, 2004, 2005, 2006 Red Hat, Inc.])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000026AC_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 Drepperfbe998a2005-08-29 16:27:10 +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
Ulrich Drepper39cec7a2005-08-30 01:22:01 +0000150AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000151
Ulrich Drepper47be7952005-08-07 04:41:39 +0000152AM_CONDITIONAL(BUILD_STATIC, [dnl
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000153test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
Ulrich Drepper47be7952005-08-07 04:41:39 +0000154
Roland McGrath1b8b4462005-11-16 01:33:38 +0000155AC_ARG_ENABLE([tests-rpath],
156AC_HELP_STRING([--enable-tests-rpath], [build $ORIGIN-using rpath into tests]),
157 [tests_use_rpath=yes], [tests_use_rpath=no])
158AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
159
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000160LIBEBL_SUBDIR="$PACKAGE"
161AC_ARG_ENABLE([libebl-subdir],
162AS_HELP_STRING([--enable-libebl-subdir=DIR],
163[install libebl_CPU modules in $(libdir)/DIR]), [dnl
164LIBEBL_SUBDIR="$enable_libebl_subdir"])
165AC_SUBST([LIBEBL_SUBDIR])
166AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
167AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
168
169dnl The directories with content.
170
171dnl Documentation.
172dnl Commented out for now.
173dnl AC_CONFIG_FILES([doc/Makefile])
174
175dnl Support library.
176AC_CONFIG_FILES([lib/Makefile])
177
178dnl ELF library.
179AC_CONFIG_FILES([libelf/Makefile libelf-po/Makefile.in])
180
181dnl Higher-level ELF support library.
182AC_CONFIG_FILES([libebl/Makefile])
183
184dnl DWARF library.
185AC_CONFIG_FILES([libdw/Makefile])
186
187dnl Higher-level DWARF support library.
188AC_CONFIG_FILES([libdwfl/Makefile])
189
190dnl CPU handling library.
191AC_CONFIG_FILES([libcpu/Makefile])
192
193dnl Assembler library.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000194AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000195AC_CONFIG_FILES([libasm/Makefile])
196
Roland McGrathe47ab762005-11-17 03:16:00 +0000197dnl CPU-specific backend libraries.
198AC_CONFIG_FILES([backends/Makefile])
199
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000200dnl Tools.
201AC_CONFIG_FILES([src/Makefile po/Makefile.in])
202
203dnl Test suite.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000204AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000205AC_CONFIG_FILES([tests/Makefile])
206
207# Get the definitions necessary to create the Makefiles in the po
208# subdirectories. This is a small subset of the gettext rules.
209AC_SUBST(USE_NLS, yes)
210AM_PO_SUBDIRS
211
212
213dnl Test of the config.h file. We hide all kinds of configuration magic
214dnl in there.
215AH_BOTTOM([
216/* Eventually we will allow multi-threaded applications to use the
217 libraries. Therefore we will add the necessary locking although
218 the macros used expand to nothing for now. */
219#define lock_lock(lock) ((void) (lock))
220#define rwlock_define(class,name) class int name
221#define rwlock_init(lock) ((void) (lock))
222#define rwlock_fini(lock) ((void) (lock))
223#define rwlock_rdlock(lock) ((void) (lock))
224#define rwlock_wrlock(lock) ((void) (lock))
225#define rwlock_unlock(lock) ((void) (lock))
226#define tls_key_t void *
227#define key_create(keyp, freefct) (1)
228#define getspecific(key) key
229#define setspecific(key,val) key = val
230#define once_define(class,name) class int name
231#define once_execute(name,fct) \
232 do { \
233 if (name == 0) \
234 fct (); \
235 name = 1; \
236 } while (0)
237
238/* gettext helper macro. */
239#define N_(Str) Str
240
241/* Compiler-specific definitions. */
242#define strong_alias(name, aliasname) \
243 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
244
245#ifdef __i386__
246# define internal_function_def __attribute__ ((regparm (3), stdcall))
247#else
248# define internal_function_def /* nothing */
249#endif
250
251# define internal_function \
252 internal_function_def __attribute__ ((visibility ("internal")))
253# define internal_strong_alias(name, aliasname) \
254 extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def;
255
256#define attribute_hidden \
257 __attribute__ ((visibility ("hidden")))
258
259/* Define ALLOW_UNALIGNED if the architecture allows operations on
260 unaligned memory locations. */
Roland McGrath07d4f2f2005-10-28 06:56:24 +0000261#if defined __i386__ || defined __x86_64__
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000262# define ALLOW_UNALIGNED 1
263#else
264# define ALLOW_UNALIGNED 0
265#endif
266
267#define unlikely(expr) __builtin_expect (expr, 0)
268#define likely(expr) __builtin_expect (expr, 1)
269
270#define obstack_calloc(ob, size) \
271 ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); })
272#define obstack_strdup(ob, str) \
273 ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); })
274#define obstack_strndup(ob, str, n) \
275 ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); })
276
277#if __STDC_VERSION__ >= 199901L
278# define flexarr_size /* empty */
279#else
280# define flexarr_size 0
281#endif
282
283/* Calling conventions. */
284#ifdef __i386__
285# define CALLING_CONVENTION regparm (3), stdcall
286# define AND_CALLING_CONVENTION , regparm (3), stdcall
287#else
288# define CALLING_CONVENTION
289# define AND_CALLING_CONVENTION
290#endif
291
292/* Avoid PLT entries. */
293#ifdef PIC
294# define INTUSE(name) _INTUSE(name)
295# define _INTUSE(name) __##name##_internal
296# define INTDEF(name) _INTDEF(name)
297# define _INTDEF(name) \
298 extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name)));
299# define INTDECL(name) _INTDECL(name)
300# define _INTDECL(name) \
301 extern __typeof__ (name) __##name##_internal attribute_hidden;
302#else
303# define INTUSE(name) name
304# define INTDEF(name) /* empty */
305# define INTDECL(name) /* empty */
306#endif
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000307
308/* This macro is used by the tests conditionalize for standalone building. */
309#define ELFUTILS_HEADER(name) <lib##name.h>
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000310])
311
312AC_OUTPUT