* configure.in (_MSE_INT_H): Define on Solaris 7.
[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 ;;
6abadcf8 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
457AC_ARG_ENABLE(build-warnings,
458[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
fb40c209
AC
459[
460# not yet: -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
461build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith"
c906108c
SS
462case "${enableval}" in
463 yes) ;;
464 no) build_warnings="-w";;
465 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
466 build_warnings="${build_warnings} ${t}";;
467 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
468 build_warnings="${t} ${build_warnings}";;
469 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
d4f3574e
SS
470esac
471if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
472 echo "Setting warning flags = $build_warnings" 6>&1
473fi
104c1213
JM
474WARN_CFLAGS=""
475WERROR_CFLAGS=""
c906108c
SS
476if test "x${build_warnings}" != x -a "x$GCC" = xyes
477then
104c1213
JM
478 # Separate out the -Werror flag as some files just cannot be
479 # compiled with it enabled.
480 for w in ${build_warnings}; do
481 case $w in
482 -Werr*) WERROR_CFLAGS=-Werror ;;
483 *) WARN_CFLAGS="${WARN_CFLAGS} $w"
484 esac
485 done
d4f3574e
SS
486fi],[build_warnings=""])dnl
487
c906108c 488AC_SUBST(WARN_CFLAGS)
104c1213 489AC_SUBST(WERROR_CFLAGS)
c906108c
SS
490
491MMALLOC_CFLAGS=
492MMALLOC=
493AC_SUBST(MMALLOC_CFLAGS)
494AC_SUBST(MMALLOC)
495
496AC_ARG_WITH(mmalloc,
497[ --with-mmalloc Use memory mapped malloc package],
498[case "${withval}" in
499 yes) want_mmalloc=true ;;
500 no) want_mmalloc=false;;
501 *) AC_MSG_ERROR(bad value ${withval} for GDB with-mmalloc option) ;;
502esac],[want_mmalloc=false])dnl
503
504if test x$want_mmalloc = xtrue; then
505 AC_DEFINE(USE_MMALLOC)
506 AC_DEFINE(MMCHECK_FORCE)
507 MMALLOC_CFLAGS="-I$srcdir/../mmalloc"
508 MMALLOC='../mmalloc/libmmalloc.a'
509fi
510
88987551
L
511AC_ARG_WITH(included-regex,
512[ --with-included-regex Use included regex],
513[case "${withval}" in
514 yes) want_included_regex=true ;;
515 no) want_included_regex=false;;
516 *) AC_MSG_ERROR(bad value ${withval} for GDB with-included-regex option) ;;
517esac],[want_included_regex=true])dnl
518
519REGEX="gnu-regex.o"
520REGEX_CFLAGS="-DUSE_INCLUDED_REGEX"
521if test $want_included_regex = false; then
522 AC_MSG_CHECKING(for GNU regex)
523 AC_CACHE_VAL(gdb_cv_have_gnu_regex,
524[AC_TRY_COMPILE([#include <gnu-versions.h>
525#include <sys/types.h>
526#include <regex.h>],
527[#if !defined _GNU_REGEX_INTERFACE_VERSION || !defined __GLIBC__ || __GLIBC__ < 2
528#error No valid GNU regex.
529#endif
530],
531 [gdb_cv_have_gnu_regex=yes],
532 [gdb_cv_have_gnu_regex=no])])
533 AC_MSG_RESULT($gdb_cv_have_gnu_regex)
534 if test $gdb_cv_have_gnu_regex = yes; then
535 REGEX=
536 REGEX_CFLAGS=
537 fi
538fi
539AC_SUBST(REGEX)
540AC_SUBST(REGEX_CFLAGS)
7a292a7a
SS
541
542# In the Cygwin environment, we need some additional flags.
543AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
544[AC_EGREP_CPP(lose, [
545#if defined (__CYGWIN__) || defined (__CYGWIN32__)
546lose
547#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
548
549DLLTOOL=${DLLTOOL-dlltool}
550WINDRES=${WINDRES-windres}
551AC_SUBST(DLLTOOL)
552AC_SUBST(WINDRES)
553
c906108c 554dnl Figure out which term library to use.
b83266a0
SS
555if test x$gdb_host = xgo32; then
556 TERM_LIB=
557else
c906108c
SS
558if test x$gdb_cv_os_cygwin = xyes; then
559 TERM_LIB='`if test -r ../libtermcap/libtermcap.a; then echo ../libtermcap/libtermcap.a; else echo -ltermcap; fi`'
560else
561 TERM_LIB=
562 AC_CHECK_LIB(ncurses, tgetent, TERM_LIB=-lncurses,
563 AC_CHECK_LIB(Hcurses, tgetent, TERM_LIB=-lHcurses,
564 AC_CHECK_LIB(termlib, tgetent, TERM_LIB=-ltermlib,
565 AC_CHECK_LIB(termcap, tgetent, TERM_LIB=-ltermcap,
566 AC_CHECK_LIB(curses, tgetent, TERM_LIB=-lcurses,
567 AC_CHECK_LIB(terminfo, tgetent, TERM_LIB=-lterminfo))))))
568
569 if test "x$TERM_LIB" = x
570 then
571 AC_MSG_ERROR(Could not find a term library, e.g. termcap or termlib!)
572 fi
573fi
b83266a0 574fi
c906108c
SS
575AC_SUBST(TERM_LIB)
576
cd0fc7c3
SS
577# libreadline needs libuser32.a in a cygwin environment
578WIN32LIBS=
579if test x$gdb_cv_os_cygwin = xyes; then
c5394b80
JM
580 WIN32LIBS="-luser32"
581 case "${target}" in
582 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
583 ;;
584 esac
cd0fc7c3
SS
585fi
586AC_SUBST(WIN32LIBS)
7a292a7a 587
3fc11d3e
JM
588LIBGUI="../libgui/src/libgui.a"
589GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
590AC_SUBST(LIBGUI)
591AC_SUBST(GUI_CFLAGS_X)
7a292a7a 592
8b93c638
JM
593AC_ARG_WITH(cpu,
594[ --with-cpu=CPU Set the default CPU variant to debug],
595[case "${target}" in
596 powerpc-* | powerpcle-* )
597 ## It would be nice to keep this table in sync with the one in
598 ## gcc/configure.
599 case "${with_cpu}" in
600 ppc-uisa | rs6000 | 403 | 403GC | 505 | 860 | 601 | 602 | 603 \
601 | 604 | 750 )
602 ## Those are all handled in variants in rs6000-tdep.c, so they're fine.
603 ;;
604 common | power | power2 | rios | rios1 | rios2 | rsc | rsc1 )
605 ## These are all RS6000 variants, as far as GDB is concerned.
606 with_cpu=rs6000
607 ;;
608 603e | ec603e )
609 with_cpu=603
610 ;;
611 604e )
612 with_cpu=604
613 ;;
614 * )
615 AC_MSG_WARN(GDB: unknown --with-cpu value: \`${with_cpu}'; using \`ppc-uisa'.)
616 with_cpu=ppc-uisa
617 ;;
618 esac
619 ;;
620 * )
621 AC_MSG_WARN(GDB may ignore the --with-cpu flag for ${target} targets)
622 ;;
623esac
624AC_DEFINE_UNQUOTED(TARGET_CPU_DEFAULT, "${with_cpu}")
625],)
626
627
3fc11d3e
JM
628AC_ARG_ENABLE(gdbtk,
629[ --enable-gdbtk Enable GDBTK GUI front end],
630[case "${enableval}" in
631 yes)
632 case "$host" in
633 *go32*)
634 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
635 enable_gdbtk=no ;;
636 *windows*)
637 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
638 enable_gdbtk=no ;;
639 *)
640 enable_gdbtk=yes ;;
641 esac ;;
642 no)
643 enable_gdbtk=no ;;
644 *)
645 AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
646esac],
647[
648# Default is on for everything but go32 and Cygwin
649case "$host" in
650 *go32* | *windows*)
651 ;;
652 *)
379d6434
AC
653 if test -d "${srcdir}/gdbtk" ; then
654 enable_gdbtk=yes
655 fi
656 ;;
657esac
3fc11d3e
JM
658])
659
660WIN32LDAPP=
661AC_SUBST(WIN32LIBS)
662AC_SUBST(WIN32LDAPP)
663
664configdir="unix"
665
666GDBTKLIBS=
667if test "${enable_gdbtk}" = "yes"; then
668
669 CY_AC_PATH_TCLCONFIG
670 if test -z "${no_tcl}"; then
671 CY_AC_LOAD_TCLCONFIG
672 CY_AC_PATH_TKCONFIG
673
674 # If $no_tk is nonempty, then we can't do Tk, and there is no
675 # point to doing Tcl.
676 if test -z "${no_tk}"; then
677 CY_AC_LOAD_TKCONFIG
678 CY_AC_PATH_TCLH
679 CY_AC_PATH_TKH
680 CY_AC_PATH_ITCLH
681 CY_AC_PATH_ITKH
682 CY_AC_PATH_TIXH
683
684 # now look for Itcl library stuff
685
686 CY_AC_PATH_ITCLCONFIG
687 if test -z "${no_itcl}"; then
688 CY_AC_LOAD_ITCLCONFIG
689 case "${host}" in
690 *-*-cygwin*)
691 itcldir=../itcl/itcl/win/
692 ;;
693 *)
694 itcldir=../itcl/itcl/unix/
695 ;;
696 esac
697
698
699 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
700 ITCL_DEPS="${itcldir}${ITCL_LIB_FILE}"
701 fi
702
703
704 # now look for Itk library stuff
705 CY_AC_PATH_ITKCONFIG
706 if test -z "${no_itcl}"; then
707 CY_AC_LOAD_ITKCONFIG
708
709 case "${host}" in
710 *-*-cygwin*)
711 itkdir=../itcl/itk/win/
712 ;;
713 *)
714 itkdir=../itcl/itk/unix/
715 ;;
716 esac
717
718 ITKLIB="${ITK_BUILD_LIB_SPEC}"
719 ITK_DEPS="${itkdir}${ITK_LIB_FILE}"
720 fi
721
722 # now look for Tix library stuff
723 CY_AC_PATH_TIXCONFIG
724 if test -z "${no_tix}"; then
725 CY_AC_LOAD_TIXCONFIG
726 TIXLIB="${TIX_BUILD_LIB_SPEC}"
727 TIX_DEPS="${TIX_BUILD_LOCATION}/${TIX_LIB_FILE}"
728 fi
729
3fc11d3e
JM
730 ENABLE_CFLAGS="$ENABLE_CFLAGS -DGDBTK"
731 # Tcl/Tk 8.1 require -fwritable strings. I don't
732 # know whether 8.2 will or not, but I bet it will.
733 # I don't have to worry about 7.x since we don't support it.
734 GDBTK_CFLAGS=""
735 if test "$GCC" = "yes"; then
736 if test "$TCL_VERSION" != "8.0" ; then
737 GDBTK_CFLAGS="-fwritable-strings"
738 fi
739 fi
740
741 # Include some libraries that Tcl and Tk want.
742 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
743 CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
744 # Yes, the ordering seems wrong here. But it isn't.
745 # TK_LIBS is the list of libraries that need to be linked
746 # after Tcl/Tk. Note that this isn't put into LIBS. If it
747 # were in LIBS then any link tests after this point would
748 # try to include things like `$(LIBGUI)', which wouldn't work.
749 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
d45b9300
FN
750 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"
751 CONFIG_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-varobj.o gdbtk-wrapper.o"
752 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
753 CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)"
754 CONFIG_CLEAN="${CONFIG_ALL} \$(SUBDIR_GDBTK_CLEAN)"
e56ac5c3
AC
755 CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)"
756 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)"
3fc11d3e
JM
757
758 if test x$gdb_cv_os_cygwin = xyes; then
759 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
760 WIN32LDAPP="-Wl,--subsystem,console"
761 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
762 fi
763 fi
764 fi
765fi
766
3fc11d3e
JM
767AC_SUBST(X_CFLAGS)
768AC_SUBST(X_LDFLAGS)
769AC_SUBST(X_LIBS)
770AC_SUBST(ITCLLIB)
771AC_SUBST(ITCL_DEPS)
772AC_SUBST(ITKLIB)
773AC_SUBST(ITK_DEPS)
774AC_SUBST(TIXLIB)
775AC_SUBST(TIX_DEPS)
776AC_SUBST(GDBTKLIBS)
777AC_SUBST(GDBTK_CFLAGS)
8b93c638 778
c906108c
SS
779AC_PATH_X
780
7a292a7a
SS
781
782# Unlike the sim directory, whether a simulator is linked is controlled by
783# presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
784# This code just checks for a few cases where we'd like to ignore those
785# definitions, even when they're present in the '.mt' file. These cases
786# are when --disable-sim is specified, or if the simulator directory is
787# not part of the soruce tree.
788#
789AC_ARG_ENABLE(sim,
790[ --enable-sim Link gdb with simulator],
791[echo "enable_sim = $enable_sim";
792 echo "enableval = ${enableval}";
793 case "${enableval}" in
794 yes) ignore_sim=false ;;
795 no) ignore_sim=true ;;
796 *) ignore_sim=false ;;
797 esac],
798[ignore_sim=false])
799
800if test ! -d "${srcdir}/../sim"; then
801 ignore_sim=true
802fi
803
804if test "${ignore_sim}" = "true"; then
805 IGNORE_SIM="SIM="
806 IGNORE_SIM_OBS="SIM_OBS="
807else
808 IGNORE_SIM=""
809 IGNORE_SIM_OBS=""
810 AC_DEFINE(WITH_SIM)
811fi
812AC_SUBST(IGNORE_SIM)
813AC_SUBST(IGNORE_SIM_OBS)
814
c906108c
SS
815AC_SUBST(ENABLE_CFLAGS)
816
817AC_SUBST(CONFIG_OBS)
818AC_SUBST(CONFIG_DEPS)
819AC_SUBST(CONFIG_SRCS)
dfcd3bfb 820AC_SUBST(CONFIG_INITS)
b3a90332
AC
821AC_SUBST(CONFIG_ALL)
822AC_SUBST(CONFIG_CLEAN)
e56ac5c3
AC
823AC_SUBST(CONFIG_INSTALL)
824AC_SUBST(CONFIG_UNINSTALL)
c906108c
SS
825
826# Begin stuff to support --enable-shared
827AC_ARG_ENABLE(shared,
828[ --enable-shared Use shared libraries],
829[case "${enableval}" in
830 yes) shared=true ;;
831 no) shared=false ;;
832 *) shared=true ;;
833esac])dnl
834
835HLDFLAGS=
836HLDENV=
837# If we have shared libraries, try to set rpath reasonably.
838if test "${shared}" = "true"; then
839 case "${host}" in
840 *-*-hpux*)
841 HLDFLAGS='-Wl,+s,+b,$(libdir)'
842 ;;
843 *-*-irix5* | *-*-irix6*)
844 HLDFLAGS='-Wl,-rpath,$(libdir)'
845 ;;
846 *-*-linux*aout*)
847 ;;
d332c5ac 848 *-*-linux* | *-pc-linux-gnu*)
c906108c
SS
849 HLDFLAGS='-Wl,-rpath,$(libdir)'
850 ;;
851 *-*-solaris*)
852 HLDFLAGS='-R $(libdir)'
853 ;;
854 *-*-sysv4*)
855 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;'
856 ;;
857 esac
858fi
859
860# On SunOS, if the linker supports the -rpath option, use it to
861# prevent ../bfd and ../opcodes from being included in the run time
862# search path.
863case "${host}" in
864 *-*-sunos*)
865 echo 'main () { }' > conftest.c
866 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
867 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
868 :
869 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
870 :
871 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
872 :
873 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
874 :
875 elif test "${shared}" = "true"; then
876 HLDFLAGS='-Wl,-rpath=$(libdir)'
877 else
878 HLDFLAGS='-Wl,-rpath='
879 fi
880 rm -f conftest.t conftest.c conftest
881 ;;
882esac
883AC_SUBST(HLDFLAGS)
884AC_SUBST(HLDENV)
885# End stuff to support --enable-shared
886
887# target_subdir is used by the testsuite to find the target libraries.
888target_subdir=
889if test "${host}" != "${target}"; then
890 target_subdir="${target_alias}/"
891fi
892AC_SUBST(target_subdir)
893
894frags=
895host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
896if test ! -f ${host_makefile_frag}; then
897AC_MSG_ERROR("*** Gdb does not support host ${host}")
898fi
899frags="$frags $host_makefile_frag"
900
901target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
902if test ! -f ${target_makefile_frag}; then
903AC_MSG_ERROR("*** Gdb does not support target ${target}")
904fi
905frags="$frags $target_makefile_frag"
906
907AC_SUBST_FILE(host_makefile_frag)
908AC_SUBST_FILE(target_makefile_frag)
909AC_SUBST(frags)
910
911changequote(,)dnl
912hostfile=`sed -n '
913s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
914' ${host_makefile_frag}`
915
916targetfile=`sed -n '
917s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
918' ${target_makefile_frag}`
919
920# these really aren't orthogonal true/false values of the same condition,
921# but shells are slow enough that I like to reuse the test conditions
922# whenever possible
923if test "${target}" = "${host}"; then
924nativefile=`sed -n '
925s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
926' ${host_makefile_frag}`
927# else
928# GDBserver is only useful in a "native" enviroment
929# configdirs=`echo $configdirs | sed 's/gdbserver//'`
930fi
931changequote([,])
932
96baa820
JM
933SUBDIRS="doc testsuite nlm"
934if test "${enable_multi_ice}" = "yes"; then
935 SUBDIRS="${SUBDIRS} multi-ice"
936fi
937
938AC_SUBST(SUBDIRS)
939
c906108c
SS
940# If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
941# (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
942# corresponding links. But we have to remove the xm.h files and tm.h
943# files anyway, e.g. when switching from "configure host" to
944# "configure none".
945
946files=
947links=
948rm -f xm.h
949if test "${hostfile}" != ""; then
950files="${files} config/${gdb_host_cpu}/${hostfile}"
951links="${links} xm.h"
952fi
953rm -f tm.h
954if test "${targetfile}" != ""; then
955files="${files} config/${gdb_target_cpu}/${targetfile}"
956links="${links} tm.h"
957fi
958rm -f nm.h
959if test "${nativefile}" != ""; then
960files="${files} config/${gdb_host_cpu}/${nativefile}"
961links="${links} nm.h"
962else
963# A cross-only configuration.
964files="${files} config/nm-empty.h"
965links="${links} nm.h"
966fi
3fc11d3e 967AC_PROG_LN_S
c906108c
SS
968
969AC_LINK_FILES($files, $links)
970
971dnl Check for exe extension set on certain hosts (e.g. Win32)
972AC_EXEEXT
973
974AC_CONFIG_SUBDIRS($configdirs)
975AC_OUTPUT(Makefile tui/Makefile .gdbinit:gdbinit.in,
976[
977dnl Autoconf doesn't provide a mechanism for modifying definitions
978dnl provided by makefile fragments.
979dnl
980if test "${nativefile}" = ""; then
981sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
982 < Makefile > Makefile.tem
983mv -f Makefile.tem Makefile
984fi
985
986changequote(,)dnl
987sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
988/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
989/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
990mv -f Makefile.tmp Makefile
991changequote([,])dnl
992
2acceee2 993
c906108c
SS
994case x$CONFIG_HEADERS in
995xconfig.h:config.in)
996echo > stamp-h ;;
997esac
998],
999[
1000gdb_host_cpu=$gdb_host_cpu
1001gdb_target_cpu=$gdb_target_cpu
1002nativefile=$nativefile
1003])
1004
1005exit 0
This page took 0.11751 seconds and 4 git commands to generate.