summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 396f3ac00a625759f7e926de55d1b46180fb2121 (plain)
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
dnl Process this file with autoconf to produce a configure script. -*-m4-*-
AC_INIT(src/prelink.c)
AM_CONFIG_HEADER(config.h)
AC_PREREQ(2.13)			dnl Minimum Autoconf version required.
AC_CANONICAL_HOST

AM_INIT_AUTOMAKE([prelink], [0.0])

ALL_LINGUAS=

AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AM_PROG_LIBTOOL

AC_ARG_ENABLE(64-bit,
[  --disable-64-bit        only support 32-bit ELF],
[case "${enableval}" in
  yes)  want64=true  ;;
  no)   want64=false ;;
  *)    AC_MSG_ERROR(bad value ${enableval} for 64-bit option) ;;
esac],[want64=true])dnl

AC_CHECK_HEADER(libelf.h,,[
  if test -f /usr/include/elfutils/libelf.h; then
    CPPFLAGS="$CPPFLAGS -I /usr/include/elfutils"
  elif test -f /usr/local/include/elfutils/libelf.h; then
    CPPFLAGS="$CPPFLAGS -I /usr/local/include/elfutils"
  elif test -f /usr/include/libelf/libelf.h; then
    CPPFLAGS="$CPPFLAGS -I /usr/include/libelf"
  elif test -f /usr/local/include/libelf/libelf.h; then
    CPPFLAGS="$CPPFLAGS -I /usr/local/include/libelf"
  else
    AC_MSG_ERROR(libelf.h not found)
  fi])
LIBGELF=""
if test "$want64"x = falsex; then
  GELFINCLUDE='-I$(top_srcdir)/gelfx32'
else
  GELFINCLUDE='-I$(top_srcdir)/gelfx'
  AC_CHECK_HEADER(gelf.h,,[
    GELFINCLUDE="$GELFINCLUDE "'-I$(top_srcdir)/gelf'
    LIBGELF='../gelf/libgelf.la'
  ])
fi
AC_CHECK_LIB(elf,elf_begin)
AC_SUBST(GELFINCLUDE)
AC_SUBST(LIBGELF)

dnl Now check what kind of libelf we will link against
AC_CHECK_FUNC(gelf_getvernaux,[newbu=true],[newbu=false])

dnl Check if FTW_ACTIONRETVAL is supported
AC_CACHE_CHECK([whether FTW_ACTIONRETVAL is supported],
	       [ac_cv_ftw_actionretval], [dnl
  AC_EGREP_CPP([FTW supports ACTIONRETVAL], [
  #ifndef _GNU_SOURCE
  #define _GNU_SOURCE 1
  #endif
  #include <ftw.h>
  #ifdef FTW_ACTIONRETVAL
  FTW supports ACTIONRETVAL
  #endif
  ], ac_cv_ftw_actionretval=yes, ac_cv_ftw_actionretval=no)])
if test "x$ac_cv_ftw_actionretval" = xyes; then
  AC_DEFINE(HAVE_FTW_ACTIONRETVAL, 1,
	    [Define if FTW_ACTIONRETVAL is supported.])
fi

dnl SELinux checks
AC_CHECK_LIB(selinux,is_selinux_enabled)
AC_CHECK_HEADERS(selinux/selinux.h)

dnl This test must come as early as possible after the compiler configuration
dnl tests, because the choice of the file model can (in principle) affect
dnl whether functions and headers are available, whether they work, etc.
if test x"$newbu" = xtrue; then
  # Don't use LFS for libelf-0.x
  AC_SYS_LARGEFILE
fi

AC_LIBELF_SXWORD

AC_OUTPUT([Makefile
	   src/Makefile
	   gelfx/Makefile
	   gelfx32/Makefile
	   gelf/Makefile
	   m4/Makefile
	   patches/Makefile
	   doc/Makefile
	   testsuite/Makefile])