configure.ac revision 5570a7769869a4df25ef85f302f74a7feb6c0cd3
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(ltrace.c, 0.3.38)
3AC_CONFIG_HEADER(config.h)
4AC_PREREQ(2.50)
5
6dnl Check host system type
7AC_CANONICAL_HOST
8HOST_OS="$host_os"
9AC_SUBST(HOST_OS)
10
11dnl Checks for programs.
12AC_PROG_CC
13AC_PROG_INSTALL
14
15dnl Checks for libraries.
16AC_CHECK_LIB(iberty, cplus_demangle,,,)
17AC_CHECK_LIB(supc++, __cxa_demangle,,,)
18
19dnl
20dnl The following stuff may be useful, but I don't use it now.
21dnl
22
23dnl   dnl Checks for header files.
24AC_HEADER_STDC
25dnl   AC_HEADER_SYS_WAIT
26dnl   AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h)
27AC_CHECK_HEADERS(getopt.h)
28dnl   
29dnl   dnl Checks for typedefs, structures, and compiler characteristics.
30AC_C_CONST
31AC_TYPE_UID_T
32AC_TYPE_PID_T
33dnl   AC_HEADER_TIME
34dnl   AC_STRUCT_TM
35dnl   
36dnl   dnl Checks for library functions.
37dnl   AC_FUNC_MMAP
38dnl   AC_TYPE_SIGNAL
39dnl   AC_FUNC_VPRINTF
40dnl   AC_CHECK_FUNCS(gettimeofday strdup strerror strspn)
41AC_CHECK_FUNCS(getopt getopt_long)
42
43AC_CHECK_HEADER(gelf.h,,[
44  if test -f /usr/include/elfutils/gelf.h; then
45    CPPFLAGS="$CPPFLAGS -I /usr/include/elfutils"
46  elif test -f /usr/local/include/elfutils/gelf.h; then
47    CPPFLAGS="$CPPFLAGS -I /usr/local/include/elfutils"
48  elif test -f /usr/include/libelf/gelf.h; then
49    CPPFLAGS="$CPPFLAGS -I /usr/include/libelf"
50  elif test -f /usr/local/include/libelf/gelf.h; then
51    CPPFLAGS="$CPPFLAGS -I /usr/local/include/libelf"
52  else
53    AC_MSG_ERROR(gelf.h not found)
54  fi])
55AC_CHECK_LIB(elf,gelf_getdyn)
56
57ac_cv_have_elf_c_read_mmap=no
58AC_MSG_CHECKING(elf_begin accepts ELF_C_READ_MMAP)
59AC_TRY_COMPILE([#include <gelf.h>],
60	       [Elf *elf = elf_begin (4, ELF_C_READ_MMAP, 0);],
61	       [ac_cv_have_elf_c_read_mmap=yes])
62AC_MSG_RESULT($ac_cv_have_elf_c_read_mmap)
63if test $ac_cv_have_elf_c_read_mmap = yes; then
64AC_DEFINE(HAVE_ELF_C_READ_MMAP, 1,
65	  [Defined if ELF_C_READ_MMAP is valid argument for elf_begin])
66dnl This is not 100% correct, but all elfutils installations
67dnl are built with LFS, while AFAIK all Michael Riepe's libelfs
68dnl are built without LFS.  It is important that LFS setting
69dnl of libelf and ltrace matches.
70AC_SYS_LARGEFILE
71fi
72AC_OUTPUT(Makefile)
73