1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
|
# configure.in - Configure template for libelf.
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1995 - 2006 Michael Riepe
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# @(#) $Id: configure.in,v 1.41 2008/05/23 08:17:56 michael Exp $
AC_INIT(VERSION)
AC_CONFIG_HEADER(config.h lib/sys_elf.h)
AC_PREREQ(2.13)
mr_PACKAGE(libelf)
dnl NOTE: there must be at least one .po file!
ALL_LINGUAS=`cd $srcdir/po && echo *.po | sed 's/\.po//g'`
dnl Assuming all arguments have already been processed...
set `echo $VERSION | sed 's/\./ /g'`
MAJOR=${1-1}
MINOR=${2-0}
PATCH=${3-0}
AC_SUBST(MAJOR)
dnl Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h stdint.h fcntl.h)
AC_CHECK_HEADERS(elf.h sys/elf.h link.h sys/link.h)
AC_CACHE_CHECK([if ${CC} can compile elf.h], libelf_cv_elf_h_works, [
AC_TRY_COMPILE(
[#if HAVE_ELF_H
#include <elf.h>
#elif HAVE_SYS_ELF_H
#include <sys/elf.h>
#endif],
[Elf32_Ehdr dummy],
[libelf_cv_elf_h_works=yes],
[libelf_cv_elf_h_works=no])
])
if test "$libelf_cv_elf_h_works" = no; then
ac_cv_header_elf_h=no
ac_cv_header_sys_elf_h=no
fi
if test "$ac_cv_header_elf_h" = yes; then
AC_DEFINE(__LIBELF_HEADER_ELF_H, [<elf.h>])
elif test "$ac_cv_header_sys_elf_h" = yes; then
AC_DEFINE(__LIBELF_HEADER_ELF_H, [<sys/elf.h>])
fi
AC_CHECK_HEADERS(ar.h libelf.h nlist.h gelf.h)
AC_MSG_CHECKING([whether to install <libelf.h>, <nlist.h> and <gelf.h>])
AC_ARG_ENABLE(compat,
[ --enable-compat install <libelf.h>, <nlist.h> and <gelf.h> (default: auto)],
[DO_COMPAT="$enableval"],
[if test "$ac_cv_header_libelf_h$ac_cv_header_nlist_h$ac_cv_header_gelf_h" = yesyesyes
then DO_COMPAT=no
else DO_COMPAT=yes
fi])
AC_MSG_RESULT($DO_COMPAT)
AC_SUBST(DO_COMPAT)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(short,2)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(long,4)
AC_CHECK_SIZEOF(long long,0)
# Windows port
AC_CHECK_SIZEOF(__int64, 0)
if test "$ac_cv_header_elf_h" = yes \
|| test "$ac_cv_header_sys_elf_h" = yes; then
# Slowaris declares Elf32_Dyn in <link.h>.
# QNX declares Elf32_Dyn in <sys/link.h>.
AC_CACHE_CHECK([for struct Elf32_Dyn], libelf_cv_struct_elf32_dyn, [
AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H], [Elf32_Dyn x],
[libelf_cv_struct_elf32_dyn=yes],
AC_TRY_COMPILE([#include <link.h>], [Elf32_Dyn x],
[libelf_cv_struct_elf32_dyn=link.h],
AC_TRY_COMPILE([#include <sys/link.h>], [Elf32_Dyn x],
[libelf_cv_struct_elf32_dyn=sys/link.h],
[libelf_cv_struct_elf32_dyn=no])))])
if test "$libelf_cv_struct_elf32_dyn" = link.h; then
AC_DEFINE(__LIBELF_NEED_LINK_H)
elif test "$libelf_cv_struct_elf32_dyn" = sys/link.h; then
AC_DEFINE(__LIBELF_NEED_SYS_LINK_H)
elif test "$libelf_cv_struct_elf32_dyn" = no; then
AC_MSG_ERROR([no declaration for Elf32_Dyn])
fi
# Linux declares struct nlist in <elf.h>.
AC_CACHE_CHECK([for struct nlist in elf.h], libelf_cv_struct_nlist, [
AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H], [struct nlist nl],
[libelf_cv_struct_nlist=yes],
[libelf_cv_struct_nlist=no])])
if test "$libelf_cv_struct_nlist" = yes; then
AC_DEFINE(HAVE_STRUCT_NLIST_DECLARATION)
fi
# Check for 64-bit data types.
AC_CACHE_CHECK([for struct Elf64_Ehdr], libelf_cv_struct_elf64_ehdr,
AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
[Elf64_Ehdr x],
[libelf_cv_struct_elf64_ehdr=yes],
[libelf_cv_struct_elf64_ehdr=no]))
# Linux lacks typedefs for scalar ELF64_* types.
AC_CACHE_CHECK([for Elf64_Addr], libelf_cv_type_elf64_addr,
AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
[Elf64_Addr x],
[libelf_cv_type_elf64_addr=yes],
[libelf_cv_type_elf64_addr=no]))
# IRIX' struct Elf64_Rel is slightly different. Ugh.
AC_CACHE_CHECK([for struct Elf64_Rel], libelf_cv_struct_elf64_rel,
AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
[Elf64_Rel x; x.r_info = 1],
[libelf_cv_struct_elf64_rel=yes],
AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
[Elf64_Rel x; x.r_sym = 1],
[libelf_cv_struct_elf64_rel=irix],
[libelf_cv_struct_elf64_rel=no])))
case "$libelf_cv_struct_elf64_ehdr:\
$libelf_cv_type_elf64_addr:\
$libelf_cv_struct_elf64_rel" in
yes:yes:yes)
libelf_64bit=yes;;
yes:yes:irix)
AC_DEFINE(__LIBELF64_IRIX)
libelf_64bit=yes;;
yes:no:yes)
AC_DEFINE(__LIBELF64_LINUX)
libelf_64bit=yes;;
*)
libelf_64bit=no;;
esac
# Check for symbol versioning definitions
AC_CACHE_CHECK([for Elf32_Verdef], libelf_cv_verdef32,
AC_TRY_COMPILE(
[#include __LIBELF_HEADER_ELF_H
#if __LIBELF_NEED_LINK_H
#include <link.h> /* Solaris wants this */
#endif],
[struct {
Elf32_Verdef vd;
Elf32_Verdaux vda;
Elf32_Verneed vn;
Elf32_Vernaux vna;
} x],
[libelf_cv_verdef32=yes],
[libelf_cv_verdef32=no]))
AC_CACHE_CHECK([for Elf64_Verdef], libelf_cv_verdef64,
AC_TRY_COMPILE(
[#include __LIBELF_HEADER_ELF_H
#if __LIBELF_NEED_LINK_H
#include <link.h> /* Solaris wants this */
#endif],
[struct {
Elf64_Verdef vd;
Elf64_Verdaux vda;
Elf64_Verneed vn;
Elf64_Vernaux vna;
} x],
[libelf_cv_verdef64=yes],
[libelf_cv_verdef64=no]))
AC_CACHE_CHECK([for SHT_SUNW_verdef], libelf_cv_sun_verdef,
AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
[Elf32_Word x = SHT_SUNW_verdef + SHT_SUNW_verneed + SHT_SUNW_versym],
[libelf_cv_sun_verdef=yes],
[libelf_cv_sun_verdef=no]))
AC_CACHE_CHECK([for SHT_GNU_verdef], libelf_cv_gnu_verdef,
AC_TRY_COMPILE([#include __LIBELF_HEADER_ELF_H],
[Elf32_Word x = SHT_GNU_verdef + SHT_GNU_verneed + SHT_GNU_versym],
[libelf_cv_gnu_verdef=yes],
[libelf_cv_gnu_verdef=no]))
else
# lib/elf_repl.h supports 64-bit
libelf_64bit=yes
# lib/elf_repl.h supports symbol versioning
libelf_cv_verdef32=yes
libelf_cv_verdef64=yes
libelf_cv_sun_verdef=yes
libelf_cv_gnu_verdef=yes
fi
AC_CACHE_CHECK([for 64-bit integer], libelf_cv_int64, [
if test "$ac_cv_sizeof_long" = 8; then
libelf_cv_int64='long'
elif test "$ac_cv_sizeof___int64" = 8; then
libelf_cv_int64='__int64'
elif test "$ac_cv_sizeof_long_long" = 8; then
libelf_cv_int64='long long'
else
libelf_cv_int64=no
fi])
if test "$libelf_cv_int64" = no; then
libelf_64bit=no
else
AC_DEFINE_UNQUOTED(__libelf_i64_t, [$libelf_cv_int64])
AC_DEFINE_UNQUOTED(__libelf_u64_t, [unsigned $libelf_cv_int64])
fi
AC_CACHE_CHECK([for 32-bit integer], libelf_cv_int32, [
if test "$ac_cv_sizeof_int" = 4; then
libelf_cv_int32='int'
elif test "$ac_cv_sizeof_long" = 4; then
libelf_cv_int32='long'
else
libelf_cv_int32=no
fi])
if test "$libelf_cv_int32" = no; then
AC_MSG_ERROR([neither int nor long is 32-bit])
else
AC_DEFINE_UNQUOTED(__libelf_i32_t, [$libelf_cv_int32])
AC_DEFINE_UNQUOTED(__libelf_u32_t, [unsigned $libelf_cv_int32])
fi
AC_CACHE_CHECK([for 16-bit integer], libelf_cv_int16, [
if test "$ac_cv_sizeof_short" = 2; then
libelf_cv_int16='short'
elif test "$ac_cv_sizeof_int" = 2; then
libelf_cv_int16='int'
else
libelf_cv_int16=no
fi])
if test "$libelf_cv_int16" = no; then
AC_MSG_ERROR([neither short nor int is 16-bit])
else
AC_DEFINE_UNQUOTED(__libelf_i16_t, [$libelf_cv_int16])
AC_DEFINE_UNQUOTED(__libelf_u16_t, [unsigned $libelf_cv_int16])
fi
dnl Checks for library functions.
AC_FUNC_MMAP
AC_CHECK_FUNCS(ftruncate memcmp memcpy memmove)
AC_REPLACE_FUNCS(memset)
if test "$ac_cv_func_memset" = yes; then
AC_DEFINE(HAVE_MEMSET)
fi
AC_CACHE_CHECK([whether overlapping arrays are copied correctly],
libelf_cv_working_memmove,
[AC_TRY_RUN(changequote(<<, >>)dnl
<<#include "confdefs.h"
#if HAVE_MEMMOVE
extern void *memmove();
#else
extern void bcopy();
#define memmove(d,s,n) bcopy((s),(d),(n))
#endif
extern int strcmp();
main() {
char buf[] = "0123456789";
memmove(buf + 1, buf, 9);
if (strcmp(buf, "0012345678")) exit(1);
exit(0);
}>>, changequote([, ])dnl
libelf_cv_working_memmove=yes,
libelf_cv_working_memmove=no,
libelf_cv_working_memmove='maybe not')])
if test "$libelf_cv_working_memmove" != yes; then
AC_DEFINE(HAVE_BROKEN_MEMMOVE)
fi
AC_CACHE_CHECK([the coffee machine], mr_cv_coffee_machine,
[mr_cv_coffee_machine='empty - operator may not work as expected'])
dnl Check for 64-bit support.
AC_MSG_CHECKING([whether 64-bit ELF support is sufficient])
AC_MSG_RESULT($libelf_64bit)
AC_MSG_CHECKING([whether to include 64-bit support])
if test "$libelf_64bit" = no; then
libelf_enable_64bit=no
else
AC_ARG_ENABLE(elf64,
[ --enable-elf64 compile in 64-bit support (default: auto)],
[libelf_enable_64bit="$enableval"],
[libelf_enable_64bit=yes])
fi
AC_MSG_RESULT($libelf_enable_64bit)
if test "$libelf_enable_64bit" = yes; then
AC_DEFINE(__LIBELF64)
fi
AC_MSG_CHECKING([whether versioning support is sufficient])
libelf_versioning=no
case "$libelf_enable_64bit:$libelf_cv_verdef32:$libelf_cv_verdef64" in
no:yes:* | yes:yes:yes)
if test "$libelf_cv_sun_verdef" = yes; then
AC_DEFINE(__LIBELF_SUN_SYMBOL_VERSIONS)
libelf_versioning=yes
elif test "$libelf_cv_gnu_verdef" = yes; then
AC_DEFINE(__LIBELF_GNU_SYMBOL_VERSIONS)
libelf_versioning=yes
fi;;
esac
AC_MSG_RESULT($libelf_versioning)
AC_MSG_CHECKING([whether to include versioning support])
if test "$libelf_versioning" = no; then
libelf_enable_versioning=no
else
AC_ARG_ENABLE(versioning,
[ --enable-versioning compile in versioning support (default: auto)],
[libelf_enable_versioning="$enableval"],
[libelf_enable_versioning=yes])
fi
AC_MSG_RESULT($libelf_enable_versioning)
if test "$libelf_enable_versioning" = yes; then
AC_DEFINE(__LIBELF_SYMBOL_VERSIONS)
fi
dnl Check for NLS support.
mr_ENABLE_NLS
dnl this is for gmo2msg...
LIBINTL=
AC_CHECK_LIB(intl, gettext, [LIBINTL=-lintl])
AC_SUBST(LIBINTL)
dnl Check for shared library support.
mr_ENABLE_SHARED
dnl Check for extended ELF format support
AC_ARG_ENABLE(extended-format,
[ --enable-extended-format support extended file formats (default: no)],
[mr_enable_extended_format="$enableval"],
[mr_enable_extended_format=no])
if test "$mr_enable_extended_format" = yes; then
AC_DEFINE(ENABLE_EXTENDED_FORMAT)
fi
dnl Check if ELF sanity checks should be enabled
AC_ARG_ENABLE(sanity-checks,
[ --enable-sanity-checks enable sanity checks by default (default: yes)],
[mr_enable_sanity_checks="$enableval"],
[mr_enable_sanity_checks=yes])
if test "$mr_enable_sanity_checks" = yes; then
AC_DEFINE(ENABLE_SANITY_CHECKS)
fi
dnl Check for debug support.
mr_ENABLE_DEBUG
AC_OUTPUT([Makefile lib/Makefile po/Makefile libelf.pc],
[echo timestamp > stamp-h; echo timestamp > lib/stamp-h])
# vi: set ts=8 sw=2 :
|