Re-add launchmon options to autoconf
[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 AC_ARG_WITH(default-component,
58             [AS_HELP_STRING([--with-default-component],[Valid values: DyninstAPI, SymtabAPI, InstructionAPI, ProcControlAPI, ParseAPI, default])],
59             [DEFAULT_COMPONENT="${withval}";],
60             [DEFAULT_COMPONENT=`cat autodyninst/default_component`;])                                                            
61 AC_ARG_WITH(tcl83,
62             [AS_HELP_STRING([--with-tcl83],[Use Tcl/Tk 8.3])],
63             [TCL_VERSION="tcl8.3"; USE_TCL83="${withval}";],
64             [TCL_VERSION="tcl8.4"; USE_TCL83="false";])
65 AC_ARG_WITH(tcltk-incdir,
66             [AS_HELP_STRING([--with-tcltk-incdir],[TCL/TK include directory])],
67             [TCLTK_INC_DIR="${withval}";],)
68 AC_ARG_WITH(tcltk-libdir,
69             [AS_HELP_STRING([--with-tcltk-libdir],[TCL/TK library directory])],
70             [TCLTK_LIB_DIR="${withval}";],)
71 PD_SOFT_CHECK_INC_DIR($TCLTK_INC_DIR, [tcl.h], [tcl])
72 PD_SOFT_CHECK_LIB_DIR($TCLTK_LIB_DIR, $TCL_VERSION, [Tcl_Eval])
73 AC_SUBST(USE_TCL83)
74 AC_SUBST(TCLTK_INC_DIR)
75 AC_SUBST(TCLTK_LIB_DIR)
76 AC_SUBST(DEFAULT_COMPONENT)
77
78 AC_CANONICAL_HOST
79
80 AC_ARG_WITH(wrapper-libs, 
81             [AS_HELP_STRING([--with-wrapper-libs],[Comma seperated list of archive to wrap])],
82             [ARG_WRAPPER_LIBS="${withval}";],)
83 AC_SUBST(ARG_WRAPPER_LIBS)
84
85 AC_ARG_ENABLE(gnu-demangler,
86               [AS_HELP_STRING([--enable-gnu-demangler],[Use g++'s built in demangler])],
87               [GNU_DEMANGLER="true"],)
88
89 if test "x$DEFAULT_COMPONENT" = "xInstructionAPI"; then
90    AC_MSG_NOTICE([InstructionAPI, not requiring libelf...])   
91    SUPPRESS_LIBELF_REQ="true"
92    AC_MSG_NOTICE([InstructionAPI, not requiring thread_db...])   
93    SUPPRESS_THREADDB_REQ="true"
94    AC_MSG_NOTICE([InstructionAPI, not requiring libdwarf...])   
95    SUPPRESS_LIBDWARF_REQ="true"
96 fi
97 if test "x$DEFAULT_COMPONENT" = "xSymtabAPI"; then
98    AC_MSG_NOTICE([SymtabAPI, not requiring thread_db...])
99    SUPPRESS_THREADDB_REQ="true"
100 fi
101 if test "x$DEFAULT_COMPONENT" = "xParseAPI"; then
102    AC_MSG_NOTICE([ParseAPI, not requiring thread_db...])
103    SUPPRESS_THREADDB_REQ="true"
104 fi
105 if test "x$DEFAULT_COMPONENT" = "xProcControlAPI"; then
106    AC_MSG_NOTICE([ProcControlAPI, not requiring libdwarf...])   
107    SUPPRESS_LIBDWARF_REQ="true"
108 fi 
109 if test "`echo $host_os | cut -b-5`" = "linux" ; then
110   if test "x$PLATFORM" = "xppc32_bgp_ion"; then
111    AC_MSG_NOTICE([BG/P, thread_db required...])   
112   elif test "x$PLATFORM" = "xppc32_bgl_ion"; then
113    AC_MSG_NOTICE([BG/L, thread_db required...])
114   else 
115    AC_MSG_NOTICE([Linux, not requiring thread_db...])
116    SUPPRESS_THREADDB_REQ="true"
117   fi
118 fi
119
120 if test "`echo $host_os | cut -b-3`" = "aix" ; then
121    AC_MSG_NOTICE([AIX, not requiring thread_db...])
122    SUPPRESS_THREADDB_REQ="true"
123 fi
124
125 if test "`echo $host_os | cut -b-3`" = "aix" ; then
126    AC_MSG_NOTICE([AIX system, skipping libelf...])
127 else
128    AC_ARG_WITH(libelf-incdir,
129                    [AS_HELP_STRING([--with-libelf-incdir],[LIBELF include directory])],
130                    [LIBELF_INC_DIR="${withval}";],)
131    AC_ARG_WITH(libelf-libdir,
132             [AS_HELP_STRING([--with-libelf-libdir],[LIBELF library directory])],
133             [LIBELF_LIB_DIR="${withval}";],)
134   
135    if test "x$SUPPRESS_LIBELF_REQ" = "x"; then
136       CXXFLAGS_HOLD=$CXXFLAGS;
137       CXXFLAGS="$CXXFLAGS -I$LIBELF_INC_DIR";
138       CPPFLAGS_HOLD=$CPPFLAGS;
139       CPPFLAGS="$CPPFLAGS -I$LIBELF_INC_DIR";
140
141       AC_CHECK_HEADER([$LIBELF_INC_DIR/libelf.h], [AC_MSG_NOTICE(ELF include directory: $LIBELF_INC_DIR)],
142            [CXXFLAGS="$CXXFLAGS -I$LIBELF_INC_DIR/libelf";
143             CPPFLAGS="$CPPFLAGS -I$LIBELF_INC_DIR/libelf";
144             AC_CHECK_HEADER([$LIBELF_INC_DIR/libelf/libelf.h],
145                             [LIBELF_INC_DIR+="/libelf";AC_MSG_NOTICE(ELF include directory: $LIBELF_INC_DIR)],
146                             [AC_ERROR(couldn't find libelf.h)])])
147       CXXFLAGS=$CXXFLAGS_HOLD;
148       CPPFLAGS=$CPPFLAGS_HOLD;
149       PD_CHECK_LIB_DIR($LIBELF_LIB_DIR,[elf],[elf_memory])
150       PD_CHECK_LIB_TYPE($LIBELF_LIB_DIR, elf)
151    fi
152    LIBELF_STATIC="$LIB_TYPE_STATIC"
153    LIBELF_DYNAMIC="$LIB_TYPE_DYNAMIC"
154    AC_SUBST(LIBELF_INC_DIR)
155    AC_SUBST(LIBELF_LIB_DIR)
156    AC_SUBST(LIBELF_STATIC)
157    AC_SUBST(LIBELF_DYNAMIC)
158 fi
159
160 if test "$host_cpu" != "x86_64" -a "$host_cpu" != "i686"; then
161    AC_MSG_NOTICE([Not x86/x86_64, skipping icc on $host_cpu...])
162 else
163    AC_ARG_WITH(icc,
164                [AS_HELP_STRING([--with-icc],[Path to Intel's ICC compiler])],
165                [_ICC_="${withval}"; _ICPC_=`dirname ${withval}`/icpc;],)
166 fi
167 AC_SUBST(_ICC_)
168 AC_SUBST(_ICPC_)
169
170 if test "$host_cpu" != "x86_64" -a "$host_cpu" != "i686"; then
171    AC_MSG_NOTICE([Not x86/x86_64, skipping pgcc on $host_cpu...])
172 else
173    AC_ARG_WITH(pgcc,
174                [AS_HELP_STRING([--with-pgcc],[Path to Pathscale's PGCC compiler])],
175                [_PGC_="${withval}"; _PGCXX_=`dirname ${withval}`/pgCC;],)
176 fi
177 AC_SUBST(_PGC_)
178 AC_SUBST(_PGCXX_)
179
180 if test "`echo $host_os | cut -b-3`" = "aix" ; then
181    if test "`basename $CXX`" = "xlC" ; then
182       BUILD_XLC="true";
183    elif test "`basename $CC`" = "xlc" ; then
184       BUILD_XLC="true";
185    else
186       BUILD_XLC="";
187    fi
188    AC_SUBST(BUILD_XLC)
189 fi
190
191 if test "x$BUILD_XLC" = "x" ; then
192    AC_ARG_WITH(libiberty-libdir,
193             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
194             [LIBIBERTY_LIB_DIR="${withval}";],)
195    LIBS_HOLD=$LIBS
196    if test "x$LIBIBERTY_LIB_DIR" != "x" ; then
197       LIBS="-L$LIBIBERTY_LIB_DIR"
198    fi
199    AC_CHECK_LIB([iberty], [cplus_demangle], [HAVE_LIBIBERTY="true";],[HAVE_LIBIBERTY="false"])
200
201    LIBS_BAK=$LIBS
202    LDFLAGS_BAK=$LDFLAGS
203    CXXFLAGS_BAK=$CXXFLAGS
204    LIBS="$LIBS -liberty"
205    LDFLAGS="$LDFLAGS -shared"
206    CXXFLAGS="-fPIC"
207    AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern "C" { char *cplus_demangle(char *s, int opts); }]],
208                                    [[cplus_demangle("", 0);]])],
209                                    [LIBIBERTY_LINK="true"],
210                                    [LIBIBERTY_LINK="false"])
211    LDFLAGS=$LDFLAGS_BAK
212    LIBS=$LIBS_BAK
213    CXXFLAGS=$CXXFLAGS_BAK
214
215    if test "x$HAVE_LIBIBERTY" = "xtrue" ; then
216       if test "x$LIBIBERTY_LINK" = "xtrue" ; then
217          USE_LIBERTY=true
218          LINK_LIBERTY=true
219       elif test "x$_PGC_" != "x" ; then 
220          USE_LIBERTY=true
221          echo "WARNING: libiberty does not link with shared objects.  Mutatees will have to be linked with -liberty."
222       else
223          GNU_DEMANGLER=true
224       fi
225    else
226       GNU_DEMANGLER=true
227    fi
228
229    if test "x$GNU_DEMANGLER" = "xtrue" ; then
230       USE_LIBIBERTY=""
231       LINK_LIBIBERTY=""
232    fi
233 fi
234
235 AC_SUBST(GNU_DEMANGLER)
236 AC_SUBST(USE_LIBERTY)
237 AC_SUBST(LINK_LIBERTY)
238 AC_SUBST(LIBIBERTY_LIB_DIR)
239
240 if test "`echo $host_os | cut -b-3`" = "aix" ; then
241    AC_MSG_NOTICE([AIX system, skipping libdwarf...])
242 else
243    AC_ARG_WITH(libdwarf-incdir,
244             [AS_HELP_STRING([--with-libdwarf-incdir],[LIBDWARF include directory])],
245             [LIBDWARF_INC_DIR="${withval}";],)
246    AC_ARG_WITH(libdwarf-libdir,
247             [AS_HELP_STRING([--with-libdwarf-libdir],[LIBDWARF library directory])],
248             [LIBDWARF_LIB_DIR="${withval}";],)
249    
250    if test "x$SUPPRESS_LIBDWARF_REQ" = "x"; then                        
251        CXXFLAGS_HOLD=$CXXFLAGS;
252        CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR";
253        CPPFLAGS_HOLD=$CPPFLAGS;
254        CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR";
255
256        AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf.h], [AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
257                         [CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
258                          CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
259                          AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf/libdwarf.h],
260                               [LIBDWARF_INC_DIR+="/libdwarf";AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
261                               [AC_ERROR(couldn't find libdwarf.h)])])
262        CXXFLAGS=$CXXFLAGS_HOLD;
263        CPPFLAGS=$CPPFLAGS_HOLD;
264
265        PD_CHECK_LIB_DIR($LIBDWARF_LIB_DIR,[dwarf],[dwarf_add_arange],$LIBELF_LIB_DIR,[-lelf])
266        PD_CHECK_LIB_TYPE($LIBDWARF_LIB_DIR, dwarf)
267    fi
268
269    LIBDWARF_STATIC="$LIB_TYPE_STATIC"
270    LIBDWARF_DYNAMIC="$LIB_TYPE_DYNAMIC"
271    AC_SUBST(LIBDWARF_INC_DIR)
272    AC_SUBST(LIBDWARF_LIB_DIR)
273    AC_SUBST(LIBDWARF_STATIC)
274    AC_SUBST(LIBDWARF_DYNAMIC)
275
276    PD_CHECK_LIB_FEATURE($LIBDWARF_LIB_DIR,[dwarf],[dwarf_set_frame_cfa_value],$LIBELF_LIB_DIR,[-lelf])
277    LIBDWARF_HAS_SET_FRAME="$HAS_FEATURE"
278    AC_SUBST(LIBDWARF_HAS_SET_FRAME)
279 fi
280
281
282 AC_ARG_WITH(threaddb-incdir,
283          [AS_HELP_STRING([--with-threaddb-incdir],[THREADDB include directory])],
284          [THREADDB_INC_DIR="${withval}";],)
285 AC_ARG_WITH(threaddb-libdir,
286          [AS_HELP_STRING([--with-threaddb-libdir],[THREADDB library directory])],
287          [THREADDB_LIB_DIR="${withval}";],)
288 CXXFLAGS_HOLD=$CXXFLAGS;
289 CPPFLAGS_HOLD=$CPPFLAGS;
290 LDFLAGS_HOLD=$LDFLAGS
291 if test "x$THREADDB_INC_DIR" != "x"; then
292   CXXFLAGS="$CXXFLAGS -I$THREADDB_INC_DIR"
293   CPPFLAGS="$CPPFLAGS -I$THREADDB_INC_DIR"
294 fi
295 LDFLAGS="-shared -fPIC"
296 HAVE_THREADDB="true"
297 if test "x$SUPPRESS_THREADDB_REQ" = "x"; then
298     AC_CHECK_HEADER([thread_db.h], [AC_MSG_NOTICE(thread_db include directory: $THREADDB_INC_DIR)],
299                      [AC_ERROR(couldn't find thread_db.h)], )
300     PD_CHECK_LIB_DIR($THREADDB_LIB_DIR,[thread_db],[td_ta_new], , )
301 else
302     AC_CHECK_HEADER([thread_db.h], [AC_MSG_NOTICE(thread_db include directory: $THREADDB_INC_DIR)],
303                      [HAVE_THREADDB=""], )
304     PD_CHECK_LIB_DIR_WERR($THREADDB_LIB_DIR,[thread_db],[td_ta_new], , , [HAVE_THREADDB=""])
305 fi
306 if test "x$HAVE_THREADDB" = "xtrue"; then
307     PD_CHECK_LIB_TYPE($THREADDB_LIB_DIR, thread_db)
308 fi
309 CXXFLAGS=$CXXFLAGS_HOLD
310 CPPFLAGS=$CPPFLAGS_HOLD
311 LDFLAGS=$LDFLAGS_HOLD
312 THREADDB_STATIC="$LIB_TYPE_STATIC"
313 THREADDB_DYNAMIC="$LIB_TYPE_DYNAMIC"
314 AC_SUBST(THREADDB_INC_DIR)
315 AC_SUBST(THREADDB_LIB_DIR)
316 AC_SUBST(THREADDB_STATIC)
317 AC_SUBST(THREADDB_DYNAMIC)
318 AC_SUBST(HAVE_THREADDB)
319
320 AC_ARG_WITH(libxml2-incdir,
321             [AS_HELP_STRING([--with-libxml2-incdir],[LIBXML2 include directory])],
322             [LIBXML2_INC_DIR="${withval}";],)
323 AC_ARG_WITH(libxml2-libdir,
324             [AS_HELP_STRING([--with-libxml2-libdir],[LIBXML2 library directory])],
325             [LIBXML2_LIB_DIR="${withval}";],)
326 PD_SOFT_CHECK_INC_DIR($LIBXML2_INC_DIR, [libxml/xmlschemas.h], [libxml])
327 PD_SOFT_CHECK_LIB_DIR($LIBXML2_LIB_DIR,[xml2],[xmlAddID])
328 AC_SUBST(LIBXML2_INC_DIR)
329 AC_SUBST(LIBXML2_LIB_DIR)
330
331 AC_ARG_WITH(launchmon-incdir,
332             [AS_HELP_STRING([--with-launchmon-incdir],[Launchmon include directory])],
333             [LAUNCHMON_INC_DIR="${withval}";],)
334 AC_ARG_WITH(launchmon-libdir,
335             [AS_HELP_STRING([--with-launchmon-libdir],[Launchmon library directory])],
336             [LAUNCHMON_LIB_DIR="${withval}";],)
337 AC_SUBST(LAUNCHMON_INC_DIR)
338 AC_SUBST(LAUNCHMON_LIB_DIR)
339
340 AC_ARG_WITH(libflex-libdir,
341             [AS_HELP_STRING([--with-libflex-libdir],[Absolute path to flex library])],
342             [LIBFLEX_LIB_DIR="${withval}";],)
343 # 3/15/09: We are not checking for libflex sources and they are not in cs.wisc.edu package-base.
344 #          What's the story here?  Not needed?
345 PD_SOFT_CHECK_LIB_DIR(${LIBFLEX_LIB_DIR}, [fl], [yywrap])
346 AC_SUBST(LIBFLEX_LIB_DIR)
347 AC_PATH_PROG(NASM, nasm, "", "${PACKAGE_BASE}/nasm/bin:$PATH")
348 AC_SUBST(NASM)
349
350 AC_MSG_CHECKING([for -fno-stack-protector])
351 SAVED_CXXFLAGS=$CXXFLAGS
352 CXXFLAGS="-fno-stack-protector"
353 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], 
354                                 [AC_MSG_RESULT([yes]); STACKPROT="DISABLE_STACK_PROT=1"], 
355                                 [AC_MSG_RESULT([no]); STACKPROT=""])
356 AC_SUBST(STACKPROT)
357 CXXFLAGS=$SAVED_CXXFLAGS
358
359 if test "`echo $host_os | cut -b-3`" = "aix" ; then
360     M32FLAG="-maix32"
361 else
362     M32FLAG="-m32"
363 fi
364 AC_MSG_CHECKING([for 32-bit build environment])
365 SAVED_CXXFLAGS=$CXXFLAGS
366 CXXFLAGS=$M32FLAG
367 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[]])], 
368                                 [AC_MSG_RESULT([yes]); BUILD32=""],
369                                 [AC_MSG_RESULT([no]); BUILD32="SKIP_BUILD_RTLIB_32=1"])
370 AC_SUBST(BUILD32)
371 CXXFLAGS=$SAVED_CXXFLAGS
372
373 AC_MSG_CHECKING([whether to use MM timer])
374 case $host in
375      ia64-*-*-*) MMTIMER=true ;;
376      *)    MMTIMER=false ;;
377 esac
378 AC_MSG_RESULT(${MMTIMER})
379 AC_SUBST([MMTIMER])
380
381 AC_SUBST([DEFS])
382
383 AC_ARG_ENABLE(testsuite, AS_HELP_STRING([--disable-testsuite], [Disable the Dyninst test suite (default is no)]),
384                          [], [enable_testsuite=yes])
385
386 AS_IF([test "x$enable_testsuite" != xyes], [TESTSUITE="DONT_BUILD_NEWTESTSUITE=1"], [TESTSUITE=""])
387 AC_SUBST([TESTSUITE])
388
389 AC_CONFIG_FILES([make.config.local:autodyninst/make.config.local.in])
390 AC_OUTPUT