Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | dnl Configure input file for elfutils. -*-autoconf-*- |
| 3 | dnl |
Ulrich Drepper | 103b1dc | 2009-01-22 23:22:52 -0800 | [diff] [blame] | 4 | dnl Copyright (C) 1996-2008, 2009 Red Hat, Inc. |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 5 | dnl |
| 6 | dnl This program is free software; you can redistribute it and/or modify |
| 7 | dnl it under the terms of the GNU General Public License as published by |
| 8 | dnl the Free Software Foundation, version 2. |
| 9 | dnl |
| 10 | dnl This program is distributed in the hope that it will be useful, |
| 11 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | dnl GNU General Public License for more details. |
| 14 | dnl |
| 15 | dnl You should have received a copy of the GNU General Public License |
| 16 | dnl along with this program; if not, write to the Free Software Foundation, |
Ulrich Drepper | 1e9ef50 | 2006-04-04 22:29:06 +0000 | [diff] [blame] | 17 | dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 18 | dnl |
Ulrich Drepper | 300f3a4 | 2009-04-23 08:20:16 -0700 | [diff] [blame] | 19 | AC_INIT([Red Hat elfutils],[0.141],[http://bugzilla.redhat.com/bugzilla/], |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 20 | [elfutils]) |
| 21 | |
| 22 | AC_CONFIG_AUX_DIR([config]) |
| 23 | AC_CONFIG_FILES([config/Makefile]) |
| 24 | |
Roland McGrath | ee9d60d | 2009-04-17 13:18:35 -0700 | [diff] [blame] | 25 | AC_COPYRIGHT([Copyright (C) 1996-2009 Red Hat, Inc.]) |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 26 | AC_PREREQ(2.59) dnl Minimum Autoconf version required. |
| 27 | |
Roland McGrath | 9aa8ef7 | 2007-05-18 08:59:43 +0000 | [diff] [blame] | 28 | dnl We use GNU make extensions; automake 1.10 defaults to -Wportability. |
Ulrich Drepper | bb3424b | 2008-12-30 21:49:41 -0800 | [diff] [blame] | 29 | AM_INIT_AUTOMAKE([gnits 1.8 -Wno-portability dist-bzip2 no-dist-gzip]) |
Roland McGrath | c373d85 | 2006-10-10 00:25:21 +0000 | [diff] [blame] | 30 | AM_MAINTAINER_MODE |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 31 | |
| 32 | dnl Unique ID for this build. |
| 33 | MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)" |
| 34 | AC_SUBST([MODVERSION]) |
| 35 | AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION") |
| 36 | AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.]) |
| 37 | |
| 38 | AC_CONFIG_SRCDIR([libelf/libelf.h]) |
| 39 | AC_CONFIG_FILES([Makefile]) |
| 40 | AC_CONFIG_HEADERS([config.h]) |
| 41 | |
| 42 | AC_CONFIG_MACRO_DIR([m4]) |
| 43 | AC_CONFIG_FILES([m4/Makefile]) |
| 44 | |
| 45 | dnl The RPM spec file. We substitute a few values in the file. |
| 46 | AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in]) |
| 47 | |
| 48 | |
| 49 | AC_CANONICAL_HOST |
| 50 | |
Ulrich Drepper | 7e678fa | 2009-01-10 18:02:05 -0800 | [diff] [blame] | 51 | AC_ARG_ENABLE([thread-safety], |
| 52 | AS_HELP_STRING([--enable-thread-safety], [enable thread safety of libraries]), |
| 53 | use_tls=locks, use_locks=no) |
| 54 | AM_CONDITIONAL(USE_LOCKS, test "$use_locks" = yes) |
| 55 | AS_IF([test "$use_locks" = yes], [AC_DEFINE(USE_LOCKS)]) |
Ulrich Drepper | d56e232 | 2008-08-16 03:09:13 +0000 | [diff] [blame] | 56 | |
Ulrich Drepper | 7e678fa | 2009-01-10 18:02:05 -0800 | [diff] [blame] | 57 | AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.]) |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 58 | |
| 59 | dnl Add all the languages for which translations are available. |
| 60 | ALL_LINGUAS= |
| 61 | |
| 62 | AC_PROG_CC |
| 63 | AC_PROG_RANLIB |
| 64 | AC_PROG_YACC |
| 65 | AM_PROG_LEX |
| 66 | |
| 67 | AC_CACHE_CHECK([for gcc with C99 support], ac_cv_c99, [dnl |
| 68 | old_CFLAGS="$CFLAGS" |
| 69 | CFLAGS="$CFLAGS -std=gnu99" |
| 70 | AC_COMPILE_IFELSE([dnl |
| 71 | int 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) |
| 73 | CFLAGS="$old_CFLAGS"]) |
| 74 | AS_IF([test "x$ac_cv_c99" != xyes], |
| 75 | AC_MSG_ERROR([gcc with C99 support required])) |
| 76 | |
Roland McGrath | 8181739 | 2009-01-23 03:23:02 -0800 | [diff] [blame] | 77 | AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl |
Roland McGrath | e72bf15 | 2009-01-23 14:27:39 -0800 | [diff] [blame] | 78 | # 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. |
| 80 | save_CFLAGS="$CFLAGS" |
| 81 | save_LDFLAGS="$LDFLAGS" |
| 82 | CFLAGS="-fpic $CFLAGS" |
| 83 | LDFLAGS="-shared -Wl,-z,defs,-z,relro $LDFLAGS" |
Roland McGrath | 8181739 | 2009-01-23 03:23:02 -0800 | [diff] [blame] | 84 | AC_LINK_IFELSE([dnl |
Roland McGrath | 5784444 | 2009-01-23 03:40:50 -0800 | [diff] [blame] | 85 | AC_LANG_PROGRAM([[#undef __thread |
Roland McGrath | e72bf15 | 2009-01-23 14:27:39 -0800 | [diff] [blame] | 86 | static __thread int a; int foo (int b) { return a + b; }]], |
Roland McGrath | 8181739 | 2009-01-23 03:23:02 -0800 | [diff] [blame] | 87 | [[exit (foo (0));]])], |
Roland McGrath | e72bf15 | 2009-01-23 14:27:39 -0800 | [diff] [blame] | 88 | ac_cv_tls=yes, ac_cv_tls=no) |
| 89 | CFLAGS="$save_CFLAGS" |
| 90 | LDFLAGS="$save_LDFLAGS"]) |
Ulrich Drepper | 7e678fa | 2009-01-10 18:02:05 -0800 | [diff] [blame] | 91 | AS_IF([test "x$ac_cv_tls" != xyes], |
Roland McGrath | 8181739 | 2009-01-23 03:23:02 -0800 | [diff] [blame] | 92 | AC_MSG_ERROR([__thread support required])) |
Ulrich Drepper | 7e678fa | 2009-01-10 18:02:05 -0800 | [diff] [blame] | 93 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 94 | LOCALEDIR=$datadir |
| 95 | AC_SUBST(LOCALEDIR) |
| 96 | AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") |
| 97 | AH_TEMPLATE([LOCALEDIR], [Directory to place translation files in.]) |
| 98 | |
| 99 | DATADIRNAME=$datadir |
| 100 | AC_SUBST(DATADIRNAME) |
| 101 | |
| 102 | dnl This test must come as early as possible after the compiler configuration |
| 103 | dnl tests, because the choice of the file model can (in principle) affect |
| 104 | dnl whether functions and headers are available, whether they work, etc. |
| 105 | AC_SYS_LARGEFILE |
| 106 | |
| 107 | dnl Enable the linker to be build as a native-only linker. By default it |
| 108 | dnl can handle all architectures but this comes at a cost. A native |
| 109 | dnl will be slightly faster, small, and has fewer dependencies. |
| 110 | native_ld=no |
| 111 | AC_ARG_ENABLE([generic], |
| 112 | AS_HELP_STRING([--disable-generic], [do not build generic linker]), [dnl |
| 113 | if 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 |
| 124 | fi]) |
| 125 | AH_TEMPLATE([NATIVE_ELF], |
| 126 | [Define to 32 or 64 if a specific implementation is wanted.]) |
| 127 | AM_CONDITIONAL(NATIVE_LD, test "$native_ld" = yes) |
| 128 | dnl The automake generated Makefile cannot deal with macros in the name |
| 129 | dnl of files if at any time there is no such file, even if the filename |
| 130 | dnl would not be used. |
| 131 | AS_IF([test -z "$base_cpu"], [base_cpu=none]) |
| 132 | AC_SUBST(base_cpu) |
Ulrich Drepper | 28ed895 | 2006-07-07 03:43:47 +0000 | [diff] [blame] | 133 | dnl Support to work around automake's inflexible dependency generation. |
| 134 | dnl See src/Makefile.am for more information. |
| 135 | AM_CONDITIONAL(NEVER, false) |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 136 | |
| 137 | dnl Enable debugging via mudflap. This option will cause most libraries |
| 138 | dnl to be built as archives which are statically linked into the applications. |
| 139 | dnl All code, as far as possible, is compiled instrumented to catch all |
| 140 | dnl the bugs valgrind is able to catch. |
| 141 | use_mudflap=no |
| 142 | AC_ARG_ENABLE([mudflap], |
| 143 | AS_HELP_STRING([--enable-mudflap], |
| 144 | [build binaries with mudflap instrumentation]), [dnl |
| 145 | if 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" |
| 151 | fi]) |
| 152 | if test "$use_mudflap" = fail; then |
| 153 | AC_MSG_FAILURE([--enable-mudflap requires a compiler which understands this option]) |
| 154 | fi |
| 155 | AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes) |
| 156 | |
Ulrich Drepper | 3cbdd38 | 2008-01-02 17:44:39 +0000 | [diff] [blame] | 157 | dnl enable debugging of branch prediction. |
| 158 | use_debugpred=0 |
Ulrich Drepper | 28a0c61 | 2008-01-21 18:57:48 +0000 | [diff] [blame] | 159 | AC_ARG_ENABLE([debugpred], |
Ulrich Drepper | 3cbdd38 | 2008-01-02 17:44:39 +0000 | [diff] [blame] | 160 | AC_HELP_STRING([--enable-debugpred], |
| 161 | [build binaries with support to debug branch prediction]), |
| 162 | [use_debugpred=1], [use_debugpred=0]) |
| 163 | AC_SUBST([DEBUGPRED], $use_debugpred) |
| 164 | |
| 165 | dnl Enable gprof suport. |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 166 | AC_ARG_ENABLE([gprof], |
| 167 | AC_HELP_STRING([--enable-gprof], |
| 168 | [build binaries with gprof support]), [use_gprof=yes], [use_gprof=no]) |
| 169 | if test "$use_gprof" = yes; then |
| 170 | CFLAGS="$CFLAGS -pg" |
| 171 | LDFLAGS="$LDFLAGS -pg" |
| 172 | fi |
| 173 | AM_CONDITIONAL(GPROF, test "$use_gprof" = yes) |
Ulrich Drepper | fbe998a | 2005-08-29 16:27:10 +0000 | [diff] [blame] | 174 | |
| 175 | # Enable gcov suport. |
| 176 | AC_ARG_ENABLE([gcov], |
| 177 | AC_HELP_STRING([--enable-gcov], |
| 178 | [build binaries with gcov support]), [use_gcov=yes], [use_gcov=no]) |
| 179 | if test "$use_gcov" = yes; then |
| 180 | CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" |
| 181 | LDFLAGS="$LDFLAGS -fprofile-arcs" |
| 182 | fi |
Ulrich Drepper | 39cec7a | 2005-08-30 01:22:01 +0000 | [diff] [blame] | 183 | AM_CONDITIONAL(GCOV, test "$use_gcov" = yes) |
Ulrich Drepper | fbe998a | 2005-08-29 16:27:10 +0000 | [diff] [blame] | 184 | |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 185 | AM_CONDITIONAL(BUILD_STATIC, [dnl |
Ulrich Drepper | fbe998a | 2005-08-29 16:27:10 +0000 | [diff] [blame] | 186 | test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes]) |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 187 | |
Roland McGrath | 1b8b446 | 2005-11-16 01:33:38 +0000 | [diff] [blame] | 188 | AC_ARG_ENABLE([tests-rpath], |
| 189 | AC_HELP_STRING([--enable-tests-rpath], [build $ORIGIN-using rpath into tests]), |
| 190 | [tests_use_rpath=yes], [tests_use_rpath=no]) |
| 191 | AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes) |
| 192 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 193 | LIBEBL_SUBDIR="$PACKAGE" |
| 194 | AC_ARG_ENABLE([libebl-subdir], |
| 195 | AS_HELP_STRING([--enable-libebl-subdir=DIR], |
| 196 | [install libebl_CPU modules in $(libdir)/DIR]), [dnl |
| 197 | LIBEBL_SUBDIR="$enable_libebl_subdir"]) |
| 198 | AC_SUBST([LIBEBL_SUBDIR]) |
| 199 | AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR") |
| 200 | AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.]) |
| 201 | |
Roland McGrath | 7a64787 | 2009-01-08 19:22:35 -0800 | [diff] [blame] | 202 | dnl Test for zlib and bzlib, gives ZLIB/BZLIB .am |
| 203 | dnl conditional and config.h USE_ZLIB/USE_BZLIB #define. |
Roland McGrath | bca4315 | 2009-01-05 23:59:32 -0800 | [diff] [blame] | 204 | save_LIBS="$LIBS" |
| 205 | LIBS= |
Roland McGrath | 73e7737 | 2009-01-23 14:31:33 -0800 | [diff] [blame] | 206 | eu_ZIPLIB(z,Z,z,gzdirect,gzip) |
Roland McGrath | bca4315 | 2009-01-05 23:59:32 -0800 | [diff] [blame] | 207 | eu_ZIPLIB(bz,BZ,bz2,BZ2_bzdopen,bzip2) |
| 208 | zip_LIBS="$LIBS" |
| 209 | LIBS="$save_LIBS" |
| 210 | AC_SUBST([zip_LIBS]) |
| 211 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 212 | dnl The directories with content. |
| 213 | |
| 214 | dnl Documentation. |
| 215 | dnl Commented out for now. |
| 216 | dnl AC_CONFIG_FILES([doc/Makefile]) |
| 217 | |
| 218 | dnl Support library. |
| 219 | AC_CONFIG_FILES([lib/Makefile]) |
| 220 | |
| 221 | dnl ELF library. |
Ulrich Drepper | 2c9ee4f | 2007-06-06 02:49:30 +0000 | [diff] [blame] | 222 | AC_CONFIG_FILES([libelf/Makefile]) |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 223 | |
| 224 | dnl Higher-level ELF support library. |
| 225 | AC_CONFIG_FILES([libebl/Makefile]) |
| 226 | |
| 227 | dnl DWARF library. |
| 228 | AC_CONFIG_FILES([libdw/Makefile]) |
| 229 | |
| 230 | dnl Higher-level DWARF support library. |
| 231 | AC_CONFIG_FILES([libdwfl/Makefile]) |
| 232 | |
| 233 | dnl CPU handling library. |
| 234 | AC_CONFIG_FILES([libcpu/Makefile]) |
| 235 | |
| 236 | dnl Assembler library. |
Roland McGrath | d7f8d0c | 2005-11-17 02:32:03 +0000 | [diff] [blame] | 237 | AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see. |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 238 | AC_CONFIG_FILES([libasm/Makefile]) |
| 239 | |
Roland McGrath | e47ab76 | 2005-11-17 03:16:00 +0000 | [diff] [blame] | 240 | dnl CPU-specific backend libraries. |
| 241 | AC_CONFIG_FILES([backends/Makefile]) |
| 242 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 243 | dnl Tools. |
| 244 | AC_CONFIG_FILES([src/Makefile po/Makefile.in]) |
| 245 | |
| 246 | dnl Test suite. |
Roland McGrath | d7f8d0c | 2005-11-17 02:32:03 +0000 | [diff] [blame] | 247 | AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see. |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 248 | AC_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. |
| 252 | AC_SUBST(USE_NLS, yes) |
| 253 | AM_PO_SUBDIRS |
| 254 | |
Roland McGrath | b4d6f0f | 2008-08-25 22:55:17 +0000 | [diff] [blame] | 255 | dnl Appended to the config.h file. |
| 256 | dnl We hide all kinds of configuration magic in lib/eu-config.h. |
| 257 | AH_BOTTOM([#include <eu-config.h>]) |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 258 | |
Roland McGrath | fbc7245 | 2008-12-16 17:03:03 -0800 | [diff] [blame] | 259 | dnl Version compatibility header. |
| 260 | AC_CONFIG_FILES([version.h:config/version.h.in]) |
| 261 | AC_SUBST([eu_version]) |
Roland McGrath | ee9d60d | 2009-04-17 13:18:35 -0700 | [diff] [blame] | 262 | |
| 263 | # 1.234<whatever> -> 1234<whatever> |
| 264 | case "$PACKAGE_VERSION" in |
| 265 | [[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;; |
| 266 | *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; |
| 267 | esac |
| 268 | case "$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 | ;; |
| 283 | esac |
| 284 | |
| 285 | case "$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 McGrath | fbc7245 | 2008-12-16 17:03:03 -0800 | [diff] [blame] | 291 | esac |
| 292 | |
Roland McGrath | 105e398 | 2009-04-19 16:07:45 -0700 | [diff] [blame] | 293 | # Round up to the next release API (x.y) version. |
| 294 | [eu_version=$[($eu_version + 999) / 1000]] |
| 295 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 296 | AC_OUTPUT |