Updates to autoconf: fixed test suite detection of mutatee compilers, allowed install...
[dyninst.git] / configure.in
1 dnl == process this file with autoconf to produce a configure script ==
2
3
4 AC_PREREQ(2.59)
5 AC_INIT([Dyninst], [6.0], [bugs@dyninst.org], [dyninst])
6
7 AC_PREFIX_DEFAULT(`pwd`/..)
8
9 AC_CONFIG_AUX_DIR([autodyninst])
10 AC_CONFIG_MACRO_DIR([autodyninst])
11
12 AC_PROG_CXX(g++)
13 AC_PATH_PROG(_ICC_, icc)
14 AC_PATH_PROG(_PGC_, pgcc)
15 AC_PATH_PROG(_PGCXX_, pgCC)
16 AC_PATH_PROG(_CC_, cc)
17 AC_PATH_PROG(_CXX_, CC)
18 AC_LANG(C++)
19
20
21 dnl === configure options ==
22
23
24 PACKAGE_BASE=""
25 AC_ARG_WITH(package-base,
26            [AS_HELP_STRING([--with-package-base],[Base directory to look for packages])],
27            [PACKAGE_BASE="${withval}";
28             TCLTK_INC_DIR="${PACKAGE_BASE}/tcl8.4.5/include";
29             TCLTK_LIB_DIR="${PACKAGE_BASE}/tcl8.4.5/lib";
30             LIBELF_INC_DIR="${PACKAGE_BASE}/libelf/include";
31             LIBELF_LIB_DIR="${PACKAGE_BASE}/libelf/lib";
32             LIBDWARF_INC_DIR="${PACKAGE_BASE}/libdwarf/include";
33             LIBDWARF_LIB_DIR="${PACKAGE_BASE}/libdwarf/lib";
34             LIBXML2_INC_DIR="${PACKAGE_BASE}/libxml2/include/libxml2"
35             LIBXML2_LIB_DIR="${PACKAGE_BASE}/libxml2/lib";
36             LIBUNWIND_INC_DIR="${PACKAGE_BASE}/libunwind/include";
37             LIBUNWIND_LIB_DIR="${PACKAGE_BASE}/libunwind/lib";
38             LIBFLEX_LIB_DIR="${PACKAGE_BASE}/libflex/lib";
39            ],[
40             # We fall back on these defaults if both --with-package-base and
41             # specific --with-<package> arguments are not provided.
42             TCLTK_INC_DIR="/usr/include";
43             TCLTK_LIB_DIR="/usr/lib";
44             LIBELF_INC_DIR="/usr/include";
45             LIBELF_LIB_DIR="/usr/lib";
46             LIBDWARF_INC_DIR="/usr/include";
47             LIBDWARF_LIB_DIR="/usr/lib";
48             LIBXML2_INC_DIR="/usr/include/libxml2"
49             LIBXML2_LIB_DIR="/usr/lib";
50             LIBUNWIND_INC_DIR="/usr/include";
51             LIBUNWIND_LIB_DIR="/usr/lib";
52             LIBFLEX_LIB_DIR="/usr/lib";
53            ])
54 # 3/15/09: We don't include libiberty in the cs.wisc.edu package-base.
55 #          Why?  Putting these here for now...
56 LIBIBERTY_LIB_DIR="/usr/lib";
57
58
59 AC_ARG_WITH(tcl83,
60             [AS_HELP_STRING([--with-tcl83],[Use Tcl/Tk 8.3])],
61             [TCL_VERSION="tcl8.3"; USE_TCL83="${withval}";],
62             [TCL_VERSION="tcl8.4"; USE_TCL83="false";])
63 AC_ARG_WITH(tcltk-incdir,
64             [AS_HELP_STRING([--with-tcltk-incdir],[TCL/TK include directory])],
65             [TCLTK_INC_DIR="${withval}";],)
66 AC_ARG_WITH(tcltk-libdir,
67             [AS_HELP_STRING([--with-tcltk-libdir],[TCL/TK library directory])],
68             [TCLTK_LIB_DIR="${withval}";],)
69 PD_SOFT_CHECK_INC_DIR($TCLTK_INC_DIR, [tcl.h], [tcl])
70 PD_SOFT_CHECK_LIB_DIR($TCLTK_LIB_DIR, $TCL_VERSION, [Tcl_Eval])
71 AC_SUBST(USE_TCL83)
72 AC_SUBST(TCLTK_INC_DIR)
73 AC_SUBST(TCLTK_LIB_DIR)
74
75 AC_CANONICAL_HOST
76
77 if test "`echo $host_os | cut -b-3`" = "aix" ; then
78    AC_MSG_NOTICE([AIX system, skipping libelf...])
79    
80 else
81    AC_ARG_WITH(libelf-incdir,
82                    [AS_HELP_STRING([--with-libelf-incdir],[LIBELF include directory])],
83                    [LIBELF_INC_DIR="${withval}";],)
84    AC_ARG_WITH(libelf-libdir,
85             [AS_HELP_STRING([--with-libelf-libdir],[LIBELF library directory])],
86             [LIBELF_LIB_DIR="${withval}";],)
87    PD_CHECK_INC_DIR($LIBELF_INC_DIR, [libelf.h])
88    PD_CHECK_LIB_DIR($LIBELF_LIB_DIR,[elf],[elf_memory])
89    PD_CHECK_LIB_TYPE($LIBELF_LIB_DIR, elf)
90    LIBELF_STATIC="$LIB_TYPE_STATIC"
91    LIBELF_DYNAMIC="$LIB_TYPE_DYNAMIC"
92    AC_SUBST(LIBELF_INC_DIR)
93    AC_SUBST(LIBELF_LIB_DIR)
94    AC_SUBST(LIBELF_STATIC)
95    AC_SUBST(LIBELF_DYNAMIC)
96 fi
97
98 if test "`echo $host_os | cut -b-3`" = "aix" ; then
99    AC_MSG_NOTICE([AIX system, skipping libdwarf...])
100    
101 else
102    AC_ARG_WITH(libdwarf-incdir,
103             [AS_HELP_STRING([--with-libdwarf-incdir],[LIBDWARF include directory])],
104             [LIBDWARF_INC_DIR="${withval}";],)
105    AC_ARG_WITH(libdwarf-libdir,
106             [AS_HELP_STRING([--with-libdwarf-libdir],[LIBDWARF library directory])],
107             [LIBDWARF_LIB_DIR="${withval}";],)
108    PD_CHECK_INC_DIR($LIBDWARF_INC_DIR,[libdwarf.h])
109    PD_CHECK_LIB_DIR($LIBDWARF_LIB_DIR,[dwarf],[dwarf_add_arange],$LIBDWARF_LIB_DIR,[-lelf])
110    PD_CHECK_LIB_TYPE($LIBDWARF_LIB_DIR, dwarf)
111    LIBDWARF_STATIC="$LIB_TYPE_STATIC"
112    LIBDWARF_DYNAMIC="$LIB_TYPE_DYNAMIC"
113    AC_SUBST(LIBDWARF_INC_DIR)
114    AC_SUBST(LIBDWARF_LIB_DIR)
115    AC_SUBST(LIBDWARF_STATIC)
116    AC_SUBST(LIBDWARF_DYNAMIC)
117 fi
118
119
120
121
122 AC_ARG_WITH(libxml2-incdir,
123             [AS_HELP_STRING([--with-libxml2-incdir],[LIBXML2 include directory])],
124             [LIBXML2_INC_DIR="${withval}";],)
125 AC_ARG_WITH(libxml2-libdir,
126             [AS_HELP_STRING([--with-libxml2-libdir],[LIBXML2 library directory])],
127             [LIBXML2_LIB_DIR="${withval}";],)
128 PD_SOFT_CHECK_INC_DIR($LIBXML2_INC_DIR, [libxml/xmlschemas.h], [libxml])
129 PD_SOFT_CHECK_LIB_DIR($LIBXML2_LIB_DIR,[xml2],[xmlAddID])
130 AC_SUBST(LIBXML2_INC_DIR)
131 AC_SUBST(LIBXML2_LIB_DIR)
132
133 if test "`echo $host_os | cut -b-3`" = "aix" ; then
134    AC_MSG_NOTICE([AIX system, skipping libiberty...])
135 else
136    AC_ARG_WITH(libiberty-libdir,
137             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
138             [LIBIBERTY_LIB_DIR="${withval}";],)
139    LIBS_HOLD=$LIBS
140    LIBS="-L$LIBIBERTY_LIB_DIR"
141    AC_CHECK_LIB([iberty], [cplus_demangle], [], 
142                           [AC_CHECK_FILE($LIBIBERTY_LIB_DIR/libiberty.a, 
143                           [],
144                           [AC_MSG_ERROR(Can't find libiberty in $LIBIBERTY_LIB_DIR)])])
145    LIBS=$LIBS_HOLD                        
146    AC_SUBST(LIBIBERTY_LIB_DIR)
147    PD_CHECK_LIB_TYPE($LIBIBERTY_LIB_DIR, iberty)
148    LIBIBERTY_STATIC="$LIB_TYPE_STATIC"
149    LIBIBERTY_DYNAMIC="$LIB_TYPE_DYNAMIC"
150    AC_SUBST(LIBIBERTY_STATIC)
151    AC_SUBST(LIBIBERTY_DYNAMIC)
152 fi
153
154 if test "$host_cpu" != "ia-64" ; then
155    AC_MSG_NOTICE([Not IA-64, skipping libunwind...])
156 else
157    AC_ARG_WITH(libunwind-incdir,
158             [AS_HELP_STRING([--with-libunwind-incdir],[LIBUNWIND include directory])],
159             [LIBUNWIND_INC_DIR="${withval}";],)
160    AC_ARG_WITH(libunwind-libdir,
161             [AS_HELP_STRING([--with-libunwind-libdir],[LIBUNWIND library directory])],
162             [LIBUNWIND_LIB_DIR="${withval}";],)
163
164    PD_CHECK_INC_DIR(${LIBUNWIND_INC_DIR}, [libunwind.h])
165 fi
166 AC_SUBST(LIBUNWIND_INC_DIR)
167 AC_SUBST(LIBUNWIND_LIB_DIR)
168
169
170 AC_ARG_WITH(libflex-libdir,
171             [AS_HELP_STRING([--with-libflex-libdir],[Absolute path to flex library])],
172             [LIBFLEX_LIB_DIR="${withval}";],)
173 # 3/15/09: We are not checking for libflex sources and they are not in cs.wisc.edu package-base.
174 #          What's the story here?  Not needed?
175 PD_SOFT_CHECK_LIB_DIR(${LIBFLEX_LIB_DIR}, [fl], [yywrap])
176 AC_SUBST(LIBFLEX_LIB_DIR)
177 AC_PATH_PROG(NASM, nasm, "", "${PACKAGE_BASE}/nasm/bin:$PATH")
178 AC_SUBST(NASM)
179
180 AC_MSG_CHECKING([for -fno-stack-protector])
181 SAVED_CXXFLAGS=$CXXFLAGS
182 CXXFLAGS="-fno-stack-protector"
183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], 
184                                 [AC_MSG_RESULT([yes]); STACKPROT="DISABLE_STACK_PROT=1"], 
185                                 [AC_MSG_RESULT([no]); STACKPROT=""])
186 AC_SUBST(STACKPROT)
187 CXXFLAGS=$SAVED_CXXFLAGS
188
189 AC_MSG_CHECKING([whether to use MM timer])
190 case $host in
191      ia64-*-*-*) MMTIMER=true ;;
192      *)    MMTIMER=false ;;
193 esac
194 AC_MSG_RESULT(${MMTIMER})
195 AC_SUBST([MMTIMER])
196
197 AC_SUBST([DEFS])
198 AC_CONFIG_FILES([make.config.local:autodyninst/make.config.local.in])
199 AC_OUTPUT