Use ACX_NONCANONICAL_TARGET in gdb/configure
[deliverable/binutils-gdb.git] / gdb / configure.ac
CommitLineData
c906108c 1dnl Autoconf configure script for GDB, the GNU debugger.
3666a048 2dnl Copyright (C) 1995-2021 Free Software Foundation, Inc.
c906108c
SS
3dnl
4dnl This file is part of GDB.
4869db5e 5dnl
c906108c
SS
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
5a0e3bd0 8dnl the Free Software Foundation; either version 3 of the License, or
c906108c 9dnl (at your option) any later version.
5a0e3bd0 10dnl
c906108c
SS
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.
5a0e3bd0 15dnl
c906108c 16dnl You should have received a copy of the GNU General Public License
5a0e3bd0 17dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c
SS
18
19dnl Process this file with autoconf to produce a configure script.
20
0d79cdc4
AM
21m4_include(../config/debuginfod.m4)
22
5593a99a
SM
23AC_INIT
24AC_CONFIG_SRCDIR([main.c])
c5adaa19 25AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h])
413ccac7 26AM_MAINTAINER_MODE
c906108c
SS
27
28AC_PROG_CC
3bc3d82a
PA
29AC_PROG_CXX
30
c462b41b 31AC_USE_SYSTEM_EXTENSIONS
da2f07f1 32ACX_LARGEFILE
4869db5e 33AM_PROG_INSTALL_STRIP
c906108c 34
e28b3332 35AC_CONFIG_AUX_DIR(..)
91e1a0ed
SM
36
37# Set build, build_cpu, build_vendor and build_os.
38AC_CANONICAL_BUILD
39
40# Set host, host_cpu, host_vendor, and host_os.
41AC_CANONICAL_HOST
42
43# Set target, target_cpu, target_vendor, and target_os.
44AC_CANONICAL_TARGET
45
b316465f
TT
46ACX_NONCANONICAL_TARGET
47
9009e1ae 48AC_ARG_PROGRAM
c906108c 49
0bcda685
PA
50# We require a C++11 compiler. Check if one is available, and if
51# necessary, set CXX_DIALECT to some -std=xxx switch.
52AX_CXX_COMPILE_STDCXX(11, , mandatory)
53
a417dc56
RW
54# Dependency checking.
55ZW_CREATE_DEPDIR
56ZW_PROG_COMPILER_DEPENDENCIES([CC])
57
ddc9cd0f
AC
58dnl List of object files and targets accumulated by configure.
59
60CONFIG_OBS=
61CONFIG_DEPS=
62CONFIG_SRCS=
63ENABLE_CFLAGS=
64
65CONFIG_ALL=
66CONFIG_CLEAN=
67CONFIG_INSTALL=
68CONFIG_UNINSTALL=
69
20e95c23
DJ
70dnl Set up for gettext.
71ZW_GNU_GETTEXT_SISTER_DIR
ddc9cd0f
AC
72
73localedir='${datadir}/locale'
74AC_SUBST(localedir)
75
20e95c23 76if test x"$USE_NLS" = xyes; then
ddc9cd0f 77 CONFIG_ALL="$CONFIG_ALL all-po"
4869db5e 78 CONFIG_CLEAN="$CONFIG_CLEAN clean-po"
ddc9cd0f
AC
79 CONFIG_INSTALL="$CONFIG_INSTALL install-po"
80 CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po"
81fi
82
83PACKAGE=gdb
84AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
85AC_SUBST(PACKAGE)
0fbb3da7 86
f06e05e0
JK
87# We never need to detect it in this sub-configure.
88# But preserve it for config.status --recheck.
89AC_ARG_VAR(MAKEINFO,
90 [Parent configure detects if it is of sufficient version.])
91AC_ARG_VAR(MAKEINFOFLAGS,
92 [Parameters for MAKEINFO.])
5048e516
JK
93
94MAKEINFO_EXTRA_FLAGS=""
95AC_CACHE_CHECK([whether $MAKEINFO supports @click], gdb_cv_have_makeinfo_click,
96 [echo '@clicksequence{a @click{} b}' >conftest.texinfo
97 if eval "$MAKEINFO conftest.texinfo >&5 2>&5"; then
98 gdb_cv_have_makeinfo_click=yes
99 else
100 gdb_cv_have_makeinfo_click=no
101 fi])
102if test x"$gdb_cv_have_makeinfo_click" = xyes; then
103 MAKEINFO_EXTRA_FLAGS="$MAKEINFO_EXTRA_FLAGS -DHAVE_MAKEINFO_CLICK"
104fi
105AC_SUBST(MAKEINFO_EXTRA_FLAGS)
106
b14b1491
TT
107GDB_AC_WITH_DIR(DEBUGDIR, separate-debug-dir,
108 [look for global separate debug info in this path @<:@LIBDIR/debug@:>@],
109 [${libdir}/debug])
110
f83d8a90
DE
111# We can't pass paths as command line arguments.
112# Mingw32 tries to be clever and will convert the paths for us.
113# For example -DBINDIR="/usr/local/bin" passed on the command line may get
114# converted to -DBINDIR="E:/msys/mingw32/msys/1.0/local/bin".
115# This breaks GDB's relocatable path conversions since paths passed in
116# config.h would not get so translated, the path prefixes no longer match.
117AC_DEFINE_DIR(BINDIR, bindir, [Directory of programs.])
118
b14b1491
TT
119# GDB's datadir relocation
120
121GDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir,
122 [look for global separate data files in this path @<:@DATADIR/gdb@:>@],
123 [${datadir}/gdb])
aa28a74e 124
29b0e8a2 125AC_ARG_WITH(relocated-sources,
d2596e2e 126AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this path for source files]),
29b0e8a2
JM
127[reloc_srcdir="${withval}"
128 AC_DEFINE_DIR(RELOC_SRCDIR, reloc_srcdir,
129 [Relocated directory for source files. ])
130])
131
7349ff92
JK
132AC_MSG_CHECKING([for default auto-load directory])
133AC_ARG_WITH(auto-load-dir,
134AS_HELP_STRING([--with-auto-load-dir=PATH],
1564a261
JK
135 [directories from which to load auto-loaded scripts @<:@$debugdir:$datadir/auto-load@:>@]),,
136 [with_auto_load_dir='$debugdir:$datadir/auto-load'])
2861ee4f 137escape_dir=`echo $with_auto_load_dir | sed -e 's/[[$]]datadir\>/\\\\\\\\\\\\&/g' -e 's/[[$]]debugdir\>/\\\\\\\\\\\\&/g'`
7349ff92
JK
138AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
139 [Directories from which to load auto-loaded scripts.])
140AC_MSG_RESULT([$with_auto_load_dir])
141
bccbefd2
JK
142AC_MSG_CHECKING([for default auto-load safe-path])
143AC_ARG_WITH(auto-load-safe-path,
6dea1fbd 144AS_HELP_STRING([--with-auto-load-safe-path=PATH],
aff139ff 145 [directories safe to hold auto-loaded files @<:@--with-auto-load-dir@:>@])
6dea1fbd
JK
146AS_HELP_STRING([--without-auto-load-safe-path],
147 [do not restrict auto-loaded files locations]),
148 [if test "$with_auto_load_safe_path" = "no"; then
149 with_auto_load_safe_path="/"
150 fi],
7349ff92 151[with_auto_load_safe_path="$with_auto_load_dir"])
2861ee4f 152escape_dir=`echo $with_auto_load_safe_path | sed -e 's/[[$]]datadir\>/\\\\\\\\\\\\&/g' -e 's/[[$]]debugdir\>/\\\\\\\\\\\\&/g'`
6dea1fbd 153AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
bccbefd2
JK
154 [Directories safe to hold auto-loaded files.])
155AC_MSG_RESULT([$with_auto_load_safe_path])
156
f99d1d37
TT
157# Enable shared libraries.
158AC_ARG_ENABLE(shared,
ba56237d 159AS_HELP_STRING([--enable-shared], [build shared libraries [default=yes]]),,
f99d1d37
TT
160 enable_shared=yes)
161
162# If we have shared libraries, try to set RPATH_ENVVAR reasonably,
163# such that we can find the shared libraries in the build tree.
164if test $enable_shared = no; then
165 # The variable `RPATH_ENVVAR' itself is not likely to be used on any
166 # platform.
167 RPATH_ENVVAR=RPATH_ENVVAR
168else
169 # The variable `LD_LIBRARY_PATH' is used on most platforms.
170 RPATH_ENVVAR=LD_LIBRARY_PATH
171 # The following exceptions are taken from Libtool 1.4.3.
172 case $host_os in
173 aix*)
174 if test $host_cpu != ia64; then
175 RPATH_ENVVAR=LIBPATH
176 fi ;;
177 darwin* | rhapsody*)
178 RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
179 esac
180fi
181AC_SUBST(RPATH_ENVVAR)
96baa820 182
d0c678e6
UW
183# Check whether to support alternative target configurations
184AC_ARG_ENABLE(targets,
d2596e2e 185AS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
d0c678e6 186[case "${enableval}" in
5593a99a 187 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
d0c678e6
UW
188 ;;
189 no) enable_targets= ;;
190 *) enable_targets=$enableval ;;
191esac])
192
c0993dbe
UW
193# Check whether to enable 64-bit support on 32-bit hosts
194AC_ARG_ENABLE(64-bit-bfd,
d2596e2e 195AS_HELP_STRING([--enable-64-bit-bfd], [64-bit support (on hosts with narrower word sizes)]),
c0993dbe
UW
196[case "${enableval}" in
197 yes) want64=true ;;
198 no) want64=false ;;
199 *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
200esac],[want64=false])dnl
201
121ce6e5
DJ
202# Provide defaults for some variables set by the per-host and per-target
203# configuration.
204gdb_host_obs=posix-hdep.o
205
771b4502
UW
206if test "${target}" = "${host}"; then
207 gdb_native=yes
208else
209 gdb_native=no
210fi
211
27e9bf90 212. $srcdir/configure.host
c906108c 213
d0c678e6
UW
214# Accumulate some settings from configure.tgt over all enabled targets
215
216TARGET_OBS=
217all_targets=
b292c783 218HAVE_NATIVE_GCORE_TARGET=
d0c678e6
UW
219
220for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
221do
222 if test "$targ_alias" = "all"; then
223 all_targets=true
224 else
225 # Canonicalize the secondary target names.
226 result=`$ac_config_sub $targ_alias 2>/dev/null`
227 if test -n "$result"; then
228 targ=$result
229 else
230 targ=$targ_alias
231 fi
232
233 . ${srcdir}/configure.tgt
234
bf307134
JB
235 AS_IF([test -z "${gdb_target_obs}"],
236 [AC_MSG_ERROR([configuration ${targ} is unsupported.])])
237
d0c678e6
UW
238 # Target-specific object files
239 for i in ${gdb_target_obs}; do
240 case " $TARGET_OBS " in
241 *" ${i} "*) ;;
242 *)
243 TARGET_OBS="$TARGET_OBS ${i}"
244 ;;
245 esac
246 done
c0993dbe
UW
247
248 # Check whether this target needs 64-bit CORE_ADDR
249 if test x${want64} = xfalse; then
250 . ${srcdir}/../bfd/config.bfd
251 fi
b292c783
JK
252
253 # Check whether this target is native and supports gcore.
254 if test $gdb_native = yes -a "$targ_alias" = "$target_alias" \
255 && $gdb_have_gcore; then
256 HAVE_NATIVE_GCORE_TARGET=1
257 fi
d0c678e6
UW
258 fi
259done
260
261if test x${all_targets} = xtrue; then
c0993dbe
UW
262
263 # We want all 64-bit targets if we either:
264 # - run on a 64-bit host or
265 # - already require 64-bit support for some other target or
266 # - the --enable-64-bit-bfd option was supplied
267 # Otherwise we only support all 32-bit targets.
268 #
269 # NOTE: This test must be in sync with the corresponding
270 # tests in BFD!
271
272 if test x${want64} = xfalse; then
273 AC_CHECK_SIZEOF(long)
274 if test "x${ac_cv_sizeof_long}" = "x8"; then
275 want64=true
276 fi
277 fi
278 if test x${want64} = xtrue; then
279 TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
280 else
281 TARGET_OBS='$(ALL_TARGET_OBS)'
282 fi
d0c678e6
UW
283fi
284
285AC_SUBST(TARGET_OBS)
b292c783 286AC_SUBST(HAVE_NATIVE_GCORE_TARGET)
d0c678e6
UW
287
288# For other settings, only the main target counts.
289gdb_sim=
290gdb_osabi=
d0c678e6 291targ=$target; . ${srcdir}/configure.tgt
c906108c 292
27e9bf90
MK
293# Fetch the default architecture and default target vector from BFD.
294targ=$target; . $srcdir/../bfd/config.bfd
5c8cc331 295
27e9bf90
MK
296# We only want the first architecture, so strip off the others if
297# there is more than one.
298targ_archs=`echo $targ_archs | sed 's/ .*//'`
5c8cc331 299
27e9bf90
MK
300if test "x$targ_archs" != x; then
301 AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
302 [Define to BFD's default architecture. ])
1ba607ad 303fi
27e9bf90
MK
304if test "x$targ_defvec" != x; then
305 AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
306 [Define to BFD's default target vector. ])
1ba607ad
AC
307fi
308
627af7ea
MK
309# Enable MI.
310AC_ARG_ENABLE(gdbmi,
d2596e2e 311AS_HELP_STRING([--disable-gdbmi], [disable machine-interface (MI)]),
627af7ea
MK
312 [case $enableval in
313 yes | no)
314 ;;
315 *)
316 AC_MSG_ERROR([bad value $enableval for --enable-gdbmi]) ;;
317 esac],
318 [enable_gdbmi=yes])
319if test x"$enable_gdbmi" = xyes; then
0ad6b8ee 320 if test -d "$srcdir/mi"; then
627af7ea
MK
321 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
322 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
323 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
627af7ea 324 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
627af7ea
MK
325 fi
326fi
327
287c1a40
MK
328# Enable TUI.
329AC_ARG_ENABLE(tui,
d2596e2e 330AS_HELP_STRING([--enable-tui], [enable full-screen terminal user interface (TUI)]),
287c1a40 331 [case $enableval in
3ca64bd3 332 yes | no | auto)
287c1a40
MK
333 ;;
334 *)
335 AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
3ca64bd3 336 esac],enable_tui=auto)
287c1a40 337
8ee53726
MK
338# Enable gdbtk.
339AC_ARG_ENABLE(gdbtk,
d2596e2e 340AS_HELP_STRING([--enable-gdbtk], [enable gdbtk graphical user interface (GUI)]),
8ee53726
MK
341 [case $enableval in
342 yes | no)
343 ;;
344 *)
345 AC_MSG_ERROR([bad value $enableval for --enable-gdbtk]) ;;
346 esac],
0ad6b8ee 347 [if test -d "$srcdir/gdbtk"; then
8ee53726
MK
348 enable_gdbtk=yes
349 else
350 enable_gdbtk=no
351 fi])
352# We unconditionally disable gdbtk tests on selected platforms.
353case $host_os in
354 go32* | windows*)
355 AC_MSG_WARN([gdbtk isn't supported on $host; disabling])
356 enable_gdbtk=no ;;
357esac
358
0d79cdc4
AM
359# Handle optional debuginfod support
360AC_DEBUGINFOD
05e7c244 361
0d79cdc4 362# Libunwind support for ia64.
05e7c244
JK
363AC_ARG_WITH(libunwind-ia64,
364AS_HELP_STRING([--with-libunwind-ia64],
365 [use libunwind frame unwinding for ia64 targets]),,
366 [with_libunwind_ia64=auto])
367
368# Backward compatibility option.
369if test "${with_libunwind+set}" = set; then
370 if test x"$with_libunwind_ia64" != xauto; then
371 AC_MSG_ERROR(
372 [option --with-libunwind is deprecated, use --with-libunwind-ia64])
0e5d83e3 373 fi
05e7c244
JK
374 AC_MSG_WARN([option --with-libunwind is deprecated, use --with-libunwind-ia64])
375 with_libunwind_ia64="$with_libunwind"
376fi
377
378case "$with_libunwind_ia64" in
379 yes | no)
380 ;;
381 auto)
382 AC_CHECK_HEADERS(libunwind-ia64.h)
383 with_libunwind_ia64=$ac_cv_header_libunwind_ia64_h
384 ;;
385 *)
386 AC_MSG_ERROR(
387 [bad value $with_libunwind_ia64 for GDB --with-libunwind-ia64 option])
388 ;;
389esac
390
391if test x"$with_libunwind_ia64" = xyes; then
b54a8fd7 392 AC_CHECK_HEADERS(libunwind-ia64.h)
05e7c244
JK
393 if test x"$ac_cv_header_libunwind_ia64_h" != xyes; then
394 AC_MSG_ERROR([GDB option --with-libunwind-ia64 requires libunwind-ia64.h])
395 fi
396 CONFIG_OBS="$CONFIG_OBS ia64-libunwind-tdep.o"
397 CONFIG_DEPS="$CONFIG_DEPS ia64-libunwind-tdep.o"
398 CONFIG_SRCS="$CONFIG_SRCS ia64-libunwind-tdep.c"
0e5d83e3
JJ
399fi
400
cb01cfba 401opt_curses=no
d2596e2e 402AC_ARG_WITH(curses, AS_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
cb01cfba 403
76a39ba7 404prefer_curses=no
cb01cfba 405if test "$opt_curses" = "yes"; then
76a39ba7 406 prefer_curses=yes
cb01cfba
JB
407fi
408
d28f9cdf
DJ
409# Profiling support.
410AC_ARG_ENABLE(profiling,
d2596e2e 411AS_HELP_STRING([--enable-profiling], [enable profiling of GDB]),
d28f9cdf
DJ
412 [case $enableval in
413 yes | no)
414 ;;
415 *)
416 AC_MSG_ERROR([bad value $enableval for --enable-profile]) ;;
417 esac],
418 [enable_profiling=no])
419
d9feb4e7 420AC_CHECK_FUNCS(monstartup _mcleanup)
5593a99a
SM
421AC_CACHE_CHECK(
422 [for _etext],
423 [ac_cv_var__etext],
424 [AC_LINK_IFELSE(
425 [AC_LANG_PROGRAM(
426 [#include <stdlib.h>
427 extern char _etext;],
428 [free (&_etext);]
429 )],
430 [ac_cv_var__etext=yes],
431 [ac_cv_var__etext=no]
432 )]
433)
0ad6b8ee 434if test "$ac_cv_var__etext" = yes; then
b0b1c2c0
MK
435 AC_DEFINE(HAVE__ETEXT, 1,
436 [Define to 1 if your system has the _etext variable. ])
437fi
5593a99a
SM
438AC_CACHE_CHECK(
439 [for etext],
440 [ac_cv_var_etext],
441 [AC_LINK_IFELSE(
442 [AC_LANG_PROGRAM(
443 [#include <stdlib.h>
444 extern char etext;],
445 [free (&etext);]
446 )],
447 [ac_cv_var_etext=yes],
448 [ac_cv_var_etext=no]
449 )]
450)
0ad6b8ee 451if test "$ac_cv_var_etext" = yes; then
01fe12f6
JB
452 AC_DEFINE(HAVE_ETEXT, 1,
453 [Define to 1 if your system has the etext variable. ])
454fi
d28f9cdf 455if test "$enable_profiling" = yes ; then
0ad6b8ee 456 if test "$ac_cv_func_monstartup" = no || test "$ac_cv_func__mcleanup" = no; then
d9feb4e7
DJ
457 AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
458 fi
d28f9cdf
DJ
459 PROFILE_CFLAGS=-pg
460 OLD_CFLAGS="$CFLAGS"
461 CFLAGS="$CFLAGS $PROFILE_CFLAGS"
462
5593a99a
SM
463 AC_CACHE_CHECK(
464 [whether $CC supports -pg],
465 [ac_cv_cc_supports_pg],
466 [AC_COMPILE_IFELSE(
467 [AC_LANG_PROGRAM([], [int x;])],
468 [ac_cv_cc_supports_pg=yes],
469 [ac_cv_cc_supports_pg=no]
470 )]
471 )
d28f9cdf 472
0ad6b8ee 473 if test "$ac_cv_cc_supports_pg" = no; then
d9feb4e7
DJ
474 AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
475 fi
d28f9cdf
DJ
476
477 CFLAGS="$OLD_CFLAGS"
478fi
479
44cee4fd
TT
480CODESIGN_CERT=
481AC_ARG_ENABLE([codesign],
482 AS_HELP_STRING([--enable-codesign=CERT],
483 [sign gdb with 'codesign -s CERT']),
484 [CODESIGN_CERT=$enableval])
485AC_SUBST([CODESIGN_CERT])
486
c16158bc 487ACX_PKGVERSION([GDB])
112c22ed 488ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
c16158bc
JM
489AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
490AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
491
8bb2c122
MK
492# --------------------- #
493# Checks for programs. #
494# --------------------- #
495
7a292a7a 496AC_PROG_AWK
c906108c 497AC_PROG_INSTALL
8bb2c122
MK
498AC_PROG_LN_S
499AC_PROG_RANLIB
500AC_PROG_YACC
501
c906108c 502AC_CHECK_TOOL(AR, ar)
95ca63c4
CF
503AC_CHECK_TOOL(DLLTOOL, dlltool)
504AC_CHECK_TOOL(WINDRES, windres)
c906108c 505
036c3acb
TS
506case $host_os in
507 gnu*)
508 # Needed for GNU Hurd hosts.
509 AC_CHECK_TOOL(MIG, mig)
510 if test x"$MIG" = x; then
511 AC_MSG_ERROR([MIG not found but required for $host hosts])
512 fi
513 ;;
514esac
75c6e08a 515
9a156167
MK
516# ---------------------- #
517# Checks for libraries. #
518# ---------------------- #
519
520# We might need to link with -lm; most simulators need it.
521AC_CHECK_LIB(m, main)
522
c890192f
MK
523# Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
524AC_SEARCH_LIBS(gethostbyname, nsl)
525
9a156167
MK
526# Some systems (e.g. Solaris) have `socketpair' in libsocket.
527AC_SEARCH_LIBS(socketpair, socket)
528
233a11ab 529# Link in zlib if we can. This allows us to read compressed debug sections.
b040ad30 530AM_ZLIB
233a11ab 531
6c7a06a3
TT
532AM_ICONV
533
478aac75
DE
534# GDB may fork/exec the iconv program to get the list of supported character
535# sets. Allow the user to specify where to find it.
536# There are several factors affecting the choice of option name:
537# - There is already --with-libiconv-prefix but we can't use it, it specifies
538# the build-time location of libiconv files.
539# - The program we need to find is iconv, which comes with glibc. The user
540# doesn't necessarily have libiconv installed. Therefore naming this
541# --with-libiconv-foo feels wrong.
542# - We want the path to be relocatable, but GDB_AC_DEFINE_RELOCATABLE is
543# defined to work on directories not files (though it really doesn't know
544# the difference).
545# - Calling this --with-iconv-prefix is perceived to cause too much confusion
546# with --with-libiconv-prefix.
547# Putting these together is why the option name is --with-iconv-bin.
548
549AC_ARG_WITH(iconv-bin,
550AS_HELP_STRING([--with-iconv-bin=PATH], [specify where to find the iconv program]),
551[iconv_bin="${withval}"
552 AC_DEFINE_UNQUOTED([ICONV_BIN], ["${iconv_bin}"],
553 [Path of directory of iconv program.])
554 GDB_AC_DEFINE_RELOCATABLE(ICONV_BIN, iconv, ${iconv_bin})
555])
556
cb01cfba 557# For the TUI, we need enhanced curses functionality.
bd8a8e1b 558if test x"$enable_tui" != xno; then
cb01cfba
JB
559 prefer_curses=yes
560fi
561
562curses_found=no
563if test x"$prefer_curses" = xyes; then
564 # FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
565 # curses library because the latter might not provide all the
566 # functionality we need. However, this leads to problems on systems
567 # where the linker searches /usr/local/lib, but the compiler doesn't
568 # search /usr/local/include, if ncurses is installed in /usr/local. A
569 # default installation of ncurses on alpha*-dec-osf* will lead to such
570 # a situation.
5007d765 571 AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses])
cb01cfba
JB
572
573 if test "$ac_cv_search_waddstr" != no; then
574 curses_found=yes
575 fi
576fi
577
77f120bf
JB
578# Check whether we should enable the TUI, but only do so if we really
579# can.
580if test x"$enable_tui" != xno; then
0ad6b8ee 581 if test -d "$srcdir/tui"; then
cb01cfba 582 if test "$curses_found" != no; then
77f120bf
JB
583 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
584 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
585 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
586 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
77f120bf
JB
587 else
588 if test x"$enable_tui" = xyes; then
589 AC_MSG_ERROR([no enhanced curses library found; disable TUI])
590 else
591 AC_MSG_WARN([no enhanced curses library found; disabling TUI])
592 fi
593 fi
594 fi
595fi
596
4f0be353
MK
597# Since GDB uses Readline, we need termcap functionality. In many
598# cases this will be provided by the curses library, but some systems
96fe4562 599# have a separate termcap library, or no curses library at all.
287c1a40
MK
600
601case $host_os in
602 cygwin*)
0ad6b8ee 603 if test -d "$srcdir/libtermcap"; then
287c1a40
MK
604 LIBS="../libtermcap/libtermcap.a $LIBS"
605 ac_cv_search_tgetent="../libtermcap/libtermcap.a"
606 fi ;;
228a417c 607 go32* | *djgpp*)
287c1a40
MK
608 ac_cv_search_tgetent="none required"
609 ;;
287c1a40
MK
610esac
611
4f0be353 612# These are the libraries checked by Readline.
2578ecb1 613AC_SEARCH_LIBS(tgetent, [termcap tinfow tinfo curses ncursesw ncurses])
287c1a40
MK
614
615if test "$ac_cv_search_tgetent" = no; then
7a85168d 616 CONFIG_OBS="$CONFIG_OBS stub-termcap.o"
287c1a40
MK
617fi
618
6a30b0a5
AS
619AC_ARG_WITH([system-readline],
620 [AS_HELP_STRING([--with-system-readline],
621 [use installed readline library])])
622
623if test "$with_system_readline" = yes; then
5593a99a
SM
624 AC_CACHE_CHECK(
625 [whether system readline is new enough],
626 [gdb_cv_readline_ok],
627 [AC_COMPILE_IFELSE(
628 [AC_LANG_PROGRAM(
629 [#include <stdio.h>
630 #include <readline/readline.h>],
631 [#if RL_VERSION_MAJOR < 7
632 # error "readline version 7 required"
633 #endif]
634 )],
635 [gdb_cv_readline_ok=yes],
636 [gdb_cv_readline_ok=no]
637 )]
638 )
86c6b807
TT
639 if test "$gdb_cv_readline_ok" != yes; then
640 AC_MSG_ERROR([system readline is not new enough])
641 fi
642
6a30b0a5
AS
643 READLINE=-lreadline
644 READLINE_DEPS=
645 READLINE_CFLAGS=
39037522 646 READLINE_TEXI_INCFLAG=
6a30b0a5
AS
647else
648 READLINE='$(READLINE_DIR)/libreadline.a'
649 READLINE_DEPS='$(READLINE)'
650 READLINE_CFLAGS='-I$(READLINE_SRC)/..'
39037522 651 READLINE_TEXI_INCFLAG='-I $(READLINE_DIR)'
6a30b0a5
AS
652fi
653AC_SUBST(READLINE)
654AC_SUBST(READLINE_DEPS)
655AC_SUBST(READLINE_CFLAGS)
39037522 656AC_SUBST(READLINE_TEXI_INCFLAG)
6a30b0a5 657
f997c383
SD
658# Generate jit-reader.h
659
660# This is typedeffed to GDB_CORE_ADDR in jit-reader.h
661TARGET_PTR=
662
663AC_CHECK_SIZEOF(unsigned long long)
664AC_CHECK_SIZEOF(unsigned long)
665AC_CHECK_SIZEOF(unsigned __int128)
666
667if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
668 TARGET_PTR="unsigned long"
669elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
670 TARGET_PTR="unsigned long long"
671elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
672 TARGET_PTR="unsigned __int128"
673else
674 TARGET_PTR="unsigned long"
675fi
676
677AC_SUBST(TARGET_PTR)
678AC_CONFIG_FILES([jit-reader.h:jit-reader.in])
679
a2d08b9e
SD
680AC_SEARCH_LIBS(dlopen, dl)
681
b8e0a31c
SD
682GDB_AC_WITH_DIR([JIT_READER_DIR], [jit-reader-dir],
683 [directory to load the JIT readers from],
684 [${libdir}/gdb])
685
5c39566f
DJ
686AC_ARG_WITH(expat,
687 AS_HELP_STRING([--with-expat], [include expat support (auto/yes/no)]),
688 [], [with_expat=auto])
689AC_MSG_CHECKING([whether to use expat])
690AC_MSG_RESULT([$with_expat])
691
692if test "${with_expat}" = no; then
693 AC_MSG_WARN([expat support disabled; some features may be unavailable.])
694 HAVE_LIBEXPAT=no
ca4ca11e 695else
5c39566f
DJ
696 AC_LIB_HAVE_LINKFLAGS([expat], [], [#include "expat.h"],
697 [XML_Parser p = XML_ParserCreate (0);])
698 if test "$HAVE_LIBEXPAT" != yes; then
699 if test "$with_expat" = yes; then
700 AC_MSG_ERROR([expat is missing or unusable])
701 else
702 AC_MSG_WARN([expat is missing or unusable; some features may be unavailable.])
703 fi
704 else
705 save_LIBS=$LIBS
706 LIBS="$LIBS $LIBEXPAT"
707 AC_CHECK_FUNCS(XML_StopParser)
708 LIBS=$save_LIBS
709 fi
7fa2210b
DJ
710fi
711
2c947d9b
JB
712# Verify that we have a usable GMP library.
713AC_LIB_HAVE_LINKFLAGS([gmp], [], [#include <gmp.h>],
714 [mpz_t n;
715 mpz_init (n);])
1b4ac058
JB
716if test "$HAVE_LIBGMP" != yes; then
717 AC_MSG_ERROR([GMP is missing or unusable])
718fi
2c947d9b 719
2400729e
UW
720AC_ARG_WITH(mpfr,
721 AS_HELP_STRING([--with-mpfr], [include MPFR support (auto/yes/no)]),
722 [], [with_mpfr=auto])
723AC_MSG_CHECKING([whether to use MPFR])
724AC_MSG_RESULT([$with_mpfr])
725
726if test "${with_mpfr}" = no; then
727 AC_MSG_WARN([MPFR support disabled; some features may be unavailable.])
728 HAVE_LIBMPFR=no
729else
da658607 730 AC_LIB_HAVE_LINKFLAGS([mpfr], [gmp], [#include <mpfr.h>],
2400729e
UW
731 [mpfr_exp_t exp; mpfr_t x;
732 mpfr_frexp (&exp, x, x, MPFR_RNDN);])
733 if test "$HAVE_LIBMPFR" != yes; then
734 if test "$with_mpfr" = yes; then
735 AC_MSG_ERROR([MPFR is missing or unusable])
736 else
737 AC_MSG_WARN([MPFR is missing or unusable; some features may be unavailable.])
738 fi
739 fi
740fi
741
d344e670
DE
742# --------------------- #
743# Check for libpython. #
744# --------------------- #
745
d57a3c85 746dnl Utility to simplify finding libpython.
71737c43 747dnl $1 = the shell variable to assign the result to
ec685c5e 748dnl If libpython is found we store $version here.
71737c43
CB
749dnl $2 = additional flags to add to CPPFLAGS
750dnl $3 = additional flags to add to LIBS
ec685c5e 751
d57a3c85
TJB
752AC_DEFUN([AC_TRY_LIBPYTHON],
753[
71737c43
CB
754 define([have_libpython_var],$1)
755 new_CPPFLAGS=$2
756 new_LIBS=$3
757 AC_MSG_CHECKING([for python])
ec685c5e 758 save_CPPFLAGS=$CPPFLAGS
d57a3c85 759 save_LIBS=$LIBS
ec685c5e 760 CPPFLAGS="$CPPFLAGS $new_CPPFLAGS"
bf27f0e2 761 LIBS="$new_LIBS $LIBS"
ec685c5e 762 found_usable_python=no
d0ac1c44
SM
763 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "Python.h"]],
764 [[Py_Initialize ();]])],
71737c43 765 [have_libpython_var=yes
ac534cba
JB
766 found_usable_python=yes
767 PYTHON_CPPFLAGS=$new_CPPFLAGS
768 PYTHON_LIBS=$new_LIBS])
769 CPPFLAGS=$save_CPPFLAGS
770 LIBS=$save_LIBS
ec685c5e 771 AC_MSG_RESULT([${found_usable_python}])
d57a3c85
TJB
772])
773
0c4a4063
DE
774dnl There are several different values for --with-python:
775dnl
776dnl no - Don't include python support.
777dnl yes - Include python support, error if it's missing.
778dnl If we find python in $PATH, use it to fetch configure options,
779dnl otherwise assume the compiler can find it with no help from us.
6c28e44a 780dnl Python 2.7 and 2.6 are tried in turn.
0c4a4063
DE
781dnl auto - Same as "yes", but if python is missing from the system,
782dnl fall back to "no".
783dnl /path/to/python/exec-prefix -
784dnl Use the python located in this directory.
785dnl If /path/to/python/exec-prefix/bin/python exists, use it to find
786dnl the compilation parameters. Otherwise use
787dnl -I/path/to/python/exec-prefix/include,
788dnl -L/path/to/python/exec-prefix/lib.
6c28e44a 789dnl Python 2.7 and 2.6 are tried in turn.
0c4a4063
DE
790dnl NOTE: This case is historical. It is what was done for 7.0/7.1
791dnl but is deprecated.
792dnl /path/to/python/executable -
793dnl Run python-config.py with this version of python to fetch the
794dnl compilation parameters.
795dnl NOTE: This needn't be the real python executable.
796dnl In a cross-compilation scenario (build != host), this could be
797dnl a shell script that provides what python-config.py provides for
798dnl --ldflags, --includes, --exec-prefix.
799dnl python-executable -
800dnl Find python-executable in $PATH, and then handle the same as
801dnl /path/to/python/executable.
802dnl
803dnl If a python program is specified, it is used to run python-config.py and
804dnl is passed --ldflags, --includes, --exec-prefix.
805
d57a3c85 806AC_ARG_WITH(python,
0c4a4063 807 AS_HELP_STRING([--with-python@<:@=PYTHON@:>@], [include python support (auto/yes/no/<python-program>)]),
d57a3c85
TJB
808 [], [with_python=auto])
809AC_MSG_CHECKING([whether to use python])
810AC_MSG_RESULT([$with_python])
811
812if test "${with_python}" = no; then
813 AC_MSG_WARN([python support disabled; some features may be unavailable.])
814 have_libpython=no
815else
816 case "${with_python}" in
8c85a4e2 817 [[\\/]]* | ?:[[\\/]]*)
0ad6b8ee 818 if test -d "${with_python}"; then
ec685c5e 819 # Assume the python binary is ${with_python}/bin/python.
ec685c5e 820 python_prog="${with_python}/bin/python"
0c4a4063 821 python_prefix=
9c4ea6c5
JB
822 # If python does not exit ${with_python}/bin, then try in
823 # ${with_python}. On Windows/MinGW, this is where the Python
824 # executable is.
825 if test ! -x "${python_prog}"; then
826 python_prog="${with_python}/python"
827 python_prefix=
828 fi
e7a30f46 829 if test ! -x "${python_prog}"; then
ec685c5e
DE
830 # Fall back to gdb 7.0/7.1 behaviour.
831 python_prog=missing
0c4a4063 832 python_prefix=${with_python}
ec685c5e 833 fi
e7a30f46 834 elif test -x "${with_python}"; then
ec685c5e
DE
835 # While we can't run python compiled for $host (unless host == build),
836 # the user could write a script that provides the needed information,
837 # so we support that.
ec685c5e 838 python_prog=${with_python}
0c4a4063 839 python_prefix=
ec685c5e 840 else
5593a99a 841 AC_MSG_ERROR(invalid value for --with-python)
ec685c5e 842 fi
d57a3c85 843 ;;
ec685c5e
DE
844 */*)
845 # Disallow --with-python=foo/bar.
5593a99a 846 AC_MSG_ERROR(invalid value for --with-python)
d57a3c85 847 ;;
ec685c5e
DE
848 *)
849 # The user has either specified auto, yes, or the name of the python
850 # program assumed to be in $PATH.
851 python_prefix=
852 case "${with_python}" in
853 yes | auto)
0ad6b8ee 854 if test "${build}" = "${host}"; then
ec685c5e
DE
855 AC_PATH_PROG(python_prog_path, python, missing)
856 if test "${python_prog_path}" = missing; then
857 python_prog=missing
858 else
859 python_prog=${python_prog_path}
860 fi
861 else
862 # Not much we can do except assume the cross-compiler will find the
863 # right files.
864 python_prog=missing
865 fi
866 ;;
867 *)
868 # While we can't run python compiled for $host (unless host == build),
869 # the user could write a script that provides the needed information,
870 # so we support that.
871 python_prog="${with_python}"
872 AC_PATH_PROG(python_prog_path, ${python_prog}, missing)
873 if test "${python_prog_path}" = missing; then
5593a99a 874 AC_MSG_ERROR(unable to find python program ${python_prog})
ec685c5e
DE
875 fi
876 ;;
877 esac
d57a3c85
TJB
878 esac
879
ec685c5e 880 if test "${python_prog}" != missing; then
e7a30f46
DE
881 # We have a python program to use, but it may be too old.
882 # Don't flag an error for --with-python=auto (the default).
883 have_python_config=yes
ec685c5e
DE
884 python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
885 if test $? != 0; then
e7a30f46
DE
886 have_python_config=failed
887 if test "${with_python}" != auto; then
5593a99a 888 AC_MSG_ERROR(failure running python-config --includes)
e7a30f46 889 fi
d57a3c85 890 fi
ec685c5e
DE
891 python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
892 if test $? != 0; then
e7a30f46
DE
893 have_python_config=failed
894 if test "${with_python}" != auto; then
5593a99a 895 AC_MSG_ERROR(failure running python-config --ldflags)
e7a30f46 896 fi
ec685c5e 897 fi
0c4a4063
DE
898 python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
899 if test $? != 0; then
e7a30f46
DE
900 have_python_config=failed
901 if test "${with_python}" != auto; then
5593a99a 902 AC_MSG_ERROR(failure running python-config --exec-prefix)
e7a30f46 903 fi
0c4a4063 904 fi
ec685c5e 905 else
ac534cba
JB
906 # We do not have a python executable we can use to determine where
907 # to find the Python headers and libs. We cannot guess the include
908 # path from the python_prefix either, because that include path
909 # depends on the Python version. So, there is nothing much we can
910 # do except assume that the compiler will be able to find those files.
911 python_includes=
912 python_libs=
0c4a4063 913 have_python_config=no
d57a3c85 914 fi
ec685c5e 915
ec685c5e
DE
916 # If we have python-config, only try the configuration it provides.
917 # Otherwise fallback on the old way of trying different versions of
918 # python in turn.
919
920 have_libpython=no
921 if test "${have_python_config}" = yes; then
71737c43
CB
922 AC_TRY_LIBPYTHON(have_libpython,
923 ${python_includes}, ${python_libs})
e7a30f46 924 elif test "${have_python_config}" != failed; then
420697bb 925 if test "${have_libpython}" = no; then
71737c43 926 AC_TRY_LIBPYTHON(have_libpython,
bf27f0e2 927 ${python_includes}, "-lpython2.7 ${python_libs}")
420697bb 928 fi
ec685c5e 929 if test "${have_libpython}" = no; then
71737c43 930 AC_TRY_LIBPYTHON(have_libpython,
bf27f0e2 931 ${python_includes}, "-lpython2.6 ${python_libs}")
ec685c5e 932 fi
d57a3c85 933 fi
ec685c5e
DE
934
935 if test "${have_libpython}" = no; then
d57a3c85
TJB
936 case "${with_python}" in
937 yes)
938 AC_MSG_ERROR([python is missing or unusable])
939 ;;
940 auto)
941 AC_MSG_WARN([python is missing or unusable; some features may be unavailable.])
942 ;;
943 *)
944 AC_MSG_ERROR([no usable python found at ${with_python}])
945 ;;
946 esac
0c4a4063
DE
947 else
948 if test -n "${python_prefix}"; then
949 AC_DEFINE_UNQUOTED(WITH_PYTHON_PATH, "${python_prefix}",
950 [Define if --with-python provides a path, either directly or via python-config.py --exec-prefix.])
951 GDB_AC_DEFINE_RELOCATABLE(PYTHON_PATH, python, ${python_prefix})
952 fi
d57a3c85
TJB
953 fi
954fi
955
d13c7322
AB
956dnl Use --with-python-libdir to control where GDB looks for the Python
957dnl libraries.
958dnl
959dnl If this is not given then the default will be based on the value
960dnl passed to --with-python, which is in the python_prefix variable.
961dnl If the --with-python option wasn't given then the default value in
962dnl python_prefix is based on running the 'gdb/python/python-config
963dnl --exec-prefix' script.
964AC_ARG_WITH(python-libdir,
965 AS_HELP_STRING([--with-python-libdir@<:@=DIR@:>@], [search for python's libraries in DIR]),
966 [],[
967 # If no python libdir is specified then select one based on
968 # python's prefix path.
969 if test -n "${python_prefix}"; then
970 with_python_libdir=${python_prefix}/lib
971 fi
972 ])
973
ec685c5e 974if test "${have_libpython}" != no; then
d57a3c85
TJB
975 AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
976 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
977 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
978 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
94f7449c 979 CONFIG_INSTALL="$CONFIG_INSTALL install-python"
d57a3c85
TJB
980 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
981
d13c7322
AB
982 if test -n "${with_python_libdir}"; then
983 AC_DEFINE_UNQUOTED(WITH_PYTHON_LIBDIR, "${with_python_libdir}",
984 [Directory containing Python's standard libraries from --with-python-libdir.])
985 GDB_AC_DEFINE_RELOCATABLE(PYTHON_LIBDIR, [python lib], ${with_python_libdir})
986 fi
987
d57a3c85
TJB
988 # Flags needed to compile Python code (taken from python-config --cflags).
989 # We cannot call python-config directly because it will output whatever was
990 # used when compiling the Python interpreter itself, including flags which
991 # would make the python-related objects be compiled differently from the
992 # rest of GDB (e.g., -O2 and -fPIC).
993 if test "${GCC}" = yes; then
ae292b3a
TT
994 tentative_python_cflags="-fno-strict-aliasing -fwrapv"
995 # Python headers recommend -DNDEBUG, but it's unclear if that just
996 # refers to building Python itself. In release mode, though, it
997 # doesn't hurt for the Python code in gdb to follow.
998 $development || tentative_python_cflags="$tentative_python_cflags -DNDEBUG"
d57a3c85
TJB
999 fi
1000
1001 if test "x${tentative_python_cflags}" != x; then
1002 AC_MSG_CHECKING(compiler flags for python code)
1003 for flag in ${tentative_python_cflags}; do
1004 # Check that the compiler accepts it
1005 saved_CFLAGS="$CFLAGS"
1006 CFLAGS="$CFLAGS $flag"
5593a99a
SM
1007 AC_COMPILE_IFELSE(
1008 [AC_LANG_PROGRAM([], [])],
1009 [PYTHON_CFLAGS="${PYTHON_CFLAGS} $flag"],
1010 []
1011 )
d57a3c85
TJB
1012 CFLAGS="$saved_CFLAGS"
1013 done
1014 AC_MSG_RESULT(${PYTHON_CFLAGS})
1015 fi
043b6510 1016
c83393b9
JB
1017 # On x64 Windows, Python's include headers, and pyconfig.h in
1018 # particular, rely on MS_WIN64 macro to detect that it's a 64bit
1019 # version of Windows. Unfortunately, MS_WIN64 is only defined if
1020 # _MSC_VER, a Microsoft-specific macro, is defined. So, when
1021 # building on x64 Windows with GCC, we define MS_WIN64 ourselves.
1022 # The issue was reported to the Python community, but still isn't
1023 # solved as of 2012-10-02 (http://bugs.python.org/issue4709).
1024
043b6510 1025 case "$gdb_host" in
c83393b9
JB
1026 mingw64)
1027 if test "${GCC}" = yes; then
1028 CPPFLAGS="$CPPFLAGS -DMS_WIN64"
1029 fi
1030 ;;
043b6510 1031 esac
d57a3c85 1032else
6dddc817
DE
1033 # Even if Python support is not compiled in, we need to have this file
1034 # included so that the "python" command, et.al., still exists.
8fd8d003 1035 CONFIG_OBS="$CONFIG_OBS python/python.o"
6dddc817 1036 CONFIG_SRCS="$CONFIG_SRCS python/python.c"
d57a3c85 1037fi
a4a1c157
PA
1038
1039# Work around Python http://bugs.python.org/issue10112. See also
1040# http://bugs.python.org/issue11410, otherwise -Wl,--dynamic-list has
1041# no effect. Note that the only test after this that uses Python is
1042# the -rdynamic/-Wl,--dynamic-list test, and we do want that one to be
1043# run without -export-dynamic too.
1044PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/-Xlinker -export-dynamic//'`
1045
d57a3c85 1046AC_SUBST(PYTHON_CFLAGS)
ac534cba
JB
1047AC_SUBST(PYTHON_CPPFLAGS)
1048AC_SUBST(PYTHON_LIBS)
4df42755 1049AM_CONDITIONAL(HAVE_PYTHON, test "${have_libpython}" != no)
d57a3c85 1050
ed3ef339
DE
1051# -------------------- #
1052# Check for libguile. #
1053# -------------------- #
1054
ed3ef339
DE
1055dnl Utility to simplify finding libguile.
1056dnl $1 = pkg-config-program
1057dnl $2 = space-separate list of guile versions to try
1058dnl $3 = yes|no, indicating whether to flag errors or ignore them
1059dnl $4 = the shell variable to assign the result to
1060dnl If libguile is found we store "yes" here.
1061
1062AC_DEFUN([AC_TRY_LIBGUILE],
1063[
1064 pkg_config=$1
1065 guile_version_list=$2
1066 flag_errors=$3
1067 define([have_libguile_var],$4)
ed3ef339
DE
1068 found_usable_guile=checking
1069 AC_MSG_CHECKING([for usable guile from ${pkg_config}])
1070 for guile_version in ${guile_version_list}; do
1071 ${pkg_config} --exists ${guile_version} 2>/dev/null
1072 if test $? != 0; then
1073 continue
1074 fi
1075 dnl pkg-config says the package exists, so if we get an error now,
1076 dnl that's bad.
1077 new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}`
1078 if test $? != 0; then
e1402065 1079 AC_MSG_ERROR([failure running pkg-config --cflags ${guile_version}])
ed3ef339
DE
1080 fi
1081 new_LIBS=`${pkg_config} --libs ${guile_version}`
1082 if test $? != 0; then
e1402065 1083 AC_MSG_ERROR([failure running pkg-config --libs ${guile_version}])
ed3ef339
DE
1084 fi
1085 dnl If we get this far, great.
1086 found_usable_guile=${guile_version}
1087 break
1088 done
1089 if test "${found_usable_guile}" = "checking"; then
1090 if test "${flag_errors}" = "yes"; then
e1402065 1091 AC_MSG_ERROR([unable to find usable guile version from "${guile_version_list}"])
ed3ef339
DE
1092 else
1093 found_usable_guile=no
1094 fi
1095 fi
1096 dnl One final sanity check.
1097 dnl The user could have said --with-guile=python-2.7.
1098 if test "${found_usable_guile}" != no; then
1099 save_CPPFLAGS=$CPPFLAGS
1100 save_LIBS=$LIBS
1101 CPPFLAGS="$CPPFLAGS $new_CPPFLAGS"
1102 LIBS="$LIBS $new_LIBS"
d0ac1c44
SM
1103 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "libguile.h"]],
1104 [[scm_init_guile ();]])],
ed3ef339
DE
1105 [have_libguile_var=yes
1106 GUILE_CPPFLAGS=$new_CPPFLAGS
1107 GUILE_LIBS=$new_LIBS],
1108 [found_usable_guile=no])
92fab5a6
AW
1109 dnl scm_set_automatic_finalization_enabled added in Guile 2.2.
1110 AC_CHECK_FUNC(scm_set_automatic_finalization_enabled,
1111 AC_DEFINE(HAVE_GUILE_MANUAL_FINALIZATION, 1,
1112 [Define if Guile supports manual finalization.])
1113 )
ed3ef339
DE
1114 CPPFLAGS=$save_CPPFLAGS
1115 LIBS=$save_LIBS
1116 if test "${found_usable_guile}" = no; then
1117 if test "${flag_errors}" = yes; then
e1402065 1118 AC_MSG_FAILURE([linking guile version ${guile_version} test program failed])
ed3ef339
DE
1119 fi
1120 fi
1121 fi
1122 AC_MSG_RESULT([${found_usable_guile}])
1123])
1124
1125dnl There are several different values for --with-guile:
1126dnl
1127dnl no - Don't include guile support.
1128dnl yes - Include guile support, error if it's missing.
1129dnl The pkg-config program must be in $PATH.
1130dnl auto - Same as "yes", but if guile is missing from the system,
1131dnl fall back to "no".
1132dnl guile-version [guile-version-choice-2 ...] -
1133dnl A space-separated list of guile package versions to try.
1134dnl These are passed to pkg-config as-is.
1135dnl E.g., guile-2.0 or guile-2.2-uninstalled
1136dnl This requires making sure PKG_CONFIG_PATH is set appropriately.
1137dnl /path/to/pkg-config -
1138dnl Use this pkg-config program.
1139dnl NOTE: This needn't be the "real" pkg-config program.
1140dnl It could be a shell script. It is invoked as:
1141dnl pkg-config --exists $version
1142dnl pkg-config --cflags $version
1143dnl pkg-config --libs $version
d342a0da
DE
1144dnl pkg-config --variable guild $version
1145dnl The script will be called with $version having each value in
1146dnl $try_guile_versions until --exists indicates success.
ed3ef339
DE
1147
1148AC_ARG_WITH(guile,
1149 AS_HELP_STRING([--with-guile@<:@=GUILE@:>@], [include guile support (auto/yes/no/<guile-version>/<pkg-config-program>)]),
1150 [], [with_guile=auto])
1151AC_MSG_CHECKING([whether to use guile])
1152AC_MSG_RESULT([$with_guile])
1153
e1402065
DE
1154dnl We check guile with pkg-config.
1155AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing)
1156
ae5369e7 1157try_guile_versions="guile-3.0 guile-2.2 guile-2.0"
ed3ef339
DE
1158have_libguile=no
1159case "${with_guile}" in
1160no)
1161 AC_MSG_WARN([guile support disabled; some features will be unavailable.])
1162 ;;
1163auto)
e1402065
DE
1164 if test "${pkg_config_prog_path}" = "missing"; then
1165 AC_MSG_WARN([pkg-config not found, guile support disabled])
1166 else
1167 AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, no, have_libguile)
1168 fi
ed3ef339
DE
1169 ;;
1170yes)
e1402065
DE
1171 if test "${pkg_config_prog_path}" = "missing"; then
1172 AC_MSG_ERROR([pkg-config not found])
1173 fi
ed3ef339
DE
1174 AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, yes, have_libguile)
1175 ;;
1176[[\\/]]* | ?:[[\\/]]*)
e1402065
DE
1177 if test -x "${with_guile}"; then
1178 AC_TRY_LIBGUILE(${with_guile}, ${try_guile_versions}, yes, have_libguile)
1179 else
1180 AC_MSG_ERROR([Guile config program not executable: ${with_guile}])
1181 fi
ed3ef339
DE
1182 ;;
1183"" | */*)
1184 # Disallow --with=guile="" and --with-guile=foo/bar.
e1402065 1185 AC_MSG_ERROR([invalid value for --with-guile])
ed3ef339
DE
1186 ;;
1187*)
1188 # A space separate list of guile versions to try, in order.
e1402065
DE
1189 if test "${pkg_config_prog_path}" = "missing"; then
1190 AC_MSG_ERROR([pkg-config not found])
1191 fi
ed3ef339
DE
1192 AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${with_guile}, yes, have_libguile)
1193 ;;
1194esac
1195
e76c5d17
DE
1196if test "${have_libguile}" != no; then
1197 dnl Get the name of the 'guild' program.
d342a0da
DE
1198 case "${with_guile}" in
1199 [[\\/]]* | ?:[[\\/]]*)
1200 GDB_GUILE_PROGRAM_NAMES(["${with_guile}"], ["${guile_version}"])
1201 ;;
1202 *)
1203 GDB_GUILE_PROGRAM_NAMES(["${pkg_config_prog_path}"], ["${guile_version}"])
1204 ;;
1205 esac
e76c5d17
DE
1206
1207 dnl Make sure guild can handle this host.
1208 GDB_TRY_GUILD([$srcdir/guile/lib/gdb/support.scm])
1209 dnl If not, disable guile support.
1210 if test "$ac_cv_guild_ok" = no; then
1211 have_libguile=no
1212 AC_MSG_WARN(disabling guile support, $GUILD fails compiling for $host)
1213 fi
1214fi
1215
ed3ef339
DE
1216if test "${have_libguile}" != no; then
1217 AC_DEFINE(HAVE_GUILE, 1, [Define if Guile interpreter is being linked in.])
1218 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GUILE_OBS)"
1219 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_GUILE_DEPS)"
1220 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_GUILE_SRCS)"
1221 CONFIG_INSTALL="$CONFIG_INSTALL install-guile"
1222 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_GUILE_CFLAGS)"
16954d5d
LC
1223
1224 dnl The 'scm_new_smob' function appeared in Guile 2.0.6.
1225 save_LIBS="$LIBS"
1226 save_CPPFLAGS="$CPPFLAGS"
1227 LIBS="$GUILE_LIBS"
1228 CPPFLAGS="$GUILE_CPPFLAGS"
1229 AC_CHECK_FUNCS([scm_new_smob])
1230 LIBS="$save_LIBS"
1231 CPPFLAGS="$save_CPPFLAGS"
ed3ef339
DE
1232else
1233 # Even if Guile support is not compiled in, we need to have these files
1234 # included.
bd810fff 1235 CONFIG_OBS="$CONFIG_OBS guile/guile.o"
ed3ef339
DE
1236 CONFIG_SRCS="$CONFIG_SRCS guile/guile.c"
1237fi
1238AC_SUBST(GUILE_CPPFLAGS)
1239AC_SUBST(GUILE_LIBS)
4df42755 1240AM_CONDITIONAL(HAVE_GUILE, test "${have_libguile}" != no)
ed3ef339 1241
62f29fda
TT
1242# ---------------------------- #
1243# Check for source highlight. #
1244# ---------------------------- #
1245
1246SRCHIGH_LIBS=
1247SRCHIGH_CFLAGS=
189b8c2e
ST
1248
1249AC_ARG_ENABLE(source-highlight,
1250 AS_HELP_STRING([--enable-source-highlight],
1251 [enable source-highlight for source listings]),
1252 [case "${enableval}" in
1253 yes) enable_source_highlight=yes ;;
1254 no) enable_source_highlight=no ;;
1255 *) AC_MSG_ERROR(bad value ${enableval} for source-highlight option) ;;
1256esac],
1257[enable_source_highlight=auto])
1258
1259if test "${enable_source_highlight}" != "no"; then
1260 AC_MSG_CHECKING([for the source-highlight library])
1261 if test "${pkg_config_prog_path}" = "missing"; then
1262 AC_MSG_RESULT([no - pkg-config not found])
1263 if test "${enable_source_highlight}" = "yes"; then
1264 AC_MSG_ERROR([pkg-config was not found in your system])
1265 fi
1266 else
0455b7d3
BE
1267 if ${pkg_config_prog_path} --exists source-highlight; then
1268 case "$LDFLAGS" in
1269 *static-libstdc*)
1270 AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl
d806ea2d
TT
1271either use --disable-source-highlight or dnl
1272--without-static-standard-libraries])
0455b7d3
BE
1273 ;;
1274 esac
d806ea2d 1275
62f29fda
TT
1276 SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
1277 SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
1278 AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1,
1279 [Define to 1 if the source-highlight library is available])
1280 AC_MSG_RESULT([yes])
189b8c2e 1281 else
62f29fda 1282 AC_MSG_RESULT([no])
189b8c2e
ST
1283 if test "${enable_source_highlight}" = "yes"; then
1284 AC_MSG_ERROR([source-highlight was not found in your system])
1285 fi
1286 fi
1287 fi
62f29fda
TT
1288fi
1289AC_SUBST(SRCHIGH_LIBS)
1290AC_SUBST(SRCHIGH_CFLAGS)
1291
5ee754fc
MK
1292# ------------------------- #
1293# Checks for header files. #
1294# ------------------------- #
c906108c
SS
1295
1296AC_HEADER_STDC
a9322a30 1297# elf_hp.h is for HP/UX 64-bit shared library support.
8ae8e197 1298AC_CHECK_HEADERS([nlist.h machine/reg.h \
05ea2a05 1299 thread_db.h \
a9322a30 1300 sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
05ea2a05 1301 sys/resource.h sys/ptrace.h ptrace.h \
8ae8e197 1302 sys/reg.h sys/debugreg.h \
2d41fa11 1303 termios.h elf_hp.h])
7cb9022a
MK
1304AC_CHECK_HEADERS(sys/user.h, [], [],
1305[#if HAVE_SYS_PARAM_H
1306# include <sys/param.h>
1307#endif
1308])
5ee754fc 1309
5007d765 1310AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncursesw/ncurses.h ncurses/ncurses.h ncurses/term.h)
c401b55a
MK
1311AC_CHECK_HEADERS(term.h, [], [],
1312[#if HAVE_CURSES_H
1313# include <curses.h>
1314#endif
1315])
5ee754fc 1316
95420d30 1317AC_CHECK_HEADERS([sys/socket.h])
05a6b8c2
EZ
1318AC_CHECK_HEADERS([ws2tcpip.h])
1319
b9362cc7
AC
1320# ------------------------- #
1321# Checks for declarations. #
1322# ------------------------- #
1323
07697489
PA
1324libiberty_INIT
1325
29d17e47 1326AC_CHECK_DECLS([snprintf])
a8111142 1327AM_LC_MESSAGES
b9362cc7 1328
5ee754fc
MK
1329# ------------------ #
1330# Checks for types. #
1331# ------------------ #
c906108c 1332
f9f87d2c
MK
1333AC_CHECK_TYPES(socklen_t, [], [],
1334[#include <sys/types.h>
05a6b8c2
EZ
1335#if HAVE_SYS_SOCKET_H
1336# include <sys/socket.h>
1337#elif HAVE_WS2TCPIP_H
1338# include <ws2tcpip.h>
1339#endif
f9f87d2c 1340])
5ee754fc
MK
1341
1342# ------------------------------------- #
1343# Checks for compiler characteristics. #
1344# ------------------------------------- #
c906108c
SS
1345
1346AC_C_CONST
bce58c09 1347AC_C_INLINE
9b913628 1348AC_C_BIGENDIAN
c906108c 1349
5ee754fc
MK
1350# ------------------------------ #
1351# Checks for library functions. #
1352# ------------------------------ #
1353
05ea2a05 1354AC_CHECK_FUNCS([getuid getgid \
8ae8e197 1355 pipe pread pread64 pwrite resize_term \
05ea2a05 1356 getpgid setsid \
c12d372d 1357 sigaction sigsetmask socketpair \
110ed339 1358 ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
3332aaf2 1359 setrlimit getrlimit posix_madvise waitpid \
05ea2a05 1360 use_default_colors])
6c7a06a3 1361AM_LANGINFO_CODESET
3266f10b 1362GDB_AC_COMMON
97bf5e38 1363
eb7aa561
PA
1364# Check the return and argument types of ptrace.
1365GDB_AC_PTRACE
086ec9eb 1366
72473524
DJ
1367dnl AC_FUNC_SETPGRP does not work when cross compiling
1368dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
1369if test "$cross_compiling" = no; then
1370 AC_FUNC_SETPGRP
1371else
5593a99a
SM
1372 AC_CACHE_CHECK(
1373 [whether setpgrp takes no argument],
1374 [ac_cv_func_setpgrp_void],
1375 [AC_COMPILE_IFELSE(
1376 [AC_LANG_PROGRAM(
1377 [#include <unistd.h>],
1378 [if (setpgrp(1,1) == -1)
1379 exit (0);
1380 else
1381 exit (1);]
1382 )],
1383 [ac_cv_func_setpgrp_void=no],
1384 [ac_cv_func_setpgrp_void=yes]
1385 )]
1386 )
0ad6b8ee 1387if test "$ac_cv_func_setpgrp_void" = yes; then
72473524
DJ
1388 AC_DEFINE(SETPGRP_VOID, 1)
1389fi
1390fi
c906108c 1391
5c45e068
MK
1392# Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
1393AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
1394[#include <sys/param.h>
1395#include <sys/proc.h>
1396])
70f9f479 1397
da7d81e3 1398# See if <sys/lwp.h> defines `struct lwp`.
5593a99a
SM
1399AC_CACHE_CHECK(
1400 [for struct lwp],
1401 [gdb_cv_struct_lwp],
1402 [AC_COMPILE_IFELSE(
1403 [AC_LANG_PROGRAM(
1404 [#include <sys/param.h>
1405 #define _KMEMUSER
1406 #include <sys/lwp.h>],
1407 [struct lwp l;]
1408 )],
1409 [gdb_cv_struct_lwp=yes],
1410 [gdb_cv_struct_lwp=no]
1411 )]
1412)
0ad6b8ee 1413if test "$gdb_cv_struct_lwp" = yes; then
da7d81e3
NW
1414 AC_DEFINE(HAVE_STRUCT_LWP, 1,
1415 [Define to 1 if your system has struct lwp.])
1416fi
1417
78434e59 1418# See if <machine/reg.h> degines `struct reg'.
5593a99a
SM
1419AC_CACHE_CHECK(
1420 [for struct reg in machine/reg.h],
1421 [gdb_cv_struct_reg],
1422 [AC_COMPILE_IFELSE(
1423 [AC_LANG_PROGRAM(
1424 [#include <sys/types.h>
1425 #include <machine/reg.h>],
1426 [struct reg r;]
1427 )],
1428 [gdb_cv_struct_reg=yes],
1429 [gdb_cv_struct_reg=no]
1430 )]
1431)
0ad6b8ee 1432if test "$gdb_cv_struct_reg" = yes; then
78434e59
MK
1433 AC_DEFINE(HAVE_STRUCT_REG, 1,
1434 [Define to 1 if your system has struct reg in <machine/reg.h>.])
1435fi
1436
0afdd437 1437# See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
7dfa765c 1438# Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
5c45e068 1439AC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [],
a6e69c1f
JB
1440 [#include <sys/types.h>
1441#include <machine/reg.h>])
7dfa765c 1442
0afdd437 1443# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
f60300e7 1444AC_MSG_CHECKING(for PTRACE_GETREGS)
5593a99a
SM
1445AC_CACHE_VAL(
1446 [gdb_cv_have_ptrace_getregs],
1447 [AC_COMPILE_IFELSE(
1448 [AC_LANG_PROGRAM([#include <sys/ptrace.h>], [PTRACE_GETREGS;])],
1449 [gdb_cv_have_ptrace_getregs=yes],
1450 [gdb_cv_have_ptrace_getregs=no]
1451 )]
1452)
f60300e7 1453AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
0ad6b8ee 1454if test "$gdb_cv_have_ptrace_getregs" = yes; then
4869db5e 1455 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
60ca704f 1456 [Define if sys/ptrace.h defines the PTRACE_GETREGS request.])
f60300e7
MK
1457fi
1458
0afdd437 1459# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
6ce2ac0b 1460AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
5593a99a
SM
1461AC_CACHE_VAL(
1462 [gdb_cv_have_ptrace_getfpxregs],
1463 [AC_COMPILE_IFELSE(
1464 [AC_LANG_PROGRAM([#include <sys/ptrace.h>], [PTRACE_GETFPXREGS;])],
1465 [gdb_cv_have_ptrace_getfpxregs=yes],
1466 [gdb_cv_have_ptrace_getfpxregs=no]
1467 )]
1468)
6ce2ac0b 1469AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
0ad6b8ee 1470if test "$gdb_cv_have_ptrace_getfpxregs" = yes; then
60ca704f
SE
1471 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
1472 [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.])
5c44784c
JM
1473fi
1474
0afdd437
MK
1475# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
1476AC_MSG_CHECKING(for PT_GETDBREGS)
5593a99a
SM
1477AC_CACHE_VAL(
1478 [gdb_cv_have_pt_getdbregs],
1479 [AC_COMPILE_IFELSE(
1480 [AC_LANG_PROGRAM(
1481 [#include <sys/types.h>
1482 #include <sys/ptrace.h>],
1483 [PT_GETDBREGS;]
1484 )],
1485 [gdb_cv_have_pt_getdbregs=yes],
1486 [gdb_cv_have_pt_getdbregs=no]
1487 )]
1488)
0afdd437 1489AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
0ad6b8ee 1490if test "$gdb_cv_have_pt_getdbregs" = yes; then
60ca704f
SE
1491 AC_DEFINE(HAVE_PT_GETDBREGS, 1,
1492 [Define if sys/ptrace.h defines the PT_GETDBREGS request.])
0afdd437
MK
1493fi
1494
7e89e357
JT
1495# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
1496AC_MSG_CHECKING(for PT_GETXMMREGS)
5593a99a
SM
1497AC_CACHE_VAL(
1498 [gdb_cv_have_pt_getxmmregs],
1499 [AC_COMPILE_IFELSE(
1500 [AC_LANG_PROGRAM(
1501 [#include <sys/types.h>
1502 #include <sys/ptrace.h>],
1503 [PT_GETXMMREGS;]
1504 )],
1505 [gdb_cv_have_pt_getxmmregs=yes],
1506 [gdb_cv_have_pt_getxmmregs=no]
1507 )]
1508)
7e89e357 1509AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
0ad6b8ee 1510if test "$gdb_cv_have_pt_getxmmregs" = yes; then
60ca704f
SE
1511 AC_DEFINE(HAVE_PT_GETXMMREGS, 1,
1512 [Define if sys/ptrace.h defines the PT_GETXMMREGS request.])
7e89e357
JT
1513fi
1514
6e9567fe
JB
1515# See if <sys/ptrace.h> supports LWP names on FreeBSD
1516# Older FreeBSD versions don't have the pl_tdname member of
1517# `struct ptrace_lwpinfo'.
1518AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_tdname], [], [],
1519 [#include <sys/ptrace.h>])
1520
e6cdd38e
JB
1521# See if <sys/ptrace.h> supports syscall fields on FreeBSD. The
1522# pl_syscall_code member of `struct ptrace_lwpinfo' was added in
1523# FreeBSD 10.3.
1524AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_syscall_code], [], [],
1525 [#include <sys/ptrace.h>])
6e9567fe 1526
bc8bcb4b
MK
1527# Check if the compiler supports the `long long' type.
1528
1529AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
1530 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1531[[extern long long foo;]],
1532[[switch (foo & 2) { case 0: return 1; }]])],
1533 gdb_cv_c_long_long=yes,
1534 gdb_cv_c_long_long=no)])
0ad6b8ee 1535if test "$gdb_cv_c_long_long" != yes; then
74a0d9f6
JK
1536 # libdecnumber requires long long.
1537 AC_MSG_ERROR([Compiler must support long long for GDB.])
c906108c
SS
1538fi
1539
bc8bcb4b 1540# Check if the compiler and runtime support printing long longs.
c906108c 1541
bc8bcb4b
MK
1542AC_CACHE_CHECK([for long long support in printf],
1543 gdb_cv_printf_has_long_long,
1544 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
1545[[char buf[32];
c906108c
SS
1546 long long l = 0;
1547 l = (l << 16) + 0x0123;
1548 l = (l << 16) + 0x4567;
1549 l = (l << 16) + 0x89ab;
1550 l = (l << 16) + 0xcdef;
1551 sprintf (buf, "0x%016llx", l);
bc8bcb4b
MK
1552 return (strcmp ("0x0123456789abcdef", buf));]])],
1553 gdb_cv_printf_has_long_long=yes,
1554 gdb_cv_printf_has_long_long=no,
1555 gdb_cv_printf_has_long_long=no)])
0ad6b8ee 1556if test "$gdb_cv_printf_has_long_long" = yes; then
bc8bcb4b
MK
1557 AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
1558 [Define to 1 if the "%ll" format works to print long longs.])
c906108c 1559fi
c906108c 1560
1a619819
LM
1561# Check if the compiler and runtime support printing decfloats.
1562
1563AC_CACHE_CHECK([for decfloat support in printf],
1564 gdb_cv_printf_has_decfloat,
1565 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
1566[[char buf[64];
1567 _Decimal32 d32 = 1.2345df;
1568 _Decimal64 d64 = 1.2345dd;
1569 _Decimal128 d128 = 1.2345dl;
1570 sprintf (buf, "Decimal32: %H\nDecimal64: %D\nDecimal128: %DD", d32, d64, d128);
1571 return (strcmp ("Decimal32: 1.2345\nDecimal64: 1.2345\nDecimal128: 1.2345", buf));]])],
1572 gdb_cv_printf_has_decfloat=yes,
1573 gdb_cv_printf_has_decfloat=no,
1574 gdb_cv_printf_has_decfloat=no)])
0ad6b8ee 1575if test "$gdb_cv_printf_has_decfloat" = yes; then
1a619819
LM
1576 AC_DEFINE(PRINTF_HAS_DECFLOAT, 1,
1577 [Define to 1 if the "%H, %D and %DD" formats work to print decfloats.])
1578fi
1579
bc8bcb4b
MK
1580# Check if the compiler supports the `long double' type. We can't use
1581# AC_C_LONG_DOUBLE because that one does additional checks on the
1582# constants defined in <float.h> that fail on some systems,
1583# e.g. FreeBSD/i386 4.7 and OpenBSD/i386 3.6.
c906108c 1584
bc8bcb4b
MK
1585AC_CACHE_CHECK([for long double support in compiler], gdb_cv_c_long_double,
1586 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[long double foo;]])],
1587 gdb_cv_c_long_double=yes,
1588 gdb_cv_c_long_double=no)])
0ad6b8ee 1589if test "$gdb_cv_c_long_double" = yes; then
bc8bcb4b
MK
1590 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
1591 [Define to 1 if the compiler supports long double.])
c906108c
SS
1592fi
1593
bc8bcb4b 1594# Check if the compiler and runtime support printing long doubles.
c906108c 1595
bc8bcb4b
MK
1596AC_CACHE_CHECK([for long double support in printf],
1597 gdb_cv_printf_has_long_double,
1598 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
1599[[char buf[16];
c906108c
SS
1600 long double f = 3.141592653;
1601 sprintf (buf, "%Lg", f);
bc8bcb4b
MK
1602 return (strncmp ("3.14159", buf, 7));]])],
1603 gdb_cv_printf_has_long_double=yes,
1604 gdb_cv_printf_has_long_double=no,
1605 gdb_cv_printf_has_long_double=no)])
0ad6b8ee 1606if test "$gdb_cv_printf_has_long_double" = yes; then
bc8bcb4b
MK
1607 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1,
1608 [Define to 1 if the "%Lg" format works to print long doubles.])
c906108c 1609fi
c906108c 1610
bc8bcb4b 1611# Check if the compiler and runtime support scanning long doubles.
c906108c 1612
4869db5e 1613AC_CACHE_CHECK([for long double support in scanf],
bc8bcb4b
MK
1614 gdb_cv_scanf_has_long_double,
1615 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
1616[[#include <stdio.h>]],
1617[[char *buf = "3.141592653";
c906108c
SS
1618 long double f = 0;
1619 sscanf (buf, "%Lg", &f);
bc8bcb4b
MK
1620 return !(f > 3.14159 && f < 3.14160);]])],
1621 gdb_cv_scanf_has_long_double=yes,
1622 gdb_cv_scanf_has_long_double=no,
1623 gdb_cv_scanf_has_long_double=no)])
0ad6b8ee 1624if test "$gdb_cv_scanf_has_long_double" = yes; then
bc8bcb4b
MK
1625 AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1,
1626 [Define to 1 if the "%Lg" format works to scan long doubles.])
c906108c 1627fi
c906108c 1628
438013df
AO
1629case ${host_os} in
1630aix*)
5593a99a
SM
1631 AC_CACHE_CHECK(
1632 [for -bbigtoc option], [gdb_cv_bigtoc],
1633 [SAVE_LDFLAGS=$LDFLAGS
1634
1635 case $GCC in
1636 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
1637 *) gdb_cv_bigtoc=-bbigtoc ;;
1638 esac
1639
1640 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
1641 AC_LINK_IFELSE(
1642 [AC_LANG_PROGRAM([], [int i;])],
1643 [],
1644 [gdb_cv_bigtoc=]
1645 )
1646 LDFLAGS="${SAVE_LDFLAGS}"]
1647 )
438013df
AO
1648 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
1649 ;;
1650esac
1651
38f6b338
JK
1652AC_MSG_CHECKING(for the dynamic export flag)
1653dynamic_list=false
0407b3f1 1654if test "${gdb_native}" = yes; then
38f6b338
JK
1655 # The dynamically loaded libthread_db needs access to symbols in the gdb
1656 # executable. Older GNU ld supports --export-dynamic but --dynamic-list
1657 # may not be supported there.
1658 old_LDFLAGS="$LDFLAGS"
1659 # Older GNU ld supports --export-dynamic but --dynamic-list it does not.
1660 RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
1661 LDFLAGS="$LDFLAGS $RDYNAMIC"
1662 if test "${have_libpython}" = no; then
5593a99a
SM
1663 AC_LINK_IFELSE(
1664 [AC_LANG_PROGRAM([], [])],
1665 [dynamic_list=true],
1666 []
1667 )
38f6b338
JK
1668 else
1669 # Workaround http://bugs.python.org/issue4434 where static
1670 # libpythonX.Y.a would get its symbols required for
1671 # pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
1672 # Problem does not happen for the recommended libpythonX.Y.so linkage.
a4a1c157
PA
1673
1674 # Note the workaround for Python
1675 # http://bugs.python.org/issue10112 earlier has removed
1676 # -export-dynamic from PYTHON_LIBS. That's exactly what we want
1677 # here too, as otherwise it'd make this -Wl,--dynamic-list test
1678 # always pass.
38f6b338
JK
1679 old_CFLAGS="$CFLAGS"
1680 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8c1fb155
JK
1681 old_LIBS="$LIBS"
1682 LIBS="$LIBS $PYTHON_LIBS"
1b4f615e
PA
1683 old_CPPFLAGS="$CPPFLAGS"
1684 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
38f6b338 1685 AC_RUN_IFELSE(
d0ac1c44 1686 [AC_LANG_PROGRAM(
1b4f615e 1687 [#include "Python.h"],
38f6b338
JK
1688 [int err;
1689 Py_Initialize ();
3fed4c0b 1690 err = PyRun_SimpleString ("import ctypes\n");
38f6b338 1691 Py_Finalize ();
d0ac1c44 1692 return err == 0 ? 0 : 1;])],
38f6b338 1693 [dynamic_list=true], [], [true])
8c1fb155 1694 LIBS="$old_LIBS"
38f6b338 1695 CFLAGS="$old_CFLAGS"
1b4f615e 1696 CPPFLAGS="$old_CPPFLAGS"
f6528abd 1697 fi
38f6b338
JK
1698 LDFLAGS="$old_LDFLAGS"
1699fi
1700if $dynamic_list; then
1701 found="-Wl,--dynamic-list"
1702 RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
1703else
1704 found="-rdynamic"
1705 RDYNAMIC="-rdynamic"
0407b3f1 1706fi
38f6b338
JK
1707AC_SUBST(RDYNAMIC)
1708AC_MSG_RESULT($found)
0407b3f1
AS
1709
1710dnl For certain native configurations, we need to check whether thread
1711dnl support can be built in or not.
1712dnl
1713dnl Note that we only want this if we are both native (host == target),
1714dnl and not doing a canadian cross build (build == host).
f6528abd 1715
0ad6b8ee 1716if test "${build}" = "${host}" -a "${host}" = "${target}" ; then
c906108c 1717 case ${host_os} in
d92419e5
JB
1718 aix*)
1719 AC_MSG_CHECKING(for AiX thread debugging library)
5593a99a
SM
1720 AC_CACHE_VAL(
1721 [gdb_cv_have_aix_thread_debug],
1722 [AC_COMPILE_IFELSE(
1723 [AC_LANG_PROGRAM(
1724 [#include <sys/pthdebug.h>],
1725 [#ifndef PTHDB_VERSION_3
1726 #error
1727 #endif]
1728 )],
1729 [gdb_cv_have_aix_thread_debug=yes],
1730 [gdb_cv_have_aix_thread_debug=no]
1731 )]
1732 )
d92419e5 1733 AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
0ad6b8ee 1734 if test "$gdb_cv_have_aix_thread_debug" = yes; then
d92419e5 1735 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
3483b318 1736 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
7f533142 1737 LIBS="$LIBS -lpthdebug"
d645e32e
JB
1738
1739 # Older versions of AIX do not provide the declaration for
1740 # the getthrds function (it appears that it was introduced
1741 # with AIX 6.x).
1742 AC_CHECK_DECLS(getthrds, [], [], [[#include <procinfo.h>]])
d92419e5
JB
1743 fi
1744 ;;
c906108c
SS
1745 esac
1746 AC_SUBST(CONFIG_LDFLAGS)
1747fi
1748
59f80f10
DJ
1749dnl See if we have a thread_db header file that has TD_NOTALLOC and
1750dnl other error codes.
3f47be5c 1751if test "x$ac_cv_header_thread_db_h" = "xyes"; then
5593a99a
SM
1752 AC_CACHE_CHECK(
1753 [whether <thread_db.h> has TD_NOTALLOC],
1754 [gdb_cv_thread_db_h_has_td_notalloc],
1755 [AC_COMPILE_IFELSE(
1756 [AC_LANG_PROGRAM(
1757 [#include <thread_db.h>],
1758 [int i = TD_NOTALLOC;]
1759 )],
1760 [gdb_cv_thread_db_h_has_td_notalloc=yes],
1761 [gdb_cv_thread_db_h_has_td_notalloc=no]
1762 )]
1763 )
1764
1765 AC_CACHE_CHECK(
1766 [whether <thread_db.h> has TD_VERSION],
1767 [gdb_cv_thread_db_h_has_td_version],
1768 [AC_COMPILE_IFELSE(
1769 [AC_LANG_PROGRAM(
1770 [#include <thread_db.h>],
1771 [int i = TD_VERSION;]
1772 )],
1773 [gdb_cv_thread_db_h_has_td_version=yes],
1774 [gdb_cv_thread_db_h_has_td_version=no]
1775 )]
1776 )
1777
1778 AC_CACHE_CHECK(
1779 [whether <thread_db.h> has TD_NOTLS],
1780 [gdb_cv_thread_db_h_has_td_notls],
1781 [AC_COMPILE_IFELSE(
1782 [AC_LANG_PROGRAM(
1783 [#include <thread_db.h>],
1784 [int i = TD_NOTLS;]
1785 )],
1786 [gdb_cv_thread_db_h_has_td_notls=yes],
1787 [gdb_cv_thread_db_h_has_td_notls=no]
1788 )]
1789 )
3f47be5c
EZ
1790fi
1791if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
1792 AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
1793 [Define if <thread_db.h> has the TD_NOTALLOC error code.])
1794fi
59f80f10
DJ
1795if test "x$gdb_cv_thread_db_h_has_td_version" = "xyes"; then
1796 AC_DEFINE(THREAD_DB_HAS_TD_VERSION, 1,
1797 [Define if <thread_db.h> has the TD_VERSION error code.])
1798fi
1799if test "x$gdb_cv_thread_db_h_has_td_notls" = "xyes"; then
1800 AC_DEFINE(THREAD_DB_HAS_TD_NOTLS, 1,
1801 [Define if <thread_db.h> has the TD_NOTLS error code.])
1802fi
3f47be5c 1803
e655c1a2
PA
1804dnl Set the host's .gdbinit filename.
1805case $host_os in
1806 go32* | *djgpp*)
1807 gdbinit=gdb.ini
1808 ;;
1809 *)
1810 gdbinit=.gdbinit
1811 ;;
1812esac
1813AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
1814
92e4e97a
AB
1815dnl Set the host's .gdbearlyinit filename
1816AC_DEFINE_UNQUOTED(GDBEARLYINIT,".gdbearlyinit",[The .gdbearlyinit filename.])
1817
c906108c 1818dnl Handle optional features that can be enabled.
fb40c209 1819
f83d8a90
DE
1820# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
1821# except that the argument to --with-sysroot is optional.
1822# --with-sysroot (or --with-sysroot=yes) sets the default sysroot path.
1823if test "x$with_sysroot" = xyes; then
1824 with_sysroot="${exec_prefix}/${target_alias}/sys-root"
1825fi
030292b7 1826AC_ARG_WITH(sysroot,
f83d8a90
DE
1827 AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
1828 [search for usr/lib et al within DIR]),
1829 [TARGET_SYSTEM_ROOT=$withval], [TARGET_SYSTEM_ROOT=])
1830AC_DEFINE_DIR(TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT,
1831 [search for usr/lib et al within DIR])
030292b7 1832AC_SUBST(TARGET_SYSTEM_ROOT)
f83d8a90 1833GDB_AC_DEFINE_RELOCATABLE(TARGET_SYSTEM_ROOT, sysroot, ${ac_define_dir})
030292b7 1834
b14b1491
TT
1835GDB_AC_WITH_DIR(SYSTEM_GDBINIT, system-gdbinit,
1836 [automatically load a system-wide gdbinit file],
1837 [])
ed2a2229
CB
1838GDB_AC_WITH_DIR(SYSTEM_GDBINIT_DIR, system-gdbinit-dir,
1839 [automatically load system-wide gdbinit files from this directory],
1840 [])
16e7150e 1841
b835bb52 1842AM_GDB_WARNINGS
f35d5ade 1843AM_GDB_UBSAN
3bc3d82a 1844
7a292a7a
SS
1845# In the Cygwin environment, we need some additional flags.
1846AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
92a021de 1847[AC_EGREP_CPP(^lose$, [
7a292a7a
SS
1848#if defined (__CYGWIN__) || defined (__CYGWIN32__)
1849lose
1850#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
1851
aff38e61
AC
1852
1853dnl Figure out which of the many generic ser-*.c files the _host_ supports.
3eb25fda 1854SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
aff38e61 1855case ${host} in
95cbc983
AC
1856 *go32* ) SER_HARDWIRE=ser-go32.o ;;
1857 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
0ea3f30e 1858 *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
c1168a2f 1859 *) SER_HARDWIRE="$SER_HARDWIRE ser-uds.o" ;;
aff38e61
AC
1860esac
1861AC_SUBST(SER_HARDWIRE)
1862
cd0fc7c3
SS
1863# libreadline needs libuser32.a in a cygwin environment
1864WIN32LIBS=
0ad6b8ee 1865if test x"$gdb_cv_os_cygwin" = xyes; then
c5394b80
JM
1866 WIN32LIBS="-luser32"
1867 case "${target}" in
1868 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
1869 ;;
1870 esac
cd0fc7c3 1871fi
b4505029
MM
1872
1873# The ser-tcp.c module requires sockets.
b2ceabe8
TT
1874# Note that WIN32APILIBS is set by GDB_AC_COMMON.
1875WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
7a292a7a 1876
31d99776 1877# Add ELF support to GDB, but only if BFD includes ELF support.
def63ff0
TT
1878GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,
1879 [bfd_get_elf_phdr_upper_bound (NULL)], elf-bfd.h)
0ad6b8ee 1880if test "$gdb_cv_var_elf" = yes; then
fb8f3fc0
AB
1881 CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o dtrace-probe.o \
1882 gcore-elf.o elf-none-tdep.o"
31d99776
DJ
1883 AC_DEFINE(HAVE_ELF, 1,
1884 [Define if ELF support should be included.])
075ff26d
JK
1885 # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
1886 if test "$plugins" = "yes"; then
a48b32c0 1887 AC_SEARCH_LIBS(dlopen, dl)
075ff26d 1888 fi
31d99776 1889fi
31d99776 1890
4f05add4
TT
1891# Add macho support to GDB, but only if BFD includes it.
1892GDB_AC_CHECK_BFD([for Mach-O support in BFD], gdb_cv_var_macho,
1893 [bfd_mach_o_lookup_command (NULL, 0, NULL)], mach-o.h)
0ad6b8ee 1894if test "$gdb_cv_var_macho" = yes; then
4f05add4
TT
1895 CONFIG_OBS="$CONFIG_OBS machoread.o"
1896fi
1897
121ce6e5
DJ
1898# Add any host-specific objects to GDB.
1899CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
1900
608e2dbb 1901# If building on ELF, look for lzma support for embedded compressed debug info.
0ad6b8ee 1902if test "$gdb_cv_var_elf" = yes; then
608e2dbb
TT
1903 AC_ARG_WITH(lzma,
1904 AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]),
1905 [], [with_lzma=auto])
1906 AC_MSG_CHECKING([whether to use lzma])
1907 AC_MSG_RESULT([$with_lzma])
1908
1909 if test "${with_lzma}" != no; then
1910 AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include "lzma.h"],
1911 [lzma_index_iter iter;
1912 lzma_index_iter_init (&iter, 0);
1913 lzma_mf_is_supported (LZMA_MF_HC3);])
1914 if test "$HAVE_LIBLZMA" != yes; then
1915 if test "$with_lzma" = yes; then
1916 AC_MSG_ERROR([missing liblzma for --with-lzma])
1917 fi
1918 fi
1919 fi
1920fi
1921
3fc11d3e
JM
1922LIBGUI="../libgui/src/libgui.a"
1923GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
1924AC_SUBST(LIBGUI)
1925AC_SUBST(GUI_CFLAGS_X)
7a292a7a 1926
3fc11d3e
JM
1927WIN32LDAPP=
1928AC_SUBST(WIN32LIBS)
1929AC_SUBST(WIN32LDAPP)
1930
d91670b9 1931case "${host}" in
686a5eed 1932*-*-cygwin* | *-*-mingw* )
d91670b9
CV
1933 configdir="win"
1934 ;;
1935*)
1936 configdir="unix"
1937 ;;
1938esac
3fc11d3e
JM
1939
1940GDBTKLIBS=
1941if test "${enable_gdbtk}" = "yes"; then
1942
d1c3b63a
KS
1943 # Gdbtk must have an absolute path to srcdir in order to run
1944 # properly when not installed.
1945 here=`pwd`
1946 cd ${srcdir}
1947 GDBTK_SRC_DIR=`pwd`
1948 cd $here
1949
5062cc19 1950 SC_PATH_TCLCONFIG
85541719
DE
1951
1952 # If $no_tk is nonempty, then we can't do Tk, and there is no
1953 # point to doing Tcl.
1954 SC_PATH_TKCONFIG
1955
1956 if test -z "${no_tcl}" -a -z "${no_tk}"; then
5062cc19
KS
1957 SC_LOAD_TCLCONFIG
1958
1959 # Check for in-tree tcl
1960 here=`pwd`
1961 cd ${srcdir}/..
1962 topdir=`pwd`
1963 cd ${here}
1964
1965 intree="no"
1966 if test "${TCL_SRC_DIR}" = "${topdir}/tcl"; then
1967 intree="yes"
1968 fi
1969
1970 # Find Tcl private headers
1971 if test x"${intree}" = xno; then
1972 CY_AC_TCL_PRIVATE_HEADERS
1973 TCL_INCLUDE="${TCL_INCLUDE_SPEC} ${TCL_PRIVATE_INCLUDE}"
1974 TCL_LIBRARY="${TCL_LIB_SPEC}"
1975 TCL_DEPS=""
1976 else
1977 # If building tcl in the same src tree, private headers
1978 # are not needed, but we need to be sure to use the right
1979 # headers library
4869db5e 1980 TCL_INCLUDE="-I${TCL_SRC_DIR}/generic"
5062cc19
KS
1981 TCL_LIBRARY="${TCL_BUILD_LIB_SPEC}"
1982 TCL_DEPS="../tcl/${configdir}${TCL_LIB_FILE}"
1983 fi
1984 AC_SUBST(TCL_INCLUDE)
1985 AC_SUBST(TCL_LIBRARY)
1986 AC_SUBST(TCL_DEPS)
dd2504ab 1987
85541719
DE
1988 SC_LOAD_TKCONFIG
1989
1990 # Check for in-tree Tk
1991 intree="no"
1992 if test "${TK_SRC_DIR}" = "${topdir}/tk"; then
4869db5e 1993 intree="yes"
85541719
DE
1994 fi
1995
1996 # Find Tk private headers
1997 if test x"${intree}" = xno; then
1998 CY_AC_TK_PRIVATE_HEADERS
1999 TK_INCLUDE="${TK_INCLUDE_SPEC} ${TK_PRIVATE_INCLUDE}"
2000 TK_LIBRARY=${TK_LIB_SPEC}
2001 TK_DEPS=""
2002 else
2003 TK_INCLUDE="-I${TK_SRC_DIR}/generic"
2004 TK_LIBRARY="${TK_BUILD_LIB_SPEC}"
2005 TK_DEPS="../tk/${configdir}/${TK_LIB_FILE}"
2006 fi
2007 AC_SUBST(TK_INCLUDE)
2008 AC_SUBST(TK_LIBRARY)
2009 AC_SUBST(TK_DEPS)
2010 AC_SUBST(TK_XINCLUDES)
2011
2012 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
2013
2014 # Include some libraries that Tcl and Tk want.
2015 TCL_LIBS='$(LIBGUI) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
2016 # Yes, the ordering seems wrong here. But it isn't.
2017 # TK_LIBS is the list of libraries that need to be linked
2018 # after Tcl/Tk. Note that this isn't put into LIBS. If it
2019 # were in LIBS then any link tests after this point would
2020 # try to include things like `$(LIBGUI)', which wouldn't work.
2021 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
2022
2023 CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
2024 CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
2025 CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
2026 CONFIG_ALL="${CONFIG_ALL} all-gdbtk"
2027 CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk"
2028 CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
2029 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
2030
0ad6b8ee 2031 if test x"$gdb_cv_os_cygwin" = xyes; then
85541719
DE
2032 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
2033 WIN32LDAPP="-Wl,--subsystem,console"
2034 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
3fc11d3e 2035 fi
ffc6a242 2036
85541719
DE
2037 AC_CONFIG_SUBDIRS(gdbtk)
2038 fi
3fc11d3e
JM
2039fi
2040
3fc11d3e
JM
2041AC_SUBST(X_CFLAGS)
2042AC_SUBST(X_LDFLAGS)
2043AC_SUBST(X_LIBS)
3fc11d3e
JM
2044AC_SUBST(GDBTKLIBS)
2045AC_SUBST(GDBTK_CFLAGS)
d1c3b63a 2046AC_SUBST(GDBTK_SRC_DIR)
8b93c638 2047
c906108c
SS
2048AC_PATH_X
2049
4869db5e
RM
2050# Unlike the sim directory, whether a simulator is linked is controlled by
2051# presence of a gdb_sim definition in the target configure.tgt entry.
7a292a7a
SS
2052# This code just checks for a few cases where we'd like to ignore those
2053# definitions, even when they're present in the '.mt' file. These cases
2054# are when --disable-sim is specified, or if the simulator directory is
6c5cfe5b 2055# not part of the source tree.
7a292a7a
SS
2056#
2057AC_ARG_ENABLE(sim,
d2596e2e 2058AS_HELP_STRING([--enable-sim], [link gdb with simulator]),
7a292a7a
SS
2059[echo "enable_sim = $enable_sim";
2060 echo "enableval = ${enableval}";
2061 case "${enableval}" in
2062 yes) ignore_sim=false ;;
2063 no) ignore_sim=true ;;
2064 *) ignore_sim=false ;;
2065 esac],
2066[ignore_sim=false])
2067
2068if test ! -d "${srcdir}/../sim"; then
2069 ignore_sim=true
2070fi
2071
9b624dbe
UW
2072SIM=
2073SIM_OBS=
2074if test "${ignore_sim}" = "false"; then
2075 if test x"${gdb_sim}" != x ; then
2076 SIM="${gdb_sim}"
2077 SIM_OBS="remote-sim.o"
60ca704f 2078 AC_DEFINE(WITH_SIM, 1, [Define if the simulator is being linked in.])
976102cd
PA
2079
2080 # Some tdep code should only be compiled in when the ppc sim is
2081 # built. PR sim/13418.
2082 case $target in
2083 powerpc*-*-*)
2084 AC_DEFINE(WITH_PPC_SIM, 1, [Define if the PPC simulator is being linked in.])
2085 ;;
2086 esac
9b624dbe 2087 fi
7a292a7a 2088fi
9b624dbe
UW
2089AC_SUBST(SIM)
2090AC_SUBST(SIM_OBS)
7a292a7a 2091
c906108c 2092AC_SUBST(ENABLE_CFLAGS)
d28f9cdf 2093AC_SUBST(PROFILE_CFLAGS)
c906108c
SS
2094
2095AC_SUBST(CONFIG_OBS)
2096AC_SUBST(CONFIG_DEPS)
2097AC_SUBST(CONFIG_SRCS)
b3a90332
AC
2098AC_SUBST(CONFIG_ALL)
2099AC_SUBST(CONFIG_CLEAN)
e56ac5c3
AC
2100AC_SUBST(CONFIG_INSTALL)
2101AC_SUBST(CONFIG_UNINSTALL)
c906108c 2102
c35f4ffc
AC
2103# List of host floatformats.
2104AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
2105AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
2106AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
2107
c906108c
SS
2108# target_subdir is used by the testsuite to find the target libraries.
2109target_subdir=
2110if test "${host}" != "${target}"; then
2111 target_subdir="${target_alias}/"
2112fi
2113AC_SUBST(target_subdir)
2114
21ea5acd 2115# Import nat definitions.
2b351b19 2116nat_makefile_frag=/dev/null
771b4502 2117if test "${gdb_native}" = "yes"; then
21ea5acd
SDJ
2118 . ${srcdir}/configure.nat
2119 nativefile=$NAT_FILE
c906108c 2120fi
c906108c 2121
21ea5acd
SDJ
2122AC_SUBST(NAT_FILE)
2123AC_SUBST(NATDEPFILES)
2124AC_SUBST(NAT_CDEPS)
2125AC_SUBST(LOADLIBES)
2126AC_SUBST(MH_CFLAGS)
2127AC_SUBST(XM_CLIBS)
2128AC_SUBST(NAT_GENERATED_FILES)
2129AC_SUBST(HAVE_NATIVE_GCORE_HOST)
2b351b19 2130AC_SUBST_FILE(nat_makefile_frag)
c906108c 2131
b00a8037
DJ
2132if test x"${gdb_osabi}" != x ; then
2133 AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi,
2134 [Define to the default OS ABI for this configuration.])
2135fi
2136
393fd4c3
YQ
2137# Check for babeltrace and babeltrace-ctf
2138AC_ARG_WITH(babeltrace,
5593a99a 2139 AS_HELP_STRING([--with-babeltrace], [include babeltrace support (auto/yes/no)]),
393fd4c3
YQ
2140 [], [with_babeltrace=auto])
2141AC_MSG_CHECKING([whether to use babeltrace])
2142AC_MSG_RESULT([$with_babeltrace])
2143
2144if test "x$with_babeltrace" = "xno"; then
2145 AC_MSG_WARN([babletrace support disabled; GDB is unable to read CTF data.])
2146else
2147 # Append -Werror to CFLAGS so that configure can catch the warning
2148 # "assignment from incompatible pointer type", which is related to
2149 # the babeltrace change from 1.0.3 to 1.1.0. Babeltrace 1.1.0 works
2150 # in GDB, while babeltrace 1.0.3 is broken.
2151 # AC_LIB_HAVE_LINKFLAGS may modify CPPFLAGS in it, so it should be
2152 # safe to save and restore CFLAGS here.
2153 saved_CFLAGS=$CFLAGS
2154 CFLAGS="$CFLAGS -Werror"
2155 AC_LIB_HAVE_LINKFLAGS([babeltrace], [babeltrace-ctf],
2156 [#include <babeltrace/babeltrace.h>
2157 #include <babeltrace/ctf/events.h>
2158 #include <babeltrace/ctf/iterator.h>],
2159 [struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL));
2160 struct bt_ctf_event *event = NULL;
2161 const struct bt_definition *scope;
2162
13cdc2af 2163 pos->type = BT_SEEK_BEGIN;
65c749e7 2164 bt_iter_set_pos (bt_ctf_get_iter (NULL), pos);
4869db5e 2165 scope = bt_ctf_get_top_level_scope (event,
393fd4c3
YQ
2166 BT_STREAM_EVENT_HEADER);
2167 bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
2168 ])
2169 CFLAGS=$saved_CFLAGS
2170
2171 if test "$HAVE_LIBBABELTRACE" != yes; then
2172 if test "$with_babeltrace" = yes; then
2173 AC_MSG_ERROR([babeltrace is missing or unusable])
2174 else
2175 AC_MSG_WARN([babeltrace is missing or unusable; GDB is unable to read CTF data.])
2176 fi
2177 fi
2178fi
2179
ccb1ba62
CB
2180# Check for xxhash
2181AC_ARG_WITH(xxhash,
5593a99a 2182 AS_HELP_STRING([--with-xxhash], [use libxxhash for hashing (faster) (auto/yes/no)]),
ccb1ba62
CB
2183 [], [with_xxhash=auto])
2184
1776e3e5
NA
2185GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
2186if test x${enable_static} = xno; then
2187 LIBCTF="-Wl,--rpath,../libctf/.libs ../libctf/.libs/libctf.so"
2188 CTF_DEPS="../libctf/.libs/libctf.so"
2189else
2190 LIBCTF="../libctf/.libs/libctf.a"
2191 CTF_DEPS="$LIBCTF"
2192fi
2193if test "${enable_libctf}" = yes; then
2194 AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
2195else
2196 LIBCTF=
2197 CTF_DEPS=
2198fi
f99d1d37 2199AC_SUBST(enable_libctf)
1776e3e5
NA
2200AC_SUBST(LIBCTF)
2201AC_SUBST(CTF_DEPS)
2202
2203# If nativefile (NAT_FILE) is not set in configure.nat, we link to an
2204# empty version.
2205
ccb1ba62
CB
2206if test "x$with_xxhash" != "xno"; then
2207 AC_LIB_HAVE_LINKFLAGS([xxhash], [],
2208 [#include <xxhash.h>],
2209 [XXH32("foo", 3, 0);
2210 ])
2211 if test "$HAVE_LIBXXHASH" != yes; then
2212 if test "$with_xxhash" = yes; then
2213 AC_MSG_ERROR([xxhash is missing or unusable])
2214 fi
2215 fi
2216 if test "x$with_xxhash" = "xauto"; then
2217 with_xxhash="$HAVE_LIBXXHASH"
2218 fi
2219fi
2220
2221AC_MSG_CHECKING([whether to use xxhash])
2222AC_MSG_RESULT([$with_xxhash])
2223
a0a461e5 2224NM_H=
c906108c
SS
2225rm -f nm.h
2226if test "${nativefile}" != ""; then
0f475e27
AC
2227 case "${nativefile}" in
2228 nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
2229 * ) GDB_NM_FILE="${nativefile}"
2230 esac
a0a461e5
TT
2231 AC_CONFIG_LINKS([nm.h:$GDB_NM_FILE], [echo > stamp-nmh],
2232 [GDB_NM_FILE=$GDB_NM_FILE])
60ca704f 2233 AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile])
a0a461e5 2234 NM_H=nm.h
c906108c 2235fi
cfd53605 2236AC_SUBST(GDB_NM_FILE)
a0a461e5 2237AC_SUBST(NM_H)
5a2402b8 2238
e3487908
GKB
2239dnl Add dependency for xsltproc if building with maintainer-mode enabled.
2240AC_PATH_PROGS(XSLTPROC, xsltproc, missing)
2241if test "x$USE_MAINTAINER_MODE" = xyes; then
2242 if test "${XSLTPROC}" = missing; then
5593a99a 2243 AC_MSG_ERROR(unable to find xsltproc. maintainer-mode requires xsltproc.)
e3487908
GKB
2244 fi
2245fi
2246AC_SUBST(XSLTPROC)
2247
c906108c
SS
2248dnl Check for exe extension set on certain hosts (e.g. Win32)
2249AC_EXEEXT
2250
234b45d4 2251dnl Detect the character set used by this host.
6c7a06a3
TT
2252dnl At the moment, we just assume it's UTF-8.
2253AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
234b45d4
KB
2254 [Define to be a string naming the default host character set.])
2255
8ecfd7bd 2256GDB_AC_SELFTEST([
74cd3f9d
SM
2257 CONFIG_OBS="$CONFIG_OBS \$(SELFTESTS_OBS)"
2258 CONFIG_SRCS="$CONFIG_SRCS \$(SELFTESTS_SRCS)"
8ecfd7bd 2259])
dcd1f979 2260
f6a88844
JM
2261GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])
2262GDB_AC_TRANSFORM([gcore], [GCORE_TRANSFORM_NAME])
b292c783 2263AC_CONFIG_FILES([gcore], [chmod +x gcore])
c5adaa19 2264AC_CONFIG_FILES([Makefile gdb-gdb.gdb gdb-gdb.py doc/Makefile data-directory/Makefile])
f99d1d37
TT
2265# Transform the name of some programs for the testsuite/lib/pdtrace
2266# test tool.
2267GDB_AC_TRANSFORM(strip, STRIP_TRANSFORM_NAME)
2268GDB_AC_TRANSFORM(readelf, READELF_TRANSFORM_NAME)
2269GDB_AC_TRANSFORM(as, GAS_TRANSFORM_NAME)
2270GDB_AC_TRANSFORM(nm, NM_TRANSFORM_NAME)
2271AC_CONFIG_FILES([testsuite/lib/pdtrace], [chmod +x testsuite/lib/pdtrace])
2272AC_CONFIG_FILES([testsuite/Makefile])
c906108c 2273
1e94266c 2274AC_OUTPUT
This page took 1.585591 seconds and 4 git commands to generate.