IA-64 watchpoint support.
[deliverable/binutils-gdb.git] / gdb / configure.in
CommitLineData
c906108c
SS
1dnl Autoconf configure script for GDB, the GNU debugger.
2dnl Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
3dnl
4dnl This file is part of GDB.
5dnl
6dnl This program is free software; you can redistribute it and/or modify
7dnl it under the terms of the GNU General Public License as published by
8dnl the Free Software Foundation; either version 2 of the License, or
9dnl (at your option) any later version.
10dnl
11dnl This program is distributed in the hope that it will be useful,
12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14dnl GNU General Public License for more details.
15dnl
16dnl You should have received a copy of the GNU General Public License
17dnl along with this program; if not, write to the Free Software
18dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20dnl Process this file with autoconf to produce a configure script.
21
22AC_PREREQ(2.13)dnl
23AC_INIT(main.c)
24AC_CONFIG_HEADER(config.h:config.in)
25
26AC_PROG_CC
27AC_AIX
28AC_ISC_POSIX
29AM_PROG_CC_STDC
30
31AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
32AC_CANONICAL_SYSTEM
33
34dnl gdb doesn't use gettext, but bfd does. We call this to ensure we
35dnl link with the correct libraries.
36ALL_LINGUAS=
37CY_GNU_GETTEXT
38
39dnl List of object files added by configure.
40
41CONFIG_OBS=
42CONFIG_DEPS=
43CONFIG_SRCS=
fb40c209
AC
44CONFIG_INITS=
45ENABLE_CFLAGS=
b3a90332
AC
46CONFIG_ALL=
47CONFIG_CLEAN=
e56ac5c3
AC
48CONFIG_INSTALL=
49CONFIG_UNINSTALL=
c906108c
SS
50
51configdirs="doc testsuite"
52
96baa820
JM
53AC_ARG_ENABLE(multi-ice,
54[ --enable-multi-ice Build the multi-ice-gdb-server],
55[case "${enableval}" in
56 yes ) enable_multi_ice="yes" ;;
57 no) enable_multi_ice="no" ;;
58 *) AC_MSG_ERROR(Bad value for --enable-multi-ice: ${enableval}) ;;
59 esac
60])
61
62if test "${enable_multi_ice}" = "yes"; then
63 configdirs="${configdirs} multi-ice"
64fi
65
c906108c
SS
66dnl
67changequote(,)dnl
68
69. ${srcdir}/configure.host
70
71. ${srcdir}/configure.tgt
72
73dnl
74changequote([,])dnl
75
7a292a7a 76AC_PROG_AWK
c906108c
SS
77AC_PROG_INSTALL
78AC_CHECK_TOOL(AR, ar)
79AC_CHECK_TOOL(RANLIB, ranlib, :)
80AC_PROG_YACC
81
75c6e08a
MK
82dnl MiG is needed for the Hurd.
83AC_CHECK_TOOL(MIG, mig)
84
c906108c
SS
85AC_ARG_PROGRAM
86
87AC_TYPE_SIGNAL
88
89AC_HEADER_STDC
90
6abadcf8
ND
91dnl Solaris 7 needs _MSE_INT_H defined to avoid a clash between <widec.h>
92dnl and <wchar.h> that causes AC_CHECK_HEADERS to think <curses.h> doesn't
93dnl exist.
94
95case $host_os in solaris2.7) case "$GCC" in yes)
96 AC_DEFINE(_MSE_INT_H)
97esac; esac
98
ed9a39eb 99AC_CHECK_HEADERS(ctype.h curses.h endian.h link.h thread_db.h proc_service.h \
c906108c 100 memory.h objlist.h ptrace.h sgtty.h stddef.h stdlib.h \
ed9a39eb 101 string.h sys/procfs.h sys/ptrace.h sys/reg.h stdint.h \
c906108c 102 term.h termio.h termios.h unistd.h wait.h sys/wait.h \
104c1213 103 wchar.h wctype.h asm/debugreg.h sys/debugreg.h sys/select.h \
c2d11a7d 104 time.h sys/ioctl.h)
c906108c
SS
105AC_HEADER_STAT
106
107AC_C_CONST
108
2acceee2 109AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc poll sigprocmask)
c906108c
SS
110AC_FUNC_ALLOCA
111
f60300e7
MK
112dnl See if ptrace.h provides the PTRACE_GETREGS request.
113AC_MSG_CHECKING(for PTRACE_GETREGS)
114AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
115[AC_TRY_COMPILE([#include <sys/ptrace.h>],
116 [PTRACE_GETREGS;],
117 [gdb_cv_have_ptrace_getregs=yes],
118 [gdb_cv_have_ptrace_getregs=no])])
119AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
120if test $gdb_cv_have_ptrace_getregs = yes; then
121 AC_DEFINE(HAVE_PTRACE_GETREGS)
122fi
123
5c44784c
JM
124dnl See if ptrace.h provides the PTRACE_GETXFPREGS request.
125dnl PTRACE_GETXFPREGS is a Cygnus invention, since we wrote our own
126dnl Linux kernel patch for SSE support. That patch may or may not
127dnl actually make it into the official distribution. If you find that
128dnl years have gone by since this configure test was added, and Linux
129dnl isn't using PTRACE_GETXFPREGS, that means that our patch didn't
130dnl make it, and you can delete this code.
131AC_MSG_CHECKING(for PTRACE_GETXFPREGS)
132AC_CACHE_VAL(gdb_cv_have_ptrace_getxfpregs,
133[AC_TRY_COMPILE([#include <sys/ptrace.h>],
134 [PTRACE_GETXFPREGS;],
135 [gdb_cv_have_ptrace_getxfpregs=yes],
136 [gdb_cv_have_ptrace_getxfpregs=no])])
137AC_MSG_RESULT($gdb_cv_have_ptrace_getxfpregs)
138if test $gdb_cv_have_ptrace_getxfpregs = yes; then
139 AC_DEFINE(HAVE_PTRACE_GETXFPREGS)
140fi
141
7be570e7
JM
142AC_CHECK_LIB(socket, socketpair)
143AC_CHECK_FUNCS(socketpair)
144
145
c906108c
SS
146BFD_NEED_DECLARATION(malloc)
147BFD_NEED_DECLARATION(realloc)
148BFD_NEED_DECLARATION(free)
149BFD_NEED_DECLARATION(strerror)
150BFD_NEED_DECLARATION(strdup)
b83266a0 151BFD_NEED_DECLARATION(strstr)
c906108c
SS
152
153
154# The following save_state_t checkery is only necessary for HPUX
155# versions earlier than 10.20. When those fade from memory, this
156# could be expunged. --jsm 1999-03-22
157
158AC_MSG_CHECKING(for HPUX save_state structure)
159AC_EGREP_HEADER(save_state_t, machine/save_state.h,
160 gdb_cv_hpux_savestate=yes, gdb_cv_hpux_savestate=no)
161AC_EGREP_HEADER(ss_wide, machine/save_state.h, gdb_cv_hpux_sswide=yes,
162 gdb_cv_hpux_sswide=no)
163if test $gdb_cv_hpux_savestate = yes
164then
165 AC_DEFINE(HAVE_STRUCT_SAVE_STATE_T, 1)
166fi
167if test $gdb_cv_hpux_sswide = yes
168then
169 AC_DEFINE(HAVE_STRUCT_MEMBER_SS_WIDE, 1)
170fi
171AC_MSG_RESULT($gdb_cv_hpux_sswide)
172
173
174# If we are configured native on GNU/Linux, work around problems with
175# sys/procfs.h
c3f6f71d 176# Also detect which type of /proc is in use, such as for Unixware or Solaris.
c906108c
SS
177
178if test "${target}" = "${host}"; then
179 case "${host}" in
180 i[[3456]]86-*-linux*)
181 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2)
182 AC_DEFINE(sys_quotactl)
183 ;;
c5394b80 184 *-*-unixware* | *-*-sysv4.2* | *-*-sysv5*)
c3f6f71d
JM
185 AC_DEFINE(NEW_PROC_API)
186 ;;
3423db82 187 *-*-solaris2.[[678]])
c3f6f71d
JM
188 AC_DEFINE(NEW_PROC_API)
189 ;;
c906108c 190 esac
c906108c
SS
191fi
192
193if test "$ac_cv_header_sys_procfs_h" = yes; then
194 BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
195 BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
196 BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
197 BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
83d37ec8
MK
198 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
199 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
200 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
201 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
c906108c
SS
202
203 dnl Check for PIOCSET ioctl entry
204
205 AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
206 AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
207 [AC_TRY_COMPILE([#include <unistd.h>
208#include <sys/types.h>
209#include <sys/procfs.h>
210], [
211 int dummy;;
212 dummy = ioctl(0, PIOCSET, &dummy);
213 ],
214 gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
215 AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
216 if test $gdb_cv_have_procfs_piocset = yes; then
217 AC_DEFINE(HAVE_PROCFS_PIOCSET)
218 fi
219fi
220
221dnl See if host has libm. This is usually needed by simulators.
222AC_CHECK_LIB(m, main)
223
224dnl Solaris puts wctype in /usr/lib/libw.a before Solaris 2.6.
225dnl
226dnl A bug in GNU ld 2.9.1 causes a problem if we link in -lw
227dnl under Solaris 2.6 because it is some funky empty library.
228dnl So only link in libw if we have to.
229AC_CHECK_LIB(c, wctype,: ,AC_CHECK_LIB(w, wctype))
230
231dnl See if compiler supports "long long" type.
232
233AC_MSG_CHECKING(for long long support in compiler)
234AC_CACHE_VAL(gdb_cv_c_long_long,
235[AC_TRY_COMPILE(, [
236 extern long long foo;
237 switch (foo & 2) { case 0: return 1; }
238],
239gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
240AC_MSG_RESULT($gdb_cv_c_long_long)
241if test $gdb_cv_c_long_long = yes; then
242 AC_DEFINE(CC_HAS_LONG_LONG)
243fi
244
245dnl See if the compiler and runtime support printing long long
246
247AC_MSG_CHECKING(for long long support in printf)
248AC_CACHE_VAL(gdb_cv_printf_has_long_long,
249[AC_TRY_RUN([
250int main () {
251 char buf[32];
252 long long l = 0;
253 l = (l << 16) + 0x0123;
254 l = (l << 16) + 0x4567;
255 l = (l << 16) + 0x89ab;
256 l = (l << 16) + 0xcdef;
257 sprintf (buf, "0x%016llx", l);
258 return (strcmp ("0x0123456789abcdef", buf));
259}],
260gdb_cv_printf_has_long_long=yes,
261gdb_cv_printf_has_long_long=no,
262gdb_cv_printf_has_long_long=no)])
263if test $gdb_cv_printf_has_long_long = yes; then
264 AC_DEFINE(PRINTF_HAS_LONG_LONG)
265fi
266AC_MSG_RESULT($gdb_cv_printf_has_long_long)
267
268dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
269dnl because autoconf complains about cross-compilation issues. However, this
270dnl code uses the same variables as the macro for compatibility.
271
272AC_MSG_CHECKING(for long double support in compiler)
273AC_CACHE_VAL(ac_cv_c_long_double,
274[AC_TRY_COMPILE(, [long double foo;],
275ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
276AC_MSG_RESULT($ac_cv_c_long_double)
277if test $ac_cv_c_long_double = yes; then
278 AC_DEFINE(HAVE_LONG_DOUBLE)
279fi
280
281dnl See if the compiler and runtime support printing long doubles
282
283AC_MSG_CHECKING(for long double support in printf)
284AC_CACHE_VAL(gdb_cv_printf_has_long_double,
285[AC_TRY_RUN([
286int main () {
287 char buf[16];
288 long double f = 3.141592653;
289 sprintf (buf, "%Lg", f);
290 return (strncmp ("3.14159", buf, 7));
291}],
292gdb_cv_printf_has_long_double=yes,
293gdb_cv_printf_has_long_double=no,
294gdb_cv_printf_has_long_double=no)])
295if test $gdb_cv_printf_has_long_double = yes; then
296 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
297fi
298AC_MSG_RESULT($gdb_cv_printf_has_long_double)
299
300dnl See if the compiler and runtime support scanning long doubles
301
302AC_MSG_CHECKING(for long double support in scanf)
303AC_CACHE_VAL(gdb_cv_scanf_has_long_double,
304[AC_TRY_RUN([
305int main () {
306 char *buf = "3.141592653";
307 long double f = 0;
308 sscanf (buf, "%Lg", &f);
309 return !(f > 3.14159 && f < 3.14160);
310}],
311gdb_cv_scanf_has_long_double=yes,
312gdb_cv_scanf_has_long_double=no,
313gdb_cv_scanf_has_long_double=no)])
314if test $gdb_cv_scanf_has_long_double = yes; then
315 AC_DEFINE(SCANF_HAS_LONG_DOUBLE)
316fi
317AC_MSG_RESULT($gdb_cv_scanf_has_long_double)
318
319AC_FUNC_MMAP
320
321dnl See if thread_db library is around for Solaris thread debugging. Note that
322dnl we must explicitly test for version 1 of the library because version 0
323dnl (present on Solaris 2.4 or earlier) doesn't have the same API.
324
325dnl Note that we only want this if we are both native (host == target), and
326dnl not doing a canadian cross build (build == host).
327
328if test ${build} = ${host} -a ${host} = ${target} ; then
329 case ${host_os} in
330 hpux*)
331 AC_MSG_CHECKING(for HPUX/OSF thread support)
332 if test -f /usr/include/dce/cma_config.h ; then
333 if test "$GCC" = "yes" ; then
334 AC_MSG_RESULT(yes)
335 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
336 CONFIG_OBS="${CONFIG_OJS} hpux-thread.o"
337 CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
338 else
339 AC_MSG_RESULT(no (suppressed because you are not using GCC))
340 fi
341 else
342 AC_MSG_RESULT(no)
343 fi
344 ;;
345 solaris*)
346 AC_MSG_CHECKING(for Solaris thread debugging library)
347 if test -f /usr/lib/libthread_db.so.1 ; then
348 AC_MSG_RESULT(yes)
349 AC_DEFINE(HAVE_THREAD_DB_LIB)
350 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
351 CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
352 AC_CHECK_LIB(dl, dlopen)
353 if test "$GCC" = "yes" ; then
354 # The GNU linker requires the -export-dynamic option to make
355 # all symbols visible in the dynamic symbol table.
356 hold_ldflags=$LDFLAGS
357 AC_MSG_CHECKING(for the ld -export-dynamic flag)
358 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
359 AC_TRY_LINK(, [int i;], found=yes, found=no)
360 LDFLAGS=$hold_ldflags
361 AC_MSG_RESULT($found)
362 if test $found = yes; then
363 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
364 fi
365 fi
366 # Sun randomly tweaked the prototypes in <proc_service.h>
367 # at one point.
368 AC_MSG_CHECKING(if <proc_service.h> is old)
369 AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
370 AC_TRY_COMPILE([
371 #include <proc_service.h>
372 ps_err_e ps_pdwrite
373 (struct ps_prochandle*, psaddr_t, const void*, size_t);
374 ],, gdb_cv_proc_service_is_old=no,
375 gdb_cv_proc_service_is_old=yes)
376 ])
377 AC_MSG_RESULT($gdb_cv_proc_service_is_old)
378 if test $gdb_cv_proc_service_is_old = yes; then
379 AC_DEFINE(PROC_SERVICE_IS_OLD)
380 fi
381 else
382 AC_MSG_RESULT(no)
383 fi
384 ;;
385 esac
386 AC_SUBST(CONFIG_LDFLAGS)
387fi
388
389dnl Handle optional features that can be enabled.
fb40c209
AC
390
391dnl Handle MI sub-directory configury.
392AC_ARG_ENABLE(gdbmi,
393[ --enable-gdbmi Enable GDB-MI interface],
394[
395 case "${enable_gdbmi}" in
396 yes | no) ;;
397 "") enable_gdbmi=yes ;;
398 *)
399 AC_MSG_ERROR(Bad value for --enable-gdbmi: ${enableval})
400 ;;
401 esac
402])
403case ${enable_gdbmi} in
404 "yes" )
405 if test -d "${srcdir}/mi" ; then
406 CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_MI_OBS)"
407 CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_MI_DEPS)"
408 CONFIG_SRCS="${CONFIG_SRS} \$(SUBDIR_MI_SRCS)"
409 CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_MI_INITS)"
b0b1b869 410 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_MI_CFLAGS)"
b3a90332
AC
411 CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_MI_ALL)"
412 CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_MI_CLEAN)"
e56ac5c3
AC
413 CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_MI_INSTALL)"
414 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_MI_UNINSTALL)"
fb40c209
AC
415 fi
416 ;;
417esac
c906108c
SS
418
419AC_ARG_ENABLE(tui,
420[ --enable-tui Enable full-screen terminal user interface],
421[
422 case "${enable_tui}" in
423 yes | no) ;;
424 "") enable_tui=yes ;;
425 *)
426 AC_MSG_ERROR(Bad value for --enable-tui: ${enableval})
427 ;;
428 esac
429])
430case ${enable_tui} in
431 "yes" )
432 AC_DEFINE(TUI)
433 BUILD_TUI=all-tui
434 TUI_LIBRARY=tui/libtui.a
435 ;;
436 * )
437 BUILD_TUI=
438 TUI_LIBRARY=
439 ;;
440esac
441AC_SUBST(BUILD_TUI)
442AC_SUBST(TUI_LIBRARY)
443
444AC_ARG_ENABLE(netrom,
445[ --enable-netrom Enable NetROM support],
446[case "${enableval}" in
447yes) enable_netrom=yes ;;
448no) enable_netrom=no ;;
449*) AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;;
450esac])
451
452if test "${enable_netrom}" = "yes"; then
453 CONFIG_OBS="${CONFIG_OBS} remote-nrom.o"
454 CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c"
455fi
456
1decb323
AC
457
458build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
459-Wformat -Wparentheses -Wpointer-arith"
460# Not yet: -Wall -Wpointer-arith -Wstrict-prototypes
461# -Wmissing-prototypes -Wmissing-declarations
c906108c
SS
462AC_ARG_ENABLE(build-warnings,
463[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
1decb323 464[case "${enableval}" in
c906108c
SS
465 yes) ;;
466 no) build_warnings="-w";;
467 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
468 build_warnings="${build_warnings} ${t}";;
469 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
470 build_warnings="${t} ${build_warnings}";;
471 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
d4f3574e
SS
472esac
473if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
474 echo "Setting warning flags = $build_warnings" 6>&1
1decb323 475fi])dnl
104c1213
JM
476WARN_CFLAGS=""
477WERROR_CFLAGS=""
c906108c
SS
478if test "x${build_warnings}" != x -a "x$GCC" = xyes
479then
104c1213
JM
480 # Separate out the -Werror flag as some files just cannot be
481 # compiled with it enabled.
482 for w in ${build_warnings}; do
483 case $w in
484 -Werr*) WERROR_CFLAGS=-Werror ;;
485 *) WARN_CFLAGS="${WARN_CFLAGS} $w"
486 esac
487 done
1decb323 488fi
c906108c 489AC_SUBST(WARN_CFLAGS)
104c1213 490AC_SUBST(WERROR_CFLAGS)
c906108c
SS
491
492MMALLOC_CFLAGS=
493MMALLOC=
494AC_SUBST(MMALLOC_CFLAGS)
495AC_SUBST(MMALLOC)
496
497AC_ARG_WITH(mmalloc,
498[ --with-mmalloc Use memory mapped malloc package],
499[case "${withval}" in
500 yes) want_mmalloc=true ;;
501 no) want_mmalloc=false;;
502 *) AC_MSG_ERROR(bad value ${withval} for GDB with-mmalloc option) ;;
503esac],[want_mmalloc=false])dnl
504
505if test x$want_mmalloc = xtrue; then
506 AC_DEFINE(USE_MMALLOC)
507 AC_DEFINE(MMCHECK_FORCE)
508 MMALLOC_CFLAGS="-I$srcdir/../mmalloc"
509 MMALLOC='../mmalloc/libmmalloc.a'
510fi
511
88987551
L
512AC_ARG_WITH(included-regex,
513[ --with-included-regex Use included regex],
514[case "${withval}" in
515 yes) want_included_regex=true ;;
516 no) want_included_regex=false;;
517 *) AC_MSG_ERROR(bad value ${withval} for GDB with-included-regex option) ;;
518esac],[want_included_regex=true])dnl
519
88987551
L
520if test $want_included_regex = false; then
521 AC_MSG_CHECKING(for GNU regex)
522 AC_CACHE_VAL(gdb_cv_have_gnu_regex,
523[AC_TRY_COMPILE([#include <gnu-versions.h>
524#include <sys/types.h>
525#include <regex.h>],
526[#if !defined _GNU_REGEX_INTERFACE_VERSION || !defined __GLIBC__ || __GLIBC__ < 2
527#error No valid GNU regex.
528#endif
529],
530 [gdb_cv_have_gnu_regex=yes],
531 [gdb_cv_have_gnu_regex=no])])
532 AC_MSG_RESULT($gdb_cv_have_gnu_regex)
e48f66e4
AC
533 if test $gdb_cv_have_gnu_regex = no; then
534 want_included_regex=true
88987551
L
535 fi
536fi
e48f66e4
AC
537
538if test x${want_included_regex} = xtrue; then
539 REGEX="gnu-regex.o"
540 AC_DEFINE(USE_INCLUDED_REGEX)
541fi
88987551 542AC_SUBST(REGEX)
7a292a7a
SS
543
544# In the Cygwin environment, we need some additional flags.
545AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
546[AC_EGREP_CPP(lose, [
547#if defined (__CYGWIN__) || defined (__CYGWIN32__)
548lose
549#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
550
551DLLTOOL=${DLLTOOL-dlltool}
552WINDRES=${WINDRES-windres}
553AC_SUBST(DLLTOOL)
554AC_SUBST(WINDRES)
555
c906108c 556dnl Figure out which term library to use.
b83266a0
SS
557if test x$gdb_host = xgo32; then
558 TERM_LIB=
559else
c906108c
SS
560if test x$gdb_cv_os_cygwin = xyes; then
561 TERM_LIB='`if test -r ../libtermcap/libtermcap.a; then echo ../libtermcap/libtermcap.a; else echo -ltermcap; fi`'
562else
563 TERM_LIB=
564 AC_CHECK_LIB(ncurses, tgetent, TERM_LIB=-lncurses,
565 AC_CHECK_LIB(Hcurses, tgetent, TERM_LIB=-lHcurses,
566 AC_CHECK_LIB(termlib, tgetent, TERM_LIB=-ltermlib,
567 AC_CHECK_LIB(termcap, tgetent, TERM_LIB=-ltermcap,
568 AC_CHECK_LIB(curses, tgetent, TERM_LIB=-lcurses,
569 AC_CHECK_LIB(terminfo, tgetent, TERM_LIB=-lterminfo))))))
570
571 if test "x$TERM_LIB" = x
572 then
573 AC_MSG_ERROR(Could not find a term library, e.g. termcap or termlib!)
574 fi
575fi
b83266a0 576fi
c906108c
SS
577AC_SUBST(TERM_LIB)
578
cd0fc7c3
SS
579# libreadline needs libuser32.a in a cygwin environment
580WIN32LIBS=
581if test x$gdb_cv_os_cygwin = xyes; then
c5394b80
JM
582 WIN32LIBS="-luser32"
583 case "${target}" in
584 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
585 ;;
586 esac
cd0fc7c3
SS
587fi
588AC_SUBST(WIN32LIBS)
7a292a7a 589
3fc11d3e
JM
590LIBGUI="../libgui/src/libgui.a"
591GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
592AC_SUBST(LIBGUI)
593AC_SUBST(GUI_CFLAGS_X)
7a292a7a 594
8b93c638
JM
595AC_ARG_WITH(cpu,
596[ --with-cpu=CPU Set the default CPU variant to debug],
597[case "${target}" in
598 powerpc-* | powerpcle-* )
599 ## It would be nice to keep this table in sync with the one in
600 ## gcc/configure.
601 case "${with_cpu}" in
602 ppc-uisa | rs6000 | 403 | 403GC | 505 | 860 | 601 | 602 | 603 \
603 | 604 | 750 )
604 ## Those are all handled in variants in rs6000-tdep.c, so they're fine.
605 ;;
606 common | power | power2 | rios | rios1 | rios2 | rsc | rsc1 )
607 ## These are all RS6000 variants, as far as GDB is concerned.
608 with_cpu=rs6000
609 ;;
610 603e | ec603e )
611 with_cpu=603
612 ;;
613 604e )
614 with_cpu=604
615 ;;
616 * )
617 AC_MSG_WARN(GDB: unknown --with-cpu value: \`${with_cpu}'; using \`ppc-uisa'.)
618 with_cpu=ppc-uisa
619 ;;
620 esac
621 ;;
622 * )
623 AC_MSG_WARN(GDB may ignore the --with-cpu flag for ${target} targets)
624 ;;
625esac
626AC_DEFINE_UNQUOTED(TARGET_CPU_DEFAULT, "${with_cpu}")
627],)
628
629
3fc11d3e
JM
630AC_ARG_ENABLE(gdbtk,
631[ --enable-gdbtk Enable GDBTK GUI front end],
632[case "${enableval}" in
633 yes)
634 case "$host" in
635 *go32*)
636 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
637 enable_gdbtk=no ;;
638 *windows*)
639 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
640 enable_gdbtk=no ;;
641 *)
642 enable_gdbtk=yes ;;
643 esac ;;
644 no)
645 enable_gdbtk=no ;;
646 *)
647 AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
648esac],
649[
650# Default is on for everything but go32 and Cygwin
651case "$host" in
652 *go32* | *windows*)
653 ;;
654 *)
379d6434
AC
655 if test -d "${srcdir}/gdbtk" ; then
656 enable_gdbtk=yes
657 fi
658 ;;
659esac
3fc11d3e
JM
660])
661
662WIN32LDAPP=
663AC_SUBST(WIN32LIBS)
664AC_SUBST(WIN32LDAPP)
665
666configdir="unix"
667
668GDBTKLIBS=
669if test "${enable_gdbtk}" = "yes"; then
670
671 CY_AC_PATH_TCLCONFIG
672 if test -z "${no_tcl}"; then
673 CY_AC_LOAD_TCLCONFIG
674 CY_AC_PATH_TKCONFIG
675
676 # If $no_tk is nonempty, then we can't do Tk, and there is no
677 # point to doing Tcl.
678 if test -z "${no_tk}"; then
679 CY_AC_LOAD_TKCONFIG
680 CY_AC_PATH_TCLH
681 CY_AC_PATH_TKH
682 CY_AC_PATH_ITCLH
683 CY_AC_PATH_ITKH
684 CY_AC_PATH_TIXH
685
686 # now look for Itcl library stuff
687
688 CY_AC_PATH_ITCLCONFIG
689 if test -z "${no_itcl}"; then
690 CY_AC_LOAD_ITCLCONFIG
691 case "${host}" in
692 *-*-cygwin*)
693 itcldir=../itcl/itcl/win/
694 ;;
695 *)
696 itcldir=../itcl/itcl/unix/
697 ;;
698 esac
699
700
701 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
702 ITCL_DEPS="${itcldir}${ITCL_LIB_FILE}"
703 fi
704
705
706 # now look for Itk library stuff
707 CY_AC_PATH_ITKCONFIG
708 if test -z "${no_itcl}"; then
709 CY_AC_LOAD_ITKCONFIG
710
711 case "${host}" in
712 *-*-cygwin*)
713 itkdir=../itcl/itk/win/
714 ;;
715 *)
716 itkdir=../itcl/itk/unix/
717 ;;
718 esac
719
720 ITKLIB="${ITK_BUILD_LIB_SPEC}"
721 ITK_DEPS="${itkdir}${ITK_LIB_FILE}"
722 fi
723
724 # now look for Tix library stuff
725 CY_AC_PATH_TIXCONFIG
726 if test -z "${no_tix}"; then
727 CY_AC_LOAD_TIXCONFIG
728 TIXLIB="${TIX_BUILD_LIB_SPEC}"
729 TIX_DEPS="${TIX_BUILD_LOCATION}/${TIX_LIB_FILE}"
730 fi
731
3fc11d3e
JM
732 ENABLE_CFLAGS="$ENABLE_CFLAGS -DGDBTK"
733 # Tcl/Tk 8.1 require -fwritable strings. I don't
734 # know whether 8.2 will or not, but I bet it will.
735 # I don't have to worry about 7.x since we don't support it.
736 GDBTK_CFLAGS=""
737 if test "$GCC" = "yes"; then
738 if test "$TCL_VERSION" != "8.0" ; then
739 GDBTK_CFLAGS="-fwritable-strings"
740 fi
741 fi
742
743 # Include some libraries that Tcl and Tk want.
744 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
745 CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
746 # Yes, the ordering seems wrong here. But it isn't.
747 # TK_LIBS is the list of libraries that need to be linked
748 # after Tcl/Tk. Note that this isn't put into LIBS. If it
749 # were in LIBS then any link tests after this point would
750 # try to include things like `$(LIBGUI)', which wouldn't work.
751 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
d45b9300
FN
752 CONFIG_SRCS="${CONFIG_SRCS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c"
753 CONFIG_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-varobj.o gdbtk-wrapper.o"
754 CONFIG_INITS="${CONFIG_INITS} gdbtk/generic/gdbtk.c gdbtk/generic/gdbtk-cmds.c gdbtk/generic/gdbtk-hooks.c gdbtk/generic/gdbtk-varobj.c gdbtk/generic/gdbtk-wrapper.c"
b3a90332
AC
755 CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)"
756 CONFIG_CLEAN="${CONFIG_ALL} \$(SUBDIR_GDBTK_CLEAN)"
e56ac5c3
AC
757 CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)"
758 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)"
3fc11d3e
JM
759
760 if test x$gdb_cv_os_cygwin = xyes; then
761 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
762 WIN32LDAPP="-Wl,--subsystem,console"
763 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
764 fi
765 fi
766 fi
767fi
768
3fc11d3e
JM
769AC_SUBST(X_CFLAGS)
770AC_SUBST(X_LDFLAGS)
771AC_SUBST(X_LIBS)
772AC_SUBST(ITCLLIB)
773AC_SUBST(ITCL_DEPS)
774AC_SUBST(ITKLIB)
775AC_SUBST(ITK_DEPS)
776AC_SUBST(TIXLIB)
777AC_SUBST(TIX_DEPS)
778AC_SUBST(GDBTKLIBS)
779AC_SUBST(GDBTK_CFLAGS)
8b93c638 780
c906108c
SS
781AC_PATH_X
782
7a292a7a
SS
783
784# Unlike the sim directory, whether a simulator is linked is controlled by
785# presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
786# This code just checks for a few cases where we'd like to ignore those
787# definitions, even when they're present in the '.mt' file. These cases
788# are when --disable-sim is specified, or if the simulator directory is
789# not part of the soruce tree.
790#
791AC_ARG_ENABLE(sim,
792[ --enable-sim Link gdb with simulator],
793[echo "enable_sim = $enable_sim";
794 echo "enableval = ${enableval}";
795 case "${enableval}" in
796 yes) ignore_sim=false ;;
797 no) ignore_sim=true ;;
798 *) ignore_sim=false ;;
799 esac],
800[ignore_sim=false])
801
802if test ! -d "${srcdir}/../sim"; then
803 ignore_sim=true
804fi
805
806if test "${ignore_sim}" = "true"; then
807 IGNORE_SIM="SIM="
808 IGNORE_SIM_OBS="SIM_OBS="
809else
810 IGNORE_SIM=""
811 IGNORE_SIM_OBS=""
812 AC_DEFINE(WITH_SIM)
813fi
814AC_SUBST(IGNORE_SIM)
815AC_SUBST(IGNORE_SIM_OBS)
816
c906108c
SS
817AC_SUBST(ENABLE_CFLAGS)
818
819AC_SUBST(CONFIG_OBS)
820AC_SUBST(CONFIG_DEPS)
821AC_SUBST(CONFIG_SRCS)
dfcd3bfb 822AC_SUBST(CONFIG_INITS)
b3a90332
AC
823AC_SUBST(CONFIG_ALL)
824AC_SUBST(CONFIG_CLEAN)
e56ac5c3
AC
825AC_SUBST(CONFIG_INSTALL)
826AC_SUBST(CONFIG_UNINSTALL)
c906108c
SS
827
828# Begin stuff to support --enable-shared
829AC_ARG_ENABLE(shared,
830[ --enable-shared Use shared libraries],
831[case "${enableval}" in
832 yes) shared=true ;;
833 no) shared=false ;;
834 *) shared=true ;;
835esac])dnl
836
837HLDFLAGS=
838HLDENV=
839# If we have shared libraries, try to set rpath reasonably.
840if test "${shared}" = "true"; then
841 case "${host}" in
842 *-*-hpux*)
843 HLDFLAGS='-Wl,+s,+b,$(libdir)'
844 ;;
845 *-*-irix5* | *-*-irix6*)
846 HLDFLAGS='-Wl,-rpath,$(libdir)'
847 ;;
848 *-*-linux*aout*)
849 ;;
d332c5ac 850 *-*-linux* | *-pc-linux-gnu*)
c906108c
SS
851 HLDFLAGS='-Wl,-rpath,$(libdir)'
852 ;;
853 *-*-solaris*)
854 HLDFLAGS='-R $(libdir)'
855 ;;
856 *-*-sysv4*)
857 HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;'
858 ;;
859 esac
860fi
861
862# On SunOS, if the linker supports the -rpath option, use it to
863# prevent ../bfd and ../opcodes from being included in the run time
864# search path.
865case "${host}" in
866 *-*-sunos*)
867 echo 'main () { }' > conftest.c
868 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
869 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
870 :
871 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
872 :
873 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
874 :
875 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
876 :
877 elif test "${shared}" = "true"; then
878 HLDFLAGS='-Wl,-rpath=$(libdir)'
879 else
880 HLDFLAGS='-Wl,-rpath='
881 fi
882 rm -f conftest.t conftest.c conftest
883 ;;
884esac
885AC_SUBST(HLDFLAGS)
886AC_SUBST(HLDENV)
887# End stuff to support --enable-shared
888
889# target_subdir is used by the testsuite to find the target libraries.
890target_subdir=
891if test "${host}" != "${target}"; then
892 target_subdir="${target_alias}/"
893fi
894AC_SUBST(target_subdir)
895
896frags=
897host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
898if test ! -f ${host_makefile_frag}; then
899AC_MSG_ERROR("*** Gdb does not support host ${host}")
900fi
901frags="$frags $host_makefile_frag"
902
903target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
904if test ! -f ${target_makefile_frag}; then
905AC_MSG_ERROR("*** Gdb does not support target ${target}")
906fi
907frags="$frags $target_makefile_frag"
908
909AC_SUBST_FILE(host_makefile_frag)
910AC_SUBST_FILE(target_makefile_frag)
911AC_SUBST(frags)
912
913changequote(,)dnl
914hostfile=`sed -n '
915s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
916' ${host_makefile_frag}`
917
918targetfile=`sed -n '
919s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
920' ${target_makefile_frag}`
921
922# these really aren't orthogonal true/false values of the same condition,
923# but shells are slow enough that I like to reuse the test conditions
924# whenever possible
925if test "${target}" = "${host}"; then
926nativefile=`sed -n '
927s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
928' ${host_makefile_frag}`
929# else
930# GDBserver is only useful in a "native" enviroment
931# configdirs=`echo $configdirs | sed 's/gdbserver//'`
932fi
933changequote([,])
934
96baa820
JM
935SUBDIRS="doc testsuite nlm"
936if test "${enable_multi_ice}" = "yes"; then
937 SUBDIRS="${SUBDIRS} multi-ice"
938fi
939
940AC_SUBST(SUBDIRS)
941
c906108c
SS
942# If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
943# (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
944# corresponding links. But we have to remove the xm.h files and tm.h
945# files anyway, e.g. when switching from "configure host" to
946# "configure none".
947
948files=
949links=
950rm -f xm.h
951if test "${hostfile}" != ""; then
952files="${files} config/${gdb_host_cpu}/${hostfile}"
953links="${links} xm.h"
954fi
955rm -f tm.h
956if test "${targetfile}" != ""; then
957files="${files} config/${gdb_target_cpu}/${targetfile}"
958links="${links} tm.h"
959fi
960rm -f nm.h
961if test "${nativefile}" != ""; then
962files="${files} config/${gdb_host_cpu}/${nativefile}"
963links="${links} nm.h"
964else
965# A cross-only configuration.
966files="${files} config/nm-empty.h"
967links="${links} nm.h"
968fi
3fc11d3e 969AC_PROG_LN_S
c906108c
SS
970
971AC_LINK_FILES($files, $links)
972
973dnl Check for exe extension set on certain hosts (e.g. Win32)
974AC_EXEEXT
975
976AC_CONFIG_SUBDIRS($configdirs)
977AC_OUTPUT(Makefile tui/Makefile .gdbinit:gdbinit.in,
978[
979dnl Autoconf doesn't provide a mechanism for modifying definitions
980dnl provided by makefile fragments.
981dnl
982if test "${nativefile}" = ""; then
983sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
984 < Makefile > Makefile.tem
985mv -f Makefile.tem Makefile
986fi
987
988changequote(,)dnl
989sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
990/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
991/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
992mv -f Makefile.tmp Makefile
993changequote([,])dnl
994
2acceee2 995
c906108c
SS
996case x$CONFIG_HEADERS in
997xconfig.h:config.in)
998echo > stamp-h ;;
999esac
1000],
1001[
1002gdb_host_cpu=$gdb_host_cpu
1003gdb_target_cpu=$gdb_target_cpu
1004nativefile=$nativefile
1005])
1006
1007exit 0
This page took 0.107681 seconds and 4 git commands to generate.