Commiting Aishwarya's work in allowing StackwalkerAPI users to change the system...
[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], [7.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(_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             ARG_WRAPPER_LIBS="";
36             LIBXML2_INC_DIR="${PACKAGE_BASE}/libxml2/include/libxml2"
37             LIBXML2_LIB_DIR="${PACKAGE_BASE}/libxml2/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             ARG_WRAPPER_LIBS="";
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             LIBFLEX_LIB_DIR="/usr/lib";
52            ])
53 # 3/15/09: We don't include libiberty in the cs.wisc.edu package-base.
54 #          Why?  Putting these here for now...
55 #LIBIBERTY_LIB_DIR="/usr/lib";
56
57
58 AC_ARG_WITH(tcl83,
59             [AS_HELP_STRING([--with-tcl83],[Use Tcl/Tk 8.3])],
60             [TCL_VERSION="tcl8.3"; USE_TCL83="${withval}";],
61             [TCL_VERSION="tcl8.4"; USE_TCL83="false";])
62 AC_ARG_WITH(tcltk-incdir,
63             [AS_HELP_STRING([--with-tcltk-incdir],[TCL/TK include directory])],
64             [TCLTK_INC_DIR="${withval}";],)
65 AC_ARG_WITH(tcltk-libdir,
66             [AS_HELP_STRING([--with-tcltk-libdir],[TCL/TK library directory])],
67             [TCLTK_LIB_DIR="${withval}";],)
68 PD_SOFT_CHECK_INC_DIR($TCLTK_INC_DIR, [tcl.h], [tcl])
69 PD_SOFT_CHECK_LIB_DIR($TCLTK_LIB_DIR, $TCL_VERSION, [Tcl_Eval])
70 AC_SUBST(USE_TCL83)
71 AC_SUBST(TCLTK_INC_DIR)
72 AC_SUBST(TCLTK_LIB_DIR)
73
74 AC_CANONICAL_HOST
75
76 AC_ARG_WITH(wrapper-libs, 
77             [AS_HELP_STRING([--with-wrapper-libs],[Comma seperated list of archive to wrap])],
78             [ARG_WRAPPER_LIBS="${withval}";],)
79 AC_SUBST(ARG_WRAPPER_LIBS)
80
81 AC_ARG_ENABLE(gnu-demangler,
82               [AS_HELP_STRING([--enable-gnu-demangler],[Use g++'s built in demangler])],
83               [GNU_DEMANGLER="true"],)
84
85 if test "`echo $host_os | cut -b-3`" = "aix" ; then
86    AC_MSG_NOTICE([AIX system, skipping libelf...])
87    
88 else
89    AC_ARG_WITH(libelf-incdir,
90                    [AS_HELP_STRING([--with-libelf-incdir],[LIBELF include directory])],
91                    [LIBELF_INC_DIR="${withval}";],)
92    AC_ARG_WITH(libelf-libdir,
93             [AS_HELP_STRING([--with-libelf-libdir],[LIBELF library directory])],
94             [LIBELF_LIB_DIR="${withval}";],)
95   
96    CXXFLAGS_HOLD=$CXXFLAGS;
97    CXXFLAGS="$CXXFLAGS -I$LIBELF_INC_DIR";
98    CPPFLAGS_HOLD=$CPPFLAGS;
99    CPPFLAGS="$CPPFLAGS -I$LIBELF_INC_DIR";
100                         
101    AC_CHECK_HEADER([$LIBELF_INC_DIR/libelf.h], [AC_MSG_NOTICE(ELF include directory: $LIBELF_INC_DIR)],
102         [CXXFLAGS="$CXXFLAGS -I$LIBELF_INC_DIR/libelf";
103          CPPFLAGS="$CPPFLAGS -I$LIBELF_INC_DIR/libelf";
104          AC_CHECK_HEADER([$LIBELF_INC_DIR/libelf/libelf.h],
105                          [LIBELF_INC_DIR+="/libelf";AC_MSG_NOTICE(ELF include directory: $LIBELF_INC_DIR)],
106                          [AC_ERROR(couldn't find libelf.h)])])
107    CXXFLAGS=$CXXFLAGS_HOLD;
108    CPPFLAGS=$CPPFLAGS_HOLD;
109    PD_CHECK_LIB_DIR($LIBELF_LIB_DIR,[elf],[elf_memory])
110    PD_CHECK_LIB_TYPE($LIBELF_LIB_DIR, elf)
111    LIBELF_STATIC="$LIB_TYPE_STATIC"
112    LIBELF_DYNAMIC="$LIB_TYPE_DYNAMIC"
113    AC_SUBST(LIBELF_INC_DIR)
114    AC_SUBST(LIBELF_LIB_DIR)
115    AC_SUBST(LIBELF_STATIC)
116    AC_SUBST(LIBELF_DYNAMIC)
117 fi
118
119 if test "$host_cpu" != "x86_64" -a "$host_cpu" != "i686"; then
120    AC_MSG_NOTICE([Not x86/x86_64, skipping icc on $host_cpu...])
121 else
122    AC_ARG_WITH(icc,
123                [AS_HELP_STRING([--with-icc],[Path to Intel's ICC compiler])],
124                [_ICC_="${withval}"; _ICPC_=`dirname ${withval}`/icpc;],)
125 fi
126 AC_SUBST(_ICC_)
127 AC_SUBST(_ICPC_)
128
129 if test "$host_cpu" != "x86_64" -a "$host_cpu" != "i686"; then
130    AC_MSG_NOTICE([Not x86/x86_64, skipping pgcc on $host_cpu...])
131 else
132    AC_ARG_WITH(pgcc,
133                [AS_HELP_STRING([--with-pgcc],[Path to Pathscale's PGCC compiler])],
134                [_PGC_="${withval}"; _PGCXX_=`dirname ${withval}`/pgCC;],)
135 fi
136 AC_SUBST(_PGC_)
137 AC_SUBST(_PGCXX_)
138
139 if test "`echo $host_os | cut -b-3`" = "aix" ; then
140    if test "`basename $CXX`" = "xlC" ; then
141       BUILD_XLC="true";
142    elif test "`basename $CC`" = "xlc" ; then
143       BUILD_XLC="true";
144    else
145       BUILD_XLC="";
146    fi
147    AC_SUBST(BUILD_XLC)
148 fi
149
150 if test "x$BUILD_XLC" = "x" ; then
151    AC_ARG_WITH(libiberty-libdir,
152             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
153             [LIBIBERTY_LIB_DIR="${withval}";],)
154    LIBS_HOLD=$LIBS
155    if test "x$LIBIBERTY_LIB_DIR" != "x" ; then
156       LIBS="-L$LIBIBERTY_LIB_DIR"
157    fi
158    AC_CHECK_LIB([iberty], [cplus_demangle], [HAVE_LIBIBERTY="true";],[HAVE_LIBIBERTY="false"])
159
160    LIBS_BAK=$LIBS
161    LDFLAGS_BAK=$LDFLAGS
162    CXXFLAGS_BAK=$CXXFLAGS
163    LIBS="$LIBS -liberty"
164    LDFLAGS="$LDFLAGS -shared"
165    CXXFLAGS="-fPIC"
166    AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern "C" { char *cplus_demangle(char *s, int opts); }]],
167                                    [[cplus_demangle("", 0);]])],
168                                    [LIBIBERTY_LINK="true"],
169                                    [LIBIBERTY_LINK="false"])
170    LDFLAGS=$LDFLAGS_BAK
171    LIBS=$LIBS_BAK
172    CXXFLAGS=$CXXFLAGS_BAK
173
174    if test "x$HAVE_LIBIBERTY" = "xtrue" ; then
175       if test "x$LIBIBERTY_LINK" = "xtrue" ; then
176          USE_LIBERTY=true
177          LINK_LIBERTY=true
178       elif test "x$_PGC_" != "x" ; then 
179          USE_LIBERTY=true
180          echo "WARNING: libiberty does not link with shared objects.  Mutatees will have to be linked with -liberty."
181       else
182          GNU_DEMANGLER=true
183       fi
184    else
185       GNU_DEMANGLER=true
186    fi
187
188    if test "x$GNU_DEMANGLER" = "xtrue" ; then
189       USE_LIBIBERTY=""
190       LINK_LIBIBERTY=""
191    fi
192 fi
193
194 AC_SUBST(GNU_DEMANGLER)
195 AC_SUBST(USE_LIBERTY)
196 AC_SUBST(LINK_LIBERTY)
197 AC_SUBST(LIBIBERTY_LIB_DIR)
198  
199 if test "`echo $host_os | cut -b-3`" = "aix" ; then
200    AC_MSG_NOTICE([AIX system, skipping libdwarf...])
201    
202 else
203    AC_ARG_WITH(libdwarf-incdir,
204             [AS_HELP_STRING([--with-libdwarf-incdir],[LIBDWARF include directory])],
205             [LIBDWARF_INC_DIR="${withval}";],)
206    AC_ARG_WITH(libdwarf-libdir,
207             [AS_HELP_STRING([--with-libdwarf-libdir],[LIBDWARF library directory])],
208             [LIBDWARF_LIB_DIR="${withval}";],)
209    
210    CXXFLAGS_HOLD=$CXXFLAGS;
211    CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR";
212    CPPFLAGS_HOLD=$CPPFLAGS;
213    CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR";
214                         
215    AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf.h], [AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
216         [CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
217          CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
218          AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf/libdwarf.h],
219                          [LIBDWARF_INC_DIR+="/libdwarf";AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
220                          [AC_ERROR(couldn't find libdwarf.h)])])
221    CXXFLAGS=$CXXFLAGS_HOLD;
222    CPPFLAGS=$CPPFLAGS_HOLD;
223
224    PD_CHECK_LIB_DIR($LIBDWARF_LIB_DIR,[dwarf],[dwarf_add_arange],$LIBELF_LIB_DIR,[-lelf])
225    PD_CHECK_LIB_TYPE($LIBDWARF_LIB_DIR, dwarf)
226    LIBDWARF_STATIC="$LIB_TYPE_STATIC"
227    LIBDWARF_DYNAMIC="$LIB_TYPE_DYNAMIC"
228    AC_SUBST(LIBDWARF_INC_DIR)
229    AC_SUBST(LIBDWARF_LIB_DIR)
230    AC_SUBST(LIBDWARF_STATIC)
231    AC_SUBST(LIBDWARF_DYNAMIC)
232
233    PD_CHECK_LIB_FEATURE($LIBDWARF_LIB_DIR,[dwarf],[dwarf_set_frame_cfa_value],$LIBELF_LIB_DIR,[-lelf])
234    LIBDWARF_HAS_SET_FRAME="$HAS_FEATURE"
235    AC_SUBST(LIBDWARF_HAS_SET_FRAME)
236 fi
237
238
239
240
241 AC_ARG_WITH(libxml2-incdir,
242             [AS_HELP_STRING([--with-libxml2-incdir],[LIBXML2 include directory])],
243             [LIBXML2_INC_DIR="${withval}";],)
244 AC_ARG_WITH(libxml2-libdir,
245             [AS_HELP_STRING([--with-libxml2-libdir],[LIBXML2 library directory])],
246             [LIBXML2_LIB_DIR="${withval}";],)
247 PD_SOFT_CHECK_INC_DIR($LIBXML2_INC_DIR, [libxml/xmlschemas.h], [libxml])
248 PD_SOFT_CHECK_LIB_DIR($LIBXML2_LIB_DIR,[xml2],[xmlAddID])
249 AC_SUBST(LIBXML2_INC_DIR)
250 AC_SUBST(LIBXML2_LIB_DIR)
251
252 AC_ARG_WITH(libflex-libdir,
253             [AS_HELP_STRING([--with-libflex-libdir],[Absolute path to flex library])],
254             [LIBFLEX_LIB_DIR="${withval}";],)
255 # 3/15/09: We are not checking for libflex sources and they are not in cs.wisc.edu package-base.
256 #          What's the story here?  Not needed?
257 PD_SOFT_CHECK_LIB_DIR(${LIBFLEX_LIB_DIR}, [fl], [yywrap])
258 AC_SUBST(LIBFLEX_LIB_DIR)
259 AC_PATH_PROG(NASM, nasm, "", "${PACKAGE_BASE}/nasm/bin:$PATH")
260 AC_SUBST(NASM)
261
262 AC_MSG_CHECKING([for -fno-stack-protector])
263 SAVED_CXXFLAGS=$CXXFLAGS
264 CXXFLAGS="-fno-stack-protector"
265 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], 
266                                 [AC_MSG_RESULT([yes]); STACKPROT="DISABLE_STACK_PROT=1"], 
267                                 [AC_MSG_RESULT([no]); STACKPROT=""])
268 AC_SUBST(STACKPROT)
269 CXXFLAGS=$SAVED_CXXFLAGS
270
271 if test "`echo $host_os | cut -b-3`" = "aix" ; then
272     M32FLAG="-maix32"
273 else
274     M32FLAG="-m32"
275 fi
276 AC_MSG_CHECKING([for 32-bit build environment])
277 SAVED_CXXFLAGS=$CXXFLAGS
278 CXXFLAGS=$M32FLAG
279 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[]])], 
280                                 [AC_MSG_RESULT([yes]); BUILD32=""],
281                                 [AC_MSG_RESULT([no]); BUILD32="SKIP_BUILD_RTLIB_32=1"])
282 AC_SUBST(BUILD32)
283 CXXFLAGS=$SAVED_CXXFLAGS
284
285 AC_MSG_CHECKING([whether to use MM timer])
286 case $host in
287      ia64-*-*-*) MMTIMER=true ;;
288      *)    MMTIMER=false ;;
289 esac
290 AC_MSG_RESULT(${MMTIMER})
291 AC_SUBST([MMTIMER])
292
293 AC_SUBST([DEFS])
294
295 AC_ARG_ENABLE(testsuite, AS_HELP_STRING([--disable-testsuite], [Disable the Dyninst test suite (default is no)]),
296                          [], [enable_testsuite=yes])
297
298 AS_IF([test "x$enable_testsuite" != xyes], [TESTSUITE="DONT_BUILD_NEWTESTSUITE=1"], [TESTSUITE=""])
299 AC_SUBST([TESTSUITE])
300
301 AC_CONFIG_FILES([make.config.local:autodyninst/make.config.local.in])
302 AC_OUTPUT