blob: de81c68c38b5c98ea8cfe7a7fa046ed7ec2620f4 [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
Ulrich Drepper28ed8952006-07-07 03:43:47 +00004dnl Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00005dnl
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 Drepper28ed8952006-07-07 03:43:47 +000019AC_INIT([Red Hat elfutils],[0.122],[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)
Ulrich Drepper28ed8952006-07-07 03:43:47 +0000111dnl Support to work around automake's inflexible dependency generation.
112dnl See src/Makefile.am for more information.
113AM_CONDITIONAL(NEVER, false)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000114
115dnl Enable debugging via mudflap. This option will cause most libraries
116dnl to be built as archives which are statically linked into the applications.
117dnl All code, as far as possible, is compiled instrumented to catch all
118dnl the bugs valgrind is able to catch.
119use_mudflap=no
120AC_ARG_ENABLE([mudflap],
121AS_HELP_STRING([--enable-mudflap],
122[build binaries with mudflap instrumentation]), [dnl
123if test "x$enable_mudflap" = xyes; then
124 # Check whether the compiler support -fmudflap.
125 old_CFLAGS="$CFLAGS"
126 CFLAGS="$CFLAGS -fmudflap"
127 AC_TRY_COMPILE([], [], use_mudflap=yes, use_mudflap=fail)
128 CFLAGS="$old_CFLAGS"
129fi])
130if test "$use_mudflap" = fail; then
131 AC_MSG_FAILURE([--enable-mudflap requires a compiler which understands this option])
132fi
133AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes)
134
Ulrich Drepper47be7952005-08-07 04:41:39 +0000135# Enable gprof suport.
136AC_ARG_ENABLE([gprof],
137AC_HELP_STRING([--enable-gprof],
138[build binaries with gprof support]), [use_gprof=yes], [use_gprof=no])
139if test "$use_gprof" = yes; then
140 CFLAGS="$CFLAGS -pg"
141 LDFLAGS="$LDFLAGS -pg"
142fi
143AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000144
145# Enable gcov suport.
146AC_ARG_ENABLE([gcov],
147AC_HELP_STRING([--enable-gcov],
148[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no])
149if test "$use_gcov" = yes; then
150 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
151 LDFLAGS="$LDFLAGS -fprofile-arcs"
152fi
Ulrich Drepper39cec7a2005-08-30 01:22:01 +0000153AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000154
Ulrich Drepper47be7952005-08-07 04:41:39 +0000155AM_CONDITIONAL(BUILD_STATIC, [dnl
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000156test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
Ulrich Drepper47be7952005-08-07 04:41:39 +0000157
Roland McGrath1b8b4462005-11-16 01:33:38 +0000158AC_ARG_ENABLE([tests-rpath],
159AC_HELP_STRING([--enable-tests-rpath], [build $ORIGIN-using rpath into tests]),
160 [tests_use_rpath=yes], [tests_use_rpath=no])
161AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
162
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000163LIBEBL_SUBDIR="$PACKAGE"
164AC_ARG_ENABLE([libebl-subdir],
165AS_HELP_STRING([--enable-libebl-subdir=DIR],
166[install libebl_CPU modules in $(libdir)/DIR]), [dnl
167LIBEBL_SUBDIR="$enable_libebl_subdir"])
168AC_SUBST([LIBEBL_SUBDIR])
169AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
170AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
171
172dnl The directories with content.
173
174dnl Documentation.
175dnl Commented out for now.
176dnl AC_CONFIG_FILES([doc/Makefile])
177
178dnl Support library.
179AC_CONFIG_FILES([lib/Makefile])
180
181dnl ELF library.
182AC_CONFIG_FILES([libelf/Makefile libelf-po/Makefile.in])
183
184dnl Higher-level ELF support library.
185AC_CONFIG_FILES([libebl/Makefile])
186
187dnl DWARF library.
188AC_CONFIG_FILES([libdw/Makefile])
189
190dnl Higher-level DWARF support library.
191AC_CONFIG_FILES([libdwfl/Makefile])
192
193dnl CPU handling library.
194AC_CONFIG_FILES([libcpu/Makefile])
195
196dnl Assembler library.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000197AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000198AC_CONFIG_FILES([libasm/Makefile])
199
Roland McGrathe47ab762005-11-17 03:16:00 +0000200dnl CPU-specific backend libraries.
201AC_CONFIG_FILES([backends/Makefile])
202
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000203dnl Tools.
204AC_CONFIG_FILES([src/Makefile po/Makefile.in])
205
206dnl Test suite.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000207AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000208AC_CONFIG_FILES([tests/Makefile])
209
210# Get the definitions necessary to create the Makefiles in the po
211# subdirectories. This is a small subset of the gettext rules.
212AC_SUBST(USE_NLS, yes)
213AM_PO_SUBDIRS
214
215
216dnl Test of the config.h file. We hide all kinds of configuration magic
217dnl in there.
218AH_BOTTOM([
219/* Eventually we will allow multi-threaded applications to use the
220 libraries. Therefore we will add the necessary locking although
221 the macros used expand to nothing for now. */
222#define lock_lock(lock) ((void) (lock))
223#define rwlock_define(class,name) class int name
224#define rwlock_init(lock) ((void) (lock))
225#define rwlock_fini(lock) ((void) (lock))
226#define rwlock_rdlock(lock) ((void) (lock))
227#define rwlock_wrlock(lock) ((void) (lock))
228#define rwlock_unlock(lock) ((void) (lock))
229#define tls_key_t void *
230#define key_create(keyp, freefct) (1)
231#define getspecific(key) key
232#define setspecific(key,val) key = val
233#define once_define(class,name) class int name
234#define once_execute(name,fct) \
235 do { \
236 if (name == 0) \
237 fct (); \
238 name = 1; \
239 } while (0)
240
241/* gettext helper macro. */
242#define N_(Str) Str
243
244/* Compiler-specific definitions. */
245#define strong_alias(name, aliasname) \
246 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
247
248#ifdef __i386__
Ulrich Drepperd89d2db2006-07-12 18:39:51 +0000249# define internal_function __attribute__ ((regparm (3), stdcall))
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000250#else
Ulrich Drepperd89d2db2006-07-12 18:39:51 +0000251# define internal_function /* nothing */
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000252#endif
253
Ulrich Drepperd89d2db2006-07-12 18:39:51 +0000254#define internal_strong_alias(name, aliasname) \
255 extern __typeof (name) aliasname __attribute__ ((alias (#name))) internal_function;
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000256
257#define attribute_hidden \
258 __attribute__ ((visibility ("hidden")))
259
260/* Define ALLOW_UNALIGNED if the architecture allows operations on
261 unaligned memory locations. */
Roland McGrath07d4f2f2005-10-28 06:56:24 +0000262#if defined __i386__ || defined __x86_64__
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000263# define ALLOW_UNALIGNED 1
264#else
265# define ALLOW_UNALIGNED 0
266#endif
267
268#define unlikely(expr) __builtin_expect (expr, 0)
269#define likely(expr) __builtin_expect (expr, 1)
270
271#define obstack_calloc(ob, size) \
272 ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); })
273#define obstack_strdup(ob, str) \
274 ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); })
275#define obstack_strndup(ob, str, n) \
276 ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); })
277
278#if __STDC_VERSION__ >= 199901L
279# define flexarr_size /* empty */
280#else
281# define flexarr_size 0
282#endif
283
284/* Calling conventions. */
285#ifdef __i386__
286# define CALLING_CONVENTION regparm (3), stdcall
287# define AND_CALLING_CONVENTION , regparm (3), stdcall
288#else
289# define CALLING_CONVENTION
290# define AND_CALLING_CONVENTION
291#endif
292
293/* Avoid PLT entries. */
294#ifdef PIC
295# define INTUSE(name) _INTUSE(name)
296# define _INTUSE(name) __##name##_internal
297# define INTDEF(name) _INTDEF(name)
298# define _INTDEF(name) \
299 extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name)));
300# define INTDECL(name) _INTDECL(name)
301# define _INTDECL(name) \
302 extern __typeof__ (name) __##name##_internal attribute_hidden;
303#else
304# define INTUSE(name) name
305# define INTDEF(name) /* empty */
306# define INTDECL(name) /* empty */
307#endif
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000308
309/* This macro is used by the tests conditionalize for standalone building. */
310#define ELFUTILS_HEADER(name) <lib##name.h>
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000311])
312
313AC_OUTPUT