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