Merge branch 'master' of legendre@git.dyninst.org:/pub/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], [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],[Comman seperated list of archive to wrap])],
82             [ARG_WRAPPER_LIBS="${withval}";],)
83 AC_SUBST(ARG_WRAPPER_LIBS)
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 "`echo $host_os | cut -b-3`" = "aix" ; then
120    if test "`basename $CXX`" = "xlC" ; then
121       BUILD_XLC="true";
122    elif test "`basename $CC`" = "xlc" ; then
123       BUILD_XLC="true";
124    else
125       BUILD_XLC="";
126    AC_ARG_WITH(libiberty-libdir,
127             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
128             [LIBIBERTY_LIB_DIR="${withval}";],)
129    LIBS_HOLD=$LIBS
130    LIBS="-L$LIBIBERTY_LIB_DIR"
131    AC_CHECK_LIB([iberty], [cplus_demangle], [HAVE_LIBIBERTY="1";],
132                           [AC_CHECK_FILE($LIBIBERTY_LIB_DIR/libiberty.a,
133                           [],
134                           [AC_MSG_ERROR(Can't find libiberty in $LIBIBERTY_LIB_DIR)])])
135    LIBS=$LIBS_HOLD
136    AC_SUBST(LIBIBERTY_LIB_DIR)
137    PD_CHECK_LIB_TYPE($LIBIBERTY_LIB_DIR, iberty)
138    LIBIBERTY_STATIC="$LIB_TYPE_STATIC"
139    LIBIBERTY_DYNAMIC="$LIB_TYPE_DYNAMIC"
140    AC_SUBST(LIBIBERTY_STATIC)
141    AC_SUBST(LIBIBERTY_DYNAMIC)
142    AC_SUBST(HAVE_LIBIBERTY)
143       
144    fi
145    AC_SUBST(BUILD_XLC)
146 else
147    AC_ARG_WITH(libiberty-libdir,
148             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
149             [LIBIBERTY_LIB_DIR="${withval}";],)
150    LIBS_HOLD=$LIBS
151    LIBS="-L$LIBIBERTY_LIB_DIR"
152    AC_CHECK_LIB([iberty], [cplus_demangle], [HAVE_LIBIBERTY="1";],
153                           [AC_CHECK_FILE($LIBIBERTY_LIB_DIR/libiberty.a,
154                           [],
155                           [AC_MSG_ERROR(Can't find libiberty in $LIBIBERTY_LIB_DIR)])])
156    LIBS=$LIBS_HOLD
157    AC_SUBST(LIBIBERTY_LIB_DIR)
158    PD_CHECK_LIB_TYPE($LIBIBERTY_LIB_DIR, iberty)
159    LIBIBERTY_STATIC="$LIB_TYPE_STATIC"
160    LIBIBERTY_DYNAMIC="$LIB_TYPE_DYNAMIC"
161    AC_SUBST(LIBIBERTY_STATIC)
162    AC_SUBST(LIBIBERTY_DYNAMIC)
163    AC_SUBST(HAVE_LIBIBERTY)
164 fi
165  
166 if test "`echo $host_os | cut -b-3`" = "aix" ; then
167    AC_MSG_NOTICE([AIX system, skipping libdwarf...])
168    
169 else
170    AC_ARG_WITH(libdwarf-incdir,
171             [AS_HELP_STRING([--with-libdwarf-incdir],[LIBDWARF include directory])],
172             [LIBDWARF_INC_DIR="${withval}";],)
173    AC_ARG_WITH(libdwarf-libdir,
174             [AS_HELP_STRING([--with-libdwarf-libdir],[LIBDWARF library directory])],
175             [LIBDWARF_LIB_DIR="${withval}";],)
176    
177    CXXFLAGS_HOLD=$CXXFLAGS;
178    CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR";
179    CPPFLAGS_HOLD=$CPPFLAGS;
180    CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR";
181                         
182    AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf.h], [AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
183         [CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
184          CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
185          AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf/libdwarf.h],
186                          [LIBDWARF_INC_DIR+="/libdwarf";AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
187                          [AC_ERROR(couldn't find libdwarf.h)])])
188    CXXFLAGS=$CXXFLAGS_HOLD;
189    CPPFLAGS=$CPPFLAGS_HOLD;
190
191    PD_CHECK_LIB_DIR($LIBDWARF_LIB_DIR,[dwarf],[dwarf_add_arange],$LIBELF_LIB_DIR,[-lelf])
192    PD_CHECK_LIB_TYPE($LIBDWARF_LIB_DIR, dwarf)
193    LIBDWARF_STATIC="$LIB_TYPE_STATIC"
194    LIBDWARF_DYNAMIC="$LIB_TYPE_DYNAMIC"
195    AC_SUBST(LIBDWARF_INC_DIR)
196    AC_SUBST(LIBDWARF_LIB_DIR)
197    AC_SUBST(LIBDWARF_STATIC)
198    AC_SUBST(LIBDWARF_DYNAMIC)
199
200    PD_CHECK_LIB_FEATURE($LIBDWARF_LIB_DIR,[dwarf],[dwarf_set_frame_cfa_value],$LIBELF_LIB_DIR,[-lelf])
201    LIBDWARF_HAS_SET_FRAME="$HAS_FEATURE"
202    AC_SUBST(LIBDWARF_HAS_SET_FRAME)
203 fi
204
205
206
207
208 AC_ARG_WITH(libxml2-incdir,
209             [AS_HELP_STRING([--with-libxml2-incdir],[LIBXML2 include directory])],
210             [LIBXML2_INC_DIR="${withval}";],)
211 AC_ARG_WITH(libxml2-libdir,
212             [AS_HELP_STRING([--with-libxml2-libdir],[LIBXML2 library directory])],
213             [LIBXML2_LIB_DIR="${withval}";],)
214 PD_SOFT_CHECK_INC_DIR($LIBXML2_INC_DIR, [libxml/xmlschemas.h], [libxml])
215 PD_SOFT_CHECK_LIB_DIR($LIBXML2_LIB_DIR,[xml2],[xmlAddID])
216 AC_SUBST(LIBXML2_INC_DIR)
217 AC_SUBST(LIBXML2_LIB_DIR)
218
219 if test "$host_cpu" != "ia64" ; then
220    AC_MSG_NOTICE([Not IA-64, skipping libunwind...])
221 else
222    AC_ARG_WITH(libunwind-incdir,
223             [AS_HELP_STRING([--with-libunwind-incdir],[LIBUNWIND include directory])],
224             [LIBUNWIND_INC_DIR="${withval}";],)
225    AC_ARG_WITH(libunwind-libdir,
226             [AS_HELP_STRING([--with-libunwind-libdir],[LIBUNWIND library directory])],
227             [LIBUNWIND_LIB_DIR="${withval}";],)
228
229    PD_CHECK_INC_DIR(${LIBUNWIND_INC_DIR}, [libunwind.h])
230 fi
231 AC_SUBST(LIBUNWIND_INC_DIR)
232 AC_SUBST(LIBUNWIND_LIB_DIR)
233
234 if test "$host_cpu" != "x86_64" -a "$host_cpu" != "i686"; then
235    AC_MSG_NOTICE([Not x86/x86_64, skipping icc on $host_cpu...])
236 else
237    AC_ARG_WITH(icc,
238                [AS_HELP_STRING([--with-icc],[Path to Intel's ICC compiler])],
239                [_ICC_="${withval}"; _ICPC_=`dirname ${withval}`/icpc;],)
240 fi
241 AC_SUBST(_ICC_)
242 AC_SUBST(_ICPC_)
243
244 if test "$host_cpu" != "x86_64" -a "$host_cpu" != "i686"; then
245    AC_MSG_NOTICE([Not x86/x86_64, skipping pgcc on $host_cpu...])
246 else
247    AC_ARG_WITH(pgcc,
248                [AS_HELP_STRING([--with-pgcc],[Path to Pathscale's PGCC compiler])],
249                [_PGC_="${withval}"; _PGCXX_=`dirname ${withval}`/pgCC;],)
250 fi
251 AC_SUBST(_PGC_)
252 AC_SUBST(_PGCXX_)
253
254 AC_ARG_WITH(libflex-libdir,
255             [AS_HELP_STRING([--with-libflex-libdir],[Absolute path to flex library])],
256             [LIBFLEX_LIB_DIR="${withval}";],)
257 # 3/15/09: We are not checking for libflex sources and they are not in cs.wisc.edu package-base.
258 #          What's the story here?  Not needed?
259 PD_SOFT_CHECK_LIB_DIR(${LIBFLEX_LIB_DIR}, [fl], [yywrap])
260 AC_SUBST(LIBFLEX_LIB_DIR)
261 AC_PATH_PROG(NASM, nasm, "", "${PACKAGE_BASE}/nasm/bin:$PATH")
262 AC_SUBST(NASM)
263
264 AC_MSG_CHECKING([for -fno-stack-protector])
265 SAVED_CXXFLAGS=$CXXFLAGS
266 CXXFLAGS="-fno-stack-protector"
267 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], 
268                                 [AC_MSG_RESULT([yes]); STACKPROT="DISABLE_STACK_PROT=1"], 
269                                 [AC_MSG_RESULT([no]); STACKPROT=""])
270 AC_SUBST(STACKPROT)
271 CXXFLAGS=$SAVED_CXXFLAGS
272
273 if test "`echo $host_os | cut -b-3`" = "aix" ; then
274     M32FLAG="-maix32"
275 else
276     M32FLAG="-m32"
277 fi
278 AC_MSG_CHECKING([for 32-bit build environment])
279 SAVED_CXXFLAGS=$CXXFLAGS
280 CXXFLAGS=$M32FLAG
281 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[]])], 
282                                 [AC_MSG_RESULT([yes]); BUILD32=""],
283                                 [AC_MSG_RESULT([no]); BUILD32="SKIP_BUILD_RTLIB_32=1"])
284 AC_SUBST(BUILD32)
285 CXXFLAGS=$SAVED_CXXFLAGS
286
287 AC_MSG_CHECKING([whether to use MM timer])
288 case $host in
289      ia64-*-*-*) MMTIMER=true ;;
290      *)    MMTIMER=false ;;
291 esac
292 AC_MSG_RESULT(${MMTIMER})
293 AC_SUBST([MMTIMER])
294
295 AC_SUBST([DEFS])
296
297 AC_ARG_ENABLE(testsuite, AS_HELP_STRING([--disable-testsuite], [Disable the Dyninst test suite (default is no)]),
298                          [], [enable_testsuite=yes])
299
300 AS_IF([test "x$enable_testsuite" != xyes], [TESTSUITE="DONT_BUILD_NEWTESTSUITE=1"], [TESTSUITE=""])
301 AC_SUBST([TESTSUITE])
302
303 AC_CONFIG_FILES([make.config.local:autodyninst/make.config.local.in])
304 AC_OUTPUT