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