blob: 4addfec03f1642ac14c7d0e8b079179212bfd482 [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
Roland McGrathfba8ec82010-05-03 11:42:53 -07004dnl Copyright (C) 1996-2010 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
Roland McGrathfba8ec82010-05-03 11:42:53 -070019AC_INIT([Red Hat elfutils],[0.147],[http://bugzilla.redhat.com/bugzilla/],[elfutils])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000020
21AC_CONFIG_AUX_DIR([config])
22AC_CONFIG_FILES([config/Makefile])
23
Ulrich Drepperb5bd4072010-02-23 18:48:59 -080024AC_COPYRIGHT([Copyright (C) 1996-2010 Red Hat, Inc.])
Ulrich Drepperdb12f162009-09-21 08:04:38 -070025AC_PREREQ(2.63) dnl Minimum Autoconf version required.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000026
Roland McGrath9aa8ef72007-05-18 08:59:43 +000027dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
Ulrich Drepperbb3424b2008-12-30 21:49:41 -080028AM_INIT_AUTOMAKE([gnits 1.8 -Wno-portability dist-bzip2 no-dist-gzip])
Roland McGrathc373d852006-10-10 00:25:21 +000029AM_MAINTAINER_MODE
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000030
31dnl Unique ID for this build.
32MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)"
33AC_SUBST([MODVERSION])
34AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
35AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
36
37AC_CONFIG_SRCDIR([libelf/libelf.h])
38AC_CONFIG_FILES([Makefile])
39AC_CONFIG_HEADERS([config.h])
40
41AC_CONFIG_MACRO_DIR([m4])
42AC_CONFIG_FILES([m4/Makefile])
43
44dnl The RPM spec file. We substitute a few values in the file.
45AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in])
46
47
48AC_CANONICAL_HOST
49
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080050AC_ARG_ENABLE([thread-safety],
51AS_HELP_STRING([--enable-thread-safety], [enable thread safety of libraries]),
52use_tls=locks, use_locks=no)
53AM_CONDITIONAL(USE_LOCKS, test "$use_locks" = yes)
54AS_IF([test "$use_locks" = yes], [AC_DEFINE(USE_LOCKS)])
Ulrich Drepperd56e2322008-08-16 03:09:13 +000055
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080056AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000057
58dnl Add all the languages for which translations are available.
59ALL_LINGUAS=
60
61AC_PROG_CC
62AC_PROG_RANLIB
63AC_PROG_YACC
64AM_PROG_LEX
65
66AC_CACHE_CHECK([for gcc with C99 support], ac_cv_c99, [dnl
67old_CFLAGS="$CFLAGS"
68CFLAGS="$CFLAGS -std=gnu99"
69AC_COMPILE_IFELSE([dnl
70int foo (int a) { for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; }],
71 ac_cv_c99=yes, ac_cv_c99=no)
72CFLAGS="$old_CFLAGS"])
73AS_IF([test "x$ac_cv_c99" != xyes],
74 AC_MSG_ERROR([gcc with C99 support required]))
75
Roland McGrath81817392009-01-23 03:23:02 -080076AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
Roland McGrathe72bf152009-01-23 14:27:39 -080077# Use the same flags that we use for our DSOs, so the test is representative.
78# Some old compiler/linker/libc combinations fail some ways and not others.
79save_CFLAGS="$CFLAGS"
80save_LDFLAGS="$LDFLAGS"
81CFLAGS="-fpic $CFLAGS"
82LDFLAGS="-shared -Wl,-z,defs,-z,relro $LDFLAGS"
Roland McGrath81817392009-01-23 03:23:02 -080083AC_LINK_IFELSE([dnl
Roland McGrath57844442009-01-23 03:40:50 -080084AC_LANG_PROGRAM([[#undef __thread
Roland McGrathe72bf152009-01-23 14:27:39 -080085static __thread int a; int foo (int b) { return a + b; }]],
Roland McGrath81817392009-01-23 03:23:02 -080086 [[exit (foo (0));]])],
Roland McGrathe72bf152009-01-23 14:27:39 -080087 ac_cv_tls=yes, ac_cv_tls=no)
88CFLAGS="$save_CFLAGS"
89LDFLAGS="$save_LDFLAGS"])
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080090AS_IF([test "x$ac_cv_tls" != xyes],
Roland McGrath81817392009-01-23 03:23:02 -080091 AC_MSG_ERROR([__thread support required]))
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080092
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000093dnl This test must come as early as possible after the compiler configuration
94dnl tests, because the choice of the file model can (in principle) affect
95dnl whether functions and headers are available, whether they work, etc.
96AC_SYS_LARGEFILE
97
98dnl Enable the linker to be build as a native-only linker. By default it
99dnl can handle all architectures but this comes at a cost. A native
100dnl will be slightly faster, small, and has fewer dependencies.
101native_ld=no
102AC_ARG_ENABLE([generic],
103AS_HELP_STRING([--disable-generic], [do not build generic linker]), [dnl
104if test "$enable_generic" = no; then
105 case "$host_cpu" in
106 i?86)
107 AC_DEFINE(NATIVE_ELF, 32)
108 native_ld=yes
109 base_cpu=i386
110 ;;
111 *)
112 AC_MSG_ERROR([no machine-specific linker for this configuration available])
113 ;;
114 esac
115fi])
116AH_TEMPLATE([NATIVE_ELF],
117[Define to 32 or 64 if a specific implementation is wanted.])
118AM_CONDITIONAL(NATIVE_LD, test "$native_ld" = yes)
119dnl The automake generated Makefile cannot deal with macros in the name
120dnl of files if at any time there is no such file, even if the filename
121dnl would not be used.
122AS_IF([test -z "$base_cpu"], [base_cpu=none])
123AC_SUBST(base_cpu)
Ulrich Drepper28ed8952006-07-07 03:43:47 +0000124dnl Support to work around automake's inflexible dependency generation.
125dnl See src/Makefile.am for more information.
126AM_CONDITIONAL(NEVER, false)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000127
128dnl Enable debugging via mudflap. This option will cause most libraries
129dnl to be built as archives which are statically linked into the applications.
130dnl All code, as far as possible, is compiled instrumented to catch all
131dnl the bugs valgrind is able to catch.
132use_mudflap=no
133AC_ARG_ENABLE([mudflap],
134AS_HELP_STRING([--enable-mudflap],
135[build binaries with mudflap instrumentation]), [dnl
136if test "x$enable_mudflap" = xyes; then
137 # Check whether the compiler support -fmudflap.
138 old_CFLAGS="$CFLAGS"
139 CFLAGS="$CFLAGS -fmudflap"
Ulrich Drepperdb12f162009-09-21 08:04:38 -0700140 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[use_mudflap=yes],[use_mudflap=fail])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000141 CFLAGS="$old_CFLAGS"
142fi])
143if test "$use_mudflap" = fail; then
144 AC_MSG_FAILURE([--enable-mudflap requires a compiler which understands this option])
145fi
146AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes)
147
Ulrich Drepper3cbdd382008-01-02 17:44:39 +0000148dnl enable debugging of branch prediction.
149use_debugpred=0
Ulrich Drepper28a0c612008-01-21 18:57:48 +0000150AC_ARG_ENABLE([debugpred],
Ulrich Drepperdb12f162009-09-21 08:04:38 -0700151AS_HELP_STRING([--enable-debugpred],[build binaries with support to debug branch prediction]),
Ulrich Drepper3cbdd382008-01-02 17:44:39 +0000152[use_debugpred=1], [use_debugpred=0])
153AC_SUBST([DEBUGPRED], $use_debugpred)
154
155dnl Enable gprof suport.
Ulrich Drepper47be7952005-08-07 04:41:39 +0000156AC_ARG_ENABLE([gprof],
Ulrich Drepperdb12f162009-09-21 08:04:38 -0700157AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=yes], [use_gprof=no])
Ulrich Drepper47be7952005-08-07 04:41:39 +0000158if test "$use_gprof" = yes; then
159 CFLAGS="$CFLAGS -pg"
160 LDFLAGS="$LDFLAGS -pg"
161fi
162AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000163
164# Enable gcov suport.
165AC_ARG_ENABLE([gcov],
Ulrich Drepperdb12f162009-09-21 08:04:38 -0700166AS_HELP_STRING([--enable-gcov],[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no])
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000167if test "$use_gcov" = yes; then
168 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
169 LDFLAGS="$LDFLAGS -fprofile-arcs"
170fi
Ulrich Drepper39cec7a2005-08-30 01:22:01 +0000171AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000172
Ulrich Drepper47be7952005-08-07 04:41:39 +0000173AM_CONDITIONAL(BUILD_STATIC, [dnl
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000174test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
Ulrich Drepper47be7952005-08-07 04:41:39 +0000175
Roland McGrath1b8b4462005-11-16 01:33:38 +0000176AC_ARG_ENABLE([tests-rpath],
Ulrich Drepperdb12f162009-09-21 08:04:38 -0700177AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
Roland McGrath1b8b4462005-11-16 01:33:38 +0000178 [tests_use_rpath=yes], [tests_use_rpath=no])
179AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
180
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000181LIBEBL_SUBDIR="$PACKAGE"
182AC_ARG_ENABLE([libebl-subdir],
183AS_HELP_STRING([--enable-libebl-subdir=DIR],
184[install libebl_CPU modules in $(libdir)/DIR]), [dnl
185LIBEBL_SUBDIR="$enable_libebl_subdir"])
186AC_SUBST([LIBEBL_SUBDIR])
187AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
188AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
189
Roland McGrath7a647872009-01-08 19:22:35 -0800190dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am
191dnl conditional and config.h USE_ZLIB/USE_BZLIB #define.
Roland McGrathbca43152009-01-05 23:59:32 -0800192save_LIBS="$LIBS"
193LIBS=
Roland McGrath24169642009-08-26 02:26:34 -0700194eu_ZIPLIB(zlib,ZLIB,z,gzdirect,gzip)
195eu_ZIPLIB(bzlib,BZLIB,bz2,BZ2_bzdopen,bzip2)
196eu_ZIPLIB(lzma,LZMA,lzma,lzma_auto_decoder,[LZMA (xz)])
Roland McGrathbca43152009-01-05 23:59:32 -0800197zip_LIBS="$LIBS"
198LIBS="$save_LIBS"
199AC_SUBST([zip_LIBS])
200
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000201dnl The directories with content.
202
203dnl Documentation.
204dnl Commented out for now.
205dnl AC_CONFIG_FILES([doc/Makefile])
206
207dnl Support library.
208AC_CONFIG_FILES([lib/Makefile])
209
210dnl ELF library.
Ulrich Drepper2c9ee4f2007-06-06 02:49:30 +0000211AC_CONFIG_FILES([libelf/Makefile])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000212
213dnl Higher-level ELF support library.
214AC_CONFIG_FILES([libebl/Makefile])
215
216dnl DWARF library.
217AC_CONFIG_FILES([libdw/Makefile])
218
219dnl Higher-level DWARF support library.
220AC_CONFIG_FILES([libdwfl/Makefile])
221
222dnl CPU handling library.
223AC_CONFIG_FILES([libcpu/Makefile])
224
225dnl Assembler library.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000226AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000227AC_CONFIG_FILES([libasm/Makefile])
228
Roland McGrathe47ab762005-11-17 03:16:00 +0000229dnl CPU-specific backend libraries.
230AC_CONFIG_FILES([backends/Makefile])
231
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000232dnl Tools.
233AC_CONFIG_FILES([src/Makefile po/Makefile.in])
234
235dnl Test suite.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000236AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000237AC_CONFIG_FILES([tests/Makefile])
238
239# Get the definitions necessary to create the Makefiles in the po
240# subdirectories. This is a small subset of the gettext rules.
241AC_SUBST(USE_NLS, yes)
242AM_PO_SUBDIRS
243
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000244dnl Appended to the config.h file.
245dnl We hide all kinds of configuration magic in lib/eu-config.h.
246AH_BOTTOM([#include <eu-config.h>])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000247
Roland McGrathfbc72452008-12-16 17:03:03 -0800248dnl Version compatibility header.
249AC_CONFIG_FILES([version.h:config/version.h.in])
250AC_SUBST([eu_version])
Roland McGrathee9d60d2009-04-17 13:18:35 -0700251
252# 1.234<whatever> -> 1234<whatever>
253case "$PACKAGE_VERSION" in
254[[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;;
255*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
256esac
257case "$eu_version" in
258*.*)
259 # 1234.567 -> "1234", "567"
260 eu_extra_version="${eu_version#*.}"
261 eu_version="${eu_version%%.*}"
262 case "$eu_extra_version" in
263 [[0-9]][[0-9]][[0-9]]) ;;
264 [[0-9]][[0-9]]) eu_extra_version="${eu_extra_version}0" ;;
265 [[0-9]]) eu_extra_version="${eu_extra_version}00" ;;
266 *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
267 esac
268 ;;
269*)
270 eu_extra_version=000
271 ;;
272esac
273
274case "$eu_version" in
275 0[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version#0}$eu_extra_version" ;;
276[[0-9]][[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}$eu_extra_version" ;;
277[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}0$eu_extra_version" ;;
278[[0-9]][[0-9]]) eu_version="${eu_version}00$eu_extra_version";;
279*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
Roland McGrathfbc72452008-12-16 17:03:03 -0800280esac
281
Roland McGrath105e3982009-04-19 16:07:45 -0700282# Round up to the next release API (x.y) version.
283[eu_version=$[($eu_version + 999) / 1000]]
284
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000285AC_OUTPUT