Autoconf fix: wrong variables used for ICC/ICPC.
[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.0], [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    PD_CHECK_INC_DIR($LIBELF_INC_DIR, [libelf.h])
89    PD_CHECK_LIB_DIR($LIBELF_LIB_DIR,[elf],[elf_memory])
90    PD_CHECK_LIB_TYPE($LIBELF_LIB_DIR, elf)
91    LIBELF_STATIC="$LIB_TYPE_STATIC"
92    LIBELF_DYNAMIC="$LIB_TYPE_DYNAMIC"
93    AC_SUBST(LIBELF_INC_DIR)
94    AC_SUBST(LIBELF_LIB_DIR)
95    AC_SUBST(LIBELF_STATIC)
96    AC_SUBST(LIBELF_DYNAMIC)
97 fi
98
99 if test "`echo $host_os | cut -b-3`" = "aix" ; then
100    AC_MSG_NOTICE([AIX system, skipping libdwarf...])
101    
102 else
103    AC_ARG_WITH(libdwarf-incdir,
104             [AS_HELP_STRING([--with-libdwarf-incdir],[LIBDWARF include directory])],
105             [LIBDWARF_INC_DIR="${withval}";],)
106    AC_ARG_WITH(libdwarf-libdir,
107             [AS_HELP_STRING([--with-libdwarf-libdir],[LIBDWARF library directory])],
108             [LIBDWARF_LIB_DIR="${withval}";],)
109    PD_CHECK_INC_DIR($LIBDWARF_INC_DIR,[libdwarf.h])
110    PD_CHECK_LIB_DIR($LIBDWARF_LIB_DIR,[dwarf],[dwarf_add_arange],$LIBDWARF_LIB_DIR,[-lelf])
111    PD_CHECK_LIB_TYPE($LIBDWARF_LIB_DIR, dwarf)
112    LIBDWARF_STATIC="$LIB_TYPE_STATIC"
113    LIBDWARF_DYNAMIC="$LIB_TYPE_DYNAMIC"
114    AC_SUBST(LIBDWARF_INC_DIR)
115    AC_SUBST(LIBDWARF_LIB_DIR)
116    AC_SUBST(LIBDWARF_STATIC)
117    AC_SUBST(LIBDWARF_DYNAMIC)
118 fi
119
120
121
122
123 AC_ARG_WITH(libxml2-incdir,
124             [AS_HELP_STRING([--with-libxml2-incdir],[LIBXML2 include directory])],
125             [LIBXML2_INC_DIR="${withval}";],)
126 AC_ARG_WITH(libxml2-libdir,
127             [AS_HELP_STRING([--with-libxml2-libdir],[LIBXML2 library directory])],
128             [LIBXML2_LIB_DIR="${withval}";],)
129 PD_SOFT_CHECK_INC_DIR($LIBXML2_INC_DIR, [libxml/xmlschemas.h], [libxml])
130 PD_SOFT_CHECK_LIB_DIR($LIBXML2_LIB_DIR,[xml2],[xmlAddID])
131 AC_SUBST(LIBXML2_INC_DIR)
132 AC_SUBST(LIBXML2_LIB_DIR)
133
134 if test "`echo $host_os | cut -b-3`" = "aix" ; then
135    AC_MSG_NOTICE([AIX system, skipping libiberty...])
136 else
137    AC_ARG_WITH(libiberty-libdir,
138             [AS_HELP_STRING([--with-libiberty-libdir],[LIBIBERTY library directory])],
139             [LIBIBERTY_LIB_DIR="${withval}";],)
140    LIBS_HOLD=$LIBS
141    LIBS="-L$LIBIBERTY_LIB_DIR"
142    AC_CHECK_LIB([iberty], [cplus_demangle], [], 
143                           [AC_CHECK_FILE($LIBIBERTY_LIB_DIR/libiberty.a, 
144                           [],
145                           [AC_MSG_ERROR(Can't find libiberty in $LIBIBERTY_LIB_DIR)])])
146    LIBS=$LIBS_HOLD                        
147    AC_SUBST(LIBIBERTY_LIB_DIR)
148    PD_CHECK_LIB_TYPE($LIBIBERTY_LIB_DIR, iberty)
149    LIBIBERTY_STATIC="$LIB_TYPE_STATIC"
150    LIBIBERTY_DYNAMIC="$LIB_TYPE_DYNAMIC"
151    AC_SUBST(LIBIBERTY_STATIC)
152    AC_SUBST(LIBIBERTY_DYNAMIC)
153 fi
154
155 if test "$host_cpu" != "ia64" ; then
156    AC_MSG_NOTICE([Not IA-64, skipping libunwind...])
157 else
158    AC_ARG_WITH(libunwind-incdir,
159             [AS_HELP_STRING([--with-libunwind-incdir],[LIBUNWIND include directory])],
160             [LIBUNWIND_INC_DIR="${withval}";],)
161    AC_ARG_WITH(libunwind-libdir,
162             [AS_HELP_STRING([--with-libunwind-libdir],[LIBUNWIND library directory])],
163             [LIBUNWIND_LIB_DIR="${withval}";],)
164
165    PD_CHECK_INC_DIR(${LIBUNWIND_INC_DIR}, [libunwind.h])
166 fi
167 AC_SUBST(LIBUNWIND_INC_DIR)
168 AC_SUBST(LIBUNWIND_LIB_DIR)
169
170
171 AC_ARG_WITH(libflex-libdir,
172             [AS_HELP_STRING([--with-libflex-libdir],[Absolute path to flex library])],
173             [LIBFLEX_LIB_DIR="${withval}";],)
174 # 3/15/09: We are not checking for libflex sources and they are not in cs.wisc.edu package-base.
175 #          What's the story here?  Not needed?
176 PD_SOFT_CHECK_LIB_DIR(${LIBFLEX_LIB_DIR}, [fl], [yywrap])
177 AC_SUBST(LIBFLEX_LIB_DIR)
178 AC_PATH_PROG(NASM, nasm, "", "${PACKAGE_BASE}/nasm/bin:$PATH")
179 AC_SUBST(NASM)
180
181 AC_MSG_CHECKING([for -fno-stack-protector])
182 SAVED_CXXFLAGS=$CXXFLAGS
183 CXXFLAGS="-fno-stack-protector"
184 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], 
185                                 [AC_MSG_RESULT([yes]); STACKPROT="DISABLE_STACK_PROT=1"], 
186                                 [AC_MSG_RESULT([no]); STACKPROT=""])
187 AC_SUBST(STACKPROT)
188 CXXFLAGS=$SAVED_CXXFLAGS
189
190 AC_MSG_CHECKING([whether to use MM timer])
191 case $host in
192      ia64-*-*-*) MMTIMER=true ;;
193      *)    MMTIMER=false ;;
194 esac
195 AC_MSG_RESULT(${MMTIMER})
196 AC_SUBST([MMTIMER])
197
198 AC_SUBST([DEFS])
199
200 AC_ARG_ENABLE(testsuite, AS_HELP_STRING([--disable-testsuite], [Disable the Dyninst test suite (default is no)]),
201                          [], [enable_testsuite=yes])
202
203 AS_IF([test "x$enable_testsuite" != xyes], [TESTSUITE="DONT_BUILD_TESTSUITE=1"], [TESTSUITE=""])
204 AC_SUBST([TESTSUITE])
205
206 AC_CONFIG_FILES([make.config.local:autodyninst/make.config.local.in])
207 AC_OUTPUT