More parseThat build issues
[dyninst.git] / parseThat / configure.ac
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT([parseThat], [1.0])
3 AC_CONFIG_SRCDIR([src/config.C])
4 AC_PREFIX_DEFAULT([.])
5
6 AC_ARG_WITH(dyninst,
7             [AS_HELP_STRING([--with-dyninst],[Base directory to look for dyninst headers and libraries])],
8             [DYNINST_LIB="${withval}/${PLATFORM}/lib"
9              DYNINST_INC="${withval}/include"],)
10
11 AC_ARG_WITH(dyninst-lib,
12             [AS_HELP_STRING([--with-dyninst-lib],[Directory to look for dyninst libraries])],
13             [DYNINST_LIB="${withval}"],)
14
15 AC_ARG_WITH(dyninst-include,
16             [AS_HELP_STRING([--with-dyninst-include],[Directory to look for dyninst headers])],
17             [DYNINST_INC="${withval}"],)
18
19 AC_ARG_WITH(dwarf-lib,
20             [AS_HELP_STRING([--with-dwarf-include],[Directory to look for libdwarf])],
21             [DWARF_LIB="${withval}"],)
22
23 AC_ARG_WITH(elf-lib,
24             [AS_HELP_STRING([--with-elf-include],[Directory to look for libelf])],
25             [ELF_LIB="${withval}"],)
26
27 if test -n ${DYNINST_ROOT}; then
28    # Add search paths to CPPFLAGS and LDFLAGS.
29    if test -z ${DYNINST_LIB}; then
30       DYNINST_LIB="${DYNINST_ROOT}/${PLATFORM}/lib"
31    fi
32    if test -z ${DYNINST_INC}; then
33       DYNINST_INC="${DYNINST_ROOT}/include"
34    fi
35 fi
36
37 AC_SUBST([LDFLAGS], ["-L${DYNINST_LIB} ${LDFLAGS}"])
38 AC_SUBST([DWARFFLAGS], ["-L${DWARF_LIB}"])
39 AC_SUBST([ELFFLAGS], ["-L${ELF_LIB}"])
40 AC_SUBST([CPPFLAGS], ["-I${DYNINST_INC} ${CPPFLAGS}"])
41
42 # Generate host string.
43 AC_CANONICAL_HOST()
44
45 # Build all configure tests with C++ compiler.
46 AC_LANG([C++])
47
48 # sha1.C requres these system files and endianess to be tested.
49 AC_CHECK_HEADERS([inttypes.h], [], [], [// Do not use default includes])
50 AC_CHECK_HEADERS([stdint.h], [], [], [// Do not use default includes])
51 AC_C_BIGENDIAN()
52
53 # Search for Dyninst in all the right places.
54 AC_CHECK_HEADER([BPatch.h], [],
55                 [AC_MSG_ERROR([Cannot find DyninstAPI library include files.])],
56                 [// Do not use default includes])
57
58 # Check if Dyninst is version 5.0+
59 AC_CHECK_HEADERS([BPatch_process.h],
60                  [AC_SUBST([DYNINST_VER], [5])],
61                  [AC_SUBST([DYNINST_VER], [4])],
62                  [// Do not use default includes])
63
64 # Find appropriate install program
65 AC_PROG_INSTALL()
66
67 AC_CONFIG_FILES([Makefile])
68 AC_OUTPUT()