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