Check for libdwarf includes in both /usr/include and /usr/include/libdwarf if they...
[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             LIBXML2_INC_DIR="${PACKAGE_BASE}/libxml2/include/libxml2"
36             LIBXML2_LIB_DIR="${PACKAGE_BASE}/libxml2/lib";
37             LIBUNWIND_INC_DIR="${PACKAGE_BASE}/libunwind/include";
38             LIBUNWIND_LIB_DIR="${PACKAGE_BASE}/libunwind/lib";
39             LIBFLEX_LIB_DIR="${PACKAGE_BASE}/libflex/lib";
40            ],[
41             # We fall back on these defaults if both --with-package-base and
42             # specific --with-<package> arguments are not provided.
43             TCLTK_INC_DIR="/usr/include";
44             TCLTK_LIB_DIR="/usr/lib";
45             LIBELF_INC_DIR="/usr/include";
46             LIBELF_LIB_DIR="/usr/lib";
47             LIBDWARF_INC_DIR="/usr/include";
48             LIBDWARF_LIB_DIR="/usr/lib";
49             LIBXML2_INC_DIR="/usr/include/libxml2"
50             LIBXML2_LIB_DIR="/usr/lib";
51             LIBUNWIND_INC_DIR="/usr/include";
52             LIBUNWIND_LIB_DIR="/usr/lib";
53             LIBFLEX_LIB_DIR="/usr/lib";
54            ])
55 # 3/15/09: We don't include libiberty in the cs.wisc.edu package-base.
56 #          Why?  Putting these here for now...
57 LIBIBERTY_LIB_DIR="/usr/lib";
58
59
60 AC_ARG_WITH(tcl83,
61             [AS_HELP_STRING([--with-tcl83],[Use Tcl/Tk 8.3])],
62             [TCL_VERSION="tcl8.3"; USE_TCL83="${withval}";],
63             [TCL_VERSION="tcl8.4"; USE_TCL83="false";])
64 AC_ARG_WITH(tcltk-incdir,
65             [AS_HELP_STRING([--with-tcltk-incdir],[TCL/TK include directory])],
66             [TCLTK_INC_DIR="${withval}";],)
67 AC_ARG_WITH(tcltk-libdir,
68             [AS_HELP_STRING([--with-tcltk-libdir],[TCL/TK library directory])],
69             [TCLTK_LIB_DIR="${withval}";],)
70 PD_SOFT_CHECK_INC_DIR($TCLTK_INC_DIR, [tcl.h], [tcl])
71 PD_SOFT_CHECK_LIB_DIR($TCLTK_LIB_DIR, $TCL_VERSION, [Tcl_Eval])
72 AC_SUBST(USE_TCL83)
73 AC_SUBST(TCLTK_INC_DIR)
74 AC_SUBST(TCLTK_LIB_DIR)
75
76 AC_CANONICAL_HOST
77
78 if test "`echo $host_os | cut -b-3`" = "aix" ; then
79    AC_MSG_NOTICE([AIX system, skipping libelf...])
80    
81 else
82    AC_ARG_WITH(libelf-incdir,
83                    [AS_HELP_STRING([--with-libelf-incdir],[LIBELF include directory])],
84                    [LIBELF_INC_DIR="${withval}";],)
85    AC_ARG_WITH(libelf-libdir,
86             [AS_HELP_STRING([--with-libelf-libdir],[LIBELF library directory])],
87             [LIBELF_LIB_DIR="${withval}";],)
88   
89    CXXFLAGS_HOLD=$CXXFLAGS;
90    CXXFLAGS="$CXXFLAGS -I$LIBELF_INC_DIR";
91    CPPFLAGS_HOLD=$CPPFLAGS;
92    CPPFLAGS="$CPPFLAGS -I$LIBELF_INC_DIR";
93                         
94    AC_CHECK_HEADER([$LIBELF_INC_DIR/libelf.h], [AC_MSG_NOTICE(ELF include directory: $LIBELF_INC_DIR)],
95         [CXXFLAGS="$CXXFLAGS -I$LIBELF_INC_DIR/libelf";
96          CPPFLAGS="$CPPFLAGS -I$LIBELF_INC_DIR/libelf";
97          AC_CHECK_HEADER([$LIBELF_INC_DIR/libelf/libelf.h],
98                          [LIBELF_INC_DIR+="/libelf";AC_MSG_NOTICE(ELF include directory: $LIBELF_INC_DIR)],
99                          [AC_ERROR(couldn't find libelf.h)])])
100    CXXFLAGS=$CXXFLAGS_HOLD;
101    CPPFLAGS=$CPPFLAGS_HOLD;
102    PD_CHECK_LIB_DIR($LIBELF_LIB_DIR,[elf],[elf_memory])
103    PD_CHECK_LIB_TYPE($LIBELF_LIB_DIR, elf)
104    LIBELF_STATIC="$LIB_TYPE_STATIC"
105    LIBELF_DYNAMIC="$LIB_TYPE_DYNAMIC"
106    AC_SUBST(LIBELF_INC_DIR)
107    AC_SUBST(LIBELF_LIB_DIR)
108    AC_SUBST(LIBELF_STATIC)
109    AC_SUBST(LIBELF_DYNAMIC)
110 fi
111
112 if test "`echo $host_os | cut -b-3`" = "aix" ; then
113    AC_MSG_NOTICE([AIX system, skipping libdwarf...])
114    
115 else
116    AC_ARG_WITH(libdwarf-incdir,
117             [AS_HELP_STRING([--with-libdwarf-incdir],[LIBDWARF include directory])],
118             [LIBDWARF_INC_DIR="${withval}";],)
119    AC_ARG_WITH(libdwarf-libdir,
120             [AS_HELP_STRING([--with-libdwarf-libdir],[LIBDWARF library directory])],
121             [LIBDWARF_LIB_DIR="${withval}";],)
122    
123    CXXFLAGS_HOLD=$CXXFLAGS;
124    CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR";
125    CPPFLAGS_HOLD=$CPPFLAGS;
126    CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR";
127                         
128    AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf.h], [AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
129         [CXXFLAGS="$CXXFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
130          CPPFLAGS="$CPPFLAGS -I$LIBDWARF_INC_DIR/libdwarf";
131          AC_CHECK_HEADER([$LIBDWARF_INC_DIR/libdwarf/libdwarf.h],
132                          [LIBDWARF_INC_DIR+="/libdwarf";AC_MSG_NOTICE(DWARF include directory: $LIBDWARF_INC_DIR)],
133                          [AC_ERROR(couldn't find libdwarf.h)])])
134    CXXFLAGS=$CXXFLAGS_HOLD;
135    CPPFLAGS=$CPPFLAGS_HOLD;
136
137    PD_CHECK_LIB_DIR($LIBDWARF_LIB_DIR,[dwarf],[dwarf_add_arange],$LIBDWARF_LIB_DIR,[-lelf])
138    PD_CHECK_LIB_TYPE($LIBDWARF_LIB_DIR, dwarf)
139    LIBDWARF_STATIC="$LIB_TYPE_STATIC"
140    LIBDWARF_DYNAMIC="$LIB_TYPE_DYNAMIC"
141    AC_SUBST(LIBDWARF_INC_DIR)
142    AC_SUBST(LIBDWARF_LIB_DIR)
143    AC_SUBST(LIBDWARF_STATIC)
144    AC_SUBST(LIBDWARF_DYNAMIC)
145 fi
146
147
148
149
150 AC_ARG_WITH(libxml2-incdir,
151             [AS_HELP_STRING([--with-libxml2-incdir],[LIBXML2 include directory])],
152             [LIBXML2_INC_DIR="${withval}";],)
153 AC_ARG_WITH(libxml2-libdir,
154             [AS_HELP_STRING([--with-libxml2-libdir],[LIBXML2 library directory])],
155             [LIBXML2_LIB_DIR="${withval}";],)
156 PD_SOFT_CHECK_INC_DIR($LIBXML2_INC_DIR, [libxml/xmlschemas.h], [libxml])
157 PD_SOFT_CHECK_LIB_DIR($LIBXML2_LIB_DIR,[xml2],[xmlAddID])
158 AC_SUBST(LIBXML2_INC_DIR)
159 AC_SUBST(LIBXML2_LIB_DIR)
160
161 if test "`echo $host_os | cut -b-3`" = "aix" ; then
162    AC_MSG_NOTICE([AIX system, skipping libiberty...])
163 else
164    AC_ARG_WITH(libiberty-libdir,
165             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
166             [LIBIBERTY_LIB_DIR="${withval}";],)
167    LIBS_HOLD=$LIBS
168    LIBS="-L$LIBIBERTY_LIB_DIR"
169    AC_CHECK_LIB([iberty], [cplus_demangle], [], 
170                           [AC_CHECK_FILE($LIBIBERTY_LIB_DIR/libiberty.a, 
171                           [],
172                           [AC_MSG_ERROR(Can't find libiberty in $LIBIBERTY_LIB_DIR)])])
173    LIBS=$LIBS_HOLD                        
174    AC_SUBST(LIBIBERTY_LIB_DIR)
175    PD_CHECK_LIB_TYPE($LIBIBERTY_LIB_DIR, iberty)
176    LIBIBERTY_STATIC="$LIB_TYPE_STATIC"
177    LIBIBERTY_DYNAMIC="$LIB_TYPE_DYNAMIC"
178    AC_SUBST(LIBIBERTY_STATIC)
179    AC_SUBST(LIBIBERTY_DYNAMIC)
180 fi
181
182 if test "$host_cpu" != "ia64" ; then
183    AC_MSG_NOTICE([Not IA-64, skipping libunwind...])
184 else
185    AC_ARG_WITH(libunwind-incdir,
186             [AS_HELP_STRING([--with-libunwind-incdir],[LIBUNWIND include directory])],
187             [LIBUNWIND_INC_DIR="${withval}";],)
188    AC_ARG_WITH(libunwind-libdir,
189             [AS_HELP_STRING([--with-libunwind-libdir],[LIBUNWIND library directory])],
190             [LIBUNWIND_LIB_DIR="${withval}";],)
191
192    PD_CHECK_INC_DIR(${LIBUNWIND_INC_DIR}, [libunwind.h])
193 fi
194 AC_SUBST(LIBUNWIND_INC_DIR)
195 AC_SUBST(LIBUNWIND_LIB_DIR)
196
197
198 AC_ARG_WITH(libflex-libdir,
199             [AS_HELP_STRING([--with-libflex-libdir],[Absolute path to flex library])],
200             [LIBFLEX_LIB_DIR="${withval}";],)
201 # 3/15/09: We are not checking for libflex sources and they are not in cs.wisc.edu package-base.
202 #          What's the story here?  Not needed?
203 PD_SOFT_CHECK_LIB_DIR(${LIBFLEX_LIB_DIR}, [fl], [yywrap])
204 AC_SUBST(LIBFLEX_LIB_DIR)
205 AC_PATH_PROG(NASM, nasm, "", "${PACKAGE_BASE}/nasm/bin:$PATH")
206 AC_SUBST(NASM)
207
208 AC_MSG_CHECKING([for -fno-stack-protector])
209 SAVED_CXXFLAGS=$CXXFLAGS
210 CXXFLAGS="-fno-stack-protector"
211 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], 
212                                 [AC_MSG_RESULT([yes]); STACKPROT="DISABLE_STACK_PROT=1"], 
213                                 [AC_MSG_RESULT([no]); STACKPROT=""])
214 AC_SUBST(STACKPROT)
215 CXXFLAGS=$SAVED_CXXFLAGS
216
217 AC_MSG_CHECKING([whether to use MM timer])
218 case $host in
219      ia64-*-*-*) MMTIMER=true ;;
220      *)    MMTIMER=false ;;
221 esac
222 AC_MSG_RESULT(${MMTIMER})
223 AC_SUBST([MMTIMER])
224
225 AC_SUBST([DEFS])
226
227 AC_ARG_ENABLE(testsuite, AS_HELP_STRING([--disable-testsuite], [Disable the Dyninst test suite (default is no)]),
228                          [], [enable_testsuite=yes])
229
230 AS_IF([test "x$enable_testsuite" != xyes], [TESTSUITE="DONT_BUILD_TESTSUITE=1"], [TESTSUITE=""])
231 AC_SUBST([TESTSUITE])
232
233 AC_CONFIG_FILES([make.config.local:autodyninst/make.config.local.in])
234 AC_OUTPUT