Final fixes for IAPI/Power integration:
[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.1], [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(_ICPC_, icpc)
15 AC_PATH_PROG(_PGC_, pgcc)
16 AC_PATH_PROG(_PGCXX_, pgCC)
17 AC_PATH_PROG(_CC_, cc)
18 AC_PATH_PROG(_CXX_, CC)
19 AC_LANG(C++)
20
21
22 dnl === configure options ==
23
24
25 PACKAGE_BASE=""
26 AC_ARG_WITH(package-base,
27            [AS_HELP_STRING([--with-package-base],[Base directory to look for packages])],
28            [PACKAGE_BASE="${withval}";
29             TCLTK_INC_DIR="${PACKAGE_BASE}/tcl8.4.5/include";
30             TCLTK_LIB_DIR="${PACKAGE_BASE}/tcl8.4.5/lib";
31             LIBELF_INC_DIR="${PACKAGE_BASE}/libelf/include";
32             LIBELF_LIB_DIR="${PACKAGE_BASE}/libelf/lib";
33             LIBDWARF_INC_DIR="${PACKAGE_BASE}/libdwarf/include";
34             LIBDWARF_LIB_DIR="${PACKAGE_BASE}/libdwarf/lib";
35             LIBXML2_INC_DIR="${PACKAGE_BASE}/libxml2/include/libxml2"
36             LIBXML2_LIB_DIR="${PACKAGE_BASE}/libxml2/lib";
37             LIBUNWIND_INC_DIR="${PACKAGE_BASE}/libunwind/include";
38             LIBUNWIND_LIB_DIR="${PACKAGE_BASE}/libunwind/lib";
39             LIBFLEX_LIB_DIR="${PACKAGE_BASE}/libflex/lib";
40            ],[
41             # We fall back on these defaults if both --with-package-base and
42             # specific --with-<package> arguments are not provided.
43             TCLTK_INC_DIR="/usr/include";
44             TCLTK_LIB_DIR="/usr/lib";
45             LIBELF_INC_DIR="/usr/include";
46             LIBELF_LIB_DIR="/usr/lib";
47             LIBDWARF_INC_DIR="/usr/include";
48             LIBDWARF_LIB_DIR="/usr/lib";
49             LIBXML2_INC_DIR="/usr/include/libxml2"
50             LIBXML2_LIB_DIR="/usr/lib";
51             LIBUNWIND_INC_DIR="/usr/include";
52             LIBUNWIND_LIB_DIR="/usr/lib";
53             LIBFLEX_LIB_DIR="/usr/lib";
54            ])
55 # 3/15/09: We don't include libiberty in the cs.wisc.edu package-base.
56 #          Why?  Putting these here for now...
57 LIBIBERTY_LIB_DIR="/usr/lib";
58
59
60 AC_ARG_WITH(tcl83,
61             [AS_HELP_STRING([--with-tcl83],[Use Tcl/Tk 8.3])],
62             [TCL_VERSION="tcl8.3"; USE_TCL83="${withval}";],
63             [TCL_VERSION="tcl8.4"; USE_TCL83="false";])
64 AC_ARG_WITH(tcltk-incdir,
65             [AS_HELP_STRING([--with-tcltk-incdir],[TCL/TK include directory])],
66             [TCLTK_INC_DIR="${withval}";],)
67 AC_ARG_WITH(tcltk-libdir,
68             [AS_HELP_STRING([--with-tcltk-libdir],[TCL/TK library directory])],
69             [TCLTK_LIB_DIR="${withval}";],)
70 PD_SOFT_CHECK_INC_DIR($TCLTK_INC_DIR, [tcl.h], [tcl])
71 PD_SOFT_CHECK_LIB_DIR($TCLTK_LIB_DIR, $TCL_VERSION, [Tcl_Eval])
72 AC_SUBST(USE_TCL83)
73 AC_SUBST(TCLTK_INC_DIR)
74 AC_SUBST(TCLTK_LIB_DIR)
75
76 AC_CANONICAL_HOST
77
78 if test "`echo $host_os | cut -b-3`" = "aix" ; then
79    AC_MSG_NOTICE([AIX system, skipping libelf...])
80    
81 else
82    AC_ARG_WITH(libelf-incdir,
83                    [AS_HELP_STRING([--with-libelf-incdir],[LIBELF include directory])],
84                    [LIBELF_INC_DIR="${withval}";],)
85    AC_ARG_WITH(libelf-libdir,
86             [AS_HELP_STRING([--with-libelf-libdir],[LIBELF library directory])],
87             [LIBELF_LIB_DIR="${withval}";],)
88   
89    CXXFLAGS_HOLD=$CXXFLAGS;
90    CXXFLAGS="$CXXFLAGS -I$LIBELF_INC_DIR";
91    CPPFLAGS_HOLD=$CPPFLAGS;
92    CPPFLAGS="$CPPFLAGS -I$LIBELF_INC_DIR";
93                         
94    AC_CHECK_HEADER([$LIBELF_INC_DIR/libelf.h], [AC_MSG_NOTICE(ELF include directory: $LIBELF_INC_DIR)],
95         [CXXFLAGS="$CXXFLAGS -I$LIBELF_INC_DIR/libelf";
96          CPPFLAGS="$CPPFLAGS -I$LIBELF_INC_DIR/libelf";
97          AC_CHECK_HEADER([$LIBELF_INC_DIR/libelf/libelf.h],
98                          [LIBELF_INC_DIR+="/libelf";AC_MSG_NOTICE(ELF include directory: $LIBELF_INC_DIR)],
99                          [AC_ERROR(couldn't find libelf.h)])])
100    CXXFLAGS=$CXXFLAGS_HOLD;
101    CPPFLAGS=$CPPFLAGS_HOLD;
102    PD_CHECK_LIB_DIR($LIBELF_LIB_DIR,[elf],[elf_memory])
103    PD_CHECK_LIB_TYPE($LIBELF_LIB_DIR, elf)
104    LIBELF_STATIC="$LIB_TYPE_STATIC"
105    LIBELF_DYNAMIC="$LIB_TYPE_DYNAMIC"
106    AC_SUBST(LIBELF_INC_DIR)
107    AC_SUBST(LIBELF_LIB_DIR)
108    AC_SUBST(LIBELF_STATIC)
109    AC_SUBST(LIBELF_DYNAMIC)
110 fi
111
112 if test "`echo $host_os | cut -b-3`" = "aix" ; then
113    if test "`basename $CXX`" = "xlC" ; then
114       BUILD_XLC="true";
115    elif test "`basename $CC`" = "xlc" ; then
116       BUILD_XLC="true";
117    else
118       BUILD_XLC="";
119    AC_ARG_WITH(libiberty-libdir,
120             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
121             [LIBIBERTY_LIB_DIR="${withval}";],)
122    LIBS_HOLD=$LIBS
123    LIBS="-L$LIBIBERTY_LIB_DIR"
124    AC_CHECK_LIB([iberty], [cplus_demangle], [HAVE_LIBIBERTY="1";],
125                           [AC_CHECK_FILE($LIBIBERTY_LIB_DIR/libiberty.a,
126                           [],
127                           [AC_MSG_ERROR(Can't find libiberty in $LIBIBERTY_LIB_DIR)])])
128    LIBS=$LIBS_HOLD
129    AC_SUBST(LIBIBERTY_LIB_DIR)
130    PD_CHECK_LIB_TYPE($LIBIBERTY_LIB_DIR, iberty)
131    LIBIBERTY_STATIC="$LIB_TYPE_STATIC"
132    LIBIBERTY_DYNAMIC="$LIB_TYPE_DYNAMIC"
133    AC_SUBST(LIBIBERTY_STATIC)
134    AC_SUBST(LIBIBERTY_DYNAMIC)
135    AC_SUBST(HAVE_LIBIBERTY)
136       
137    fi
138    AC_SUBST(BUILD_XLC)
139 else
140    AC_ARG_WITH(libiberty-libdir,
141             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
142             [LIBIBERTY_LIB_DIR="${withval}";],)
143    LIBS_HOLD=$LIBS
144    LIBS="-L$LIBIBERTY_LIB_DIR"
145    AC_CHECK_LIB([iberty], [cplus_demangle], [HAVE_LIBIBERTY="1";],
146                           [AC_CHECK_FILE($LIBIBERTY_LIB_DIR/libiberty.a,
147                           [],
148                           [AC_MSG_ERROR(Can't find libiberty in $LIBIBERTY_LIB_DIR)])])
149    LIBS=$LIBS_HOLD
150    AC_SUBST(LIBIBERTY_LIB_DIR)
151    PD_CHECK_LIB_TYPE($LIBIBERTY_LIB_DIR, iberty)
152    LIBIBERTY_STATIC="$LIB_TYPE_STATIC"
153    LIBIBERTY_DYNAMIC="$LIB_TYPE_DYNAMIC"
154    AC_SUBST(LIBIBERTY_STATIC)
155    AC_SUBST(LIBIBERTY_DYNAMIC)
156    AC_SUBST(HAVE_LIBIBERTY)
157 fi
158  
159 if test "`echo $host_os | cut -b-3`" = "aix" ; then
160    AC_MSG_NOTICE([AIX system, skipping libdwarf...])
161    
162 else
163    AC_ARG_WITH(libdwarf-incdir,
164             [AS_HELP_STRING([--with-libdwarf-incdir],[LIBDWARF include directory])],
165             [LIBDWARF_INC_DIR="${withval}";],)
166    AC_ARG_WITH(libdwarf-libdir,
167             [AS_HELP_STRING([--with-libdwarf-libdir],[LIBDWARF library directory])],
168             [LIBDWARF_LIB_DIR="${withval}";],)
169    
170    CXXFLAGS_HOLD=$CXXFLAGS;
171    CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR";
172    CPPFLAGS_HOLD=$CPPFLAGS;
173    CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR";
174                         
175    AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf.h], [AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
176         [CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
177          CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
178          AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf/libdwarf.h],
179                          [LIBDWARF_INC_DIR+="/libdwarf";AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
180                          [AC_ERROR(couldn't find libdwarf.h)])])
181    CXXFLAGS=$CXXFLAGS_HOLD;
182    CPPFLAGS=$CPPFLAGS_HOLD;
183
184    PD_CHECK_LIB_DIR($LIBDWARF_LIB_DIR,[dwarf],[dwarf_add_arange],$LIBELF_LIB_DIR,[-lelf])
185    PD_CHECK_LIB_TYPE($LIBDWARF_LIB_DIR, dwarf)
186    LIBDWARF_STATIC="$LIB_TYPE_STATIC"
187    LIBDWARF_DYNAMIC="$LIB_TYPE_DYNAMIC"
188    AC_SUBST(LIBDWARF_INC_DIR)
189    AC_SUBST(LIBDWARF_LIB_DIR)
190    AC_SUBST(LIBDWARF_STATIC)
191    AC_SUBST(LIBDWARF_DYNAMIC)
192
193    PD_CHECK_LIB_FEATURE($LIBDWARF_LIB_DIR,[dwarf],[dwarf_set_frame_cfa_value],$LIBELF_LIB_DIR,[-lelf])
194    LIBDWARF_HAS_SET_FRAME="$HAS_FEATURE"
195    AC_SUBST(LIBDWARF_HAS_SET_FRAME)
196 fi
197
198
199
200
201 AC_ARG_WITH(libxml2-incdir,
202             [AS_HELP_STRING([--with-libxml2-incdir],[LIBXML2 include directory])],
203             [LIBXML2_INC_DIR="${withval}";],)
204 AC_ARG_WITH(libxml2-libdir,
205             [AS_HELP_STRING([--with-libxml2-libdir],[LIBXML2 library directory])],
206             [LIBXML2_LIB_DIR="${withval}";],)
207 PD_SOFT_CHECK_INC_DIR($LIBXML2_INC_DIR, [libxml/xmlschemas.h], [libxml])
208 PD_SOFT_CHECK_LIB_DIR($LIBXML2_LIB_DIR,[xml2],[xmlAddID])
209 AC_SUBST(LIBXML2_INC_DIR)
210 AC_SUBST(LIBXML2_LIB_DIR)
211
212
213 if test "$host_cpu" != "ia64" ; then
214    AC_MSG_NOTICE([Not IA-64, skipping libunwind...])
215 else
216    AC_ARG_WITH(libunwind-incdir,
217             [AS_HELP_STRING([--with-libunwind-incdir],[LIBUNWIND include directory])],
218             [LIBUNWIND_INC_DIR="${withval}";],)
219    AC_ARG_WITH(libunwind-libdir,
220             [AS_HELP_STRING([--with-libunwind-libdir],[LIBUNWIND library directory])],
221             [LIBUNWIND_LIB_DIR="${withval}";],)
222
223    PD_CHECK_INC_DIR(${LIBUNWIND_INC_DIR}, [libunwind.h])
224 fi
225 AC_SUBST(LIBUNWIND_INC_DIR)
226 AC_SUBST(LIBUNWIND_LIB_DIR)
227
228
229 AC_ARG_WITH(libflex-libdir,
230             [AS_HELP_STRING([--with-libflex-libdir],[Absolute path to flex library])],
231             [LIBFLEX_LIB_DIR="${withval}";],)
232 # 3/15/09: We are not checking for libflex sources and they are not in cs.wisc.edu package-base.
233 #          What's the story here?  Not needed?
234 PD_SOFT_CHECK_LIB_DIR(${LIBFLEX_LIB_DIR}, [fl], [yywrap])
235 AC_SUBST(LIBFLEX_LIB_DIR)
236 AC_PATH_PROG(NASM, nasm, "", "${PACKAGE_BASE}/nasm/bin:$PATH")
237 AC_SUBST(NASM)
238
239 AC_MSG_CHECKING([for -fno-stack-protector])
240 SAVED_CXXFLAGS=$CXXFLAGS
241 CXXFLAGS="-fno-stack-protector"
242 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], 
243                                 [AC_MSG_RESULT([yes]); STACKPROT="DISABLE_STACK_PROT=1"], 
244                                 [AC_MSG_RESULT([no]); STACKPROT=""])
245 AC_SUBST(STACKPROT)
246 CXXFLAGS=$SAVED_CXXFLAGS
247
248 if test "`echo $host_os | cut -b-3`" = "aix" ; then
249     M32FLAG="-maix32"
250 else
251     M32FLAG="-m32"
252 fi
253 AC_MSG_CHECKING([for 32-bit build environment])
254 SAVED_CXXFLAGS=$CXXFLAGS
255 CXXFLAGS=$M32FLAG
256 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[]])], 
257                                 [AC_MSG_RESULT([yes]); BUILD32=""],
258                                 [AC_MSG_RESULT([no]); BUILD32="SKIP_BUILD_RTLIB_32=1"])
259 AC_SUBST(BUILD32)
260 CXXFLAGS=$SAVED_CXXFLAGS
261
262 AC_MSG_CHECKING([whether to use MM timer])
263 case $host in
264      ia64-*-*-*) MMTIMER=true ;;
265      *)    MMTIMER=false ;;
266 esac
267 AC_MSG_RESULT(${MMTIMER})
268 AC_SUBST([MMTIMER])
269
270 AC_SUBST([DEFS])
271
272 AC_ARG_ENABLE(testsuite, AS_HELP_STRING([--disable-testsuite], [Disable the Dyninst test suite (default is no)]),
273                          [], [enable_testsuite=yes])
274
275 AS_IF([test "x$enable_testsuite" != xyes], [TESTSUITE="DONT_BUILD_TESTSUITE=1"], [TESTSUITE=""])
276 AC_SUBST([TESTSUITE])
277
278 AC_CONFIG_FILES([make.config.local:autodyninst/make.config.local.in])
279 AC_OUTPUT