Changes to configure.in for FreeBSD.
[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    LIBS="$LIBS -liberty"
167    LDFLAGS="$LDFLAGS -shared"
168    AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern "C" { char *cplus_demangle(char *s, int opts); }]],
169                                    [[cplus_demangle("", 0);]])],
170                                    [LIBIBERTY_LINK="true"],
171                                    [LIBIBERTY_LINK="false"])
172    LDFLAGS=$LDFLAGS_BAK
173    LIBS=$LIBS_BAK
174
175    if test "x$HAVE_LIBIBERTY" = "xtrue" ; then
176       if test "x$LIBIBERTY_LINK" = "xtrue" ; then
177          USE_LIBERTY=true
178          LINK_LIBERTY=true
179       elif test "x$_PGC_" != "x" ; then 
180          USE_LIBERTY=true
181          echo "WARNING: libiberty does not link with shared objects.  Mutatees will have to be linked with -liberty."
182       else
183          GNU_DEMANGLER=true
184       fi
185    else
186       GNU_DEMANGLER=true
187    fi
188
189    if test "x$GNU_DEMANGLER" = "xtrue" ; then
190       USE_LIBIBERTY=""
191       LINK_LIBIBERTY=""
192    fi
193 fi
194
195 AC_SUBST(GNU_DEMANGLER)
196 AC_SUBST(USE_LIBERTY)
197 AC_SUBST(LINK_LIBERTY)
198 AC_SUBST(LIBIBERTY_LIB_DIR)
199  
200 if test "`echo $host_os | cut -b-3`" = "aix" ; then
201    AC_MSG_NOTICE([AIX system, skipping libdwarf...])
202    
203 else
204    AC_ARG_WITH(libdwarf-incdir,
205             [AS_HELP_STRING([--with-libdwarf-incdir],[LIBDWARF include directory])],
206             [LIBDWARF_INC_DIR="${withval}";],)
207    AC_ARG_WITH(libdwarf-libdir,
208             [AS_HELP_STRING([--with-libdwarf-libdir],[LIBDWARF library directory])],
209             [LIBDWARF_LIB_DIR="${withval}";],)
210    
211    CXXFLAGS_HOLD=$CXXFLAGS;
212    CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR";
213    CPPFLAGS_HOLD=$CPPFLAGS;
214    CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR";
215                         
216    AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf.h], [AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
217         [CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
218          CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
219          AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf/libdwarf.h],
220                          [LIBDWARF_INC_DIR+="/libdwarf";AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
221                          [AC_ERROR(couldn't find libdwarf.h)])])
222    CXXFLAGS=$CXXFLAGS_HOLD;
223    CPPFLAGS=$CPPFLAGS_HOLD;
224
225    PD_CHECK_LIB_DIR($LIBDWARF_LIB_DIR,[dwarf],[dwarf_add_arange],$LIBELF_LIB_DIR,[-lelf])
226    PD_CHECK_LIB_TYPE($LIBDWARF_LIB_DIR, dwarf)
227    LIBDWARF_STATIC="$LIB_TYPE_STATIC"
228    LIBDWARF_DYNAMIC="$LIB_TYPE_DYNAMIC"
229    AC_SUBST(LIBDWARF_INC_DIR)
230    AC_SUBST(LIBDWARF_LIB_DIR)
231    AC_SUBST(LIBDWARF_STATIC)
232    AC_SUBST(LIBDWARF_DYNAMIC)
233
234    PD_CHECK_LIB_FEATURE($LIBDWARF_LIB_DIR,[dwarf],[dwarf_set_frame_cfa_value],$LIBELF_LIB_DIR,[-lelf])
235    LIBDWARF_HAS_SET_FRAME="$HAS_FEATURE"
236    AC_SUBST(LIBDWARF_HAS_SET_FRAME)
237 fi
238
239
240
241
242 AC_ARG_WITH(libxml2-incdir,
243             [AS_HELP_STRING([--with-libxml2-incdir],[LIBXML2 include directory])],
244             [LIBXML2_INC_DIR="${withval}";],)
245 AC_ARG_WITH(libxml2-libdir,
246             [AS_HELP_STRING([--with-libxml2-libdir],[LIBXML2 library directory])],
247             [LIBXML2_LIB_DIR="${withval}";],)
248 PD_SOFT_CHECK_INC_DIR($LIBXML2_INC_DIR, [libxml/xmlschemas.h], [libxml])
249 PD_SOFT_CHECK_LIB_DIR($LIBXML2_LIB_DIR,[xml2],[xmlAddID])
250 AC_SUBST(LIBXML2_INC_DIR)
251 AC_SUBST(LIBXML2_LIB_DIR)
252
253 if test "$host_cpu" != "ia64" ; then
254    AC_MSG_NOTICE([Not IA-64, skipping libunwind...])
255 else
256    AC_ARG_WITH(libunwind-incdir,
257             [AS_HELP_STRING([--with-libunwind-incdir],[LIBUNWIND include directory])],
258             [LIBUNWIND_INC_DIR="${withval}";],)
259    AC_ARG_WITH(libunwind-libdir,
260             [AS_HELP_STRING([--with-libunwind-libdir],[LIBUNWIND library directory])],
261             [LIBUNWIND_LIB_DIR="${withval}";],)
262
263    PD_CHECK_INC_DIR(${LIBUNWIND_INC_DIR}, [libunwind.h])
264 fi
265 AC_SUBST(LIBUNWIND_INC_DIR)
266 AC_SUBST(LIBUNWIND_LIB_DIR)
267
268 AC_ARG_WITH(libflex-libdir,
269             [AS_HELP_STRING([--with-libflex-libdir],[Absolute path to flex library])],
270             [LIBFLEX_LIB_DIR="${withval}";],)
271 # 3/15/09: We are not checking for libflex sources and they are not in cs.wisc.edu package-base.
272 #          What's the story here?  Not needed?
273 PD_SOFT_CHECK_LIB_DIR(${LIBFLEX_LIB_DIR}, [fl], [yywrap])
274 AC_SUBST(LIBFLEX_LIB_DIR)
275 AC_PATH_PROG(NASM, nasm, "", "${PACKAGE_BASE}/nasm/bin:$PATH")
276 AC_SUBST(NASM)
277
278 AC_MSG_CHECKING([for -fno-stack-protector])
279 SAVED_CXXFLAGS=$CXXFLAGS
280 CXXFLAGS="-fno-stack-protector"
281 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], 
282                                 [AC_MSG_RESULT([yes]); STACKPROT="DISABLE_STACK_PROT=1"], 
283                                 [AC_MSG_RESULT([no]); STACKPROT=""])
284 AC_SUBST(STACKPROT)
285 CXXFLAGS=$SAVED_CXXFLAGS
286
287 if test "`echo $host_os | cut -b-3`" = "aix" ; then
288     M32FLAG="-maix32"
289 else
290     M32FLAG="-m32"
291 fi
292 AC_MSG_CHECKING([for 32-bit build environment])
293 SAVED_CXXFLAGS=$CXXFLAGS
294 CXXFLAGS=$M32FLAG
295 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]], [[]])], 
296                                 [AC_MSG_RESULT([yes]); BUILD32=""],
297                                 [AC_MSG_RESULT([no]); BUILD32="SKIP_BUILD_RTLIB_32=1"])
298 AC_SUBST(BUILD32)
299 CXXFLAGS=$SAVED_CXXFLAGS
300
301 AC_MSG_CHECKING([whether to use MM timer])
302 case $host in
303      ia64-*-*-*) MMTIMER=true ;;
304      *)    MMTIMER=false ;;
305 esac
306 AC_MSG_RESULT(${MMTIMER})
307 AC_SUBST([MMTIMER])
308
309 AC_SUBST([DEFS])
310
311 AC_ARG_ENABLE(testsuite, AS_HELP_STRING([--disable-testsuite], [Disable the Dyninst test suite (default is no)]),
312                          [], [enable_testsuite=yes])
313
314 AS_IF([test "x$enable_testsuite" != xyes], [TESTSUITE="DONT_BUILD_NEWTESTSUITE=1"], [TESTSUITE=""])
315 AC_SUBST([TESTSUITE])
316
317 AC_CONFIG_FILES([make.config.local:autodyninst/make.config.local.in])
318 AC_OUTPUT