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