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