Fix parseThat configure so we don't depend on DYNINST_ROOT
[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 if test -n ${DYNINST_ROOT}; then
20    # Add search paths to CPPFLAGS and LDFLAGS.
21    if test -z ${DYNINST_LIB}; then
22       DYNINST_LIB="${DYNINST_ROOT}/${PLATFORM}/lib"
23    fi
24    if test -z ${DYNINST_INC}; then
25       DYNINST_INC="${DYNINST_ROOT}/include"
26    fi
27 fi
28
29 AC_SUBST([LDFLAGS], ["-L${DYNINST_LIB} ${LDFLAGS}"])
30 AC_SUBST([CPPFLAGS], ["-I${DYNINST_INC} ${CPPFLAGS}"])
31
32 # Generate host string.
33 AC_CANONICAL_HOST()
34
35 # Build all configure tests with C++ compiler.
36 AC_LANG([C++])
37
38 # sha1.C requres these system files and endianess to be tested.
39 AC_CHECK_HEADERS([inttypes.h], [], [], [// Do not use default includes])
40 AC_CHECK_HEADERS([stdint.h], [], [], [// Do not use default includes])
41 AC_C_BIGENDIAN()
42
43 # Search for Dyninst in all the right places.
44 AC_CHECK_HEADER([BPatch.h], [],
45                 [AC_MSG_ERROR([Cannot find DyninstAPI library include files.])],
46                 [// Do not use default includes])
47
48 # Check if Dyninst is version 5.0+
49 AC_CHECK_HEADERS([BPatch_process.h],
50                  [AC_SUBST([DYNINST_VER], [5])],
51                  [AC_SUBST([DYNINST_VER], [4])],
52                  [// Do not use default includes])
53
54 # Find appropriate install program
55 AC_PROG_INSTALL()
56
57 AC_CONFIG_FILES([Makefile])
58 AC_OUTPUT()