xref: /dragonfly/contrib/gdb-7/gdb/configure.ac (revision ef5ccd6c)
15796c8dcSSimon Schubertdnl Autoconf configure script for GDB, the GNU debugger.
2*ef5ccd6cSJohn Marinodnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
35796c8dcSSimon Schubertdnl
45796c8dcSSimon Schubertdnl This file is part of GDB.
55796c8dcSSimon Schubertdnl
65796c8dcSSimon Schubertdnl This program is free software; you can redistribute it and/or modify
75796c8dcSSimon Schubertdnl it under the terms of the GNU General Public License as published by
85796c8dcSSimon Schubertdnl the Free Software Foundation; either version 3 of the License, or
95796c8dcSSimon Schubertdnl (at your option) any later version.
105796c8dcSSimon Schubertdnl
115796c8dcSSimon Schubertdnl This program is distributed in the hope that it will be useful,
125796c8dcSSimon Schubertdnl but WITHOUT ANY WARRANTY; without even the implied warranty of
135796c8dcSSimon Schubertdnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
145796c8dcSSimon Schubertdnl GNU General Public License for more details.
155796c8dcSSimon Schubertdnl
165796c8dcSSimon Schubertdnl You should have received a copy of the GNU General Public License
175796c8dcSSimon Schubertdnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
185796c8dcSSimon Schubert
195796c8dcSSimon Schubertdnl Process this file with autoconf to produce a configure script.
205796c8dcSSimon Schubert
215796c8dcSSimon SchubertAC_PREREQ(2.59)dnl
225796c8dcSSimon SchubertAC_INIT(main.c)
235796c8dcSSimon SchubertAC_CONFIG_HEADER(config.h:config.in)
245796c8dcSSimon SchubertAM_MAINTAINER_MODE
255796c8dcSSimon Schubert
26*ef5ccd6cSJohn Marino# Provide more thorough testing by -lmcheck.
27*ef5ccd6cSJohn Marino# Set it to 'true' for development snapshots, 'false' for releases or
28*ef5ccd6cSJohn Marino# pre-releases.
29*ef5ccd6cSJohn Marinodevelopment=false
30*ef5ccd6cSJohn Marino
315796c8dcSSimon SchubertAC_PROG_CC
325796c8dcSSimon SchubertAC_USE_SYSTEM_EXTENSIONS
33cf7f2e2dSJohn MarinoACX_LARGEFILE
345796c8dcSSimon SchubertAM_PROG_CC_STDC
355796c8dcSSimon Schubert
365796c8dcSSimon SchubertAC_CONFIG_AUX_DIR(..)
375796c8dcSSimon SchubertAC_CANONICAL_SYSTEM
38*ef5ccd6cSJohn MarinoAC_ARG_PROGRAM
395796c8dcSSimon Schubert
405796c8dcSSimon Schubert# Dependency checking.
415796c8dcSSimon SchubertZW_CREATE_DEPDIR
425796c8dcSSimon SchubertZW_PROG_COMPILER_DEPENDENCIES([CC])
435796c8dcSSimon Schubert
445796c8dcSSimon Schubert# Check for the 'make' the user wants to use.
455796c8dcSSimon SchubertAC_CHECK_PROGS(MAKE, make)
465796c8dcSSimon SchubertMAKE_IS_GNU=
475796c8dcSSimon Schubertcase "`$MAKE --version 2>&1 | sed 1q`" in
485796c8dcSSimon Schubert  *GNU*)
495796c8dcSSimon Schubert    MAKE_IS_GNU=yes
505796c8dcSSimon Schubert    ;;
515796c8dcSSimon Schubertesac
525796c8dcSSimon SchubertAM_CONDITIONAL(GMAKE, test "$MAKE_IS_GNU" = yes)
535796c8dcSSimon SchubertAC_PROG_MAKE_SET
545796c8dcSSimon Schubert
55*ef5ccd6cSJohn Marino# Configure gnulib.  We need to build gnulib under some other
56*ef5ccd6cSJohn Marino# directory not "gnulib", to avoid the problem of both GDB and
57*ef5ccd6cSJohn Marino# GDBserver wanting to build it in the same directory, when building
58*ef5ccd6cSJohn Marino# in the source dir.
59*ef5ccd6cSJohn MarinoACX_CONFIGURE_DIR(["gnulib"], ["build-gnulib"])
60*ef5ccd6cSJohn Marino
615796c8dcSSimon Schubertdnl List of object files and targets accumulated by configure.
625796c8dcSSimon Schubert
635796c8dcSSimon SchubertCONFIG_OBS=
645796c8dcSSimon SchubertCONFIG_DEPS=
655796c8dcSSimon SchubertCONFIG_SRCS=
665796c8dcSSimon SchubertENABLE_CFLAGS=
675796c8dcSSimon Schubert
685796c8dcSSimon SchubertCONFIG_ALL=
695796c8dcSSimon SchubertCONFIG_CLEAN=
705796c8dcSSimon SchubertCONFIG_INSTALL=
715796c8dcSSimon SchubertCONFIG_UNINSTALL=
725796c8dcSSimon Schubert
735796c8dcSSimon Schubertdnl Set up for gettext.
745796c8dcSSimon SchubertZW_GNU_GETTEXT_SISTER_DIR
755796c8dcSSimon Schubert
765796c8dcSSimon Schubertlocaledir='${datadir}/locale'
775796c8dcSSimon SchubertAC_SUBST(localedir)
785796c8dcSSimon Schubert
795796c8dcSSimon Schubertif test x"$USE_NLS" = xyes; then
805796c8dcSSimon Schubert   CONFIG_ALL="$CONFIG_ALL all-po"
815796c8dcSSimon Schubert   CONFIG_CLEAN="$CONFIG_CLEAN clean-po"
825796c8dcSSimon Schubert   CONFIG_INSTALL="$CONFIG_INSTALL install-po"
835796c8dcSSimon Schubert   CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po"
845796c8dcSSimon Schubertfi
855796c8dcSSimon Schubert
86*ef5ccd6cSJohn MarinoGNULIB=build-gnulib/import
875796c8dcSSimon Schubert
885796c8dcSSimon Schubert# For Makefile dependencies.
895796c8dcSSimon SchubertGNULIB_STDINT_H=
905796c8dcSSimon Schubertif test x"$STDINT_H" != x; then
91*ef5ccd6cSJohn Marino  GNULIB_STDINT_H=$GNULIB/$STDINT_H
925796c8dcSSimon Schubertfi
935796c8dcSSimon SchubertAC_SUBST(GNULIB_STDINT_H)
945796c8dcSSimon Schubert
955796c8dcSSimon SchubertPACKAGE=gdb
965796c8dcSSimon SchubertAC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
975796c8dcSSimon SchubertAC_SUBST(PACKAGE)
985796c8dcSSimon Schubert
99a45ae5f8SJohn Marino# We never need to detect it in this sub-configure.
100a45ae5f8SJohn Marino# But preserve it for config.status --recheck.
101a45ae5f8SJohn MarinoAC_ARG_VAR(MAKEINFO,
102a45ae5f8SJohn Marino  [Parent configure detects if it is of sufficient version.])
103a45ae5f8SJohn MarinoAC_ARG_VAR(MAKEINFOFLAGS,
104a45ae5f8SJohn Marino  [Parameters for MAKEINFO.])
105a45ae5f8SJohn Marino
106a45ae5f8SJohn MarinoMAKEINFO_EXTRA_FLAGS=""
107a45ae5f8SJohn MarinoAC_CACHE_CHECK([whether $MAKEINFO supports @click], gdb_cv_have_makeinfo_click,
108a45ae5f8SJohn Marino  [echo '@clicksequence{a @click{} b}' >conftest.texinfo
109a45ae5f8SJohn Marino  if eval "$MAKEINFO conftest.texinfo >&5 2>&5"; then
110a45ae5f8SJohn Marino    gdb_cv_have_makeinfo_click=yes
111a45ae5f8SJohn Marino  else
112a45ae5f8SJohn Marino    gdb_cv_have_makeinfo_click=no
113a45ae5f8SJohn Marino  fi])
114a45ae5f8SJohn Marinoif test x"$gdb_cv_have_makeinfo_click" = xyes; then
115a45ae5f8SJohn Marino  MAKEINFO_EXTRA_FLAGS="$MAKEINFO_EXTRA_FLAGS -DHAVE_MAKEINFO_CLICK"
116a45ae5f8SJohn Marinofi
117a45ae5f8SJohn MarinoAC_SUBST(MAKEINFO_EXTRA_FLAGS)
118a45ae5f8SJohn Marino
1195796c8dcSSimon SchubertGDB_AC_WITH_DIR(DEBUGDIR, separate-debug-dir,
1205796c8dcSSimon Schubert    [look for global separate debug info in this path @<:@LIBDIR/debug@:>@],
1215796c8dcSSimon Schubert    [${libdir}/debug])
1225796c8dcSSimon Schubert
123*ef5ccd6cSJohn Marino# We can't pass paths as command line arguments.
124*ef5ccd6cSJohn Marino# Mingw32 tries to be clever and will convert the paths for us.
125*ef5ccd6cSJohn Marino# For example -DBINDIR="/usr/local/bin" passed on the command line may get
126*ef5ccd6cSJohn Marino# converted to -DBINDIR="E:/msys/mingw32/msys/1.0/local/bin".
127*ef5ccd6cSJohn Marino# This breaks GDB's relocatable path conversions since paths passed in
128*ef5ccd6cSJohn Marino# config.h would not get so translated, the path prefixes no longer match.
129*ef5ccd6cSJohn MarinoAC_DEFINE_DIR(BINDIR, bindir, [Directory of programs.])
130*ef5ccd6cSJohn Marino
1315796c8dcSSimon Schubert# GDB's datadir relocation
1325796c8dcSSimon Schubert
1335796c8dcSSimon SchubertGDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir,
1345796c8dcSSimon Schubert    [look for global separate data files in this path @<:@DATADIR/gdb@:>@],
1355796c8dcSSimon Schubert    [${datadir}/gdb])
1365796c8dcSSimon Schubert
1375796c8dcSSimon SchubertAC_ARG_WITH(relocated-sources,
1385796c8dcSSimon SchubertAS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this path for source files]),
1395796c8dcSSimon Schubert[reloc_srcdir="${withval}"
1405796c8dcSSimon Schubert AC_DEFINE_DIR(RELOC_SRCDIR, reloc_srcdir,
1415796c8dcSSimon Schubert              [Relocated directory for source files. ])
1425796c8dcSSimon Schubert])
1435796c8dcSSimon Schubert
144*ef5ccd6cSJohn MarinoAC_MSG_CHECKING([for default auto-load directory])
145*ef5ccd6cSJohn MarinoAC_ARG_WITH(auto-load-dir,
146*ef5ccd6cSJohn MarinoAS_HELP_STRING([--with-auto-load-dir=PATH],
147*ef5ccd6cSJohn Marino  [directories from which to load auto-loaded scripts @<:@$debugdir:$datadir/auto-load@:>@]),,
148*ef5ccd6cSJohn Marino  [with_auto_load_dir='$debugdir:$datadir/auto-load'])
149*ef5ccd6cSJohn Marinoescape_dir=`echo $with_auto_load_dir | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
150*ef5ccd6cSJohn MarinoAC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
151*ef5ccd6cSJohn Marino	      [Directories from which to load auto-loaded scripts.])
152*ef5ccd6cSJohn MarinoAC_MSG_RESULT([$with_auto_load_dir])
153*ef5ccd6cSJohn Marino
154*ef5ccd6cSJohn MarinoAC_MSG_CHECKING([for default auto-load safe-path])
155*ef5ccd6cSJohn MarinoAC_ARG_WITH(auto-load-safe-path,
156*ef5ccd6cSJohn MarinoAS_HELP_STRING([--with-auto-load-safe-path=PATH],
157*ef5ccd6cSJohn Marino  [directories safe to hold auto-loaded files @<:@--with-auto-load-dir@:>@])
158*ef5ccd6cSJohn MarinoAS_HELP_STRING([--without-auto-load-safe-path],
159*ef5ccd6cSJohn Marino               [do not restrict auto-loaded files locations]),
160*ef5ccd6cSJohn Marino    [if test "$with_auto_load_safe_path" = "no"; then
161*ef5ccd6cSJohn Marino     with_auto_load_safe_path="/"
162*ef5ccd6cSJohn Marino     fi],
163*ef5ccd6cSJohn Marino[with_auto_load_safe_path="$with_auto_load_dir"])
164*ef5ccd6cSJohn Marinoescape_dir=`echo $with_auto_load_safe_path | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
165*ef5ccd6cSJohn MarinoAC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
166*ef5ccd6cSJohn Marino	      [Directories safe to hold auto-loaded files.])
167*ef5ccd6cSJohn MarinoAC_MSG_RESULT([$with_auto_load_safe_path])
168*ef5ccd6cSJohn Marino
169c50c785cSJohn MarinoAC_CONFIG_SUBDIRS(testsuite)
1705796c8dcSSimon Schubert
1715796c8dcSSimon Schubert# Check whether to support alternative target configurations
1725796c8dcSSimon SchubertAC_ARG_ENABLE(targets,
1735796c8dcSSimon SchubertAS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
1745796c8dcSSimon Schubert[case "${enableval}" in
1755796c8dcSSimon Schubert  yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
1765796c8dcSSimon Schubert            ;;
1775796c8dcSSimon Schubert  no)       enable_targets= ;;
1785796c8dcSSimon Schubert  *)        enable_targets=$enableval ;;
1795796c8dcSSimon Schubertesac])
1805796c8dcSSimon Schubert
1815796c8dcSSimon Schubert# Check whether to enable 64-bit support on 32-bit hosts
1825796c8dcSSimon SchubertAC_ARG_ENABLE(64-bit-bfd,
1835796c8dcSSimon SchubertAS_HELP_STRING([--enable-64-bit-bfd], [64-bit support (on hosts with narrower word sizes)]),
1845796c8dcSSimon Schubert[case "${enableval}" in
1855796c8dcSSimon Schubert  yes)  want64=true  ;;
1865796c8dcSSimon Schubert  no)   want64=false ;;
1875796c8dcSSimon Schubert  *)    AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
1885796c8dcSSimon Schubertesac],[want64=false])dnl
1895796c8dcSSimon Schubert
1905796c8dcSSimon Schubert# Provide defaults for some variables set by the per-host and per-target
1915796c8dcSSimon Schubert# configuration.
1925796c8dcSSimon Schubertgdb_host_obs=posix-hdep.o
1935796c8dcSSimon Schubert
1945796c8dcSSimon Schubertif test "${target}" = "${host}"; then
1955796c8dcSSimon Schubert  gdb_native=yes
1965796c8dcSSimon Schubertelse
1975796c8dcSSimon Schubert  gdb_native=no
1985796c8dcSSimon Schubertfi
1995796c8dcSSimon Schubert
2005796c8dcSSimon Schubert. $srcdir/configure.host
2015796c8dcSSimon Schubert
2025796c8dcSSimon Schubert# Accumulate some settings from configure.tgt over all enabled targets
2035796c8dcSSimon Schubert
2045796c8dcSSimon SchubertTARGET_OBS=
2055796c8dcSSimon Schubertall_targets=
2065796c8dcSSimon Schubert
2075796c8dcSSimon Schubertfor targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
2085796c8dcSSimon Schubertdo
2095796c8dcSSimon Schubert  if test "$targ_alias" = "all"; then
2105796c8dcSSimon Schubert    all_targets=true
2115796c8dcSSimon Schubert  else
2125796c8dcSSimon Schubert    # Canonicalize the secondary target names.
2135796c8dcSSimon Schubert    result=`$ac_config_sub $targ_alias 2>/dev/null`
2145796c8dcSSimon Schubert    if test -n "$result"; then
2155796c8dcSSimon Schubert        targ=$result
2165796c8dcSSimon Schubert    else
2175796c8dcSSimon Schubert        targ=$targ_alias
2185796c8dcSSimon Schubert    fi
2195796c8dcSSimon Schubert
2205796c8dcSSimon Schubert    . ${srcdir}/configure.tgt
2215796c8dcSSimon Schubert
222cf7f2e2dSJohn Marino    AS_IF([test -z "${gdb_target_obs}"],
223cf7f2e2dSJohn Marino      [AC_MSG_ERROR([configuration ${targ} is unsupported.])])
224cf7f2e2dSJohn Marino
2255796c8dcSSimon Schubert    # Target-specific object files
2265796c8dcSSimon Schubert    for i in ${gdb_target_obs}; do
2275796c8dcSSimon Schubert        case " $TARGET_OBS " in
2285796c8dcSSimon Schubert        *" ${i} "*) ;;
2295796c8dcSSimon Schubert        *)
2305796c8dcSSimon Schubert          TARGET_OBS="$TARGET_OBS ${i}"
2315796c8dcSSimon Schubert          ;;
2325796c8dcSSimon Schubert        esac
2335796c8dcSSimon Schubert    done
2345796c8dcSSimon Schubert
2355796c8dcSSimon Schubert    # Check whether this target needs 64-bit CORE_ADDR
2365796c8dcSSimon Schubert    if test x${want64} = xfalse; then
2375796c8dcSSimon Schubert      . ${srcdir}/../bfd/config.bfd
2385796c8dcSSimon Schubert    fi
2395796c8dcSSimon Schubert  fi
2405796c8dcSSimon Schubertdone
2415796c8dcSSimon Schubert
2425796c8dcSSimon Schubertif test x${all_targets} = xtrue; then
2435796c8dcSSimon Schubert
2445796c8dcSSimon Schubert  # We want all 64-bit targets if we either:
2455796c8dcSSimon Schubert  #  - run on a 64-bit host  or
2465796c8dcSSimon Schubert  #  - already require 64-bit support for some other target  or
2475796c8dcSSimon Schubert  #  - the --enable-64-bit-bfd option was supplied
2485796c8dcSSimon Schubert  # Otherwise we only support all 32-bit targets.
2495796c8dcSSimon Schubert  #
2505796c8dcSSimon Schubert  # NOTE: This test must be in sync with the corresponding
2515796c8dcSSimon Schubert  #       tests in BFD!
2525796c8dcSSimon Schubert
2535796c8dcSSimon Schubert  if test x${want64} = xfalse; then
2545796c8dcSSimon Schubert    AC_CHECK_SIZEOF(long)
2555796c8dcSSimon Schubert    if test "x${ac_cv_sizeof_long}" = "x8"; then
2565796c8dcSSimon Schubert      want64=true
2575796c8dcSSimon Schubert    fi
2585796c8dcSSimon Schubert  fi
2595796c8dcSSimon Schubert  if test x${want64} = xtrue; then
2605796c8dcSSimon Schubert    TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
2615796c8dcSSimon Schubert  else
2625796c8dcSSimon Schubert    TARGET_OBS='$(ALL_TARGET_OBS)'
2635796c8dcSSimon Schubert  fi
2645796c8dcSSimon Schubertfi
2655796c8dcSSimon Schubert
2665796c8dcSSimon SchubertAC_SUBST(TARGET_OBS)
2675796c8dcSSimon Schubert
2685796c8dcSSimon Schubert# For other settings, only the main target counts.
2695796c8dcSSimon Schubertgdb_sim=
2705796c8dcSSimon Schubertgdb_osabi=
2715796c8dcSSimon Schubertbuild_gdbserver=
2725796c8dcSSimon Schuberttarg=$target; . ${srcdir}/configure.tgt
2735796c8dcSSimon Schubert
2745796c8dcSSimon Schubert# Fetch the default architecture and default target vector from BFD.
2755796c8dcSSimon Schuberttarg=$target; . $srcdir/../bfd/config.bfd
2765796c8dcSSimon Schubert
2775796c8dcSSimon Schubert# We only want the first architecture, so strip off the others if
2785796c8dcSSimon Schubert# there is more than one.
2795796c8dcSSimon Schuberttarg_archs=`echo $targ_archs | sed 's/ .*//'`
2805796c8dcSSimon Schubert
2815796c8dcSSimon Schubertif test "x$targ_archs" != x; then
2825796c8dcSSimon Schubert  AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
2835796c8dcSSimon Schubert    [Define to BFD's default architecture. ])
2845796c8dcSSimon Schubertfi
2855796c8dcSSimon Schubertif test "x$targ_defvec" != x; then
2865796c8dcSSimon Schubert  AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
2875796c8dcSSimon Schubert    [Define to BFD's default target vector. ])
2885796c8dcSSimon Schubertfi
2895796c8dcSSimon Schubert
2905796c8dcSSimon Schubert# The CLI cannot be disabled yet, but may be in the future.
2915796c8dcSSimon Schubert
2925796c8dcSSimon Schubert# Enable CLI.
2935796c8dcSSimon SchubertAC_ARG_ENABLE(gdbcli,
2945796c8dcSSimon SchubertAS_HELP_STRING([--disable-gdbcli], [disable command-line interface (CLI)]),
2955796c8dcSSimon Schubert  [case $enableval in
2965796c8dcSSimon Schubert    yes)
2975796c8dcSSimon Schubert      ;;
2985796c8dcSSimon Schubert    no)
2995796c8dcSSimon Schubert      AC_MSG_ERROR([the command-line interface cannot be disabled yet]) ;;
3005796c8dcSSimon Schubert    *)
3015796c8dcSSimon Schubert      AC_MSG_ERROR([bad value $enableval for --enable-gdbcli]) ;;
3025796c8dcSSimon Schubert  esac],
3035796c8dcSSimon Schubert  [enable_gdbcli=yes])
3045796c8dcSSimon Schubertif test x"$enable_gdbcli" = xyes; then
3055796c8dcSSimon Schubert  if test -d $srcdir/cli; then
3065796c8dcSSimon Schubert    CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_CLI_OBS)"
3075796c8dcSSimon Schubert    CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_CLI_DEPS)"
3085796c8dcSSimon Schubert    CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_CLI_SRCS)"
3095796c8dcSSimon Schubert    ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)"
3105796c8dcSSimon Schubert  fi
3115796c8dcSSimon Schubertfi
3125796c8dcSSimon Schubert
3135796c8dcSSimon Schubert# Enable MI.
3145796c8dcSSimon SchubertAC_ARG_ENABLE(gdbmi,
3155796c8dcSSimon SchubertAS_HELP_STRING([--disable-gdbmi], [disable machine-interface (MI)]),
3165796c8dcSSimon Schubert  [case $enableval in
3175796c8dcSSimon Schubert    yes | no)
3185796c8dcSSimon Schubert      ;;
3195796c8dcSSimon Schubert    *)
3205796c8dcSSimon Schubert      AC_MSG_ERROR([bad value $enableval for --enable-gdbmi]) ;;
3215796c8dcSSimon Schubert  esac],
3225796c8dcSSimon Schubert  [enable_gdbmi=yes])
3235796c8dcSSimon Schubertif test x"$enable_gdbmi" = xyes; then
3245796c8dcSSimon Schubert  if test -d $srcdir/mi; then
3255796c8dcSSimon Schubert    CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
3265796c8dcSSimon Schubert    CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
3275796c8dcSSimon Schubert    CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
3285796c8dcSSimon Schubert    ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
3295796c8dcSSimon Schubert  fi
3305796c8dcSSimon Schubertfi
3315796c8dcSSimon Schubert
3325796c8dcSSimon Schubert# Enable TUI.
3335796c8dcSSimon SchubertAC_ARG_ENABLE(tui,
3345796c8dcSSimon SchubertAS_HELP_STRING([--enable-tui], [enable full-screen terminal user interface (TUI)]),
3355796c8dcSSimon Schubert  [case $enableval in
3365796c8dcSSimon Schubert    yes | no | auto)
3375796c8dcSSimon Schubert      ;;
3385796c8dcSSimon Schubert    *)
3395796c8dcSSimon Schubert      AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
3405796c8dcSSimon Schubert  esac],enable_tui=auto)
3415796c8dcSSimon Schubert
3425796c8dcSSimon Schubert# Enable gdbtk.
3435796c8dcSSimon SchubertAC_ARG_ENABLE(gdbtk,
3445796c8dcSSimon SchubertAS_HELP_STRING([--enable-gdbtk], [enable gdbtk graphical user interface (GUI)]),
3455796c8dcSSimon Schubert  [case $enableval in
3465796c8dcSSimon Schubert    yes | no)
3475796c8dcSSimon Schubert      ;;
3485796c8dcSSimon Schubert    *)
3495796c8dcSSimon Schubert      AC_MSG_ERROR([bad value $enableval for --enable-gdbtk]) ;;
3505796c8dcSSimon Schubert  esac],
3515796c8dcSSimon Schubert  [if test -d $srcdir/gdbtk; then
3525796c8dcSSimon Schubert    enable_gdbtk=yes
3535796c8dcSSimon Schubert  else
3545796c8dcSSimon Schubert    enable_gdbtk=no
3555796c8dcSSimon Schubert  fi])
3565796c8dcSSimon Schubert# We unconditionally disable gdbtk tests on selected platforms.
3575796c8dcSSimon Schubertcase $host_os in
3585796c8dcSSimon Schubert  go32* | windows*)
3595796c8dcSSimon Schubert    AC_MSG_WARN([gdbtk isn't supported on $host; disabling])
3605796c8dcSSimon Schubert    enable_gdbtk=no ;;
3615796c8dcSSimon Schubertesac
3625796c8dcSSimon Schubert
363*ef5ccd6cSJohn Marino# Libunwind support for ia64.
3645796c8dcSSimon Schubert
365*ef5ccd6cSJohn MarinoAC_ARG_WITH(libunwind-ia64,
366*ef5ccd6cSJohn MarinoAS_HELP_STRING([--with-libunwind-ia64],
367*ef5ccd6cSJohn Marino	       [use libunwind frame unwinding for ia64 targets]),,
368*ef5ccd6cSJohn Marino	    [with_libunwind_ia64=auto])
369*ef5ccd6cSJohn Marino
370*ef5ccd6cSJohn Marino# Backward compatibility option.
371*ef5ccd6cSJohn Marinoif test "${with_libunwind+set}" = set; then
372*ef5ccd6cSJohn Marino  if test x"$with_libunwind_ia64" != xauto; then
373*ef5ccd6cSJohn Marino    AC_MSG_ERROR(
374*ef5ccd6cSJohn Marino      [option --with-libunwind is deprecated, use --with-libunwind-ia64])
375*ef5ccd6cSJohn Marino  fi
376*ef5ccd6cSJohn Marino  AC_MSG_WARN([option --with-libunwind is deprecated, use --with-libunwind-ia64])
377*ef5ccd6cSJohn Marino  with_libunwind_ia64="$with_libunwind"
378*ef5ccd6cSJohn Marinofi
379*ef5ccd6cSJohn Marino
380*ef5ccd6cSJohn Marinocase "$with_libunwind_ia64" in
381*ef5ccd6cSJohn Marino  yes | no)
382*ef5ccd6cSJohn Marino    ;;
383*ef5ccd6cSJohn Marino  auto)
384*ef5ccd6cSJohn Marino    AC_CHECK_HEADERS(libunwind-ia64.h)
385*ef5ccd6cSJohn Marino    with_libunwind_ia64=$ac_cv_header_libunwind_ia64_h
386*ef5ccd6cSJohn Marino    ;;
387*ef5ccd6cSJohn Marino  *)
388*ef5ccd6cSJohn Marino    AC_MSG_ERROR(
389*ef5ccd6cSJohn Marino      [bad value $with_libunwind_ia64 for GDB --with-libunwind-ia64 option])
390*ef5ccd6cSJohn Marino    ;;
391*ef5ccd6cSJohn Marinoesac
392*ef5ccd6cSJohn Marino
393*ef5ccd6cSJohn Marinoif test x"$with_libunwind_ia64" = xyes; then
394*ef5ccd6cSJohn Marino  AC_CHECK_HEADERS(libunwind-ia64.h)
395*ef5ccd6cSJohn Marino  if test x"$ac_cv_header_libunwind_ia64_h" != xyes; then
396*ef5ccd6cSJohn Marino    AC_MSG_ERROR([GDB option --with-libunwind-ia64 requires libunwind-ia64.h])
397*ef5ccd6cSJohn Marino  fi
398*ef5ccd6cSJohn Marino  CONFIG_OBS="$CONFIG_OBS ia64-libunwind-tdep.o"
399*ef5ccd6cSJohn Marino  CONFIG_DEPS="$CONFIG_DEPS ia64-libunwind-tdep.o"
400*ef5ccd6cSJohn Marino  CONFIG_SRCS="$CONFIG_SRCS ia64-libunwind-tdep.c"
4015796c8dcSSimon Schubertfi
4025796c8dcSSimon Schubert
4035796c8dcSSimon Schubertopt_curses=no
4045796c8dcSSimon SchubertAC_ARG_WITH(curses, AS_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
4055796c8dcSSimon Schubert
4065796c8dcSSimon Schubertprefer_curses=no
4075796c8dcSSimon Schubertif test "$opt_curses" = "yes"; then
4085796c8dcSSimon Schubert  prefer_curses=yes
4095796c8dcSSimon Schubertfi
4105796c8dcSSimon Schubert
4115796c8dcSSimon Schubert# Profiling support.
4125796c8dcSSimon SchubertAC_ARG_ENABLE(profiling,
4135796c8dcSSimon SchubertAS_HELP_STRING([--enable-profiling], [enable profiling of GDB]),
4145796c8dcSSimon Schubert  [case $enableval in
4155796c8dcSSimon Schubert    yes | no)
4165796c8dcSSimon Schubert      ;;
4175796c8dcSSimon Schubert    *)
4185796c8dcSSimon Schubert      AC_MSG_ERROR([bad value $enableval for --enable-profile]) ;;
4195796c8dcSSimon Schubert  esac],
4205796c8dcSSimon Schubert [enable_profiling=no])
4215796c8dcSSimon Schubert
4225796c8dcSSimon SchubertAC_CHECK_FUNCS(monstartup _mcleanup)
4235796c8dcSSimon SchubertAC_CACHE_CHECK([for _etext], ac_cv_var__etext,
4245796c8dcSSimon Schubert[AC_TRY_LINK(
4255796c8dcSSimon Schubert[#include <stdlib.h>
4265796c8dcSSimon Schubertextern char _etext;
4275796c8dcSSimon Schubert],
4285796c8dcSSimon Schubert[free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)])
4295796c8dcSSimon Schubertif test $ac_cv_var__etext = yes; then
4305796c8dcSSimon Schubert  AC_DEFINE(HAVE__ETEXT, 1,
4315796c8dcSSimon Schubert            [Define to 1 if your system has the _etext variable. ])
4325796c8dcSSimon Schubertfi
4335796c8dcSSimon SchubertAC_CACHE_CHECK([for etext], ac_cv_var_etext,
4345796c8dcSSimon Schubert[AC_TRY_LINK(
4355796c8dcSSimon Schubert[#include <stdlib.h>
4365796c8dcSSimon Schubertextern char etext;
4375796c8dcSSimon Schubert],
4385796c8dcSSimon Schubert[free (&etext);], ac_cv_var_etext=yes, ac_cv_var_etext=no)])
4395796c8dcSSimon Schubertif test $ac_cv_var_etext = yes; then
4405796c8dcSSimon Schubert  AC_DEFINE(HAVE_ETEXT, 1,
4415796c8dcSSimon Schubert            [Define to 1 if your system has the etext variable. ])
4425796c8dcSSimon Schubertfi
4435796c8dcSSimon Schubertif test "$enable_profiling" = yes ; then
4445796c8dcSSimon Schubert  if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
4455796c8dcSSimon Schubert    AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
4465796c8dcSSimon Schubert  fi
4475796c8dcSSimon Schubert  PROFILE_CFLAGS=-pg
4485796c8dcSSimon Schubert  OLD_CFLAGS="$CFLAGS"
4495796c8dcSSimon Schubert  CFLAGS="$CFLAGS $PROFILE_CFLAGS"
4505796c8dcSSimon Schubert
4515796c8dcSSimon Schubert  AC_CACHE_CHECK([whether $CC supports -pg], ac_cv_cc_supports_pg,
4525796c8dcSSimon Schubert    [AC_TRY_COMPILE([], [int x;], ac_cv_cc_supports_pg=yes,
4535796c8dcSSimon Schubert     ac_cv_cc_supports_pg=no)])
4545796c8dcSSimon Schubert
4555796c8dcSSimon Schubert  if test $ac_cv_cc_supports_pg = no; then
4565796c8dcSSimon Schubert    AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
4575796c8dcSSimon Schubert  fi
4585796c8dcSSimon Schubert
4595796c8dcSSimon Schubert  CFLAGS="$OLD_CFLAGS"
4605796c8dcSSimon Schubertfi
4615796c8dcSSimon Schubert
4625796c8dcSSimon SchubertACX_PKGVERSION([GDB])
4635796c8dcSSimon SchubertACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
4645796c8dcSSimon SchubertAC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
4655796c8dcSSimon SchubertAC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
4665796c8dcSSimon Schubert
4675796c8dcSSimon Schubert# --------------------- #
4685796c8dcSSimon Schubert# Checks for programs.  #
4695796c8dcSSimon Schubert# --------------------- #
4705796c8dcSSimon Schubert
4715796c8dcSSimon SchubertAC_PROG_AWK
4725796c8dcSSimon SchubertAC_PROG_INSTALL
4735796c8dcSSimon SchubertAC_PROG_LN_S
4745796c8dcSSimon SchubertAC_PROG_RANLIB
4755796c8dcSSimon SchubertAC_PROG_YACC
4765796c8dcSSimon Schubert
4775796c8dcSSimon SchubertAC_CHECK_TOOL(AR, ar)
4785796c8dcSSimon SchubertAC_CHECK_TOOL(DLLTOOL, dlltool)
4795796c8dcSSimon SchubertAC_CHECK_TOOL(WINDRES, windres)
4805796c8dcSSimon Schubert
4815796c8dcSSimon Schubert# Needed for GNU/Hurd.
4825796c8dcSSimon SchubertAC_CHECK_TOOL(MIG, mig)
4835796c8dcSSimon Schubert
4845796c8dcSSimon Schubert# ---------------------- #
4855796c8dcSSimon Schubert# Checks for libraries.  #
4865796c8dcSSimon Schubert# ---------------------- #
4875796c8dcSSimon Schubert
4885796c8dcSSimon Schubert# We might need to link with -lm; most simulators need it.
4895796c8dcSSimon SchubertAC_CHECK_LIB(m, main)
4905796c8dcSSimon Schubert
4915796c8dcSSimon Schubert# We need to link with -lw to get `wctype' on Solaris before Solaris
4925796c8dcSSimon Schubert# 2.6.  Solaris 2.6 and beyond have this function in libc, and have a
4935796c8dcSSimon Schubert# libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
4945796c8dcSSimon Schubert# is known to have this problem).  Therefore we avoid libw if we can.
4955796c8dcSSimon SchubertAC_CHECK_FUNC(wctype, [],
4965796c8dcSSimon Schubert  [AC_CHECK_LIB(w, wctype)])
4975796c8dcSSimon Schubert
4985796c8dcSSimon Schubert# Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
4995796c8dcSSimon SchubertAC_SEARCH_LIBS(gethostbyname, nsl)
5005796c8dcSSimon Schubert
5015796c8dcSSimon Schubert# Some systems (e.g. Solaris) have `socketpair' in libsocket.
5025796c8dcSSimon SchubertAC_SEARCH_LIBS(socketpair, socket)
5035796c8dcSSimon Schubert
5045796c8dcSSimon Schubert# Link in zlib if we can.  This allows us to read compressed debug sections.
505cf7f2e2dSJohn MarinoAM_ZLIB
5065796c8dcSSimon Schubert
5075796c8dcSSimon Schubert# On HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c).
5085796c8dcSSimon SchubertAC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl])
5095796c8dcSSimon Schubert
5105796c8dcSSimon SchubertAM_ICONV
5115796c8dcSSimon Schubert
512a45ae5f8SJohn Marino# GDB may fork/exec the iconv program to get the list of supported character
513a45ae5f8SJohn Marino# sets.  Allow the user to specify where to find it.
514a45ae5f8SJohn Marino# There are several factors affecting the choice of option name:
515a45ae5f8SJohn Marino# - There is already --with-libiconv-prefix but we can't use it, it specifies
516a45ae5f8SJohn Marino#   the build-time location of libiconv files.
517a45ae5f8SJohn Marino# - The program we need to find is iconv, which comes with glibc.  The user
518a45ae5f8SJohn Marino#   doesn't necessarily have libiconv installed.  Therefore naming this
519a45ae5f8SJohn Marino#   --with-libiconv-foo feels wrong.
520a45ae5f8SJohn Marino# - We want the path to be relocatable, but GDB_AC_DEFINE_RELOCATABLE is
521a45ae5f8SJohn Marino#   defined to work on directories not files (though it really doesn't know
522a45ae5f8SJohn Marino#   the difference).
523a45ae5f8SJohn Marino# - Calling this --with-iconv-prefix is perceived to cause too much confusion
524a45ae5f8SJohn Marino#   with --with-libiconv-prefix.
525a45ae5f8SJohn Marino# Putting these together is why the option name is --with-iconv-bin.
526a45ae5f8SJohn Marino
527a45ae5f8SJohn MarinoAC_ARG_WITH(iconv-bin,
528a45ae5f8SJohn MarinoAS_HELP_STRING([--with-iconv-bin=PATH], [specify where to find the iconv program]),
529a45ae5f8SJohn Marino[iconv_bin="${withval}"
530a45ae5f8SJohn Marino AC_DEFINE_UNQUOTED([ICONV_BIN], ["${iconv_bin}"],
531a45ae5f8SJohn Marino                    [Path of directory of iconv program.])
532a45ae5f8SJohn Marino GDB_AC_DEFINE_RELOCATABLE(ICONV_BIN, iconv, ${iconv_bin})
533a45ae5f8SJohn Marino])
534a45ae5f8SJohn Marino
5355796c8dcSSimon Schubert# On alpha-osf, it appears that libtermcap and libcurses are not compatible.
5365796c8dcSSimon Schubert# There is a very specific comment in /usr/include/curses.h explaining that
5375796c8dcSSimon Schubert# termcap routines built into libcurses must not be used.
5385796c8dcSSimon Schubert#
5395796c8dcSSimon Schubert# The symptoms we observed so far is GDB unexpectedly changing
5405796c8dcSSimon Schubert# the terminal settings when tgetent is called - this is particularly
5415796c8dcSSimon Schubert# visible as the output is missing carriage returns, and so rapidly
5425796c8dcSSimon Schubert# becomes very hard to read.
5435796c8dcSSimon Schubert#
5445796c8dcSSimon Schubert# The readline configure script has already decided that libtermcap
5455796c8dcSSimon Schubert# was enough for its purposes, and so decided to build readline using
5465796c8dcSSimon Schubert# libtermcap.  Since the TUI mode requires curses, building GDB with
5475796c8dcSSimon Schubert# TUI enabled results in both libraries to be used at the same time,
5485796c8dcSSimon Schubert# which is not allowed.  This basically means that GDB with TUI is
5495796c8dcSSimon Schubert# broken on alpha-osf.
5505796c8dcSSimon Schubert
5515796c8dcSSimon Schubertcase $host_os in
552cf7f2e2dSJohn Marino  osf* )
553cf7f2e2dSJohn Marino    if test x"$enable_tui" = xyes; then
5545796c8dcSSimon Schubert      AC_MSG_ERROR([Building GDB with TUI mode is not supported on this host])
5555796c8dcSSimon Schubert    fi
556cf7f2e2dSJohn Marino    if test x"$enable_tui" = xauto; then
5575796c8dcSSimon Schubert      enable_tui=no
5585796c8dcSSimon Schubert    fi
5595796c8dcSSimon Schubert    ;;
5605796c8dcSSimon Schubertesac
5615796c8dcSSimon Schubert
5625796c8dcSSimon Schubert# For the TUI, we need enhanced curses functionality.
5635796c8dcSSimon Schubertif test x"$enable_tui" != xno; then
5645796c8dcSSimon Schubert  prefer_curses=yes
5655796c8dcSSimon Schubertfi
5665796c8dcSSimon Schubert
5675796c8dcSSimon Schubertcurses_found=no
5685796c8dcSSimon Schubertif test x"$prefer_curses" = xyes; then
5695796c8dcSSimon Schubert  # FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
5705796c8dcSSimon Schubert  # curses library because the latter might not provide all the
5715796c8dcSSimon Schubert  # functionality we need.  However, this leads to problems on systems
5725796c8dcSSimon Schubert  # where the linker searches /usr/local/lib, but the compiler doesn't
5735796c8dcSSimon Schubert  # search /usr/local/include, if ncurses is installed in /usr/local.  A
5745796c8dcSSimon Schubert  # default installation of ncurses on alpha*-dec-osf* will lead to such
5755796c8dcSSimon Schubert  # a situation.
5765796c8dcSSimon Schubert  AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])
5775796c8dcSSimon Schubert
5785796c8dcSSimon Schubert  if test "$ac_cv_search_waddstr" != no; then
5795796c8dcSSimon Schubert    curses_found=yes
5805796c8dcSSimon Schubert  fi
5815796c8dcSSimon Schubertfi
5825796c8dcSSimon Schubert
5835796c8dcSSimon Schubert# Check whether we should enable the TUI, but only do so if we really
5845796c8dcSSimon Schubert# can.
5855796c8dcSSimon Schubertif test x"$enable_tui" != xno; then
5865796c8dcSSimon Schubert  if test -d $srcdir/tui; then
5875796c8dcSSimon Schubert    if test "$curses_found" != no; then
5885796c8dcSSimon Schubert      CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
5895796c8dcSSimon Schubert      CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
5905796c8dcSSimon Schubert      CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
5915796c8dcSSimon Schubert      ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
5925796c8dcSSimon Schubert    else
5935796c8dcSSimon Schubert      if test x"$enable_tui" = xyes; then
5945796c8dcSSimon Schubert	AC_MSG_ERROR([no enhanced curses library found; disable TUI])
5955796c8dcSSimon Schubert      else
5965796c8dcSSimon Schubert	AC_MSG_WARN([no enhanced curses library found; disabling TUI])
5975796c8dcSSimon Schubert      fi
5985796c8dcSSimon Schubert    fi
5995796c8dcSSimon Schubert  fi
6005796c8dcSSimon Schubertfi
6015796c8dcSSimon Schubert
6025796c8dcSSimon Schubert# Since GDB uses Readline, we need termcap functionality.  In many
6035796c8dcSSimon Schubert# cases this will be provided by the curses library, but some systems
6045796c8dcSSimon Schubert# have a seperate termcap library, or no curses library at all.
6055796c8dcSSimon Schubert
6065796c8dcSSimon Schubertcase $host_os in
6075796c8dcSSimon Schubert  cygwin*)
6085796c8dcSSimon Schubert    if test -d $srcdir/libtermcap; then
6095796c8dcSSimon Schubert      LIBS="../libtermcap/libtermcap.a $LIBS"
6105796c8dcSSimon Schubert      ac_cv_search_tgetent="../libtermcap/libtermcap.a"
6115796c8dcSSimon Schubert    fi ;;
6125796c8dcSSimon Schubert  go32* | *djgpp*)
6135796c8dcSSimon Schubert    ac_cv_search_tgetent="none required"
6145796c8dcSSimon Schubert    ;;
6155796c8dcSSimon Schubert  *mingw32*)
6165796c8dcSSimon Schubert    ac_cv_search_tgetent="none required"
6175796c8dcSSimon Schubert    CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
6185796c8dcSSimon Schubert    ;;
6195796c8dcSSimon Schubertesac
6205796c8dcSSimon Schubert
6215796c8dcSSimon Schubert# These are the libraries checked by Readline.
6225796c8dcSSimon SchubertAC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
6235796c8dcSSimon Schubert
6245796c8dcSSimon Schubertif test "$ac_cv_search_tgetent" = no; then
6255796c8dcSSimon Schubert  AC_MSG_ERROR([no termcap library found])
6265796c8dcSSimon Schubertfi
6275796c8dcSSimon Schubert
6285796c8dcSSimon SchubertAC_ARG_WITH([system-readline],
6295796c8dcSSimon Schubert  [AS_HELP_STRING([--with-system-readline],
6305796c8dcSSimon Schubert                  [use installed readline library])])
6315796c8dcSSimon Schubert
6325796c8dcSSimon Schubertif test "$with_system_readline" = yes; then
6335796c8dcSSimon Schubert  READLINE=-lreadline
6345796c8dcSSimon Schubert  READLINE_DEPS=
6355796c8dcSSimon Schubert  READLINE_CFLAGS=
636c50c785cSJohn Marino  READLINE_TEXI_INCFLAG=
6375796c8dcSSimon Schubertelse
6385796c8dcSSimon Schubert  READLINE='$(READLINE_DIR)/libreadline.a'
6395796c8dcSSimon Schubert  READLINE_DEPS='$(READLINE)'
6405796c8dcSSimon Schubert  READLINE_CFLAGS='-I$(READLINE_SRC)/..'
641c50c785cSJohn Marino  READLINE_TEXI_INCFLAG='-I $(READLINE_DIR)'
6425796c8dcSSimon Schubertfi
6435796c8dcSSimon SchubertAC_SUBST(READLINE)
6445796c8dcSSimon SchubertAC_SUBST(READLINE_DEPS)
6455796c8dcSSimon SchubertAC_SUBST(READLINE_CFLAGS)
646c50c785cSJohn MarinoAC_SUBST(READLINE_TEXI_INCFLAG)
6475796c8dcSSimon Schubert
648a45ae5f8SJohn Marino# Generate jit-reader.h
649a45ae5f8SJohn Marino
650a45ae5f8SJohn Marino# This is typedeffed to GDB_CORE_ADDR in jit-reader.h
651a45ae5f8SJohn MarinoTARGET_PTR=
652a45ae5f8SJohn Marino
653a45ae5f8SJohn MarinoAC_CHECK_SIZEOF(unsigned long long)
654a45ae5f8SJohn MarinoAC_CHECK_SIZEOF(unsigned long)
655a45ae5f8SJohn MarinoAC_CHECK_SIZEOF(unsigned __int128)
656a45ae5f8SJohn Marino
657a45ae5f8SJohn Marinoif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
658a45ae5f8SJohn Marino  TARGET_PTR="unsigned long"
659a45ae5f8SJohn Marinoelif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
660a45ae5f8SJohn Marino  TARGET_PTR="unsigned long long"
661a45ae5f8SJohn Marinoelif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
662a45ae5f8SJohn Marino  TARGET_PTR="unsigned __int128"
663a45ae5f8SJohn Marinoelse
664a45ae5f8SJohn Marino  TARGET_PTR="unsigned long"
665a45ae5f8SJohn Marinofi
666a45ae5f8SJohn Marino
667a45ae5f8SJohn MarinoAC_SUBST(TARGET_PTR)
668a45ae5f8SJohn MarinoAC_CONFIG_FILES([jit-reader.h:jit-reader.in])
669a45ae5f8SJohn Marino
670a45ae5f8SJohn MarinoAC_SEARCH_LIBS(dlopen, dl)
671a45ae5f8SJohn Marino
672a45ae5f8SJohn MarinoGDB_AC_WITH_DIR([JIT_READER_DIR], [jit-reader-dir],
673a45ae5f8SJohn Marino                [directory to load the JIT readers from],
674a45ae5f8SJohn Marino                [${libdir}/gdb])
675a45ae5f8SJohn Marino
6765796c8dcSSimon SchubertAC_ARG_WITH(expat,
6775796c8dcSSimon Schubert  AS_HELP_STRING([--with-expat], [include expat support (auto/yes/no)]),
6785796c8dcSSimon Schubert  [], [with_expat=auto])
6795796c8dcSSimon SchubertAC_MSG_CHECKING([whether to use expat])
6805796c8dcSSimon SchubertAC_MSG_RESULT([$with_expat])
6815796c8dcSSimon Schubert
6825796c8dcSSimon Schubertif test "${with_expat}" = no; then
6835796c8dcSSimon Schubert  AC_MSG_WARN([expat support disabled; some features may be unavailable.])
6845796c8dcSSimon Schubert  HAVE_LIBEXPAT=no
6855796c8dcSSimon Schubertelse
6865796c8dcSSimon Schubert  AC_LIB_HAVE_LINKFLAGS([expat], [], [#include "expat.h"],
6875796c8dcSSimon Schubert			[XML_Parser p = XML_ParserCreate (0);])
6885796c8dcSSimon Schubert  if test "$HAVE_LIBEXPAT" != yes; then
6895796c8dcSSimon Schubert    if test "$with_expat" = yes; then
6905796c8dcSSimon Schubert      AC_MSG_ERROR([expat is missing or unusable])
6915796c8dcSSimon Schubert    else
6925796c8dcSSimon Schubert      AC_MSG_WARN([expat is missing or unusable; some features may be unavailable.])
6935796c8dcSSimon Schubert    fi
6945796c8dcSSimon Schubert  else
6955796c8dcSSimon Schubert    save_LIBS=$LIBS
6965796c8dcSSimon Schubert    LIBS="$LIBS $LIBEXPAT"
6975796c8dcSSimon Schubert    AC_CHECK_FUNCS(XML_StopParser)
6985796c8dcSSimon Schubert    LIBS=$save_LIBS
6995796c8dcSSimon Schubert  fi
7005796c8dcSSimon Schubertfi
7015796c8dcSSimon Schubert
7025796c8dcSSimon Schubertdnl Utility to simplify finding libpython.
703cf7f2e2dSJohn Marinodnl $1 = pythonX.Y
704cf7f2e2dSJohn Marinodnl $2 = the shell variable to assign the result to
705cf7f2e2dSJohn Marinodnl      If libpython is found we store $version here.
706cf7f2e2dSJohn Marinodnl $3 = additional flags to add to CPPFLAGS
707cf7f2e2dSJohn Marinodnl $4 = additional flags to add to LIBS
708cf7f2e2dSJohn Marino
7095796c8dcSSimon SchubertAC_DEFUN([AC_TRY_LIBPYTHON],
7105796c8dcSSimon Schubert[
7115796c8dcSSimon Schubert  version=$1
7125796c8dcSSimon Schubert  define([have_libpython_var],$2)
713cf7f2e2dSJohn Marino  new_CPPFLAGS=$3
714cf7f2e2dSJohn Marino  new_LIBS=$4
7155796c8dcSSimon Schubert  AC_MSG_CHECKING([for ${version}])
716cf7f2e2dSJohn Marino  save_CPPFLAGS=$CPPFLAGS
7175796c8dcSSimon Schubert  save_LIBS=$LIBS
718cf7f2e2dSJohn Marino  CPPFLAGS="$CPPFLAGS $new_CPPFLAGS"
719cf7f2e2dSJohn Marino  LIBS="$LIBS $new_LIBS"
720cf7f2e2dSJohn Marino  found_usable_python=no
721c50c785cSJohn Marino  AC_LINK_IFELSE(AC_LANG_PROGRAM([[#include "Python.h"]],
7225796c8dcSSimon Schubert                                 [[Py_Initialize ();]]),
723cf7f2e2dSJohn Marino                 [have_libpython_var=${version}
724c50c785cSJohn Marino                  found_usable_python=yes
725c50c785cSJohn Marino                  PYTHON_CPPFLAGS=$new_CPPFLAGS
726c50c785cSJohn Marino                  PYTHON_LIBS=$new_LIBS])
727c50c785cSJohn Marino  CPPFLAGS=$save_CPPFLAGS
728c50c785cSJohn Marino  LIBS=$save_LIBS
729cf7f2e2dSJohn Marino  AC_MSG_RESULT([${found_usable_python}])
7305796c8dcSSimon Schubert])
7315796c8dcSSimon Schubert
732cf7f2e2dSJohn Marinodnl There are several different values for --with-python:
733cf7f2e2dSJohn Marinodnl
734cf7f2e2dSJohn Marinodnl no -   Don't include python support.
735cf7f2e2dSJohn Marinodnl yes -  Include python support, error if it's missing.
736cf7f2e2dSJohn Marinodnl        If we find python in $PATH, use it to fetch configure options,
737cf7f2e2dSJohn Marinodnl        otherwise assume the compiler can find it with no help from us.
738cf7f2e2dSJohn Marinodnl        Python 2.7, 2.6, 2.5, and then 2.4 are tried in turn.
739cf7f2e2dSJohn Marinodnl auto - Same as "yes", but if python is missing from the system,
740cf7f2e2dSJohn Marinodnl        fall back to "no".
741cf7f2e2dSJohn Marinodnl /path/to/python/exec-prefix -
742cf7f2e2dSJohn Marinodnl        Use the python located in this directory.
743cf7f2e2dSJohn Marinodnl        If /path/to/python/exec-prefix/bin/python exists, use it to find
744cf7f2e2dSJohn Marinodnl        the compilation parameters.  Otherwise use
745cf7f2e2dSJohn Marinodnl        -I/path/to/python/exec-prefix/include,
746cf7f2e2dSJohn Marinodnl        -L/path/to/python/exec-prefix/lib.
747cf7f2e2dSJohn Marinodnl        Python 2.7, 2.6, 2.5, and then 2.4 are tried in turn.
748cf7f2e2dSJohn Marinodnl        NOTE: This case is historical.  It is what was done for 7.0/7.1
749cf7f2e2dSJohn Marinodnl        but is deprecated.
750cf7f2e2dSJohn Marinodnl /path/to/python/executable -
751cf7f2e2dSJohn Marinodnl        Run python-config.py with this version of python to fetch the
752cf7f2e2dSJohn Marinodnl        compilation parameters.
753cf7f2e2dSJohn Marinodnl        NOTE: This needn't be the real python executable.
754cf7f2e2dSJohn Marinodnl        In a cross-compilation scenario (build != host), this could be
755cf7f2e2dSJohn Marinodnl        a shell script that provides what python-config.py provides for
756cf7f2e2dSJohn Marinodnl        --ldflags, --includes, --exec-prefix.
757cf7f2e2dSJohn Marinodnl python-executable -
758cf7f2e2dSJohn Marinodnl        Find python-executable in $PATH, and then handle the same as
759cf7f2e2dSJohn Marinodnl        /path/to/python/executable.
760cf7f2e2dSJohn Marinodnl
761cf7f2e2dSJohn Marinodnl If a python program is specified, it is used to run python-config.py and
762cf7f2e2dSJohn Marinodnl is passed --ldflags, --includes, --exec-prefix.
763cf7f2e2dSJohn Marino
7645796c8dcSSimon SchubertAC_ARG_WITH(python,
765cf7f2e2dSJohn Marino  AS_HELP_STRING([--with-python@<:@=PYTHON@:>@], [include python support (auto/yes/no/<python-program>)]),
7665796c8dcSSimon Schubert  [], [with_python=auto])
7675796c8dcSSimon SchubertAC_MSG_CHECKING([whether to use python])
7685796c8dcSSimon SchubertAC_MSG_RESULT([$with_python])
7695796c8dcSSimon Schubert
7705796c8dcSSimon Schubertif test "${with_python}" = no; then
7715796c8dcSSimon Schubert  AC_MSG_WARN([python support disabled; some features may be unavailable.])
7725796c8dcSSimon Schubert  have_libpython=no
7735796c8dcSSimon Schubertelse
7745796c8dcSSimon Schubert  case "${with_python}" in
775*ef5ccd6cSJohn Marino  [[\\/]]* | ?:[[\\/]]*)
776cf7f2e2dSJohn Marino    if test -d ${with_python}; then
777cf7f2e2dSJohn Marino      # Assume the python binary is ${with_python}/bin/python.
778cf7f2e2dSJohn Marino      python_prog="${with_python}/bin/python"
779cf7f2e2dSJohn Marino      python_prefix=
780c50c785cSJohn Marino      # If python does not exit ${with_python}/bin, then try in
781c50c785cSJohn Marino      # ${with_python}.  On Windows/MinGW, this is where the Python
782c50c785cSJohn Marino      # executable is.
783c50c785cSJohn Marino      if test ! -x "${python_prog}"; then
784c50c785cSJohn Marino        python_prog="${with_python}/python"
785c50c785cSJohn Marino        python_prefix=
786c50c785cSJohn Marino      fi
787cf7f2e2dSJohn Marino      if test ! -x "${python_prog}"; then
788cf7f2e2dSJohn Marino        # Fall back to gdb 7.0/7.1 behaviour.
789cf7f2e2dSJohn Marino        python_prog=missing
790cf7f2e2dSJohn Marino        python_prefix=${with_python}
791cf7f2e2dSJohn Marino      fi
792cf7f2e2dSJohn Marino    elif test -x "${with_python}"; then
793cf7f2e2dSJohn Marino      # While we can't run python compiled for $host (unless host == build),
794cf7f2e2dSJohn Marino      # the user could write a script that provides the needed information,
795cf7f2e2dSJohn Marino      # so we support that.
796cf7f2e2dSJohn Marino      python_prog=${with_python}
797cf7f2e2dSJohn Marino      python_prefix=
798cf7f2e2dSJohn Marino    else
799cf7f2e2dSJohn Marino      AC_ERROR(invalid value for --with-python)
800cf7f2e2dSJohn Marino    fi
8015796c8dcSSimon Schubert    ;;
802cf7f2e2dSJohn Marino  */*)
803cf7f2e2dSJohn Marino    # Disallow --with-python=foo/bar.
8045796c8dcSSimon Schubert    AC_ERROR(invalid value for --with-python)
8055796c8dcSSimon Schubert    ;;
806cf7f2e2dSJohn Marino  *)
807cf7f2e2dSJohn Marino    # The user has either specified auto, yes, or the name of the python
808cf7f2e2dSJohn Marino    # program assumed to be in $PATH.
809cf7f2e2dSJohn Marino    python_prefix=
810cf7f2e2dSJohn Marino    case "${with_python}" in
811cf7f2e2dSJohn Marino    yes | auto)
812cf7f2e2dSJohn Marino      if test ${build} = ${host}; then
813cf7f2e2dSJohn Marino        AC_PATH_PROG(python_prog_path, python, missing)
814cf7f2e2dSJohn Marino        if test "${python_prog_path}" = missing; then
815cf7f2e2dSJohn Marino          python_prog=missing
816cf7f2e2dSJohn Marino        else
817cf7f2e2dSJohn Marino          python_prog=${python_prog_path}
818cf7f2e2dSJohn Marino        fi
819cf7f2e2dSJohn Marino      else
820cf7f2e2dSJohn Marino        # Not much we can do except assume the cross-compiler will find the
821cf7f2e2dSJohn Marino        # right files.
822cf7f2e2dSJohn Marino        python_prog=missing
823cf7f2e2dSJohn Marino      fi
824cf7f2e2dSJohn Marino      ;;
825cf7f2e2dSJohn Marino    *)
826cf7f2e2dSJohn Marino      # While we can't run python compiled for $host (unless host == build),
827cf7f2e2dSJohn Marino      # the user could write a script that provides the needed information,
828cf7f2e2dSJohn Marino      # so we support that.
829cf7f2e2dSJohn Marino      python_prog="${with_python}"
830cf7f2e2dSJohn Marino      AC_PATH_PROG(python_prog_path, ${python_prog}, missing)
831cf7f2e2dSJohn Marino      if test "${python_prog_path}" = missing; then
832cf7f2e2dSJohn Marino        AC_ERROR(unable to find python program ${python_prog})
833cf7f2e2dSJohn Marino      fi
834cf7f2e2dSJohn Marino      ;;
835cf7f2e2dSJohn Marino    esac
8365796c8dcSSimon Schubert  esac
8375796c8dcSSimon Schubert
838cf7f2e2dSJohn Marino  if test "${python_prog}" != missing; then
839cf7f2e2dSJohn Marino    # We have a python program to use, but it may be too old.
840cf7f2e2dSJohn Marino    # Don't flag an error for --with-python=auto (the default).
841cf7f2e2dSJohn Marino    have_python_config=yes
842cf7f2e2dSJohn Marino    python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
843cf7f2e2dSJohn Marino    if test $? != 0; then
844cf7f2e2dSJohn Marino      have_python_config=failed
845cf7f2e2dSJohn Marino      if test "${with_python}" != auto; then
846cf7f2e2dSJohn Marino        AC_ERROR(failure running python-config --includes)
847cf7f2e2dSJohn Marino      fi
848cf7f2e2dSJohn Marino    fi
849cf7f2e2dSJohn Marino    python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
850cf7f2e2dSJohn Marino    if test $? != 0; then
851cf7f2e2dSJohn Marino      have_python_config=failed
852cf7f2e2dSJohn Marino      if test "${with_python}" != auto; then
853cf7f2e2dSJohn Marino        AC_ERROR(failure running python-config --ldflags)
854cf7f2e2dSJohn Marino      fi
855cf7f2e2dSJohn Marino    fi
856cf7f2e2dSJohn Marino    python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
857cf7f2e2dSJohn Marino    if test $? != 0; then
858cf7f2e2dSJohn Marino      have_python_config=failed
859cf7f2e2dSJohn Marino      if test "${with_python}" != auto; then
860cf7f2e2dSJohn Marino        AC_ERROR(failure running python-config --exec-prefix)
861cf7f2e2dSJohn Marino      fi
862cf7f2e2dSJohn Marino    fi
863cf7f2e2dSJohn Marino  else
864c50c785cSJohn Marino    # We do not have a python executable we can use to determine where
865c50c785cSJohn Marino    # to find the Python headers and libs.  We cannot guess the include
866c50c785cSJohn Marino    # path from the python_prefix either, because that include path
867c50c785cSJohn Marino    # depends on the Python version.  So, there is nothing much we can
868c50c785cSJohn Marino    # do except assume that the compiler will be able to find those files.
869cf7f2e2dSJohn Marino    python_includes=
870cf7f2e2dSJohn Marino    python_libs=
871cf7f2e2dSJohn Marino    have_python_config=no
872cf7f2e2dSJohn Marino  fi
873cf7f2e2dSJohn Marino
874cf7f2e2dSJohn Marino  # If we have python-config, only try the configuration it provides.
875cf7f2e2dSJohn Marino  # Otherwise fallback on the old way of trying different versions of
876cf7f2e2dSJohn Marino  # python in turn.
877cf7f2e2dSJohn Marino
8785796c8dcSSimon Schubert  have_libpython=no
879cf7f2e2dSJohn Marino  if test "${have_python_config}" = yes; then
880c50c785cSJohn Marino    # Determine the Python version by extracting "-lpython<version>"
881c50c785cSJohn Marino    # part of the python_libs. <version> is usually X.Y with X and Y
882c50c785cSJohn Marino    # being decimal numbers, but can also be XY (seen on Windows).
883c50c785cSJohn Marino    #
884c50c785cSJohn Marino    # The extraction is performed using sed with a regular expression.
885c50c785cSJohn Marino    # Initially, the regexp used was using the '?' quantifier to make
886c50c785cSJohn Marino    # the dot in the version number optional.  Unfortunately, this
887c50c785cSJohn Marino    # does not work with non-GNU versions of sed because, because of
888c50c785cSJohn Marino    # what looks like a limitation (the '?' quantifier does not work
889c50c785cSJohn Marino    # with back-references).  We work around this limitation by using
890c50c785cSJohn Marino    # the '*' quantifier instead.  It means that, in theory, we might
891c50c785cSJohn Marino    # match unexpected version strings such as "-lpython2..7", but
892c50c785cSJohn Marino    # this seems unlikely in practice.  And even if that happens,
893c50c785cSJohn Marino    # an error will be triggered later on, when checking that version
894c50c785cSJohn Marino    # number.
895cf7f2e2dSJohn Marino    python_version=`echo " ${python_libs} " \
896c50c785cSJohn Marino                         | sed -e 's,^.* -l\(python[[0-9]]*[[.]]*[[0-9]]*\).*$,\1,'`
897cf7f2e2dSJohn Marino    case "${python_version}" in
898cf7f2e2dSJohn Marino    python*)
899cf7f2e2dSJohn Marino      AC_TRY_LIBPYTHON(${python_version}, have_libpython,
900cf7f2e2dSJohn Marino                       ${python_includes}, ${python_libs})
901cf7f2e2dSJohn Marino      ;;
902cf7f2e2dSJohn Marino    *)
903cf7f2e2dSJohn Marino      AC_MSG_ERROR([unable to determine python version from ${python_libs}])
904cf7f2e2dSJohn Marino      ;;
905cf7f2e2dSJohn Marino    esac
906cf7f2e2dSJohn Marino  elif test "${have_python_config}" != failed; then
9075796c8dcSSimon Schubert    if test "${have_libpython}" = no; then
908cf7f2e2dSJohn Marino      AC_TRY_LIBPYTHON(python2.7, have_libpython,
909cf7f2e2dSJohn Marino                       ${python_includes}, "${python_libs} -lpython2.7")
910cf7f2e2dSJohn Marino    fi
911cf7f2e2dSJohn Marino    if test "${have_libpython}" = no; then
912cf7f2e2dSJohn Marino      AC_TRY_LIBPYTHON(python2.6, have_libpython,
913cf7f2e2dSJohn Marino                       ${python_includes}, "${python_libs} -lpython2.6")
914cf7f2e2dSJohn Marino    fi
915cf7f2e2dSJohn Marino    if test ${have_libpython} = no; then
916cf7f2e2dSJohn Marino      AC_TRY_LIBPYTHON(python2.5, have_libpython,
917cf7f2e2dSJohn Marino                       ${python_includes}, "${python_libs} -lpython2.5")
918cf7f2e2dSJohn Marino    fi
919cf7f2e2dSJohn Marino    if test ${have_libpython} = no; then
920cf7f2e2dSJohn Marino      AC_TRY_LIBPYTHON(python2.4, have_libpython,
921cf7f2e2dSJohn Marino                       ${python_includes}, "${python_libs} -lpython2.4")
922cf7f2e2dSJohn Marino    fi
923cf7f2e2dSJohn Marino  fi
924c50c785cSJohn Marino  if test "${have_libpython}" = python2.7 -o "${have_libpython}" = python27; then
925cf7f2e2dSJohn Marino    AC_DEFINE(HAVE_LIBPYTHON2_7, 1, [Define if Python 2.7 is being used.])
926c50c785cSJohn Marino  elif test "${have_libpython}" = python2.6 -o "${have_libpython}" = python26; then
9275796c8dcSSimon Schubert    AC_DEFINE(HAVE_LIBPYTHON2_6, 1, [Define if Python 2.6 is being used.])
928c50c785cSJohn Marino  elif test "${have_libpython}" = python2.5 -o "${have_libpython}" = python25; then
9295796c8dcSSimon Schubert    AC_DEFINE(HAVE_LIBPYTHON2_5, 1, [Define if Python 2.5 is being used.])
930c50c785cSJohn Marino  elif test "${have_libpython}" = python2.4 -o "${have_libpython}" = python24; then
9315796c8dcSSimon Schubert    AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.])
9325796c8dcSSimon Schubert  fi
933cf7f2e2dSJohn Marino
934cf7f2e2dSJohn Marino  if test "${have_libpython}" = no; then
9355796c8dcSSimon Schubert    case "${with_python}" in
9365796c8dcSSimon Schubert    yes)
9375796c8dcSSimon Schubert      AC_MSG_ERROR([python is missing or unusable])
9385796c8dcSSimon Schubert      ;;
9395796c8dcSSimon Schubert    auto)
9405796c8dcSSimon Schubert      AC_MSG_WARN([python is missing or unusable; some features may be unavailable.])
9415796c8dcSSimon Schubert      ;;
9425796c8dcSSimon Schubert    *)
9435796c8dcSSimon Schubert      AC_MSG_ERROR([no usable python found at ${with_python}])
9445796c8dcSSimon Schubert      ;;
9455796c8dcSSimon Schubert    esac
946cf7f2e2dSJohn Marino  else
947cf7f2e2dSJohn Marino    if test -n "${python_prefix}"; then
948cf7f2e2dSJohn Marino      AC_DEFINE_UNQUOTED(WITH_PYTHON_PATH, "${python_prefix}",
949cf7f2e2dSJohn Marino                         [Define if --with-python provides a path, either directly or via python-config.py --exec-prefix.])
950cf7f2e2dSJohn Marino      GDB_AC_DEFINE_RELOCATABLE(PYTHON_PATH, python, ${python_prefix})
951cf7f2e2dSJohn Marino    fi
9525796c8dcSSimon Schubert  fi
9535796c8dcSSimon Schubertfi
9545796c8dcSSimon Schubert
955cf7f2e2dSJohn Marinoif test "${have_libpython}" != no; then
9565796c8dcSSimon Schubert  AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
9575796c8dcSSimon Schubert  CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
9585796c8dcSSimon Schubert  CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
9595796c8dcSSimon Schubert  CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
960cf7f2e2dSJohn Marino  CONFIG_INSTALL="$CONFIG_INSTALL install-python"
9615796c8dcSSimon Schubert  ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
9625796c8dcSSimon Schubert
9635796c8dcSSimon Schubert  # Flags needed to compile Python code (taken from python-config --cflags).
9645796c8dcSSimon Schubert  # We cannot call python-config directly because it will output whatever was
9655796c8dcSSimon Schubert  # used when compiling the Python interpreter itself, including flags which
9665796c8dcSSimon Schubert  # would make the python-related objects be compiled differently from the
9675796c8dcSSimon Schubert  # rest of GDB (e.g., -O2 and -fPIC).
9685796c8dcSSimon Schubert  if test "${GCC}" = yes; then
9695796c8dcSSimon Schubert    tentative_python_cflags="-fno-strict-aliasing -DNDEBUG -fwrapv"
9705796c8dcSSimon Schubert  fi
9715796c8dcSSimon Schubert
9725796c8dcSSimon Schubert  if test "x${tentative_python_cflags}" != x; then
9735796c8dcSSimon Schubert    AC_MSG_CHECKING(compiler flags for python code)
9745796c8dcSSimon Schubert    for flag in ${tentative_python_cflags}; do
9755796c8dcSSimon Schubert      # Check that the compiler accepts it
9765796c8dcSSimon Schubert      saved_CFLAGS="$CFLAGS"
9775796c8dcSSimon Schubert      CFLAGS="$CFLAGS $flag"
9785796c8dcSSimon Schubert      AC_TRY_COMPILE([],[],PYTHON_CFLAGS="${PYTHON_CFLAGS} $flag",)
9795796c8dcSSimon Schubert      CFLAGS="$saved_CFLAGS"
9805796c8dcSSimon Schubert    done
9815796c8dcSSimon Schubert    AC_MSG_RESULT(${PYTHON_CFLAGS})
9825796c8dcSSimon Schubert  fi
983c50c785cSJohn Marino
984c50c785cSJohn Marino  # On IRIX, type siginfo is not defined.  Instead, sys/siginfo.h provides:
985c50c785cSJohn Marino  #    #if _SGIAPI
986c50c785cSJohn Marino  #    #define siginfo __siginfo
987c50c785cSJohn Marino  #    #endif
988c50c785cSJohn Marino  # The problem is that including Python causes some XOPEN macros to be
989c50c785cSJohn Marino  # unilaterally defined, and that in turn causes _SGIAPI to evaluate
990c50c785cSJohn Marino  # to false.  So, we work around this issue by defining siginfo ourself
991c50c785cSJohn Marino  # though the command-line.
992*ef5ccd6cSJohn Marino  #
993*ef5ccd6cSJohn Marino  # On x64 Windows, Python's include headers, and pyconfig.h in
994*ef5ccd6cSJohn Marino  # particular, rely on MS_WIN64 macro to detect that it's a 64bit
995*ef5ccd6cSJohn Marino  # version of Windows.  Unfortunately, MS_WIN64 is only defined if
996*ef5ccd6cSJohn Marino  # _MSC_VER, a Microsoft-specific macro, is defined.  So, when
997*ef5ccd6cSJohn Marino  # building on x64 Windows with GCC, we define MS_WIN64 ourselves.
998*ef5ccd6cSJohn Marino  # The issue was reported to the Python community, but still isn't
999*ef5ccd6cSJohn Marino  # solved as of 2012-10-02 (http://bugs.python.org/issue4709).
1000*ef5ccd6cSJohn Marino
1001c50c785cSJohn Marino  case "$gdb_host" in
1002c50c785cSJohn Marino    irix*) if test "${GCC}" = yes; then
1003c50c785cSJohn Marino             CPPFLAGS="$CPPFLAGS -Dsiginfo=__siginfo"
1004c50c785cSJohn Marino           fi
1005c50c785cSJohn Marino           ;;
1006*ef5ccd6cSJohn Marino    mingw64)
1007*ef5ccd6cSJohn Marino           if test "${GCC}" = yes; then
1008*ef5ccd6cSJohn Marino             CPPFLAGS="$CPPFLAGS -DMS_WIN64"
1009*ef5ccd6cSJohn Marino           fi
1010*ef5ccd6cSJohn Marino           ;;
1011c50c785cSJohn Marino  esac
1012*ef5ccd6cSJohn Marino
1013*ef5ccd6cSJohn Marino  # Note that "python -m threading" cannot be used to check for
1014*ef5ccd6cSJohn Marino  # threading support due to a bug in Python 2.7.3
1015*ef5ccd6cSJohn Marino  # (http://bugs.python.org/issue15567).
1016*ef5ccd6cSJohn Marino  AC_MSG_CHECKING(whether python supports threads)
1017*ef5ccd6cSJohn Marino  saved_CPPFLAGS="${CPPFLAGS}"
1018*ef5ccd6cSJohn Marino  CPPFLAGS="${PYTHON_CPPFLAGS}"
1019*ef5ccd6cSJohn Marino  # Note that the test is reversed so that python_has_threads=yes on
1020*ef5ccd6cSJohn Marino  # unexpected failures.
1021*ef5ccd6cSJohn Marino  AC_PREPROC_IFELSE(AC_LANG_SOURCE([[
1022*ef5ccd6cSJohn Marino#include <Python.h>
1023*ef5ccd6cSJohn Marino#ifdef WITH_THREAD
1024*ef5ccd6cSJohn Marino# error
1025*ef5ccd6cSJohn Marino#endif
1026*ef5ccd6cSJohn Marino  ]]), [python_has_threads=no], [python_has_threads=yes])
1027*ef5ccd6cSJohn Marino  AC_MSG_RESULT(${python_has_threads})
1028*ef5ccd6cSJohn Marino  CPPFLAGS="${saved_CPPFLAGS}"
10295796c8dcSSimon Schubertelse
10305796c8dcSSimon Schubert  # Even if Python support is not compiled in, we need to have these files
1031cf7f2e2dSJohn Marino  # included.
1032cf7f2e2dSJohn Marino  CONFIG_OBS="$CONFIG_OBS python.o py-value.o py-prettyprint.o py-auto-load.o"
1033cf7f2e2dSJohn Marino  CONFIG_SRCS="$CONFIG_SRCS python/python.c python/py-value.c \
1034cf7f2e2dSJohn Marino	python/py-prettyprint.c python/py-auto-load.c"
10355796c8dcSSimon Schubertfi
10365796c8dcSSimon SchubertAC_SUBST(PYTHON_CFLAGS)
1037c50c785cSJohn MarinoAC_SUBST(PYTHON_CPPFLAGS)
1038c50c785cSJohn MarinoAC_SUBST(PYTHON_LIBS)
10395796c8dcSSimon Schubert
1040*ef5ccd6cSJohn Marino# Provide a --enable-libmcheck/--disable-libmcheck set of options
1041*ef5ccd6cSJohn Marino# allowing a user to enable this option even when building releases,
1042*ef5ccd6cSJohn Marino# or to disable it when building a snapshot.
1043*ef5ccd6cSJohn MarinoAC_ARG_ENABLE(libmcheck,
1044*ef5ccd6cSJohn Marino  AS_HELP_STRING([--enable-libmcheck],
1045*ef5ccd6cSJohn Marino                 [Try building GDB with -lmcheck if available]),
1046*ef5ccd6cSJohn Marino  [case "${enableval}" in
1047*ef5ccd6cSJohn Marino     yes | y) ENABLE_LIBMCHECK="yes" ;;
1048*ef5ccd6cSJohn Marino     no | n)  ENABLE_LIBMCHECK="no" ;;
1049*ef5ccd6cSJohn Marino     *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmcheck) ;;
1050*ef5ccd6cSJohn Marino   esac])
1051*ef5ccd6cSJohn Marino
1052*ef5ccd6cSJohn Marino# Enable -lmcheck by default (it provides cheap-enough memory mangling),
1053*ef5ccd6cSJohn Marino# but turn it off if Python is enabled with threads, since -lmcheck is
1054*ef5ccd6cSJohn Marino# not thread safe (http://sourceware.org/bugzilla/show_bug.cgi?id=9939),
1055*ef5ccd6cSJohn Marino# and for releases.
1056*ef5ccd6cSJohn Marinoif test -z "${ENABLE_LIBMCHECK}" \
1057*ef5ccd6cSJohn Marino        -a \( "${have_libpython}" = "no" \
1058*ef5ccd6cSJohn Marino	     -o "${python_has_threads}" = "no" \) \
1059*ef5ccd6cSJohn Marino    && $development; then
1060*ef5ccd6cSJohn Marino  ENABLE_LIBMCHECK=yes
1061*ef5ccd6cSJohn Marinofi
1062*ef5ccd6cSJohn Marino
1063*ef5ccd6cSJohn Marinoif test "$ENABLE_LIBMCHECK" = "yes" ; then
1064*ef5ccd6cSJohn Marino  if test "${have_libpython}" != "no" -a "${python_has_threads}" = "yes" ; then
1065*ef5ccd6cSJohn Marino    AC_MSG_WARN(--enable-libmcheck may lead to spurious crashes if threads are used in python)
1066*ef5ccd6cSJohn Marino  fi
1067*ef5ccd6cSJohn Marino  AC_CHECK_LIB(mcheck, main)
1068*ef5ccd6cSJohn Marinofi
1069*ef5ccd6cSJohn Marino
10705796c8dcSSimon Schubert# ------------------------- #
10715796c8dcSSimon Schubert# Checks for header files.  #
10725796c8dcSSimon Schubert# ------------------------- #
10735796c8dcSSimon Schubert
10745796c8dcSSimon SchubertAC_HEADER_DIRENT
10755796c8dcSSimon SchubertAC_HEADER_STDC
10765796c8dcSSimon Schubert# elf_hp.h is for HP/UX 64-bit shared library support.
10775796c8dcSSimon SchubertAC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
1078*ef5ccd6cSJohn Marino                  thread_db.h signal.h stddef.h \
10795796c8dcSSimon Schubert		  stdlib.h string.h memory.h strings.h sys/fault.h \
10805796c8dcSSimon Schubert		  sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
10815796c8dcSSimon Schubert		  sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
10825796c8dcSSimon Schubert		  sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
10835796c8dcSSimon Schubert		  sys/types.h sys/wait.h wait.h termios.h termio.h \
1084*ef5ccd6cSJohn Marino		  sgtty.h unistd.h elf_hp.h locale.h \
1085*ef5ccd6cSJohn Marino		  dlfcn.h sys/socket.h sys/un.h linux/perf_event.h])
10865796c8dcSSimon SchubertAC_CHECK_HEADERS(link.h, [], [],
10875796c8dcSSimon Schubert[#if HAVE_SYS_TYPES_H
10885796c8dcSSimon Schubert# include <sys/types.h>
10895796c8dcSSimon Schubert#endif
10905796c8dcSSimon Schubert#if HAVE_NLIST_H
10915796c8dcSSimon Schubert# include <nlist.h>
10925796c8dcSSimon Schubert#endif
10935796c8dcSSimon Schubert])
10945796c8dcSSimon SchubertAC_CHECK_HEADERS(sys/proc.h, [], [],
10955796c8dcSSimon Schubert[#if HAVE_SYS_PARAM_H
10965796c8dcSSimon Schubert# include <sys/param.h>
10975796c8dcSSimon Schubert#endif
10985796c8dcSSimon Schubert])
10995796c8dcSSimon SchubertAC_CHECK_HEADERS(sys/user.h, [], [],
11005796c8dcSSimon Schubert[#if HAVE_SYS_PARAM_H
11015796c8dcSSimon Schubert# include <sys/param.h>
11025796c8dcSSimon Schubert#endif
11035796c8dcSSimon Schubert])
11045796c8dcSSimon Schubert
11055796c8dcSSimon Schubert# On Solaris 2.[789], we need to define _MSE_INT_H to avoid a clash
11065796c8dcSSimon Schubert# between <widec.h> and <wchar.h> that would cause AC_CHECK_HEADERS to
11075796c8dcSSimon Schubert# think that we don't have <curses.h> if we're using GCC.
11085796c8dcSSimon Schubertcase $host_os in
11095796c8dcSSimon Schubert  solaris2.[[789]])
11105796c8dcSSimon Schubert    if test "$GCC" = yes; then
11115796c8dcSSimon Schubert      AC_DEFINE(_MSE_INT_H, 1,
11125796c8dcSSimon Schubert        [Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
11135796c8dcSSimon Schubert   Solaris 2.[789] when using GCC. ])
11145796c8dcSSimon Schubert    fi ;;
11155796c8dcSSimon Schubertesac
11165796c8dcSSimon SchubertAC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncurses/ncurses.h ncurses/term.h)
11175796c8dcSSimon SchubertAC_CHECK_HEADERS(term.h, [], [],
11185796c8dcSSimon Schubert[#if HAVE_CURSES_H
11195796c8dcSSimon Schubert# include <curses.h>
11205796c8dcSSimon Schubert#endif
11215796c8dcSSimon Schubert])
11225796c8dcSSimon Schubert
11235796c8dcSSimon Schubert# ------------------------- #
11245796c8dcSSimon Schubert# Checks for declarations.  #
11255796c8dcSSimon Schubert# ------------------------- #
11265796c8dcSSimon Schubert
11275796c8dcSSimon SchubertAC_CHECK_DECLS([free, malloc, realloc, strerror, strstr, getopt,
11285796c8dcSSimon Schubert                snprintf, vsnprintf])
11295796c8dcSSimon SchubertAM_LC_MESSAGES
11305796c8dcSSimon Schubert
11315796c8dcSSimon Schubert# ----------------------- #
11325796c8dcSSimon Schubert# Checks for structures.  #
11335796c8dcSSimon Schubert# ----------------------- #
11345796c8dcSSimon Schubert
11355796c8dcSSimon SchubertAC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize])
11365796c8dcSSimon Schubert
11375796c8dcSSimon Schubert# ------------------ #
11385796c8dcSSimon Schubert# Checks for types.  #
11395796c8dcSSimon Schubert# ------------------ #
11405796c8dcSSimon Schubert
11415796c8dcSSimon SchubertAC_TYPE_SIGNAL
11425796c8dcSSimon SchubertAC_CHECK_TYPES(socklen_t, [], [],
11435796c8dcSSimon Schubert[#include <sys/types.h>
11445796c8dcSSimon Schubert#include <sys/socket.h>
11455796c8dcSSimon Schubert])
11465796c8dcSSimon Schubert
11475796c8dcSSimon Schubert# ------------------------------------- #
11485796c8dcSSimon Schubert# Checks for compiler characteristics.  #
11495796c8dcSSimon Schubert# ------------------------------------- #
11505796c8dcSSimon Schubert
11515796c8dcSSimon SchubertAC_C_CONST
11525796c8dcSSimon SchubertAC_C_INLINE
11535796c8dcSSimon SchubertAC_C_BIGENDIAN
11545796c8dcSSimon Schubert
11555796c8dcSSimon Schubert# ------------------------------ #
11565796c8dcSSimon Schubert# Checks for library functions.  #
11575796c8dcSSimon Schubert# ------------------------------ #
11585796c8dcSSimon Schubert
11595796c8dcSSimon SchubertAC_FUNC_ALLOCA
11605796c8dcSSimon SchubertAC_FUNC_MMAP
11615796c8dcSSimon SchubertAC_FUNC_VFORK
1162*ef5ccd6cSJohn MarinoAC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid getgid \
1163*ef5ccd6cSJohn Marino		pipe poll pread pread64 pwrite readlink resize_term \
1164*ef5ccd6cSJohn Marino		sbrk setpgid setpgrp setsid \
11655796c8dcSSimon Schubert		sigaction sigprocmask sigsetmask socketpair syscall \
1166c50c785cSJohn Marino		ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
1167*ef5ccd6cSJohn Marino		setrlimit getrlimit posix_madvise waitpid lstat])
11685796c8dcSSimon SchubertAM_LANGINFO_CODESET
11695796c8dcSSimon Schubert
11705796c8dcSSimon Schubert# Check the return and argument types of ptrace.  No canned test for
11715796c8dcSSimon Schubert# this, so roll our own.
11725796c8dcSSimon Schubertgdb_ptrace_headers='
11735796c8dcSSimon Schubert#if HAVE_SYS_TYPES_H
11745796c8dcSSimon Schubert# include <sys/types.h>
11755796c8dcSSimon Schubert#endif
11765796c8dcSSimon Schubert#if HAVE_SYS_PTRACE_H
11775796c8dcSSimon Schubert# include <sys/ptrace.h>
11785796c8dcSSimon Schubert#endif
11795796c8dcSSimon Schubert#if HAVE_UNISTD_H
11805796c8dcSSimon Schubert# include <unistd.h>
11815796c8dcSSimon Schubert#endif
11825796c8dcSSimon Schubert'
11835796c8dcSSimon Schubert# There is no point in checking if we don't have a prototype.
11845796c8dcSSimon SchubertAC_CHECK_DECLS(ptrace, [], [
11855796c8dcSSimon Schubert  : ${gdb_cv_func_ptrace_ret='int'}
11865796c8dcSSimon Schubert  : ${gdb_cv_func_ptrace_args='int,int,long,long'}
11875796c8dcSSimon Schubert], $gdb_ptrace_headers)
11885796c8dcSSimon Schubert# Check return type.  Varargs (used on GNU/Linux) conflict with the
11895796c8dcSSimon Schubert# empty argument list, so check for that explicitly.
11905796c8dcSSimon SchubertAC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
11915796c8dcSSimon Schubert  AC_TRY_COMPILE($gdb_ptrace_headers,
11925796c8dcSSimon Schubert    [extern long ptrace (enum __ptrace_request, ...);],
11935796c8dcSSimon Schubert    gdb_cv_func_ptrace_ret='long',
11945796c8dcSSimon Schubert    AC_TRY_COMPILE($gdb_ptrace_headers,
11955796c8dcSSimon Schubert      [extern int ptrace ();],
11965796c8dcSSimon Schubert      gdb_cv_func_ptrace_ret='int',
11975796c8dcSSimon Schubert      gdb_cv_func_ptrace_ret='long')))
11985796c8dcSSimon SchubertAC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
11995796c8dcSSimon Schubert  [Define as the return type of ptrace.])
12005796c8dcSSimon Schubert# Check argument types.
12015796c8dcSSimon SchubertAC_CACHE_CHECK([types of arguments for ptrace], gdb_cv_func_ptrace_args, [
12025796c8dcSSimon Schubert  AC_TRY_COMPILE($gdb_ptrace_headers,
12035796c8dcSSimon Schubert    [extern long ptrace (enum __ptrace_request, ...);],
12045796c8dcSSimon Schubert    [gdb_cv_func_ptrace_args='int,int,long,long'],[
12055796c8dcSSimon Schubertfor gdb_arg1 in 'int' 'long'; do
12065796c8dcSSimon Schubert for gdb_arg2 in 'pid_t' 'int' 'long'; do
12075796c8dcSSimon Schubert  for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long' 'void *'; do
12085796c8dcSSimon Schubert   for gdb_arg4 in 'int' 'long'; do
12095796c8dcSSimon Schubert     AC_TRY_COMPILE($gdb_ptrace_headers, [
12105796c8dcSSimon Schubertextern $gdb_cv_func_ptrace_ret
12115796c8dcSSimon Schubert  ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
12125796c8dcSSimon Schubert], [gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
12135796c8dcSSimon Schubert    break 4;])
12145796c8dcSSimon Schubert    for gdb_arg5 in 'int *' 'int' 'long'; do
12155796c8dcSSimon Schubert     AC_TRY_COMPILE($gdb_ptrace_headers, [
12165796c8dcSSimon Schubertextern $gdb_cv_func_ptrace_ret
12175796c8dcSSimon Schubert  ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
12185796c8dcSSimon Schubert], [
12195796c8dcSSimon Schubertgdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
12205796c8dcSSimon Schubert    break 5;])
12215796c8dcSSimon Schubert    done
12225796c8dcSSimon Schubert   done
12235796c8dcSSimon Schubert  done
12245796c8dcSSimon Schubert done
12255796c8dcSSimon Schubertdone
12265796c8dcSSimon Schubert# Provide a safe default value.
12275796c8dcSSimon Schubert: ${gdb_cv_func_ptrace_args='int,int,long,long'}
12285796c8dcSSimon Schubert])])
12295796c8dcSSimon Schubertac_save_IFS=$IFS; IFS=','
12305796c8dcSSimon Schubertset dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
12315796c8dcSSimon SchubertIFS=$ac_save_IFS
12325796c8dcSSimon Schubertshift
12335796c8dcSSimon SchubertAC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
12345796c8dcSSimon Schubert  [Define to the type of arg 3 for ptrace.])
12355796c8dcSSimon Schubertif test -n "$[5]"; then
12365796c8dcSSimon Schubert  AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
12375796c8dcSSimon Schubert    [Define to the type of arg 5 for ptrace.])
12385796c8dcSSimon Schubertfi
12395796c8dcSSimon Schubert
12405796c8dcSSimon Schubertdnl AC_FUNC_SETPGRP does not work when cross compiling
12415796c8dcSSimon Schubertdnl Instead, assume we will have a prototype for setpgrp if cross compiling.
12425796c8dcSSimon Schubertif test "$cross_compiling" = no; then
12435796c8dcSSimon Schubert  AC_FUNC_SETPGRP
12445796c8dcSSimon Schubertelse
12455796c8dcSSimon Schubert  AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
12465796c8dcSSimon Schubert    [AC_TRY_COMPILE([
12475796c8dcSSimon Schubert#include <unistd.h>
12485796c8dcSSimon Schubert], [
12495796c8dcSSimon Schubert  if (setpgrp(1,1) == -1)
12505796c8dcSSimon Schubert    exit (0);
12515796c8dcSSimon Schubert  else
12525796c8dcSSimon Schubert    exit (1);
12535796c8dcSSimon Schubert], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
12545796c8dcSSimon Schubertif test $ac_cv_func_setpgrp_void = yes; then
12555796c8dcSSimon Schubert  AC_DEFINE(SETPGRP_VOID, 1)
12565796c8dcSSimon Schubertfi
12575796c8dcSSimon Schubertfi
12585796c8dcSSimon Schubert
12595796c8dcSSimon Schubert# Check if sigsetjmp is available.  Using AC_CHECK_FUNCS won't do
12605796c8dcSSimon Schubert# since sigsetjmp might only be defined as a macro.
12615796c8dcSSimon SchubertAC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp,
12625796c8dcSSimon Schubert[AC_TRY_COMPILE([
12635796c8dcSSimon Schubert#include <setjmp.h>
12645796c8dcSSimon Schubert], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
12655796c8dcSSimon Schubertgdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)])
12665796c8dcSSimon Schubertif test $gdb_cv_func_sigsetjmp = yes; then
12675796c8dcSSimon Schubert  AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
12685796c8dcSSimon Schubertfi
12695796c8dcSSimon Schubert
12705796c8dcSSimon Schubert# Assume we'll default to using the included libiberty regex.
12715796c8dcSSimon Schubertgdb_use_included_regex=yes
12725796c8dcSSimon Schubert
12735796c8dcSSimon Schubert# However, if the system regex is GNU regex, then default to *not*
12745796c8dcSSimon Schubert# using the included regex.
12755796c8dcSSimon SchubertAC_CACHE_CHECK(
12765796c8dcSSimon Schubert  [for GNU regex],
12775796c8dcSSimon Schubert  [gdb_cv_have_gnu_regex],
12785796c8dcSSimon Schubert  [AC_TRY_COMPILE(
12795796c8dcSSimon Schubert    [#include <gnu-versions.h>],
12805796c8dcSSimon Schubert    [#define REGEX_INTERFACE_VERSION 1
12815796c8dcSSimon Schubert#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
12825796c8dcSSimon Schubert# error "Version mismatch"
12835796c8dcSSimon Schubert#endif],
12845796c8dcSSimon Schubert    gdb_cv_have_gnu_regex=yes,
12855796c8dcSSimon Schubert    gdb_cv_have_gnu_regex=no)])
12865796c8dcSSimon Schubertif test $gdb_cv_have_gnu_regex = yes; then
12875796c8dcSSimon Schubert  gdb_use_included_regex=no
12885796c8dcSSimon Schubertfi
12895796c8dcSSimon Schubert
12905796c8dcSSimon SchubertAC_ARG_WITH(included-regex,
12915796c8dcSSimon Schubert  AS_HELP_STRING([--without-included-regex], [don't use included regex; this is the default on systems with version 2 of the GNU C library (use with caution on other system)]),
12925796c8dcSSimon Schubert  gdb_with_regex=$withval,
12935796c8dcSSimon Schubert  gdb_with_regex=$gdb_use_included_regex)
12945796c8dcSSimon Schubertif test "$gdb_with_regex" = yes; then
12955796c8dcSSimon Schubert  AC_DEFINE(USE_INCLUDED_REGEX, 1,
12965796c8dcSSimon Schubert    [Define to 1 if the regex included in libiberty should be used.])
12975796c8dcSSimon Schubertfi
12985796c8dcSSimon Schubert
12995796c8dcSSimon Schubert# Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
13005796c8dcSSimon SchubertAC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
13015796c8dcSSimon Schubert[#include <sys/param.h>
13025796c8dcSSimon Schubert#include <sys/proc.h>
13035796c8dcSSimon Schubert])
13045796c8dcSSimon Schubert
13055796c8dcSSimon Schubert# See if <sys/lwp.h> defines `struct lwp`.
13065796c8dcSSimon SchubertAC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
13075796c8dcSSimon Schubert[AC_TRY_COMPILE([#include <sys/param.h>
13085796c8dcSSimon Schubert#include <sys/lwp.h>], [struct lwp l;],
13095796c8dcSSimon Schubertgdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
13105796c8dcSSimon Schubertif test $gdb_cv_struct_lwp = yes; then
13115796c8dcSSimon Schubert  AC_DEFINE(HAVE_STRUCT_LWP, 1,
13125796c8dcSSimon Schubert            [Define to 1 if your system has struct lwp.])
13135796c8dcSSimon Schubertfi
13145796c8dcSSimon Schubert
13155796c8dcSSimon Schubert# See if <machine/reg.h> degines `struct reg'.
13165796c8dcSSimon SchubertAC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
13175796c8dcSSimon Schubert[AC_TRY_COMPILE([#include <sys/types.h>
13185796c8dcSSimon Schubert#include <machine/reg.h>], [struct reg r;],
13195796c8dcSSimon Schubertgdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)])
13205796c8dcSSimon Schubertif test $gdb_cv_struct_reg = yes; then
13215796c8dcSSimon Schubert  AC_DEFINE(HAVE_STRUCT_REG, 1,
13225796c8dcSSimon Schubert            [Define to 1 if your system has struct reg in <machine/reg.h>.])
13235796c8dcSSimon Schubertfi
13245796c8dcSSimon Schubert
13255796c8dcSSimon Schubert# See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
13265796c8dcSSimon Schubert# Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
13275796c8dcSSimon SchubertAC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [],
13285796c8dcSSimon Schubert                 [#include <machine/reg.h>])
13295796c8dcSSimon Schubert
1330*ef5ccd6cSJohn Marino# See if <sys/user.h> supports the %fs_base and %gs_bas amd64 segment registers.
1331*ef5ccd6cSJohn Marino# Older amd64 Linux's don't have the fs_base and gs_base members of
1332*ef5ccd6cSJohn Marino# `struct user_regs_struct'.
1333*ef5ccd6cSJohn MarinoAC_CHECK_MEMBERS([struct user_regs_struct.fs_base, struct user_regs_struct.gs_base],
1334*ef5ccd6cSJohn Marino		 [], [], [#include <sys/user.h>])
1335*ef5ccd6cSJohn Marino
13365796c8dcSSimon Schubert# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
13375796c8dcSSimon SchubertAC_MSG_CHECKING(for PTRACE_GETREGS)
13385796c8dcSSimon SchubertAC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
13395796c8dcSSimon Schubert[AC_TRY_COMPILE([#include <sys/ptrace.h>],
13405796c8dcSSimon Schubert		[PTRACE_GETREGS;],
13415796c8dcSSimon Schubert		[gdb_cv_have_ptrace_getregs=yes],
13425796c8dcSSimon Schubert		[gdb_cv_have_ptrace_getregs=no])])
13435796c8dcSSimon SchubertAC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
13445796c8dcSSimon Schubertif test $gdb_cv_have_ptrace_getregs = yes; then
13455796c8dcSSimon Schubert  AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
13465796c8dcSSimon Schubert  [Define if sys/ptrace.h defines the PTRACE_GETREGS request.])
13475796c8dcSSimon Schubertfi
13485796c8dcSSimon Schubert
13495796c8dcSSimon Schubert# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
13505796c8dcSSimon SchubertAC_MSG_CHECKING(for PTRACE_GETFPXREGS)
13515796c8dcSSimon SchubertAC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
13525796c8dcSSimon Schubert[AC_TRY_COMPILE([#include <sys/ptrace.h>],
13535796c8dcSSimon Schubert		[PTRACE_GETFPXREGS;],
13545796c8dcSSimon Schubert		[gdb_cv_have_ptrace_getfpxregs=yes],
13555796c8dcSSimon Schubert		[gdb_cv_have_ptrace_getfpxregs=no])])
13565796c8dcSSimon SchubertAC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
13575796c8dcSSimon Schubertif test $gdb_cv_have_ptrace_getfpxregs = yes; then
13585796c8dcSSimon Schubert  AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
13595796c8dcSSimon Schubert  [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.])
13605796c8dcSSimon Schubertfi
13615796c8dcSSimon Schubert
13625796c8dcSSimon Schubert# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
13635796c8dcSSimon SchubertAC_MSG_CHECKING(for PT_GETDBREGS)
13645796c8dcSSimon SchubertAC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
13655796c8dcSSimon Schubert[AC_TRY_COMPILE([#include <sys/types.h>
13665796c8dcSSimon Schubert#include <sys/ptrace.h>],
13675796c8dcSSimon Schubert		[PT_GETDBREGS;],
13685796c8dcSSimon Schubert		[gdb_cv_have_pt_getdbregs=yes],
13695796c8dcSSimon Schubert		[gdb_cv_have_pt_getdbregs=no])])
13705796c8dcSSimon SchubertAC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
13715796c8dcSSimon Schubertif test $gdb_cv_have_pt_getdbregs = yes; then
13725796c8dcSSimon Schubert  AC_DEFINE(HAVE_PT_GETDBREGS, 1,
13735796c8dcSSimon Schubert  [Define if sys/ptrace.h defines the PT_GETDBREGS request.])
13745796c8dcSSimon Schubertfi
13755796c8dcSSimon Schubert
13765796c8dcSSimon Schubert# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
13775796c8dcSSimon SchubertAC_MSG_CHECKING(for PT_GETXMMREGS)
13785796c8dcSSimon SchubertAC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
13795796c8dcSSimon Schubert[AC_TRY_COMPILE([#include <sys/types.h>
13805796c8dcSSimon Schubert#include <sys/ptrace.h>],
13815796c8dcSSimon Schubert		[PT_GETXMMREGS;],
13825796c8dcSSimon Schubert		[gdb_cv_have_pt_getxmmregs=yes],
13835796c8dcSSimon Schubert		[gdb_cv_have_pt_getxmmregs=no])])
13845796c8dcSSimon SchubertAC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
13855796c8dcSSimon Schubertif test $gdb_cv_have_pt_getxmmregs = yes; then
13865796c8dcSSimon Schubert  AC_DEFINE(HAVE_PT_GETXMMREGS, 1,
13875796c8dcSSimon Schubert  [Define if sys/ptrace.h defines the PT_GETXMMREGS request.])
13885796c8dcSSimon Schubertfi
13895796c8dcSSimon Schubert
1390*ef5ccd6cSJohn Marino# Detect which type of /proc is in use, such as for Solaris.
13915796c8dcSSimon Schubert
13925796c8dcSSimon Schubertif test "${target}" = "${host}"; then
13935796c8dcSSimon Schubert  case "${host}" in
1394*ef5ccd6cSJohn Marino  *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
13955796c8dcSSimon Schubert      AC_DEFINE(NEW_PROC_API, 1,
13965796c8dcSSimon Schubert      [Define if you want to use new multi-fd /proc interface
13975796c8dcSSimon Schubert       (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).])
13985796c8dcSSimon Schubert      ;;
13995796c8dcSSimon Schubert  *-*-solaris2.[[6789]] | *-*-solaris2.1[[0-9]]*)
14005796c8dcSSimon Schubert      AC_DEFINE(NEW_PROC_API, 1,
14015796c8dcSSimon Schubert      [Define if you want to use new multi-fd /proc interface
14025796c8dcSSimon Schubert       (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).])
14035796c8dcSSimon Schubert      ;;
14045796c8dcSSimon Schubert  mips-sgi-irix5*)
14055796c8dcSSimon Schubert      # Work around <sys/proc.h> needing _KMEMUSER problem on IRIX 5.
14065796c8dcSSimon Schubert      AC_DEFINE([_KMEMUSER], 1,
14075796c8dcSSimon Schubert      [Define to 1 so <sys/proc.h> gets a definition of anon_hdl.  Works
14085796c8dcSSimon Schubert       around a <sys/proc.h> problem on IRIX 5.])
14095796c8dcSSimon Schubert      ;;
14105796c8dcSSimon Schubert  esac
14115796c8dcSSimon Schubertfi
14125796c8dcSSimon Schubert
14135796c8dcSSimon Schubertif test "$ac_cv_header_sys_procfs_h" = yes; then
14145796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
14155796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
14165796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
14175796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
14185796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
14195796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
14205796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
14215796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
14225796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
14235796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
14245796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t)
14255796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(pr_sigset_t)
14265796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(pr_sigaction64_t)
14275796c8dcSSimon Schubert  BFD_HAVE_SYS_PROCFS_TYPE(pr_siginfo64_t)
14285796c8dcSSimon Schubert
14295796c8dcSSimon Schubert
14305796c8dcSSimon Schubert  dnl Check for broken prfpregset_t type
14315796c8dcSSimon Schubert
14325796c8dcSSimon Schubert  dnl For Linux/i386, glibc 2.1.3 was released with a bogus
14335796c8dcSSimon Schubert  dnl prfpregset_t type (it's a typedef for the pointer to a struct
14345796c8dcSSimon Schubert  dnl instead of the struct itself).  We detect this here, and work
14355796c8dcSSimon Schubert  dnl around it in gdb_proc_service.h.
14365796c8dcSSimon Schubert
14375796c8dcSSimon Schubert  if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
14385796c8dcSSimon Schubert    AC_MSG_CHECKING(whether prfpregset_t type is broken)
14395796c8dcSSimon Schubert    AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
14405796c8dcSSimon Schubert      [AC_TRY_RUN([#include <sys/procfs.h>
14415796c8dcSSimon Schubert       int main ()
14425796c8dcSSimon Schubert       {
14435796c8dcSSimon Schubert         if (sizeof (prfpregset_t) == sizeof (void *))
14445796c8dcSSimon Schubert           return 1;
14455796c8dcSSimon Schubert         return 0;
14465796c8dcSSimon Schubert       }],
14475796c8dcSSimon Schubert       gdb_cv_prfpregset_t_broken=no,
14485796c8dcSSimon Schubert       gdb_cv_prfpregset_t_broken=yes,
14495796c8dcSSimon Schubert       gdb_cv_prfpregset_t_broken=yes)])
14505796c8dcSSimon Schubert    AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
14515796c8dcSSimon Schubert    if test $gdb_cv_prfpregset_t_broken = yes; then
14525796c8dcSSimon Schubert      AC_DEFINE(PRFPREGSET_T_BROKEN, 1,
14535796c8dcSSimon Schubert      [Define if the prfpregset_t type is broken.])
14545796c8dcSSimon Schubert    fi
14555796c8dcSSimon Schubert  fi
14565796c8dcSSimon Schubert
14575796c8dcSSimon Schubert  dnl Check for PIOCSET ioctl entry
14585796c8dcSSimon Schubert
14595796c8dcSSimon Schubert  AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
14605796c8dcSSimon Schubert  AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
14615796c8dcSSimon Schubert  [AC_TRY_COMPILE([#include <unistd.h>
14625796c8dcSSimon Schubert#include <sys/types.h>
14635796c8dcSSimon Schubert#include <sys/procfs.h>
14645796c8dcSSimon Schubert], [
14655796c8dcSSimon Schubert    int dummy;;
14665796c8dcSSimon Schubert    dummy = ioctl(0, PIOCSET, &dummy);
14675796c8dcSSimon Schubert  ],
14685796c8dcSSimon Schubert  gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
14695796c8dcSSimon Schubert  AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
14705796c8dcSSimon Schubert  if test $gdb_cv_have_procfs_piocset = yes; then
14715796c8dcSSimon Schubert    AC_DEFINE(HAVE_PROCFS_PIOCSET, 1,
14725796c8dcSSimon Schubert    [Define if ioctl argument PIOCSET is available.])
14735796c8dcSSimon Schubert  fi
14745796c8dcSSimon Schubertfi
14755796c8dcSSimon Schubert
14765796c8dcSSimon Schubertdnl For native ports (host == target), check to see what kind of
14775796c8dcSSimon Schubertdnl legacy link.h support is needed.  (See solib-legacy.c.)
14785796c8dcSSimon Schubertif test ${host} = ${target} ; then
14795796c8dcSSimon Schubert  dnl Check for struct link_map with l_ members which are indicative
14805796c8dcSSimon Schubert  dnl of SVR4-like shared libraries
14815796c8dcSSimon Schubert
14825796c8dcSSimon Schubert  AC_MSG_CHECKING(for member l_addr in struct link_map)
14835796c8dcSSimon Schubert  AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members,
14845796c8dcSSimon Schubert    [AC_TRY_COMPILE([#include <link.h>],
14855796c8dcSSimon Schubert                    [struct link_map lm; (void) lm.l_addr;],
14865796c8dcSSimon Schubert                    gdb_cv_have_struct_link_map_with_l_members=yes,
14875796c8dcSSimon Schubert                    gdb_cv_have_struct_link_map_with_l_members=no)])
14885796c8dcSSimon Schubert  AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members)
14895796c8dcSSimon Schubert  if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
14905796c8dcSSimon Schubert    AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS,1,
14915796c8dcSSimon Schubert    [Define if <link.h> exists and defines struct link_map which has
14925796c8dcSSimon Schubert     members with an ``l_'' prefix.  (For Solaris, SVR4, and
14935796c8dcSSimon Schubert     SVR4-like systems.)])
14945796c8dcSSimon Schubert  fi
14955796c8dcSSimon Schubert
14965796c8dcSSimon Schubert  dnl Check for struct link_map with lm_ members which are indicative
14975796c8dcSSimon Schubert  dnl of SunOS-like shared libraries
14985796c8dcSSimon Schubert
14995796c8dcSSimon Schubert  AC_MSG_CHECKING(for member lm_addr in struct link_map)
15005796c8dcSSimon Schubert  AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members,
15015796c8dcSSimon Schubert    [AC_TRY_COMPILE([#include <sys/types.h>
15025796c8dcSSimon Schubert#include <link.h>],
15035796c8dcSSimon Schubert                    [struct link_map lm; (void) lm.lm_addr;],
15045796c8dcSSimon Schubert                    gdb_cv_have_struct_link_map_with_lm_members=yes,
15055796c8dcSSimon Schubert                    gdb_cv_have_struct_link_map_with_lm_members=no)])
15065796c8dcSSimon Schubert  AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members)
15075796c8dcSSimon Schubert  if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
15085796c8dcSSimon Schubert    AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS, 1,
15095796c8dcSSimon Schubert    [Define if <link.h> exists and defines struct link_map which has
15105796c8dcSSimon Schubert     members with an ``lm_'' prefix.  (For SunOS.)])
15115796c8dcSSimon Schubert  fi
15125796c8dcSSimon Schubert
15135796c8dcSSimon Schubert  dnl Check for struct so_map with som_ members which are found on
15145796c8dcSSimon Schubert  dnl some *BSD systems.
15155796c8dcSSimon Schubert
15165796c8dcSSimon Schubert  AC_MSG_CHECKING(for member som_addr in struct so_map)
15175796c8dcSSimon Schubert  AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members,
15185796c8dcSSimon Schubert    [AC_TRY_COMPILE([#include <sys/types.h>
15195796c8dcSSimon Schubert#ifdef HAVE_NLIST_H
15205796c8dcSSimon Schubert#include <nlist.h>
15215796c8dcSSimon Schubert#endif
15225796c8dcSSimon Schubert#include <link.h>],
15235796c8dcSSimon Schubert                    [struct so_map lm; (void) lm.som_addr;],
15245796c8dcSSimon Schubert                    gdb_cv_have_struct_so_map_with_som_members=yes,
15255796c8dcSSimon Schubert                    gdb_cv_have_struct_so_map_with_som_members=no)])
15265796c8dcSSimon Schubert  AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members)
15275796c8dcSSimon Schubert  if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
15285796c8dcSSimon Schubert    AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS, 1,
15295796c8dcSSimon Schubert    [Define if <link.h> exists and defines a struct so_map which has
15305796c8dcSSimon Schubert     members with an ``som_'' prefix.  (Found on older *BSD systems.)])
15315796c8dcSSimon Schubert  fi
15325796c8dcSSimon Schubert
15335796c8dcSSimon Schubert  dnl Check for struct link_map32 type, which allows a 64-bit Solaris
15345796c8dcSSimon Schubert  dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
15355796c8dcSSimon Schubert
15365796c8dcSSimon Schubert  AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
15375796c8dcSSimon Schubert  AC_CACHE_VAL(gdb_cv_have_struct_link_map32,
15385796c8dcSSimon Schubert    [AC_TRY_COMPILE([#define _SYSCALL32
15395796c8dcSSimon Schubert#include <sys/link.h>], [struct link_map32 l;],
15405796c8dcSSimon Schubert     gdb_cv_have_struct_link_map32=yes,
15415796c8dcSSimon Schubert     gdb_cv_have_struct_link_map32=no)])
15425796c8dcSSimon Schubert  AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
15435796c8dcSSimon Schubert  if test $gdb_cv_have_struct_link_map32 = yes; then
15445796c8dcSSimon Schubert    AC_DEFINE(HAVE_STRUCT_LINK_MAP32, 1,
15455796c8dcSSimon Schubert    [Define if <sys/link.h> has struct link_map32])
15465796c8dcSSimon Schubert    AC_DEFINE(_SYSCALL32, 1,
15475796c8dcSSimon Schubert    [Define if <sys/link.h> has link_map32 (solaris sparc-64 target)])
15485796c8dcSSimon Schubert  fi
15495796c8dcSSimon Schubertfi
15505796c8dcSSimon Schubert
15515796c8dcSSimon Schubert# Check if the compiler supports the `long long' type.
15525796c8dcSSimon Schubert
15535796c8dcSSimon SchubertAC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
15545796c8dcSSimon Schubert               [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
15555796c8dcSSimon Schubert[[extern long long foo;]],
15565796c8dcSSimon Schubert[[switch (foo & 2) { case 0: return 1; }]])],
15575796c8dcSSimon Schubert                                  gdb_cv_c_long_long=yes,
15585796c8dcSSimon Schubert                                  gdb_cv_c_long_long=no)])
1559*ef5ccd6cSJohn Marinoif test $gdb_cv_c_long_long != yes; then
1560*ef5ccd6cSJohn Marino  # libdecnumber requires long long.
1561*ef5ccd6cSJohn Marino  AC_MSG_ERROR([Compiler must support long long for GDB.])
15625796c8dcSSimon Schubertfi
15635796c8dcSSimon Schubert
15645796c8dcSSimon Schubert# Check if the compiler and runtime support printing long longs.
15655796c8dcSSimon Schubert
15665796c8dcSSimon SchubertAC_CACHE_CHECK([for long long support in printf],
15675796c8dcSSimon Schubert               gdb_cv_printf_has_long_long,
15685796c8dcSSimon Schubert               [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
15695796c8dcSSimon Schubert[[char buf[32];
15705796c8dcSSimon Schubert  long long l = 0;
15715796c8dcSSimon Schubert  l = (l << 16) + 0x0123;
15725796c8dcSSimon Schubert  l = (l << 16) + 0x4567;
15735796c8dcSSimon Schubert  l = (l << 16) + 0x89ab;
15745796c8dcSSimon Schubert  l = (l << 16) + 0xcdef;
15755796c8dcSSimon Schubert  sprintf (buf, "0x%016llx", l);
15765796c8dcSSimon Schubert  return (strcmp ("0x0123456789abcdef", buf));]])],
15775796c8dcSSimon Schubert                              gdb_cv_printf_has_long_long=yes,
15785796c8dcSSimon Schubert                              gdb_cv_printf_has_long_long=no,
15795796c8dcSSimon Schubert                              gdb_cv_printf_has_long_long=no)])
15805796c8dcSSimon Schubertif test $gdb_cv_printf_has_long_long = yes; then
15815796c8dcSSimon Schubert  AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
15825796c8dcSSimon Schubert            [Define to 1 if the "%ll" format works to print long longs.])
15835796c8dcSSimon Schubertfi
15845796c8dcSSimon Schubert
15855796c8dcSSimon Schubert# Check if the compiler and runtime support printing decfloats.
15865796c8dcSSimon Schubert
15875796c8dcSSimon SchubertAC_CACHE_CHECK([for decfloat support in printf],
15885796c8dcSSimon Schubert               gdb_cv_printf_has_decfloat,
15895796c8dcSSimon Schubert               [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
15905796c8dcSSimon Schubert[[char buf[64];
15915796c8dcSSimon Schubert  _Decimal32 d32 = 1.2345df;
15925796c8dcSSimon Schubert  _Decimal64 d64 = 1.2345dd;
15935796c8dcSSimon Schubert  _Decimal128 d128 = 1.2345dl;
15945796c8dcSSimon Schubert  sprintf (buf, "Decimal32: %H\nDecimal64: %D\nDecimal128: %DD", d32, d64, d128);
15955796c8dcSSimon Schubert  return (strcmp ("Decimal32: 1.2345\nDecimal64: 1.2345\nDecimal128: 1.2345", buf));]])],
15965796c8dcSSimon Schubert                              gdb_cv_printf_has_decfloat=yes,
15975796c8dcSSimon Schubert                              gdb_cv_printf_has_decfloat=no,
15985796c8dcSSimon Schubert                              gdb_cv_printf_has_decfloat=no)])
15995796c8dcSSimon Schubertif test $gdb_cv_printf_has_decfloat = yes; then
16005796c8dcSSimon Schubert  AC_DEFINE(PRINTF_HAS_DECFLOAT, 1,
16015796c8dcSSimon Schubert            [Define to 1 if the "%H, %D and %DD" formats work to print decfloats.])
16025796c8dcSSimon Schubertfi
16035796c8dcSSimon Schubert
16045796c8dcSSimon Schubert# Check if the compiler supports the `long double' type.  We can't use
16055796c8dcSSimon Schubert# AC_C_LONG_DOUBLE because that one does additional checks on the
16065796c8dcSSimon Schubert# constants defined in <float.h> that fail on some systems,
16075796c8dcSSimon Schubert# e.g. FreeBSD/i386 4.7 and OpenBSD/i386 3.6.
16085796c8dcSSimon Schubert
16095796c8dcSSimon SchubertAC_CACHE_CHECK([for long double support in compiler], gdb_cv_c_long_double,
16105796c8dcSSimon Schubert               [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[long double foo;]])],
16115796c8dcSSimon Schubert                                  gdb_cv_c_long_double=yes,
16125796c8dcSSimon Schubert                                  gdb_cv_c_long_double=no)])
16135796c8dcSSimon Schubertif test $gdb_cv_c_long_double = yes; then
16145796c8dcSSimon Schubert  AC_DEFINE(HAVE_LONG_DOUBLE, 1,
16155796c8dcSSimon Schubert           [Define to 1 if the compiler supports long double.])
16165796c8dcSSimon Schubertfi
16175796c8dcSSimon Schubert
16185796c8dcSSimon Schubert# Check if the compiler and runtime support printing long doubles.
16195796c8dcSSimon Schubert
16205796c8dcSSimon SchubertAC_CACHE_CHECK([for long double support in printf],
16215796c8dcSSimon Schubert               gdb_cv_printf_has_long_double,
16225796c8dcSSimon Schubert               [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
16235796c8dcSSimon Schubert[[char buf[16];
16245796c8dcSSimon Schubert  long double f = 3.141592653;
16255796c8dcSSimon Schubert  sprintf (buf, "%Lg", f);
16265796c8dcSSimon Schubert  return (strncmp ("3.14159", buf, 7));]])],
16275796c8dcSSimon Schubert                              gdb_cv_printf_has_long_double=yes,
16285796c8dcSSimon Schubert                              gdb_cv_printf_has_long_double=no,
16295796c8dcSSimon Schubert                              gdb_cv_printf_has_long_double=no)])
16305796c8dcSSimon Schubertif test $gdb_cv_printf_has_long_double = yes; then
16315796c8dcSSimon Schubert  AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1,
16325796c8dcSSimon Schubert            [Define to 1 if the "%Lg" format works to print long doubles.])
16335796c8dcSSimon Schubertfi
16345796c8dcSSimon Schubert
16355796c8dcSSimon Schubert# Check if the compiler and runtime support scanning long doubles.
16365796c8dcSSimon Schubert
16375796c8dcSSimon SchubertAC_CACHE_CHECK([for long double support in scanf],
16385796c8dcSSimon Schubert               gdb_cv_scanf_has_long_double,
16395796c8dcSSimon Schubert               [AC_RUN_IFELSE([AC_LANG_PROGRAM(
16405796c8dcSSimon Schubert[[#include <stdio.h>]],
16415796c8dcSSimon Schubert[[char *buf = "3.141592653";
16425796c8dcSSimon Schubert  long double f = 0;
16435796c8dcSSimon Schubert  sscanf (buf, "%Lg", &f);
16445796c8dcSSimon Schubert  return !(f > 3.14159 && f < 3.14160);]])],
16455796c8dcSSimon Schubert                              gdb_cv_scanf_has_long_double=yes,
16465796c8dcSSimon Schubert                              gdb_cv_scanf_has_long_double=no,
16475796c8dcSSimon Schubert                              gdb_cv_scanf_has_long_double=no)])
16485796c8dcSSimon Schubertif test $gdb_cv_scanf_has_long_double = yes; then
16495796c8dcSSimon Schubert  AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1,
16505796c8dcSSimon Schubert            [Define to 1 if the "%Lg" format works to scan long doubles.])
16515796c8dcSSimon Schubertfi
16525796c8dcSSimon Schubert
16535796c8dcSSimon Schubertcase ${host_os} in
16545796c8dcSSimon Schubertaix*)
16555796c8dcSSimon Schubert  AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
16565796c8dcSSimon Schubert    SAVE_LDFLAGS=$LDFLAGS
16575796c8dcSSimon Schubert
16585796c8dcSSimon Schubert    case $GCC in
16595796c8dcSSimon Schubert    yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
16605796c8dcSSimon Schubert    *) gdb_cv_bigtoc=-bbigtoc ;;
16615796c8dcSSimon Schubert    esac
16625796c8dcSSimon Schubert
16635796c8dcSSimon Schubert    LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
16645796c8dcSSimon Schubert    AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
16655796c8dcSSimon Schubert    LDFLAGS="${SAVE_LDFLAGS}"
16665796c8dcSSimon Schubert  ])
16675796c8dcSSimon Schubert  CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
16685796c8dcSSimon Schubert  ;;
16695796c8dcSSimon Schubertesac
16705796c8dcSSimon Schubert
1671cf7f2e2dSJohn MarinoAC_MSG_CHECKING(for the dynamic export flag)
1672cf7f2e2dSJohn Marinodynamic_list=false
1673cf7f2e2dSJohn Marinoif test "${gdb_native}" = yes; then
1674cf7f2e2dSJohn Marino   # The dynamically loaded libthread_db needs access to symbols in the gdb
1675cf7f2e2dSJohn Marino   # executable.  Older GNU ld supports --export-dynamic but --dynamic-list
1676cf7f2e2dSJohn Marino   # may not be supported there.
1677cf7f2e2dSJohn Marino   old_LDFLAGS="$LDFLAGS"
1678cf7f2e2dSJohn Marino   # Older GNU ld supports --export-dynamic but --dynamic-list it does not.
1679cf7f2e2dSJohn Marino   RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
1680cf7f2e2dSJohn Marino   LDFLAGS="$LDFLAGS $RDYNAMIC"
1681cf7f2e2dSJohn Marino   if test "${have_libpython}" = no; then
1682cf7f2e2dSJohn Marino     AC_TRY_LINK([], [], [dynamic_list=true])
1683cf7f2e2dSJohn Marino   else
1684cf7f2e2dSJohn Marino     # Workaround http://bugs.python.org/issue4434 where static
1685cf7f2e2dSJohn Marino     # libpythonX.Y.a would get its symbols required for
1686cf7f2e2dSJohn Marino     # pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
1687cf7f2e2dSJohn Marino     # Problem does not happen for the recommended libpythonX.Y.so linkage.
1688cf7f2e2dSJohn Marino     old_CFLAGS="$CFLAGS"
1689cf7f2e2dSJohn Marino     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
1690*ef5ccd6cSJohn Marino     old_LIBS="$LIBS"
1691*ef5ccd6cSJohn Marino     LIBS="$LIBS $PYTHON_LIBS"
1692cf7f2e2dSJohn Marino     AC_RUN_IFELSE(
1693cf7f2e2dSJohn Marino       AC_LANG_PROGRAM(
1694cf7f2e2dSJohn Marino         [#include "]${have_libpython}[/Python.h"],
1695cf7f2e2dSJohn Marino         [int err;
1696cf7f2e2dSJohn Marino          Py_Initialize ();
1697cf7f2e2dSJohn Marino          err = PyRun_SimpleString ("import itertools\n");
1698cf7f2e2dSJohn Marino          Py_Finalize ();
1699cf7f2e2dSJohn Marino          return err == 0 ? 0 : 1;]),
1700cf7f2e2dSJohn Marino       [dynamic_list=true], [], [true])
1701*ef5ccd6cSJohn Marino     LIBS="$old_LIBS"
1702cf7f2e2dSJohn Marino     CFLAGS="$old_CFLAGS"
1703cf7f2e2dSJohn Marino   fi
1704cf7f2e2dSJohn Marino   LDFLAGS="$old_LDFLAGS"
1705cf7f2e2dSJohn Marinofi
1706cf7f2e2dSJohn Marinoif $dynamic_list; then
1707cf7f2e2dSJohn Marino  found="-Wl,--dynamic-list"
1708cf7f2e2dSJohn Marino  RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
1709cf7f2e2dSJohn Marinoelse
1710cf7f2e2dSJohn Marino  found="-rdynamic"
1711cf7f2e2dSJohn Marino  RDYNAMIC="-rdynamic"
1712cf7f2e2dSJohn Marinofi
1713cf7f2e2dSJohn MarinoAC_SUBST(RDYNAMIC)
1714cf7f2e2dSJohn MarinoAC_MSG_RESULT($found)
17155796c8dcSSimon Schubert
17165796c8dcSSimon Schubertdnl For certain native configurations, we need to check whether thread
17175796c8dcSSimon Schubertdnl support can be built in or not.
17185796c8dcSSimon Schubertdnl
17195796c8dcSSimon Schubertdnl Note that we only want this if we are both native (host == target),
17205796c8dcSSimon Schubertdnl and not doing a canadian cross build (build == host).
17215796c8dcSSimon Schubert
17225796c8dcSSimon Schubertif test ${build} = ${host} -a ${host} = ${target} ; then
17235796c8dcSSimon Schubert   case ${host_os} in
17245796c8dcSSimon Schubert   solaris*)
17255796c8dcSSimon Schubert      # See if thread_db library is around for Solaris thread debugging.
17265796c8dcSSimon Schubert      # Note that we must explicitly test for version 1 of the library
17275796c8dcSSimon Schubert      # because version 0 (present on Solaris 2.4 or earlier) doesn't have
17285796c8dcSSimon Schubert      # the same API.
17295796c8dcSSimon Schubert      AC_MSG_CHECKING(for Solaris thread debugging library)
17305796c8dcSSimon Schubert      if test -f /usr/lib/libthread_db.so.1 ; then
17315796c8dcSSimon Schubert         AC_MSG_RESULT(yes)
17325796c8dcSSimon Schubert         AC_DEFINE(HAVE_THREAD_DB_LIB, 1,
17335796c8dcSSimon Schubert         [Define if using Solaris thread debugging.])
17345796c8dcSSimon Schubert         CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
17355796c8dcSSimon Schubert         CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
17365796c8dcSSimon Schubert         AC_CHECK_LIB(dl, dlopen)
1737cf7f2e2dSJohn Marino	 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} $RDYNAMIC"
17385796c8dcSSimon Schubert	 # Sun randomly tweaked the prototypes in <proc_service.h>
17395796c8dcSSimon Schubert	 # at one point.
17405796c8dcSSimon Schubert	 AC_MSG_CHECKING(if <proc_service.h> is old)
17415796c8dcSSimon Schubert	 AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
17425796c8dcSSimon Schubert	    AC_TRY_COMPILE([
17435796c8dcSSimon Schubert		#include <proc_service.h>
17445796c8dcSSimon Schubert		ps_err_e ps_pdwrite
17455796c8dcSSimon Schubert		    (struct ps_prochandle*, psaddr_t, const void*, size_t);
17465796c8dcSSimon Schubert	    ],, gdb_cv_proc_service_is_old=no,
17475796c8dcSSimon Schubert	        gdb_cv_proc_service_is_old=yes)
17485796c8dcSSimon Schubert	 ])
17495796c8dcSSimon Schubert	 AC_MSG_RESULT($gdb_cv_proc_service_is_old)
17505796c8dcSSimon Schubert	 if test $gdb_cv_proc_service_is_old = yes; then
17515796c8dcSSimon Schubert	    AC_DEFINE(PROC_SERVICE_IS_OLD, 1,
17525796c8dcSSimon Schubert            [Define if <proc_service.h> on solaris uses int instead of
17535796c8dcSSimon Schubert             size_t, and assorted other type changes.])
17545796c8dcSSimon Schubert	 fi
17555796c8dcSSimon Schubert      else
17565796c8dcSSimon Schubert         AC_MSG_RESULT(no)
17575796c8dcSSimon Schubert      fi
17585796c8dcSSimon Schubert      ;;
17595796c8dcSSimon Schubert   aix*)
17605796c8dcSSimon Schubert      AC_MSG_CHECKING(for AiX thread debugging library)
17615796c8dcSSimon Schubert      AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
17625796c8dcSSimon Schubert                   [AC_TRY_COMPILE([#include <sys/pthdebug.h>],
17635796c8dcSSimon Schubert                                   [#ifndef PTHDB_VERSION_3
17645796c8dcSSimon Schubert                                    #error
17655796c8dcSSimon Schubert                                    #endif],
17665796c8dcSSimon Schubert                                   gdb_cv_have_aix_thread_debug=yes,
17675796c8dcSSimon Schubert                                   gdb_cv_have_aix_thread_debug=no)])
17685796c8dcSSimon Schubert      AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
17695796c8dcSSimon Schubert      if test $gdb_cv_have_aix_thread_debug = yes; then
17705796c8dcSSimon Schubert         CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
17715796c8dcSSimon Schubert         CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
1772*ef5ccd6cSJohn Marino         LIBS="$LIBS -lpthdebug"
1773c50c785cSJohn Marino
1774c50c785cSJohn Marino         # Older versions of AIX do not provide the declaration for
1775c50c785cSJohn Marino         # the getthrds function (it appears that it was introduced
1776c50c785cSJohn Marino         # with AIX 6.x).
1777c50c785cSJohn Marino         AC_CHECK_DECLS(getthrds, [], [], [[#include <procinfo.h>]])
17785796c8dcSSimon Schubert      fi
17795796c8dcSSimon Schubert      ;;
17805796c8dcSSimon Schubert   esac
17815796c8dcSSimon Schubert   AC_SUBST(CONFIG_LDFLAGS)
17825796c8dcSSimon Schubertfi
17835796c8dcSSimon Schubert
17845796c8dcSSimon Schubertdnl See if we have a thread_db header file that has TD_NOTALLOC and
17855796c8dcSSimon Schubertdnl other error codes.
17865796c8dcSSimon Schubertif test "x$ac_cv_header_thread_db_h" = "xyes"; then
17875796c8dcSSimon Schubert   AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
17885796c8dcSSimon Schubert                  gdb_cv_thread_db_h_has_td_notalloc,
17895796c8dcSSimon Schubert     AC_TRY_COMPILE(
17905796c8dcSSimon Schubert       [#include <thread_db.h>],
17915796c8dcSSimon Schubert       [int i = TD_NOTALLOC;],
17925796c8dcSSimon Schubert       gdb_cv_thread_db_h_has_td_notalloc=yes,
17935796c8dcSSimon Schubert       gdb_cv_thread_db_h_has_td_notalloc=no
17945796c8dcSSimon Schubert     )
17955796c8dcSSimon Schubert   )
17965796c8dcSSimon Schubert   AC_CACHE_CHECK([whether <thread_db.h> has TD_VERSION],
17975796c8dcSSimon Schubert                  gdb_cv_thread_db_h_has_td_version,
17985796c8dcSSimon Schubert     AC_TRY_COMPILE(
17995796c8dcSSimon Schubert       [#include <thread_db.h>],
18005796c8dcSSimon Schubert       [int i = TD_VERSION;],
18015796c8dcSSimon Schubert       gdb_cv_thread_db_h_has_td_version=yes,
18025796c8dcSSimon Schubert       gdb_cv_thread_db_h_has_td_version=no
18035796c8dcSSimon Schubert     )
18045796c8dcSSimon Schubert   )
18055796c8dcSSimon Schubert   AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTLS],
18065796c8dcSSimon Schubert                  gdb_cv_thread_db_h_has_td_notls,
18075796c8dcSSimon Schubert     AC_TRY_COMPILE(
18085796c8dcSSimon Schubert       [#include <thread_db.h>],
18095796c8dcSSimon Schubert       [int i = TD_NOTLS;],
18105796c8dcSSimon Schubert       gdb_cv_thread_db_h_has_td_notls=yes,
18115796c8dcSSimon Schubert       gdb_cv_thread_db_h_has_td_notls=no
18125796c8dcSSimon Schubert     )
18135796c8dcSSimon Schubert   )
18145796c8dcSSimon Schubertfi
18155796c8dcSSimon Schubertif test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
18165796c8dcSSimon Schubert  AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
18175796c8dcSSimon Schubert            [Define if <thread_db.h> has the TD_NOTALLOC error code.])
18185796c8dcSSimon Schubertfi
18195796c8dcSSimon Schubertif test "x$gdb_cv_thread_db_h_has_td_version" = "xyes"; then
18205796c8dcSSimon Schubert  AC_DEFINE(THREAD_DB_HAS_TD_VERSION, 1,
18215796c8dcSSimon Schubert            [Define if <thread_db.h> has the TD_VERSION error code.])
18225796c8dcSSimon Schubertfi
18235796c8dcSSimon Schubertif test "x$gdb_cv_thread_db_h_has_td_notls" = "xyes"; then
18245796c8dcSSimon Schubert  AC_DEFINE(THREAD_DB_HAS_TD_NOTLS, 1,
18255796c8dcSSimon Schubert            [Define if <thread_db.h> has the TD_NOTLS error code.])
18265796c8dcSSimon Schubertfi
18275796c8dcSSimon Schubert
18285796c8dcSSimon Schubertdnl See if we have a sys/syscall header file that has __NR_tkill.
18295796c8dcSSimon Schubertif test "x$ac_cv_header_sys_syscall_h" = "xyes"; then
18305796c8dcSSimon Schubert   AC_CACHE_CHECK([whether <sys/syscall.h> has __NR_tkill],
18315796c8dcSSimon Schubert                  gdb_cv_sys_syscall_h_has_tkill,
18325796c8dcSSimon Schubert     AC_TRY_COMPILE(
18335796c8dcSSimon Schubert       [#include <sys/syscall.h>],
18345796c8dcSSimon Schubert       [int i = __NR_tkill;],
18355796c8dcSSimon Schubert       gdb_cv_sys_syscall_h_has_tkill=yes,
18365796c8dcSSimon Schubert       gdb_cv_sys_syscall_h_has_tkill=no
18375796c8dcSSimon Schubert     )
18385796c8dcSSimon Schubert   )
18395796c8dcSSimon Schubertfi
18405796c8dcSSimon Schubertdnl See if we can issue tkill syscall.
18415796c8dcSSimon Schubertif test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then
18425796c8dcSSimon Schubert  AC_DEFINE(HAVE_TKILL_SYSCALL, 1, [Define if you support the tkill syscall.])
18435796c8dcSSimon Schubertfi
18445796c8dcSSimon Schubert
18455796c8dcSSimon Schubertdnl Check if we can disable the virtual address space randomization.
18465796c8dcSSimon Schubertdnl The functionality of setarch -R.
18475796c8dcSSimon SchubertAC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
18485796c8dcSSimon Schubertdefine([PERSONALITY_TEST], [AC_LANG_PROGRAM([#include <sys/personality.h>], [
18495796c8dcSSimon Schubert#      if !HAVE_DECL_ADDR_NO_RANDOMIZE
18505796c8dcSSimon Schubert#       define ADDR_NO_RANDOMIZE 0x0040000
18515796c8dcSSimon Schubert#      endif
18525796c8dcSSimon Schubert       /* Test the flag could be set and stays set.  */
18535796c8dcSSimon Schubert       personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE);
18545796c8dcSSimon Schubert       if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE))
18555796c8dcSSimon Schubert	   return 1])])
18565796c8dcSSimon SchubertAC_RUN_IFELSE([PERSONALITY_TEST],
18575796c8dcSSimon Schubert	      [have_personality=true],
18585796c8dcSSimon Schubert	      [have_personality=false],
18595796c8dcSSimon Schubert	      [AC_LINK_IFELSE([PERSONALITY_TEST],
18605796c8dcSSimon Schubert			      [have_personality=true],
18615796c8dcSSimon Schubert			      [have_personality=false])])
18625796c8dcSSimon Schubertif $have_personality
18635796c8dcSSimon Schubertthen
18645796c8dcSSimon Schubert    AC_DEFINE([HAVE_PERSONALITY], 1,
18655796c8dcSSimon Schubert	      [Define if you support the personality syscall.])
18665796c8dcSSimon Schubertfi
18675796c8dcSSimon Schubert
18685796c8dcSSimon Schubertdnl Handle optional features that can be enabled.
18695796c8dcSSimon Schubert
1870*ef5ccd6cSJohn Marino# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
1871*ef5ccd6cSJohn Marino# except that the argument to --with-sysroot is optional.
1872*ef5ccd6cSJohn Marino# --with-sysroot (or --with-sysroot=yes) sets the default sysroot path.
1873*ef5ccd6cSJohn Marinoif test "x$with_sysroot" = xyes; then
1874*ef5ccd6cSJohn Marino  with_sysroot="${exec_prefix}/${target_alias}/sys-root"
1875*ef5ccd6cSJohn Marinofi
18765796c8dcSSimon SchubertAC_ARG_WITH(sysroot,
1877*ef5ccd6cSJohn Marino  AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
1878*ef5ccd6cSJohn Marino                 [search for usr/lib et al within DIR]),
1879*ef5ccd6cSJohn Marino  [TARGET_SYSTEM_ROOT=$withval], [TARGET_SYSTEM_ROOT=])
1880*ef5ccd6cSJohn MarinoAC_DEFINE_DIR(TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT,
1881*ef5ccd6cSJohn Marino              [search for usr/lib et al within DIR])
18825796c8dcSSimon SchubertAC_SUBST(TARGET_SYSTEM_ROOT)
1883*ef5ccd6cSJohn MarinoGDB_AC_DEFINE_RELOCATABLE(TARGET_SYSTEM_ROOT, sysroot, ${ac_define_dir})
18845796c8dcSSimon Schubert
18855796c8dcSSimon SchubertGDB_AC_WITH_DIR(SYSTEM_GDBINIT, system-gdbinit,
18865796c8dcSSimon Schubert    [automatically load a system-wide gdbinit file],
18875796c8dcSSimon Schubert    [])
18885796c8dcSSimon Schubert
18895796c8dcSSimon SchubertAC_ARG_ENABLE(werror,
18905796c8dcSSimon Schubert  AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
18915796c8dcSSimon Schubert  [case "${enableval}" in
18925796c8dcSSimon Schubert     yes | y) ERROR_ON_WARNING="yes" ;;
18935796c8dcSSimon Schubert     no | n)  ERROR_ON_WARNING="no" ;;
18945796c8dcSSimon Schubert     *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
18955796c8dcSSimon Schubert   esac])
18965796c8dcSSimon Schubert
1897*ef5ccd6cSJohn Marino# Enable -Werror by default when using gcc.  Turn it off for releases.
1898*ef5ccd6cSJohn Marinoif test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
1899*ef5ccd6cSJohn Marino    ERROR_ON_WARNING=yes
1900*ef5ccd6cSJohn Marinofi
1901*ef5ccd6cSJohn Marino
19025796c8dcSSimon SchubertWERROR_CFLAGS=""
19035796c8dcSSimon Schubertif test "${ERROR_ON_WARNING}" = yes ; then
19045796c8dcSSimon Schubert    WERROR_CFLAGS="-Werror"
19055796c8dcSSimon Schubertfi
19065796c8dcSSimon Schubert
19075796c8dcSSimon Schubert# The entries after -Wno-pointer-sign are disabled warnings which may
19085796c8dcSSimon Schubert# be enabled in the future, which can not currently be used to build
19095796c8dcSSimon Schubert# GDB.
19105796c8dcSSimon Schubert# NOTE: If you change this list, remember to update
19115796c8dcSSimon Schubert# gdb/doc/gdbint.texinfo.
19125796c8dcSSimon Schubertbuild_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
19135796c8dcSSimon Schubert-Wformat-nonliteral -Wno-pointer-sign \
1914cf7f2e2dSJohn Marino-Wno-unused -Wunused-value -Wunused-function \
1915*ef5ccd6cSJohn Marino-Wno-switch -Wno-char-subscripts -Wmissing-prototypes \
1916*ef5ccd6cSJohn Marino-Wdeclaration-after-statement -Wempty-body"
19175796c8dcSSimon Schubert
19185796c8dcSSimon Schubert# Enable -Wno-format by default when using gcc on mingw since many
19195796c8dcSSimon Schubert# GCC versions complain about %I64.
19205796c8dcSSimon Schubertcase "${host}" in
19215796c8dcSSimon Schubert  *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;;
19225796c8dcSSimon Schubertesac
19235796c8dcSSimon Schubert
19245796c8dcSSimon SchubertAC_ARG_ENABLE(build-warnings,
19255796c8dcSSimon SchubertAS_HELP_STRING([--enable-build-warnings], [enable build-time compiler warnings if gcc is used]),
19265796c8dcSSimon Schubert[case "${enableval}" in
19275796c8dcSSimon Schubert  yes)	;;
19285796c8dcSSimon Schubert  no)	build_warnings="-w";;
19295796c8dcSSimon Schubert  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
19305796c8dcSSimon Schubert        build_warnings="${build_warnings} ${t}";;
19315796c8dcSSimon Schubert  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
19325796c8dcSSimon Schubert        build_warnings="${t} ${build_warnings}";;
19335796c8dcSSimon Schubert  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
19345796c8dcSSimon Schubertesac
19355796c8dcSSimon Schubertif test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
19365796c8dcSSimon Schubert  echo "Setting compiler warning flags = $build_warnings" 6>&1
19375796c8dcSSimon Schubertfi])dnl
19385796c8dcSSimon SchubertAC_ARG_ENABLE(gdb-build-warnings,
19395796c8dcSSimon SchubertAS_HELP_STRING([--enable-gdb-build-warnings], [enable GDB specific build-time compiler warnings if gcc is used]),
19405796c8dcSSimon Schubert[case "${enableval}" in
19415796c8dcSSimon Schubert  yes)	;;
19425796c8dcSSimon Schubert  no)	build_warnings="-w";;
19435796c8dcSSimon Schubert  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
19445796c8dcSSimon Schubert        build_warnings="${build_warnings} ${t}";;
19455796c8dcSSimon Schubert  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
19465796c8dcSSimon Schubert        build_warnings="${t} ${build_warnings}";;
19475796c8dcSSimon Schubert  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
19485796c8dcSSimon Schubertesac
19495796c8dcSSimon Schubertif test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
19505796c8dcSSimon Schubert  echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
19515796c8dcSSimon Schubertfi])dnl
19525796c8dcSSimon SchubertWARN_CFLAGS=""
19535796c8dcSSimon Schubertif test "x${build_warnings}" != x -a "x$GCC" = xyes
19545796c8dcSSimon Schubertthen
19555796c8dcSSimon Schubert    AC_MSG_CHECKING(compiler warning flags)
19565796c8dcSSimon Schubert    # Separate out the -Werror flag as some files just cannot be
19575796c8dcSSimon Schubert    # compiled with it enabled.
19585796c8dcSSimon Schubert    for w in ${build_warnings}; do
19595796c8dcSSimon Schubert	case $w in
19605796c8dcSSimon Schubert	-Werr*) WERROR_CFLAGS=-Werror ;;
19615796c8dcSSimon Schubert	*) # Check that GCC accepts it
19625796c8dcSSimon Schubert	    saved_CFLAGS="$CFLAGS"
19635796c8dcSSimon Schubert	    CFLAGS="$CFLAGS $w"
19645796c8dcSSimon Schubert	    AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
19655796c8dcSSimon Schubert	    CFLAGS="$saved_CFLAGS"
19665796c8dcSSimon Schubert	esac
19675796c8dcSSimon Schubert    done
19685796c8dcSSimon Schubert    AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
19695796c8dcSSimon Schubertfi
19705796c8dcSSimon SchubertAC_SUBST(WARN_CFLAGS)
19715796c8dcSSimon SchubertAC_SUBST(WERROR_CFLAGS)
19725796c8dcSSimon Schubert
19735796c8dcSSimon Schubert# In the Cygwin environment, we need some additional flags.
19745796c8dcSSimon SchubertAC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
19755796c8dcSSimon Schubert[AC_EGREP_CPP(lose, [
19765796c8dcSSimon Schubert#if defined (__CYGWIN__) || defined (__CYGWIN32__)
19775796c8dcSSimon Schubertlose
19785796c8dcSSimon Schubert#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
19795796c8dcSSimon Schubert
19805796c8dcSSimon Schubert
19815796c8dcSSimon Schubertdnl Figure out which of the many generic ser-*.c files the _host_ supports.
19825796c8dcSSimon SchubertSER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
19835796c8dcSSimon Schubertcase ${host} in
19845796c8dcSSimon Schubert  *go32* ) SER_HARDWIRE=ser-go32.o ;;
19855796c8dcSSimon Schubert  *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
19865796c8dcSSimon Schubert  *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
19875796c8dcSSimon Schubertesac
19885796c8dcSSimon SchubertAC_SUBST(SER_HARDWIRE)
19895796c8dcSSimon Schubert
19905796c8dcSSimon Schubert# libreadline needs libuser32.a in a cygwin environment
19915796c8dcSSimon SchubertWIN32LIBS=
19925796c8dcSSimon Schubertif test x$gdb_cv_os_cygwin = xyes; then
19935796c8dcSSimon Schubert    WIN32LIBS="-luser32"
19945796c8dcSSimon Schubert    case "${target}" in
19955796c8dcSSimon Schubert	*cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
19965796c8dcSSimon Schubert	;;
19975796c8dcSSimon Schubert    esac
19985796c8dcSSimon Schubertfi
19995796c8dcSSimon Schubert
20005796c8dcSSimon Schubert# The ser-tcp.c module requires sockets.
20015796c8dcSSimon Schubertcase ${host} in
20025796c8dcSSimon Schubert  *mingw32*)
20035796c8dcSSimon Schubert    AC_DEFINE(USE_WIN32API, 1,
20045796c8dcSSimon Schubert              [Define if we should use the Windows API, instead of the
20055796c8dcSSimon Schubert	       POSIX API.  On Windows, we use the Windows API when
20065796c8dcSSimon Schubert	       building for MinGW, but the POSIX API when building
20075796c8dcSSimon Schubert	       for Cygwin.])
20085796c8dcSSimon Schubert    WIN32LIBS="$WIN32LIBS -lws2_32"
20095796c8dcSSimon Schubert    ;;
20105796c8dcSSimon Schubertesac
20115796c8dcSSimon SchubertAC_SUBST(WIN32LIBS)
20125796c8dcSSimon Schubert
20135796c8dcSSimon Schubert# Add ELF support to GDB, but only if BFD includes ELF support.
2014*ef5ccd6cSJohn MarinoGDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,
2015*ef5ccd6cSJohn Marino                 [bfd_get_elf_phdr_upper_bound (NULL)], elf-bfd.h)
20165796c8dcSSimon Schubertif test $gdb_cv_var_elf = yes; then
2017*ef5ccd6cSJohn Marino  CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o"
20185796c8dcSSimon Schubert  AC_DEFINE(HAVE_ELF, 1,
20195796c8dcSSimon Schubert	    [Define if ELF support should be included.])
2020c50c785cSJohn Marino  # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
2021c50c785cSJohn Marino  if test "$plugins" = "yes"; then
2022*ef5ccd6cSJohn Marino    LIBS="-ldl $LIBS"
2023c50c785cSJohn Marino  fi
20245796c8dcSSimon Schubertfi
2025*ef5ccd6cSJohn Marino
2026*ef5ccd6cSJohn Marino# Add macho support to GDB, but only if BFD includes it.
2027*ef5ccd6cSJohn MarinoGDB_AC_CHECK_BFD([for Mach-O support in BFD], gdb_cv_var_macho,
2028*ef5ccd6cSJohn Marino                 [bfd_mach_o_lookup_command (NULL, 0, NULL)], mach-o.h)
2029*ef5ccd6cSJohn Marinoif test $gdb_cv_var_macho = yes; then
2030*ef5ccd6cSJohn Marino  CONFIG_OBS="$CONFIG_OBS machoread.o"
2031*ef5ccd6cSJohn Marinofi
2032*ef5ccd6cSJohn Marino
2033*ef5ccd6cSJohn Marino# Add SOM support to GDB, but only if BFD includes it.
2034*ef5ccd6cSJohn MarinoGDB_AC_CHECK_BFD([for SOM support in BFD], gdb_cv_var_som,
2035*ef5ccd6cSJohn Marino                 [bfd_som_attach_aux_hdr (NULL, 0, NULL)], som.h)
2036*ef5ccd6cSJohn Marinoif test $gdb_cv_var_som = yes; then
2037*ef5ccd6cSJohn Marino  CONFIG_OBS="$CONFIG_OBS somread.o"
2038*ef5ccd6cSJohn Marinofi
20395796c8dcSSimon Schubert
20405796c8dcSSimon Schubert# Add any host-specific objects to GDB.
20415796c8dcSSimon SchubertCONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
20425796c8dcSSimon Schubert
2043*ef5ccd6cSJohn Marino# If building on ELF, look for lzma support for embedded compressed debug info.
2044*ef5ccd6cSJohn Marinoif test $gdb_cv_var_elf = yes; then
2045*ef5ccd6cSJohn Marino  AC_ARG_WITH(lzma,
2046*ef5ccd6cSJohn Marino    AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]),
2047*ef5ccd6cSJohn Marino    [], [with_lzma=auto])
2048*ef5ccd6cSJohn Marino  AC_MSG_CHECKING([whether to use lzma])
2049*ef5ccd6cSJohn Marino  AC_MSG_RESULT([$with_lzma])
2050*ef5ccd6cSJohn Marino
2051*ef5ccd6cSJohn Marino  if test "${with_lzma}" != no; then
2052*ef5ccd6cSJohn Marino    AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include "lzma.h"],
2053*ef5ccd6cSJohn Marino			  [lzma_index_iter iter;
2054*ef5ccd6cSJohn Marino			   lzma_index_iter_init (&iter, 0);
2055*ef5ccd6cSJohn Marino			   lzma_mf_is_supported (LZMA_MF_HC3);])
2056*ef5ccd6cSJohn Marino    if test "$HAVE_LIBLZMA" != yes; then
2057*ef5ccd6cSJohn Marino      if test "$with_lzma" = yes; then
2058*ef5ccd6cSJohn Marino        AC_MSG_ERROR([missing liblzma for --with-lzma])
2059*ef5ccd6cSJohn Marino      fi
2060*ef5ccd6cSJohn Marino    fi
2061*ef5ccd6cSJohn Marino  fi
2062*ef5ccd6cSJohn Marinofi
2063*ef5ccd6cSJohn Marino
20645796c8dcSSimon SchubertLIBGUI="../libgui/src/libgui.a"
20655796c8dcSSimon SchubertGUI_CFLAGS_X="-I${srcdir}/../libgui/src"
20665796c8dcSSimon SchubertAC_SUBST(LIBGUI)
20675796c8dcSSimon SchubertAC_SUBST(GUI_CFLAGS_X)
20685796c8dcSSimon Schubert
20695796c8dcSSimon SchubertWIN32LDAPP=
20705796c8dcSSimon SchubertAC_SUBST(WIN32LIBS)
20715796c8dcSSimon SchubertAC_SUBST(WIN32LDAPP)
20725796c8dcSSimon Schubert
20735796c8dcSSimon Schubertcase "${host}" in
20745796c8dcSSimon Schubert*-*-cygwin* | *-*-mingw* )
20755796c8dcSSimon Schubert    configdir="win"
20765796c8dcSSimon Schubert    ;;
20775796c8dcSSimon Schubert*)
20785796c8dcSSimon Schubert    configdir="unix"
20795796c8dcSSimon Schubert    ;;
20805796c8dcSSimon Schubertesac
20815796c8dcSSimon Schubert
20825796c8dcSSimon SchubertGDBTKLIBS=
20835796c8dcSSimon Schubertif test "${enable_gdbtk}" = "yes"; then
20845796c8dcSSimon Schubert
20855796c8dcSSimon Schubert    # Gdbtk must have an absolute path to srcdir in order to run
20865796c8dcSSimon Schubert    # properly when not installed.
20875796c8dcSSimon Schubert    here=`pwd`
20885796c8dcSSimon Schubert    cd ${srcdir}
20895796c8dcSSimon Schubert    GDBTK_SRC_DIR=`pwd`
20905796c8dcSSimon Schubert    cd $here
20915796c8dcSSimon Schubert
20925796c8dcSSimon Schubert    SC_PATH_TCLCONFIG
20935796c8dcSSimon Schubert
20945796c8dcSSimon Schubert    # If $no_tk is nonempty, then we can't do Tk, and there is no
20955796c8dcSSimon Schubert    # point to doing Tcl.
20965796c8dcSSimon Schubert    SC_PATH_TKCONFIG
20975796c8dcSSimon Schubert
20985796c8dcSSimon Schubert    if test -z "${no_tcl}" -a -z "${no_tk}"; then
20995796c8dcSSimon Schubert	SC_LOAD_TCLCONFIG
21005796c8dcSSimon Schubert
21015796c8dcSSimon Schubert        # Check for in-tree tcl
21025796c8dcSSimon Schubert        here=`pwd`
21035796c8dcSSimon Schubert        cd ${srcdir}/..
21045796c8dcSSimon Schubert        topdir=`pwd`
21055796c8dcSSimon Schubert        cd ${here}
21065796c8dcSSimon Schubert
21075796c8dcSSimon Schubert        intree="no"
21085796c8dcSSimon Schubert        if test "${TCL_SRC_DIR}" = "${topdir}/tcl"; then
21095796c8dcSSimon Schubert          intree="yes"
21105796c8dcSSimon Schubert        fi
21115796c8dcSSimon Schubert
21125796c8dcSSimon Schubert        # Find Tcl private headers
21135796c8dcSSimon Schubert        if test x"${intree}" = xno; then
21145796c8dcSSimon Schubert          CY_AC_TCL_PRIVATE_HEADERS
21155796c8dcSSimon Schubert	  TCL_INCLUDE="${TCL_INCLUDE_SPEC} ${TCL_PRIVATE_INCLUDE}"
21165796c8dcSSimon Schubert          TCL_LIBRARY="${TCL_LIB_SPEC}"
21175796c8dcSSimon Schubert          TCL_DEPS=""
21185796c8dcSSimon Schubert        else
21195796c8dcSSimon Schubert          # If building tcl in the same src tree, private headers
21205796c8dcSSimon Schubert          # are not needed, but we need to be sure to use the right
21215796c8dcSSimon Schubert          # headers library
21225796c8dcSSimon Schubert	  TCL_INCLUDE="-I${TCL_SRC_DIR}/generic"
21235796c8dcSSimon Schubert          TCL_LIBRARY="${TCL_BUILD_LIB_SPEC}"
21245796c8dcSSimon Schubert          TCL_DEPS="../tcl/${configdir}${TCL_LIB_FILE}"
21255796c8dcSSimon Schubert        fi
21265796c8dcSSimon Schubert	AC_SUBST(TCL_INCLUDE)
21275796c8dcSSimon Schubert	AC_SUBST(TCL_LIBRARY)
21285796c8dcSSimon Schubert        AC_SUBST(TCL_DEPS)
21295796c8dcSSimon Schubert
21305796c8dcSSimon Schubert	SC_LOAD_TKCONFIG
21315796c8dcSSimon Schubert
21325796c8dcSSimon Schubert        # Check for in-tree Tk
21335796c8dcSSimon Schubert        intree="no"
21345796c8dcSSimon Schubert        if test "${TK_SRC_DIR}" = "${topdir}/tk"; then
21355796c8dcSSimon Schubert          intree="yes"
21365796c8dcSSimon Schubert        fi
21375796c8dcSSimon Schubert
21385796c8dcSSimon Schubert        # Find Tk private headers
21395796c8dcSSimon Schubert        if test x"${intree}" = xno; then
21405796c8dcSSimon Schubert          CY_AC_TK_PRIVATE_HEADERS
21415796c8dcSSimon Schubert	  TK_INCLUDE="${TK_INCLUDE_SPEC} ${TK_PRIVATE_INCLUDE}"
21425796c8dcSSimon Schubert	  TK_LIBRARY=${TK_LIB_SPEC}
21435796c8dcSSimon Schubert          TK_DEPS=""
21445796c8dcSSimon Schubert        else
21455796c8dcSSimon Schubert          TK_INCLUDE="-I${TK_SRC_DIR}/generic"
21465796c8dcSSimon Schubert          TK_LIBRARY="${TK_BUILD_LIB_SPEC}"
21475796c8dcSSimon Schubert          TK_DEPS="../tk/${configdir}/${TK_LIB_FILE}"
21485796c8dcSSimon Schubert        fi
21495796c8dcSSimon Schubert	AC_SUBST(TK_INCLUDE)
21505796c8dcSSimon Schubert	AC_SUBST(TK_LIBRARY)
21515796c8dcSSimon Schubert	AC_SUBST(TK_DEPS)
21525796c8dcSSimon Schubert	AC_SUBST(TK_XINCLUDES)
21535796c8dcSSimon Schubert
21545796c8dcSSimon Schubert        ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
21555796c8dcSSimon Schubert
21565796c8dcSSimon Schubert	# Include some libraries that Tcl and Tk want.
21575796c8dcSSimon Schubert	TCL_LIBS='$(LIBGUI) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
21585796c8dcSSimon Schubert	# Yes, the ordering seems wrong here.  But it isn't.
21595796c8dcSSimon Schubert	# TK_LIBS is the list of libraries that need to be linked
21605796c8dcSSimon Schubert	# after Tcl/Tk.  Note that this isn't put into LIBS.  If it
21615796c8dcSSimon Schubert	# were in LIBS then any link tests after this point would
21625796c8dcSSimon Schubert	# try to include things like `$(LIBGUI)', which wouldn't work.
21635796c8dcSSimon Schubert	GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
21645796c8dcSSimon Schubert
21655796c8dcSSimon Schubert        CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
21665796c8dcSSimon Schubert        CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
21675796c8dcSSimon Schubert        CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
21685796c8dcSSimon Schubert	CONFIG_ALL="${CONFIG_ALL} all-gdbtk"
21695796c8dcSSimon Schubert	CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk"
21705796c8dcSSimon Schubert	CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
21715796c8dcSSimon Schubert	CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
21725796c8dcSSimon Schubert
21735796c8dcSSimon Schubert	if test x$gdb_cv_os_cygwin = xyes; then
21745796c8dcSSimon Schubert	  WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
21755796c8dcSSimon Schubert	  WIN32LDAPP="-Wl,--subsystem,console"
21765796c8dcSSimon Schubert	  CONFIG_OBS="${CONFIG_OBS} gdbres.o"
21775796c8dcSSimon Schubert	fi
21785796c8dcSSimon Schubert
21795796c8dcSSimon Schubert        AC_CONFIG_SUBDIRS(gdbtk)
21805796c8dcSSimon Schubert    fi
21815796c8dcSSimon Schubertfi
21825796c8dcSSimon Schubert
21835796c8dcSSimon SchubertAC_SUBST(X_CFLAGS)
21845796c8dcSSimon SchubertAC_SUBST(X_LDFLAGS)
21855796c8dcSSimon SchubertAC_SUBST(X_LIBS)
21865796c8dcSSimon SchubertAC_SUBST(GDBTKLIBS)
21875796c8dcSSimon SchubertAC_SUBST(GDBTK_CFLAGS)
21885796c8dcSSimon SchubertAC_SUBST(GDBTK_SRC_DIR)
21895796c8dcSSimon Schubert
21905796c8dcSSimon SchubertAC_PATH_X
21915796c8dcSSimon Schubert
21925796c8dcSSimon Schubert# Unlike the sim directory, whether a simulator is linked is controlled by
21935796c8dcSSimon Schubert# presence of a gdb_sim definition in the target configure.tgt entry.
21945796c8dcSSimon Schubert# This code just checks for a few cases where we'd like to ignore those
21955796c8dcSSimon Schubert# definitions, even when they're present in the '.mt' file.  These cases
21965796c8dcSSimon Schubert# are when --disable-sim is specified, or if the simulator directory is
21975796c8dcSSimon Schubert# not part of the source tree.
21985796c8dcSSimon Schubert#
21995796c8dcSSimon SchubertAC_ARG_ENABLE(sim,
22005796c8dcSSimon SchubertAS_HELP_STRING([--enable-sim], [link gdb with simulator]),
22015796c8dcSSimon Schubert[echo "enable_sim = $enable_sim";
22025796c8dcSSimon Schubert echo "enableval = ${enableval}";
22035796c8dcSSimon Schubert case "${enableval}" in
22045796c8dcSSimon Schubert  yes) ignore_sim=false ;;
22055796c8dcSSimon Schubert  no)  ignore_sim=true ;;
22065796c8dcSSimon Schubert  *)   ignore_sim=false ;;
22075796c8dcSSimon Schubert esac],
22085796c8dcSSimon Schubert[ignore_sim=false])
22095796c8dcSSimon Schubert
22105796c8dcSSimon Schubertif test ! -d "${srcdir}/../sim"; then
22115796c8dcSSimon Schubert  ignore_sim=true
22125796c8dcSSimon Schubertfi
22135796c8dcSSimon Schubert
22145796c8dcSSimon SchubertSIM=
22155796c8dcSSimon SchubertSIM_OBS=
22165796c8dcSSimon Schubertif test "${ignore_sim}" = "false"; then
22175796c8dcSSimon Schubert  if test x"${gdb_sim}" != x ; then
22185796c8dcSSimon Schubert    SIM="${gdb_sim}"
22195796c8dcSSimon Schubert    SIM_OBS="remote-sim.o"
22205796c8dcSSimon Schubert    AC_DEFINE(WITH_SIM, 1, [Define if the simulator is being linked in.])
22215796c8dcSSimon Schubert  fi
22225796c8dcSSimon Schubertfi
22235796c8dcSSimon SchubertAC_SUBST(SIM)
22245796c8dcSSimon SchubertAC_SUBST(SIM_OBS)
22255796c8dcSSimon Schubert
22265796c8dcSSimon SchubertAC_SUBST(ENABLE_CFLAGS)
22275796c8dcSSimon SchubertAC_SUBST(PROFILE_CFLAGS)
22285796c8dcSSimon Schubert
22295796c8dcSSimon SchubertAC_SUBST(CONFIG_OBS)
22305796c8dcSSimon SchubertAC_SUBST(CONFIG_DEPS)
22315796c8dcSSimon SchubertAC_SUBST(CONFIG_SRCS)
22325796c8dcSSimon SchubertAC_SUBST(CONFIG_ALL)
22335796c8dcSSimon SchubertAC_SUBST(CONFIG_CLEAN)
22345796c8dcSSimon SchubertAC_SUBST(CONFIG_INSTALL)
22355796c8dcSSimon SchubertAC_SUBST(CONFIG_UNINSTALL)
22365796c8dcSSimon Schubert
22375796c8dcSSimon Schubert# List of host floatformats.
22385796c8dcSSimon SchubertAC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
22395796c8dcSSimon SchubertAC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
22405796c8dcSSimon SchubertAC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
22415796c8dcSSimon Schubert
22425796c8dcSSimon Schubert# target_subdir is used by the testsuite to find the target libraries.
22435796c8dcSSimon Schuberttarget_subdir=
22445796c8dcSSimon Schubertif test "${host}" != "${target}"; then
22455796c8dcSSimon Schubert    target_subdir="${target_alias}/"
22465796c8dcSSimon Schubertfi
22475796c8dcSSimon SchubertAC_SUBST(target_subdir)
22485796c8dcSSimon Schubert
22495796c8dcSSimon Schubertfrags=
22505796c8dcSSimon Schubertif test "${gdb_native}" = "yes"; then
22515796c8dcSSimon Schubert  host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
22525796c8dcSSimon Schubert  if test ! -f ${host_makefile_frag}; then
22535796c8dcSSimon Schubert    AC_MSG_ERROR("*** Gdb does not support native target ${host}")
22545796c8dcSSimon Schubert  fi
22555796c8dcSSimon Schubert  frags="$frags $host_makefile_frag"
22565796c8dcSSimon Schubertelse
22575796c8dcSSimon Schubert  host_makefile_frag=/dev/null
22585796c8dcSSimon Schubertfi
22595796c8dcSSimon Schubert
22605796c8dcSSimon SchubertAC_SUBST_FILE(host_makefile_frag)
22615796c8dcSSimon SchubertAC_SUBST(frags)
22625796c8dcSSimon Schubert
22635796c8dcSSimon Schubertchangequote(,)dnl
22645796c8dcSSimon Schubertif test "${gdb_native}" = "yes"; then
22655796c8dcSSimon Schubert# We pick this up from the host configuration file (.mh) because we
22665796c8dcSSimon Schubert# do not have a native configuration Makefile fragment.
22675796c8dcSSimon Schubertnativefile=`sed -n '
22685796c8dcSSimon Schuberts/NAT_FILE[ 	]*=[ 	]*\([^ 	]*\)/\1/p
22695796c8dcSSimon Schubert' ${host_makefile_frag}`
22705796c8dcSSimon Schubertfi
22715796c8dcSSimon Schubertchangequote([,])
22725796c8dcSSimon Schubert
22735796c8dcSSimon Schubertif test x"${gdb_osabi}" != x ; then
22745796c8dcSSimon Schubert    AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi,
22755796c8dcSSimon Schubert		       [Define to the default OS ABI for this configuration.])
22765796c8dcSSimon Schubertfi
22775796c8dcSSimon Schubert
22785796c8dcSSimon Schubert# Enable multi-ice-gdb-server.
22795796c8dcSSimon SchubertAC_ARG_ENABLE(multi-ice,
22805796c8dcSSimon SchubertAS_HELP_STRING([--enable-multi-ice], [build the multi-ice-gdb-server]),
22815796c8dcSSimon Schubert  [case $enableval in
22825796c8dcSSimon Schubert    yes | no)
22835796c8dcSSimon Schubert      ;;
22845796c8dcSSimon Schubert    *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;;
22855796c8dcSSimon Schubert  esac])
22865796c8dcSSimon Schubertif test "x$enable_multi_ice" = xyes; then
22875796c8dcSSimon Schubert   AC_CONFIG_SUBDIRS(multi-ice)
22885796c8dcSSimon Schubertfi
22895796c8dcSSimon Schubert
2290c50c785cSJohn MarinoAC_ARG_ENABLE(gdbserver,
2291c50c785cSJohn MarinoAS_HELP_STRING([--enable-gdbserver],
2292c50c785cSJohn Marino               [automatically build gdbserver (yes/no/auto, default is auto)]),
2293c50c785cSJohn Marino[case "${enableval}" in
2294c50c785cSJohn Marino  yes| no|auto) ;;
2295c50c785cSJohn Marino  *) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbserver option) ;;
2296c50c785cSJohn Marinoesac],[enable_gdbserver=auto])
2297c50c785cSJohn Marino
2298c50c785cSJohn Marino# We only build gdbserver automatically in a native configuration, and
2299c50c785cSJohn Marino# only if the user did not explicitly disable its build.
2300c50c785cSJohn Marinoif test "$gdb_native" = "yes" -a "$enable_gdbserver" != "no"; then
23015796c8dcSSimon Schubert  AC_MSG_CHECKING(whether gdbserver is supported on this host)
23025796c8dcSSimon Schubert  if test "x$build_gdbserver" = xyes; then
23035796c8dcSSimon Schubert    AC_MSG_RESULT(yes)
23045796c8dcSSimon Schubert    AC_CONFIG_SUBDIRS(gdbserver)
2305c50c785cSJohn Marino    gdbserver_build_enabled=yes
23065796c8dcSSimon Schubert  else
23075796c8dcSSimon Schubert    AC_MSG_RESULT(no)
23085796c8dcSSimon Schubert  fi
23095796c8dcSSimon Schubertfi
23105796c8dcSSimon Schubert
2311c50c785cSJohn Marino# If the user explicitly request the gdbserver to be built, verify that
2312c50c785cSJohn Marino# we were in fact able to enable it.
2313c50c785cSJohn Marinoif test "$enable_gdbserver" = "yes" -a "$gdbserver_build_enabled" != "yes"; then
2314c50c785cSJohn Marino  AC_MSG_ERROR(Automatic gdbserver build is not supported for this configuration)
2315c50c785cSJohn Marinofi
2316c50c785cSJohn Marino
23175796c8dcSSimon Schubert# If nativefile (NAT_FILE) is not set in config/*/*.m[ht] files, we link
23185796c8dcSSimon Schubert# to an empty version.
23195796c8dcSSimon Schubert
23205796c8dcSSimon Schubertfiles=
23215796c8dcSSimon Schubertlinks=
23225796c8dcSSimon Schubert
23235796c8dcSSimon Schubertrm -f nm.h
23245796c8dcSSimon Schubertif test "${nativefile}" != ""; then
23255796c8dcSSimon Schubert    case "${nativefile}" in
23265796c8dcSSimon Schubert      nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
23275796c8dcSSimon Schubert      * ) GDB_NM_FILE="${nativefile}"
23285796c8dcSSimon Schubert    esac
23295796c8dcSSimon Schubert    files="${files} ${GDB_NM_FILE}"
23305796c8dcSSimon Schubert    links="${links} nm.h"
23315796c8dcSSimon Schubert    AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile])
23325796c8dcSSimon Schubertfi
23335796c8dcSSimon SchubertAC_SUBST(GDB_NM_FILE)
23345796c8dcSSimon Schubert
23355796c8dcSSimon SchubertAC_LINK_FILES($files, $links)
23365796c8dcSSimon Schubert
23375796c8dcSSimon Schubertdnl Check for exe extension set on certain hosts (e.g. Win32)
23385796c8dcSSimon SchubertAC_EXEEXT
23395796c8dcSSimon Schubert
23405796c8dcSSimon Schubertdnl  Detect the character set used by this host.
23415796c8dcSSimon Schubertdnl  At the moment, we just assume it's UTF-8.
23425796c8dcSSimon SchubertAC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
23435796c8dcSSimon Schubert          [Define to be a string naming the default host character set.])
23445796c8dcSSimon Schubert
2345*ef5ccd6cSJohn MarinoAC_OUTPUT(Makefile gdb-gdb.gdb doc/Makefile data-directory/Makefile,
23465796c8dcSSimon Schubert[
23475796c8dcSSimon Schubertcase x$CONFIG_HEADERS in
23485796c8dcSSimon Schubertxconfig.h:config.in)
23495796c8dcSSimon Schubertecho > stamp-h ;;
23505796c8dcSSimon Schubertesac
23515796c8dcSSimon Schubert])
23525796c8dcSSimon Schubert
23535796c8dcSSimon Schubertexit 0
2354