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 | 28ed895 | 2006-07-07 03:43:47 +0000 | [diff] [blame^] | 4 | dnl Copyright (C) 1996-2002, 2003, 2004, 2005, 2006 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 | 28ed895 | 2006-07-07 03:43:47 +0000 | [diff] [blame^] | 19 | AC_INIT([Red Hat elfutils],[0.122],[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 | |
Ulrich Drepper | 82c345d | 2006-04-04 22:07:54 +0000 | [diff] [blame] | 25 | AC_COPYRIGHT([Copyright (C) 1996-2003, 2004, 2005, 2006 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 | |
| 28 | AM_INIT_AUTOMAKE([gnits 1.7]) |
| 29 | |
| 30 | dnl Unique ID for this build. |
| 31 | MODVERSION="Build on $(hostname) $(date +%FT%R:%S%z)" |
| 32 | AC_SUBST([MODVERSION]) |
| 33 | AC_DEFINE_UNQUOTED(MODVERSION, "$MODVERSION") |
| 34 | AH_TEMPLATE([MODVERSION], [Identifier for modules in the build.]) |
| 35 | |
| 36 | AC_CONFIG_SRCDIR([libelf/libelf.h]) |
| 37 | AC_CONFIG_FILES([Makefile]) |
| 38 | AC_CONFIG_HEADERS([config.h]) |
| 39 | |
| 40 | AC_CONFIG_MACRO_DIR([m4]) |
| 41 | AC_CONFIG_FILES([m4/Makefile]) |
| 42 | |
| 43 | dnl The RPM spec file. We substitute a few values in the file. |
| 44 | AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in]) |
| 45 | |
| 46 | |
| 47 | AC_CANONICAL_HOST |
| 48 | |
| 49 | AC_ARG_ENABLE([tls], |
| 50 | AS_HELP_STRING([--enable-tls], [enable use of thread local storage]), |
| 51 | AC_DEFINE(USE_TLS)) |
| 52 | AH_TEMPLATE([USE_TLS], [Defined if thread local storage should be used.]) |
| 53 | |
| 54 | dnl Add all the languages for which translations are available. |
| 55 | ALL_LINGUAS= |
| 56 | |
| 57 | AC_PROG_CC |
| 58 | AC_PROG_RANLIB |
| 59 | AC_PROG_YACC |
| 60 | AM_PROG_LEX |
| 61 | |
| 62 | AC_CACHE_CHECK([for gcc with C99 support], ac_cv_c99, [dnl |
| 63 | old_CFLAGS="$CFLAGS" |
| 64 | CFLAGS="$CFLAGS -std=gnu99" |
| 65 | AC_COMPILE_IFELSE([dnl |
| 66 | int 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) |
| 68 | CFLAGS="$old_CFLAGS"]) |
| 69 | AS_IF([test "x$ac_cv_c99" != xyes], |
| 70 | AC_MSG_ERROR([gcc with C99 support required])) |
| 71 | |
| 72 | LOCALEDIR=$datadir |
| 73 | AC_SUBST(LOCALEDIR) |
| 74 | AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") |
| 75 | AH_TEMPLATE([LOCALEDIR], [Directory to place translation files in.]) |
| 76 | |
| 77 | DATADIRNAME=$datadir |
| 78 | AC_SUBST(DATADIRNAME) |
| 79 | |
| 80 | dnl This test must come as early as possible after the compiler configuration |
| 81 | dnl tests, because the choice of the file model can (in principle) affect |
| 82 | dnl whether functions and headers are available, whether they work, etc. |
| 83 | AC_SYS_LARGEFILE |
| 84 | |
| 85 | dnl Enable the linker to be build as a native-only linker. By default it |
| 86 | dnl can handle all architectures but this comes at a cost. A native |
| 87 | dnl will be slightly faster, small, and has fewer dependencies. |
| 88 | native_ld=no |
| 89 | AC_ARG_ENABLE([generic], |
| 90 | AS_HELP_STRING([--disable-generic], [do not build generic linker]), [dnl |
| 91 | if 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 |
| 102 | fi]) |
| 103 | AH_TEMPLATE([NATIVE_ELF], |
| 104 | [Define to 32 or 64 if a specific implementation is wanted.]) |
| 105 | AM_CONDITIONAL(NATIVE_LD, test "$native_ld" = yes) |
| 106 | dnl The automake generated Makefile cannot deal with macros in the name |
| 107 | dnl of files if at any time there is no such file, even if the filename |
| 108 | dnl would not be used. |
| 109 | AS_IF([test -z "$base_cpu"], [base_cpu=none]) |
| 110 | AC_SUBST(base_cpu) |
Ulrich Drepper | 28ed895 | 2006-07-07 03:43:47 +0000 | [diff] [blame^] | 111 | dnl Support to work around automake's inflexible dependency generation. |
| 112 | dnl See src/Makefile.am for more information. |
| 113 | AM_CONDITIONAL(NEVER, false) |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 114 | |
| 115 | dnl Enable debugging via mudflap. This option will cause most libraries |
| 116 | dnl to be built as archives which are statically linked into the applications. |
| 117 | dnl All code, as far as possible, is compiled instrumented to catch all |
| 118 | dnl the bugs valgrind is able to catch. |
| 119 | use_mudflap=no |
| 120 | AC_ARG_ENABLE([mudflap], |
| 121 | AS_HELP_STRING([--enable-mudflap], |
| 122 | [build binaries with mudflap instrumentation]), [dnl |
| 123 | if 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" |
| 129 | fi]) |
| 130 | if test "$use_mudflap" = fail; then |
| 131 | AC_MSG_FAILURE([--enable-mudflap requires a compiler which understands this option]) |
| 132 | fi |
| 133 | AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes) |
| 134 | |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 135 | # Enable gprof suport. |
| 136 | AC_ARG_ENABLE([gprof], |
| 137 | AC_HELP_STRING([--enable-gprof], |
| 138 | [build binaries with gprof support]), [use_gprof=yes], [use_gprof=no]) |
| 139 | if test "$use_gprof" = yes; then |
| 140 | CFLAGS="$CFLAGS -pg" |
| 141 | LDFLAGS="$LDFLAGS -pg" |
| 142 | fi |
| 143 | AM_CONDITIONAL(GPROF, test "$use_gprof" = yes) |
Ulrich Drepper | fbe998a | 2005-08-29 16:27:10 +0000 | [diff] [blame] | 144 | |
| 145 | # Enable gcov suport. |
| 146 | AC_ARG_ENABLE([gcov], |
| 147 | AC_HELP_STRING([--enable-gcov], |
| 148 | [build binaries with gcov support]), [use_gcov=yes], [use_gcov=no]) |
| 149 | if test "$use_gcov" = yes; then |
| 150 | CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" |
| 151 | LDFLAGS="$LDFLAGS -fprofile-arcs" |
| 152 | fi |
Ulrich Drepper | 39cec7a | 2005-08-30 01:22:01 +0000 | [diff] [blame] | 153 | AM_CONDITIONAL(GCOV, test "$use_gcov" = yes) |
Ulrich Drepper | fbe998a | 2005-08-29 16:27:10 +0000 | [diff] [blame] | 154 | |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 155 | AM_CONDITIONAL(BUILD_STATIC, [dnl |
Ulrich Drepper | fbe998a | 2005-08-29 16:27:10 +0000 | [diff] [blame] | 156 | test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes]) |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 157 | |
Roland McGrath | 1b8b446 | 2005-11-16 01:33:38 +0000 | [diff] [blame] | 158 | AC_ARG_ENABLE([tests-rpath], |
| 159 | AC_HELP_STRING([--enable-tests-rpath], [build $ORIGIN-using rpath into tests]), |
| 160 | [tests_use_rpath=yes], [tests_use_rpath=no]) |
| 161 | AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes) |
| 162 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 163 | LIBEBL_SUBDIR="$PACKAGE" |
| 164 | AC_ARG_ENABLE([libebl-subdir], |
| 165 | AS_HELP_STRING([--enable-libebl-subdir=DIR], |
| 166 | [install libebl_CPU modules in $(libdir)/DIR]), [dnl |
| 167 | LIBEBL_SUBDIR="$enable_libebl_subdir"]) |
| 168 | AC_SUBST([LIBEBL_SUBDIR]) |
| 169 | AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR") |
| 170 | AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.]) |
| 171 | |
| 172 | dnl The directories with content. |
| 173 | |
| 174 | dnl Documentation. |
| 175 | dnl Commented out for now. |
| 176 | dnl AC_CONFIG_FILES([doc/Makefile]) |
| 177 | |
| 178 | dnl Support library. |
| 179 | AC_CONFIG_FILES([lib/Makefile]) |
| 180 | |
| 181 | dnl ELF library. |
| 182 | AC_CONFIG_FILES([libelf/Makefile libelf-po/Makefile.in]) |
| 183 | |
| 184 | dnl Higher-level ELF support library. |
| 185 | AC_CONFIG_FILES([libebl/Makefile]) |
| 186 | |
| 187 | dnl DWARF library. |
| 188 | AC_CONFIG_FILES([libdw/Makefile]) |
| 189 | |
| 190 | dnl Higher-level DWARF support library. |
| 191 | AC_CONFIG_FILES([libdwfl/Makefile]) |
| 192 | |
| 193 | dnl CPU handling library. |
| 194 | AC_CONFIG_FILES([libcpu/Makefile]) |
| 195 | |
| 196 | dnl Assembler library. |
Roland McGrath | d7f8d0c | 2005-11-17 02:32:03 +0000 | [diff] [blame] | 197 | 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] | 198 | AC_CONFIG_FILES([libasm/Makefile]) |
| 199 | |
Roland McGrath | e47ab76 | 2005-11-17 03:16:00 +0000 | [diff] [blame] | 200 | dnl CPU-specific backend libraries. |
| 201 | AC_CONFIG_FILES([backends/Makefile]) |
| 202 | |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 203 | dnl Tools. |
| 204 | AC_CONFIG_FILES([src/Makefile po/Makefile.in]) |
| 205 | |
| 206 | dnl Test suite. |
Roland McGrath | d7f8d0c | 2005-11-17 02:32:03 +0000 | [diff] [blame] | 207 | AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see. |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 208 | AC_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. |
| 212 | AC_SUBST(USE_NLS, yes) |
| 213 | AM_PO_SUBDIRS |
| 214 | |
| 215 | |
| 216 | dnl Test of the config.h file. We hide all kinds of configuration magic |
| 217 | dnl in there. |
| 218 | AH_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__ |
| 249 | # define internal_function_def __attribute__ ((regparm (3), stdcall)) |
| 250 | #else |
| 251 | # define internal_function_def /* nothing */ |
| 252 | #endif |
| 253 | |
| 254 | # define internal_function \ |
| 255 | internal_function_def __attribute__ ((visibility ("internal"))) |
| 256 | # define internal_strong_alias(name, aliasname) \ |
| 257 | extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("internal"))) internal_function_def; |
| 258 | |
| 259 | #define attribute_hidden \ |
| 260 | __attribute__ ((visibility ("hidden"))) |
| 261 | |
| 262 | /* Define ALLOW_UNALIGNED if the architecture allows operations on |
| 263 | unaligned memory locations. */ |
Roland McGrath | 07d4f2f | 2005-10-28 06:56:24 +0000 | [diff] [blame] | 264 | #if defined __i386__ || defined __x86_64__ |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 265 | # define ALLOW_UNALIGNED 1 |
| 266 | #else |
| 267 | # define ALLOW_UNALIGNED 0 |
| 268 | #endif |
| 269 | |
| 270 | #define unlikely(expr) __builtin_expect (expr, 0) |
| 271 | #define likely(expr) __builtin_expect (expr, 1) |
| 272 | |
| 273 | #define obstack_calloc(ob, size) \ |
| 274 | ({ size_t _s = (size); memset (obstack_alloc (ob, _s), '\0', _s); }) |
| 275 | #define obstack_strdup(ob, str) \ |
| 276 | ({ const char *_s = (str); obstack_copy0 (ob, _s, strlen (_s)); }) |
| 277 | #define obstack_strndup(ob, str, n) \ |
| 278 | ({ const char *_s = (str); obstack_copy0 (ob, _s, strnlen (_s, n)); }) |
| 279 | |
| 280 | #if __STDC_VERSION__ >= 199901L |
| 281 | # define flexarr_size /* empty */ |
| 282 | #else |
| 283 | # define flexarr_size 0 |
| 284 | #endif |
| 285 | |
| 286 | /* Calling conventions. */ |
| 287 | #ifdef __i386__ |
| 288 | # define CALLING_CONVENTION regparm (3), stdcall |
| 289 | # define AND_CALLING_CONVENTION , regparm (3), stdcall |
| 290 | #else |
| 291 | # define CALLING_CONVENTION |
| 292 | # define AND_CALLING_CONVENTION |
| 293 | #endif |
| 294 | |
| 295 | /* Avoid PLT entries. */ |
| 296 | #ifdef PIC |
| 297 | # define INTUSE(name) _INTUSE(name) |
| 298 | # define _INTUSE(name) __##name##_internal |
| 299 | # define INTDEF(name) _INTDEF(name) |
| 300 | # define _INTDEF(name) \ |
| 301 | extern __typeof__ (name) __##name##_internal __attribute__ ((alias (#name))); |
| 302 | # define INTDECL(name) _INTDECL(name) |
| 303 | # define _INTDECL(name) \ |
| 304 | extern __typeof__ (name) __##name##_internal attribute_hidden; |
| 305 | #else |
| 306 | # define INTUSE(name) name |
| 307 | # define INTDEF(name) /* empty */ |
| 308 | # define INTDECL(name) /* empty */ |
| 309 | #endif |
Roland McGrath | d7f8d0c | 2005-11-17 02:32:03 +0000 | [diff] [blame] | 310 | |
| 311 | /* This macro is used by the tests conditionalize for standalone building. */ |
| 312 | #define ELFUTILS_HEADER(name) <lib##name.h> |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 313 | ]) |
| 314 | |
| 315 | AC_OUTPUT |