blob: 4931530c22f84cb4054e3ab108a4212442375f99 [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 Drepper103b1dc2009-01-22 23:22:52 -08004dnl Copyright (C) 1996-2008, 2009 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 Drepper300f3a42009-04-23 08:20:16 -070019AC_INIT([Red Hat elfutils],[0.141],[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
Roland McGrathee9d60d2009-04-17 13:18:35 -070025AC_COPYRIGHT([Copyright (C) 1996-2009 Red Hat, Inc.])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000026AC_PREREQ(2.59) dnl Minimum Autoconf version required.
27
Roland McGrath9aa8ef72007-05-18 08:59:43 +000028dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
Ulrich Drepperbb3424b2008-12-30 21:49:41 -080029AM_INIT_AUTOMAKE([gnits 1.8 -Wno-portability dist-bzip2 no-dist-gzip])
Roland McGrathc373d852006-10-10 00:25:21 +000030AM_MAINTAINER_MODE
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000031
32dnl Unique ID for this build.
33MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)"
34AC_SUBST([MODVERSION])
35AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION")
36AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.])
37
38AC_CONFIG_SRCDIR([libelf/libelf.h])
39AC_CONFIG_FILES([Makefile])
40AC_CONFIG_HEADERS([config.h])
41
42AC_CONFIG_MACRO_DIR([m4])
43AC_CONFIG_FILES([m4/Makefile])
44
45dnl The RPM spec file. We substitute a few values in the file.
46AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in])
47
48
49AC_CANONICAL_HOST
50
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080051AC_ARG_ENABLE([thread-safety],
52AS_HELP_STRING([--enable-thread-safety], [enable thread safety of libraries]),
53use_tls=locks, use_locks=no)
54AM_CONDITIONAL(USE_LOCKS, test "$use_locks" = yes)
55AS_IF([test "$use_locks" = yes], [AC_DEFINE(USE_LOCKS)])
Ulrich Drepperd56e2322008-08-16 03:09:13 +000056
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080057AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000058
59dnl Add all the languages for which translations are available.
60ALL_LINGUAS=
61
62AC_PROG_CC
63AC_PROG_RANLIB
64AC_PROG_YACC
65AM_PROG_LEX
66
67AC_CACHE_CHECK([for gcc with C99 support], ac_cv_c99, [dnl
68old_CFLAGS="$CFLAGS"
69CFLAGS="$CFLAGS -std=gnu99"
70AC_COMPILE_IFELSE([dnl
71int foo (int a) { for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; }],
72 ac_cv_c99=yes, ac_cv_c99=no)
73CFLAGS="$old_CFLAGS"])
74AS_IF([test "x$ac_cv_c99" != xyes],
75 AC_MSG_ERROR([gcc with C99 support required]))
76
Roland McGrath81817392009-01-23 03:23:02 -080077AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
Roland McGrathe72bf152009-01-23 14:27:39 -080078# Use the same flags that we use for our DSOs, so the test is representative.
79# Some old compiler/linker/libc combinations fail some ways and not others.
80save_CFLAGS="$CFLAGS"
81save_LDFLAGS="$LDFLAGS"
82CFLAGS="-fpic $CFLAGS"
83LDFLAGS="-shared -Wl,-z,defs,-z,relro $LDFLAGS"
Roland McGrath81817392009-01-23 03:23:02 -080084AC_LINK_IFELSE([dnl
Roland McGrath57844442009-01-23 03:40:50 -080085AC_LANG_PROGRAM([[#undef __thread
Roland McGrathe72bf152009-01-23 14:27:39 -080086static __thread int a; int foo (int b) { return a + b; }]],
Roland McGrath81817392009-01-23 03:23:02 -080087 [[exit (foo (0));]])],
Roland McGrathe72bf152009-01-23 14:27:39 -080088 ac_cv_tls=yes, ac_cv_tls=no)
89CFLAGS="$save_CFLAGS"
90LDFLAGS="$save_LDFLAGS"])
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080091AS_IF([test "x$ac_cv_tls" != xyes],
Roland McGrath81817392009-01-23 03:23:02 -080092 AC_MSG_ERROR([__thread support required]))
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080093
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000094LOCALEDIR=$datadir
95AC_SUBST(LOCALEDIR)
96AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR")
97AH_TEMPLATE([LOCALEDIR], [Directory to place translation files in.])
98
99DATADIRNAME=$datadir
100AC_SUBST(DATADIRNAME)
101
102dnl This test must come as early as possible after the compiler configuration
103dnl tests, because the choice of the file model can (in principle) affect
104dnl whether functions and headers are available, whether they work, etc.
105AC_SYS_LARGEFILE
106
107dnl Enable the linker to be build as a native-only linker. By default it
108dnl can handle all architectures but this comes at a cost. A native
109dnl will be slightly faster, small, and has fewer dependencies.
110native_ld=no
111AC_ARG_ENABLE([generic],
112AS_HELP_STRING([--disable-generic], [do not build generic linker]), [dnl
113if test "$enable_generic" = no; then
114 case "$host_cpu" in
115 i?86)
116 AC_DEFINE(NATIVE_ELF, 32)
117 native_ld=yes
118 base_cpu=i386
119 ;;
120 *)
121 AC_MSG_ERROR([no machine-specific linker for this configuration available])
122 ;;
123 esac
124fi])
125AH_TEMPLATE([NATIVE_ELF],
126[Define to 32 or 64 if a specific implementation is wanted.])
127AM_CONDITIONAL(NATIVE_LD, test "$native_ld" = yes)
128dnl The automake generated Makefile cannot deal with macros in the name
129dnl of files if at any time there is no such file, even if the filename
130dnl would not be used.
131AS_IF([test -z "$base_cpu"], [base_cpu=none])
132AC_SUBST(base_cpu)
Ulrich Drepper28ed8952006-07-07 03:43:47 +0000133dnl Support to work around automake's inflexible dependency generation.
134dnl See src/Makefile.am for more information.
135AM_CONDITIONAL(NEVER, false)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000136
137dnl Enable debugging via mudflap. This option will cause most libraries
138dnl to be built as archives which are statically linked into the applications.
139dnl All code, as far as possible, is compiled instrumented to catch all
140dnl the bugs valgrind is able to catch.
141use_mudflap=no
142AC_ARG_ENABLE([mudflap],
143AS_HELP_STRING([--enable-mudflap],
144[build binaries with mudflap instrumentation]), [dnl
145if test "x$enable_mudflap" = xyes; then
146 # Check whether the compiler support -fmudflap.
147 old_CFLAGS="$CFLAGS"
148 CFLAGS="$CFLAGS -fmudflap"
149 AC_TRY_COMPILE([], [], use_mudflap=yes, use_mudflap=fail)
150 CFLAGS="$old_CFLAGS"
151fi])
152if test "$use_mudflap" = fail; then
153 AC_MSG_FAILURE([--enable-mudflap requires a compiler which understands this option])
154fi
155AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes)
156
Ulrich Drepper3cbdd382008-01-02 17:44:39 +0000157dnl enable debugging of branch prediction.
158use_debugpred=0
Ulrich Drepper28a0c612008-01-21 18:57:48 +0000159AC_ARG_ENABLE([debugpred],
Ulrich Drepper3cbdd382008-01-02 17:44:39 +0000160AC_HELP_STRING([--enable-debugpred],
161[build binaries with support to debug branch prediction]),
162[use_debugpred=1], [use_debugpred=0])
163AC_SUBST([DEBUGPRED], $use_debugpred)
164
165dnl Enable gprof suport.
Ulrich Drepper47be7952005-08-07 04:41:39 +0000166AC_ARG_ENABLE([gprof],
167AC_HELP_STRING([--enable-gprof],
168[build binaries with gprof support]), [use_gprof=yes], [use_gprof=no])
169if test "$use_gprof" = yes; then
170 CFLAGS="$CFLAGS -pg"
171 LDFLAGS="$LDFLAGS -pg"
172fi
173AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000174
175# Enable gcov suport.
176AC_ARG_ENABLE([gcov],
177AC_HELP_STRING([--enable-gcov],
178[build binaries with gcov support]), [use_gcov=yes], [use_gcov=no])
179if test "$use_gcov" = yes; then
180 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
181 LDFLAGS="$LDFLAGS -fprofile-arcs"
182fi
Ulrich Drepper39cec7a2005-08-30 01:22:01 +0000183AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000184
Ulrich Drepper47be7952005-08-07 04:41:39 +0000185AM_CONDITIONAL(BUILD_STATIC, [dnl
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000186test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes])
Ulrich Drepper47be7952005-08-07 04:41:39 +0000187
Roland McGrath1b8b4462005-11-16 01:33:38 +0000188AC_ARG_ENABLE([tests-rpath],
189AC_HELP_STRING([--enable-tests-rpath], [build $ORIGIN-using rpath into tests]),
190 [tests_use_rpath=yes], [tests_use_rpath=no])
191AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
192
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000193LIBEBL_SUBDIR="$PACKAGE"
194AC_ARG_ENABLE([libebl-subdir],
195AS_HELP_STRING([--enable-libebl-subdir=DIR],
196[install libebl_CPU modules in $(libdir)/DIR]), [dnl
197LIBEBL_SUBDIR="$enable_libebl_subdir"])
198AC_SUBST([LIBEBL_SUBDIR])
199AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR")
200AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.])
201
Roland McGrath7a647872009-01-08 19:22:35 -0800202dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am
203dnl conditional and config.h USE_ZLIB/USE_BZLIB #define.
Roland McGrathbca43152009-01-05 23:59:32 -0800204save_LIBS="$LIBS"
205LIBS=
Roland McGrath73e77372009-01-23 14:31:33 -0800206eu_ZIPLIB(z,Z,z,gzdirect,gzip)
Roland McGrathbca43152009-01-05 23:59:32 -0800207eu_ZIPLIB(bz,BZ,bz2,BZ2_bzdopen,bzip2)
208zip_LIBS="$LIBS"
209LIBS="$save_LIBS"
210AC_SUBST([zip_LIBS])
211
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000212dnl The directories with content.
213
214dnl Documentation.
215dnl Commented out for now.
216dnl AC_CONFIG_FILES([doc/Makefile])
217
218dnl Support library.
219AC_CONFIG_FILES([lib/Makefile])
220
221dnl ELF library.
Ulrich Drepper2c9ee4f2007-06-06 02:49:30 +0000222AC_CONFIG_FILES([libelf/Makefile])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000223
224dnl Higher-level ELF support library.
225AC_CONFIG_FILES([libebl/Makefile])
226
227dnl DWARF library.
228AC_CONFIG_FILES([libdw/Makefile])
229
230dnl Higher-level DWARF support library.
231AC_CONFIG_FILES([libdwfl/Makefile])
232
233dnl CPU handling library.
234AC_CONFIG_FILES([libcpu/Makefile])
235
236dnl Assembler library.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000237AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000238AC_CONFIG_FILES([libasm/Makefile])
239
Roland McGrathe47ab762005-11-17 03:16:00 +0000240dnl CPU-specific backend libraries.
241AC_CONFIG_FILES([backends/Makefile])
242
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000243dnl Tools.
244AC_CONFIG_FILES([src/Makefile po/Makefile.in])
245
246dnl Test suite.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000247AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000248AC_CONFIG_FILES([tests/Makefile])
249
250# Get the definitions necessary to create the Makefiles in the po
251# subdirectories. This is a small subset of the gettext rules.
252AC_SUBST(USE_NLS, yes)
253AM_PO_SUBDIRS
254
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000255dnl Appended to the config.h file.
256dnl We hide all kinds of configuration magic in lib/eu-config.h.
257AH_BOTTOM([#include <eu-config.h>])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000258
Roland McGrathfbc72452008-12-16 17:03:03 -0800259dnl Version compatibility header.
260AC_CONFIG_FILES([version.h:config/version.h.in])
261AC_SUBST([eu_version])
Roland McGrathee9d60d2009-04-17 13:18:35 -0700262
263# 1.234<whatever> -> 1234<whatever>
264case "$PACKAGE_VERSION" in
265[[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;;
266*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
267esac
268case "$eu_version" in
269*.*)
270 # 1234.567 -> "1234", "567"
271 eu_extra_version="${eu_version#*.}"
272 eu_version="${eu_version%%.*}"
273 case "$eu_extra_version" in
274 [[0-9]][[0-9]][[0-9]]) ;;
275 [[0-9]][[0-9]]) eu_extra_version="${eu_extra_version}0" ;;
276 [[0-9]]) eu_extra_version="${eu_extra_version}00" ;;
277 *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
278 esac
279 ;;
280*)
281 eu_extra_version=000
282 ;;
283esac
284
285case "$eu_version" in
286 0[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version#0}$eu_extra_version" ;;
287[[0-9]][[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}$eu_extra_version" ;;
288[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}0$eu_extra_version" ;;
289[[0-9]][[0-9]]) eu_version="${eu_version}00$eu_extra_version";;
290*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
Roland McGrathfbc72452008-12-16 17:03:03 -0800291esac
292
Roland McGrath105e3982009-04-19 16:07:45 -0700293# Round up to the next release API (x.y) version.
294[eu_version=$[($eu_version + 999) / 1000]]
295
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000296AC_OUTPUT