Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | dnl Configure input file for elfutils. -*-autoconf-*- |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 3 | dnl |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 4 | dnl Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc. |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [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, |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 17 | dnl Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 18 | dnl |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 19 | AC_INIT([Red Hat elfutils],[0.138],[http://bugzilla.redhat.com/bugzilla/], |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 20 | [elfutils]) |
| 21 | |
| 22 | AC_CONFIG_AUX_DIR([config]) |
| 23 | AC_CONFIG_FILES([config/Makefile]) |
| 24 | |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 25 | AC_COPYRIGHT([Copyright (C) 1996-2007, 2008 Red Hat, Inc.]) |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 26 | AC_PREREQ(2.59) dnl Minimum Autoconf version required. |
| 27 | |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 28 | dnl We use GNU make extensions; automake 1.10 defaults to -Wportability. |
| 29 | AM_INIT_AUTOMAKE([gnits 1.8 -Wno-portability dist-bzip2 no-dist-gzip]) |
| 30 | AM_MAINTAINER_MODE |
| 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.]) |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 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 | |
| 51 | AC_ARG_ENABLE([tls], |
| 52 | AS_HELP_STRING([--enable-tls], [enable use of thread local storage]), |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 53 | use_tls=yes, use_tls=no) |
| 54 | AM_CONDITIONAL(USE_TLS, test "$use_tls" = yes) |
| 55 | AS_IF([test "$use_tls" = yes], [AC_DEFINE(USE_TLS)]) |
| 56 | |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 57 | AH_TEMPLATE([USE_TLS], [Defined if thread local storage should be used.]) |
| 58 | |
| 59 | dnl Add all the languages for which translations are available. |
| 60 | ALL_LINGUAS= |
| 61 | |
| 62 | AC_PROG_CC |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 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 | |
| 77 | LOCALEDIR=$datadir |
| 78 | AC_SUBST(LOCALEDIR) |
| 79 | AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR") |
| 80 | AH_TEMPLATE([LOCALEDIR], [Directory to place translation files in.]) |
| 81 | |
| 82 | DATADIRNAME=$datadir |
| 83 | AC_SUBST(DATADIRNAME) |
| 84 | |
| 85 | dnl This test must come as early as possible after the compiler configuration |
| 86 | dnl tests, because the choice of the file model can (in principle) affect |
| 87 | dnl whether functions and headers are available, whether they work, etc. |
| 88 | AC_SYS_LARGEFILE |
| 89 | |
| 90 | dnl Enable the linker to be build as a native-only linker. By default it |
| 91 | dnl can handle all architectures but this comes at a cost. A native |
| 92 | dnl will be slightly faster, small, and has fewer dependencies. |
| 93 | native_ld=no |
| 94 | AC_ARG_ENABLE([generic], |
| 95 | AS_HELP_STRING([--disable-generic], [do not build generic linker]), [dnl |
| 96 | if test "$enable_generic" = no; then |
| 97 | case "$host_cpu" in |
| 98 | i?86) |
| 99 | AC_DEFINE(NATIVE_ELF, 32) |
| 100 | native_ld=yes |
| 101 | base_cpu=i386 |
| 102 | ;; |
| 103 | *) |
| 104 | AC_MSG_ERROR([no machine-specific linker for this configuration available]) |
| 105 | ;; |
| 106 | esac |
| 107 | fi]) |
| 108 | AH_TEMPLATE([NATIVE_ELF], |
| 109 | [Define to 32 or 64 if a specific implementation is wanted.]) |
| 110 | AM_CONDITIONAL(NATIVE_LD, test "$native_ld" = yes) |
| 111 | dnl The automake generated Makefile cannot deal with macros in the name |
| 112 | dnl of files if at any time there is no such file, even if the filename |
| 113 | dnl would not be used. |
| 114 | AS_IF([test -z "$base_cpu"], [base_cpu=none]) |
| 115 | AC_SUBST(base_cpu) |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 116 | dnl Support to work around automake's inflexible dependency generation. |
| 117 | dnl See src/Makefile.am for more information. |
| 118 | AM_CONDITIONAL(NEVER, false) |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 119 | |
| 120 | dnl Enable debugging via mudflap. This option will cause most libraries |
| 121 | dnl to be built as archives which are statically linked into the applications. |
| 122 | dnl All code, as far as possible, is compiled instrumented to catch all |
| 123 | dnl the bugs valgrind is able to catch. |
| 124 | use_mudflap=no |
| 125 | AC_ARG_ENABLE([mudflap], |
| 126 | AS_HELP_STRING([--enable-mudflap], |
| 127 | [build binaries with mudflap instrumentation]), [dnl |
| 128 | if test "x$enable_mudflap" = xyes; then |
| 129 | # Check whether the compiler support -fmudflap. |
| 130 | old_CFLAGS="$CFLAGS" |
| 131 | CFLAGS="$CFLAGS -fmudflap" |
| 132 | AC_TRY_COMPILE([], [], use_mudflap=yes, use_mudflap=fail) |
| 133 | CFLAGS="$old_CFLAGS" |
| 134 | fi]) |
| 135 | if test "$use_mudflap" = fail; then |
| 136 | AC_MSG_FAILURE([--enable-mudflap requires a compiler which understands this option]) |
| 137 | fi |
| 138 | AM_CONDITIONAL(MUDFLAP, test "$use_mudflap" = yes) |
| 139 | |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 140 | dnl enable debugging of branch prediction. |
| 141 | use_debugpred=0 |
| 142 | AC_ARG_ENABLE([debugpred], |
| 143 | AC_HELP_STRING([--enable-debugpred], |
| 144 | [build binaries with support to debug branch prediction]), |
| 145 | [use_debugpred=1], [use_debugpred=0]) |
| 146 | AC_SUBST([DEBUGPRED], $use_debugpred) |
| 147 | |
| 148 | dnl Enable gprof suport. |
| 149 | AC_ARG_ENABLE([gprof], |
| 150 | AC_HELP_STRING([--enable-gprof], |
| 151 | [build binaries with gprof support]), [use_gprof=yes], [use_gprof=no]) |
| 152 | if test "$use_gprof" = yes; then |
| 153 | CFLAGS="$CFLAGS -pg" |
| 154 | LDFLAGS="$LDFLAGS -pg" |
| 155 | fi |
| 156 | AM_CONDITIONAL(GPROF, test "$use_gprof" = yes) |
| 157 | |
| 158 | # Enable gcov suport. |
| 159 | AC_ARG_ENABLE([gcov], |
| 160 | AC_HELP_STRING([--enable-gcov], |
| 161 | [build binaries with gcov support]), [use_gcov=yes], [use_gcov=no]) |
| 162 | if test "$use_gcov" = yes; then |
| 163 | CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" |
| 164 | LDFLAGS="$LDFLAGS -fprofile-arcs" |
| 165 | fi |
| 166 | AM_CONDITIONAL(GCOV, test "$use_gcov" = yes) |
| 167 | |
| 168 | AM_CONDITIONAL(BUILD_STATIC, [dnl |
| 169 | test "$use_mudflap" = yes -o "$use_gprof" = yes -o "$use_gcov" = yes]) |
| 170 | |
| 171 | AC_ARG_ENABLE([tests-rpath], |
| 172 | AC_HELP_STRING([--enable-tests-rpath], [build $ORIGIN-using rpath into tests]), |
| 173 | [tests_use_rpath=yes], [tests_use_rpath=no]) |
| 174 | AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes) |
| 175 | |
| 176 | LIBEBL_SUBDIR="$PACKAGE" |
| 177 | AC_ARG_ENABLE([libebl-subdir], |
| 178 | AS_HELP_STRING([--enable-libebl-subdir=DIR], |
| 179 | [install libebl_CPU modules in $(libdir)/DIR]), [dnl |
| 180 | LIBEBL_SUBDIR="$enable_libebl_subdir"]) |
| 181 | AC_SUBST([LIBEBL_SUBDIR]) |
| 182 | AC_DEFINE_UNQUOTED(LIBEBL_SUBDIR, "$LIBEBL_SUBDIR") |
| 183 | AH_TEMPLATE([LIBEBL_SUBDIR], [$libdir subdirectory containing libebl modules.]) |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 184 | |
| 185 | dnl The directories with content. |
| 186 | |
| 187 | dnl Documentation. |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 188 | dnl Commented out for now. |
| 189 | dnl AC_CONFIG_FILES([doc/Makefile]) |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 190 | |
| 191 | dnl Support library. |
| 192 | AC_CONFIG_FILES([lib/Makefile]) |
| 193 | |
| 194 | dnl ELF library. |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 195 | AC_CONFIG_FILES([libelf/Makefile]) |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 196 | |
| 197 | dnl Higher-level ELF support library. |
| 198 | AC_CONFIG_FILES([libebl/Makefile]) |
| 199 | |
| 200 | dnl DWARF library. |
| 201 | AC_CONFIG_FILES([libdw/Makefile]) |
| 202 | |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 203 | dnl Higher-level DWARF support library. |
| 204 | AC_CONFIG_FILES([libdwfl/Makefile]) |
| 205 | |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 206 | dnl CPU handling library. |
| 207 | AC_CONFIG_FILES([libcpu/Makefile]) |
| 208 | |
| 209 | dnl Assembler library. |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 210 | AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see. |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 211 | AC_CONFIG_FILES([libasm/Makefile]) |
| 212 | |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 213 | dnl CPU-specific backend libraries. |
| 214 | AC_CONFIG_FILES([backends/Makefile]) |
| 215 | |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 216 | dnl Tools. |
| 217 | AC_CONFIG_FILES([src/Makefile po/Makefile.in]) |
| 218 | |
| 219 | dnl Test suite. |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 220 | AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see. |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 221 | AC_CONFIG_FILES([tests/Makefile]) |
| 222 | |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 223 | # Get the definitions necessary to create the Makefiles in the po |
| 224 | # subdirectories. This is a small subset of the gettext rules. |
| 225 | AC_SUBST(USE_NLS, yes) |
| 226 | AM_PO_SUBDIRS |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 227 | |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 228 | dnl Appended to the config.h file. |
| 229 | dnl We hide all kinds of configuration magic in lib/eu-config.h. |
| 230 | AH_BOTTOM([#include <eu-config.h>]) |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 231 | |
Ben Cheng | cc6695e | 2012-03-07 23:04:02 -0800 | [diff] [blame] | 232 | dnl Version compatibility header. |
| 233 | AC_CONFIG_FILES([version.h:config/version.h.in]) |
| 234 | AC_SUBST([eu_version]) |
| 235 | case $PACKAGE_VERSION in |
| 236 | 0.???) eu_version=${PACKAGE_VERSION#0.} ;; |
| 237 | ?.???) eu_version=${PACKAGE_VERSION/./} ;; |
| 238 | ?.??) eu_version=${PACKAGE_VERSION/./}0 ;; |
| 239 | ?.?) eu_version=${PACKAGE_VERSION/./}00 ;; |
| 240 | *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; |
| 241 | esac |
The Android Open Source Project | 441f72d | 2009-03-03 19:29:28 -0800 | [diff] [blame] | 242 | |
| 243 | AC_OUTPUT |