Add default Smack manifest for prelink.spec
[external/prelink.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
2 AC_INIT(src/prelink.c)
3 AM_CONFIG_HEADER(config.h)
4 AC_PREREQ(2.13)                 dnl Minimum Autoconf version required.
5 AC_CANONICAL_HOST
6
7 AM_INIT_AUTOMAKE([prelink], [0.0])
8
9 ALL_LINGUAS=
10
11 AC_PROG_CC
12 AC_PROG_CXX
13 AC_PROG_CPP
14 AC_PROG_GCC_TRADITIONAL
15 AM_PROG_LIBTOOL
16
17 AC_ARG_ENABLE(64-bit,
18 [  --disable-64-bit        only support 32-bit ELF],
19 [case "${enableval}" in
20   yes)  want64=true  ;;
21   no)   want64=false ;;
22   *)    AC_MSG_ERROR(bad value ${enableval} for 64-bit option) ;;
23 esac],[want64=true])dnl
24
25 AC_CHECK_HEADER(libelf.h,,[
26   if test -f /usr/include/elfutils/libelf.h; then
27     CPPFLAGS="$CPPFLAGS -I /usr/include/elfutils"
28   elif test -f /usr/local/include/elfutils/libelf.h; then
29     CPPFLAGS="$CPPFLAGS -I /usr/local/include/elfutils"
30   elif test -f /usr/include/libelf/libelf.h; then
31     CPPFLAGS="$CPPFLAGS -I /usr/include/libelf"
32   elif test -f /usr/local/include/libelf/libelf.h; then
33     CPPFLAGS="$CPPFLAGS -I /usr/local/include/libelf"
34   else
35     AC_MSG_ERROR(libelf.h not found)
36   fi])
37 LIBGELF=""
38 if test "$want64"x = falsex; then
39   GELFINCLUDE='-I$(top_srcdir)/gelfx32'
40 else
41   GELFINCLUDE='-I$(top_srcdir)/gelfx'
42   AC_CHECK_HEADER(gelf.h,,[
43     GELFINCLUDE="$GELFINCLUDE "'-I$(top_srcdir)/gelf'
44     LIBGELF='../gelf/libgelf.la'
45   ])
46 fi
47 AC_CHECK_LIB(elf,elf_begin)
48 AC_SUBST(GELFINCLUDE)
49 AC_SUBST(LIBGELF)
50
51 dnl Now check what kind of libelf we will link against
52 AC_CHECK_FUNC(gelf_getvernaux,[newbu=true],[newbu=false])
53
54 dnl Check if FTW_ACTIONRETVAL is supported
55 AC_CACHE_CHECK([whether FTW_ACTIONRETVAL is supported],
56                [ac_cv_ftw_actionretval], [dnl
57   AC_EGREP_CPP([FTW supports ACTIONRETVAL], [
58   #ifndef _GNU_SOURCE
59   #define _GNU_SOURCE 1
60   #endif
61   #include <ftw.h>
62   #ifdef FTW_ACTIONRETVAL
63   FTW supports ACTIONRETVAL
64   #endif
65   ], ac_cv_ftw_actionretval=yes, ac_cv_ftw_actionretval=no)])
66 if test "x$ac_cv_ftw_actionretval" = xyes; then
67   AC_DEFINE(HAVE_FTW_ACTIONRETVAL, 1,
68             [Define if FTW_ACTIONRETVAL is supported.])
69 fi
70
71 dnl SELinux checks
72 AC_CHECK_LIB(selinux,is_selinux_enabled)
73 AC_CHECK_HEADERS(selinux/selinux.h)
74
75 dnl This test must come as early as possible after the compiler configuration
76 dnl tests, because the choice of the file model can (in principle) affect
77 dnl whether functions and headers are available, whether they work, etc.
78 if test x"$newbu" = xtrue; then
79   # Don't use LFS for libelf-0.x
80   AC_SYS_LARGEFILE
81 fi
82
83 AC_LIBELF_SXWORD
84
85 AC_OUTPUT([Makefile
86            src/Makefile
87            gelfx/Makefile
88            gelfx32/Makefile
89            gelf/Makefile
90            m4/Makefile
91            patches/Makefile
92            doc/Makefile
93            testsuite/Makefile])