gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / acinclude.m4
CommitLineData
c906108c
SS
1dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
2dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
3
7d928dac
PA
4# Keep these includes in sync with the aclocal_m4_deps list in
5# Makefile.in.
6
4d0b984b 7m4_include(acx_configure_dir.m4)
c971b7fa 8
f6a88844 9# This gets GDB_AC_TRANSFORM.
4d0b984b 10m4_include(transform.m4)
f6a88844 11
b835bb52 12# This gets AM_GDB_WARNINGS.
58df732b 13m4_include(../gdbsupport/warning.m4)
b835bb52 14
f35d5ade 15# AM_GDB_UBSAN
4d0b984b 16m4_include(sanitize.m4)
f35d5ade 17
8ecfd7bd 18# This gets GDB_AC_SELFTEST.
272cd5a3 19m4_include(../gdbsupport/selftest.m4)
8ecfd7bd 20
c906108c 21dnl gdb/configure.in uses BFD_NEED_DECLARATION, so get its definition.
4d0b984b 22m4_include(../bfd/bfd.m4)
c906108c 23
7d928dac 24dnl This gets the standard macros.
4d0b984b 25m4_include(../config/acinclude.m4)
c906108c 26
7d928dac 27dnl This gets AC_PLUGINS, needed by ACX_LARGEFILE.
4d0b984b 28m4_include(../config/plugins.m4)
7d928dac
PA
29
30dnl For ACX_LARGEFILE.
4d0b984b 31m4_include(../config/largefile.m4)
7d928dac
PA
32
33dnl For AM_SET_LEADING_DOT.
4d0b984b 34m4_include(../config/lead-dot.m4)
7d928dac
PA
35
36dnl This gets autoconf bugfixes.
4d0b984b 37m4_include(../config/override.m4)
fdc59709 38
7d928dac 39dnl For ZW_GNU_GETTEXT_SISTER_DIR.
4d0b984b 40m4_include(../config/gettext-sister.m4)
85981d60 41
7fa2210b 42dnl For AC_LIB_HAVE_LINKFLAGS.
4d0b984b
TT
43m4_include(../config/lib-ld.m4)
44m4_include(../config/lib-prefix.m4)
45m4_include(../config/lib-link.m4)
7fa2210b 46
c16158bc 47dnl For ACX_PKGVERSION and ACX_BUGURL.
4d0b984b 48m4_include(../config/acx.m4)
c16158bc 49
5062cc19 50dnl for TCL definitions
4d0b984b 51m4_include(../config/tcl.m4)
5062cc19 52
a417dc56 53dnl For dependency tracking macros.
4d0b984b 54m4_include([../config/depstand.m4])
a417dc56 55
a8111142 56dnl For AM_LC_MESSAGES
4d0b984b 57m4_include([../config/lcmessage.m4])
a8111142 58
6c7a06a3 59dnl For AM_LANGINFO_CODESET.
4d0b984b 60m4_include([../config/codeset.m4])
6c7a06a3 61
4d0b984b 62m4_include([../config/iconv.m4])
016a3251 63
4d0b984b 64m4_include([../config/zlib.m4])
b040ad30 65
01027315 66m4_include([../gdbsupport/common.m4])
3266f10b 67
07697489
PA
68dnl For libiberty_INIT.
69m4_include(libiberty.m4)
70
eb7aa561
PA
71dnl For GDB_AC_PTRACE.
72m4_include(ptrace.m4)
73
0bcda685
PA
74m4_include(ax_cxx_compile_stdcxx.m4)
75
5e030278
TT
76m4_include([../config/ax_pthread.m4])
77
56157b4a
AC
78## ----------------------------------------- ##
79## ANSIfy the C compiler whenever possible. ##
80## From Franc,ois Pinard ##
81## ----------------------------------------- ##
82
b811d2c2 83# Copyright (C) 1996-2020 Free Software Foundation, Inc.
56157b4a
AC
84
85# This program is free software; you can redistribute it and/or modify
86# it under the terms of the GNU General Public License as published by
87# the Free Software Foundation; either version 2, or (at your option)
88# any later version.
89
90# This program is distributed in the hope that it will be useful,
91# but WITHOUT ANY WARRANTY; without even the implied warranty of
92# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93# GNU General Public License for more details.
94
95# You should have received a copy of the GNU General Public License
7785b880 96# along with this program; if not, see <http://www.gnu.org/licenses/>.
56157b4a
AC
97
98# serial 1
99
100# @defmac AC_PROG_CC_STDC
101# @maindex PROG_CC_STDC
102# @ovindex CC
103# If the C compiler in not in ANSI C mode by default, try to add an option
104# to output variable @code{CC} to make it so. This macro tries various
105# options that select ANSI C on some system or another. It considers the
106# compiler to be in ANSI C mode if it handles function prototypes correctly.
107#
108# If you use this macro, you should check after calling it whether the C
109# compiler has been set to accept ANSI C; if not, the shell variable
110# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
111# code in ANSI C, you can make an un-ANSIfied copy of it by using the
112# program @code{ansi2knr}, which comes with Ghostscript.
113# @end defmac
114
115AC_DEFUN([AM_PROG_CC_STDC],
116[AC_REQUIRE([AC_PROG_CC])
117AC_BEFORE([$0], [AC_C_INLINE])
118AC_BEFORE([$0], [AC_C_CONST])
119dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
120dnl a magic option to avoid problems with ANSI preprocessor commands
121dnl like #elif.
122dnl FIXME: can't do this because then AC_AIX won't work due to a
123dnl circular dependency.
124dnl AC_BEFORE([$0], [AC_PROG_CPP])
125AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C])
126AC_CACHE_VAL(am_cv_prog_cc_stdc,
127[am_cv_prog_cc_stdc=no
128ac_save_CC="$CC"
129# Don't try gcc -ansi; that turns off useful extensions and
130# breaks some systems' header files.
131# AIX -qlanglvl=ansi
132# Ultrix and OSF/1 -std1
133# HP-UX 10.20 and later -Ae
134# HP-UX older versions -Aa -D_HPUX_SOURCE
135# SVR4 -Xc -D__EXTENSIONS__
136for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
137do
138 CC="$ac_save_CC $ac_arg"
139 AC_TRY_COMPILE(
140[#include <stdarg.h>
141#include <stdio.h>
142#include <sys/types.h>
143#include <sys/stat.h>
144/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
145struct buf { int x; };
146FILE * (*rcsopen) (struct buf *, struct stat *, int);
147static char *e (p, i)
148 char **p;
149 int i;
150{
151 return p[i];
152}
153static char *f (char * (*g) (char **, int), char **p, ...)
154{
155 char *s;
156 va_list v;
157 va_start (v,p);
158 s = g (p, va_arg (v,int));
159 va_end (v);
160 return s;
161}
162int test (int i, double x);
163struct s1 {int (*f) (int a);};
164struct s2 {int (*f) (double a);};
165int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
166int argc;
167char **argv;
168], [
169return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
170],
171[am_cv_prog_cc_stdc="$ac_arg"; break])
172done
173CC="$ac_save_CC"
174])
175if test -z "$am_cv_prog_cc_stdc"; then
176 AC_MSG_RESULT([none needed])
177else
178 AC_MSG_RESULT([$am_cv_prog_cc_stdc])
179fi
180case "x$am_cv_prog_cc_stdc" in
181 x|xno) ;;
182 *) CC="$CC $am_cv_prog_cc_stdc" ;;
183esac
184])
234b45d4 185
5b5d99cf
JB
186dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva
187dnl Version 1.3 (2001/03/02)
188dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html
189
190AC_DEFUN([AC_DEFINE_DIR], [
191 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
192 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
193 ac_define_dir=`eval echo [$]$2`
194 ac_define_dir=`eval echo [$]ac_define_dir`
195 ifelse($3, ,
196 AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
197 AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
198])
199
b9362cc7
AC
200dnl See whether we need a declaration for a function.
201dnl The result is highly dependent on the INCLUDES passed in, so make sure
202dnl to use a different cache variable name in this macro if it is invoked
203dnl in a different context somewhere else.
204dnl gcc_AC_CHECK_DECL(SYMBOL,
205dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
da78b0e7 206AC_DEFUN([gcc_AC_CHECK_DECL],
b9362cc7
AC
207[AC_MSG_CHECKING([whether $1 is declared])
208AC_CACHE_VAL(gcc_cv_have_decl_$1,
209[AC_TRY_COMPILE([$4],
210[#ifndef $1
211char *(*pfn) = (char *(*)) $1 ;
212#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
213if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
214 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
215else
216 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
217fi
218])dnl
219
220dnl Check multiple functions to see whether each needs a declaration.
221dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
222dnl gcc_AC_CHECK_DECLS(SYMBOLS,
223dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
da78b0e7 224AC_DEFUN([gcc_AC_CHECK_DECLS],
b9362cc7
AC
225[for ac_func in $1
226do
227changequote(, )dnl
228 ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
229changequote([, ])dnl
230gcc_AC_CHECK_DECL($ac_func,
231 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
232 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
233dnl It is possible that the include files passed in here are local headers
234dnl which supply a backup declaration for the relevant prototype based on
235dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
236dnl will always return success. E.g. see libiberty.h's handling of
237dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
238dnl 1 so that any local headers used do not provide their own prototype
239dnl during this test.
240#undef $ac_tr_decl
241#define $ac_tr_decl 1
242 $4
243)
244done
245dnl Automatically generate config.h entries via autoheader.
246if test x = y ; then
247 patsubst(translit([$1], [a-z], [A-Z]), [\w+],
248 [AC_DEFINE([HAVE_DECL_\&], 1,
249 [Define to 1 if we found this declaration otherwise define to 0.])])dnl
250fi
251])
252
5062cc19
KS
253dnl Find the location of the private Tcl headers
254dnl When Tcl is installed, this is TCL_INCLUDE_SPEC/tcl-private/generic
255dnl When Tcl is in the build tree, this is not needed.
256dnl
257dnl Note: you must use first use SC_LOAD_TCLCONFIG!
258AC_DEFUN([CY_AC_TCL_PRIVATE_HEADERS], [
259 AC_MSG_CHECKING([for Tcl private headers])
260 private_dir=""
261 dir=`echo ${TCL_INCLUDE_SPEC}/tcl-private/generic | sed -e s/-I//`
262 if test -f ${dir}/tclInt.h ; then
263 private_dir=${dir}
264 fi
265
266 if test x"${private_dir}" = x; then
267 AC_ERROR(could not find private Tcl headers)
268 else
269 TCL_PRIVATE_INCLUDE="-I${private_dir}"
270 AC_MSG_RESULT(${private_dir})
271 fi
272])
273
274dnl Find the location of the private Tk headers
275dnl When Tk is installed, this is TK_INCLUDE_SPEC/tk-private/generic
276dnl When Tk is in the build tree, this not needed.
277dnl
278dnl Note: you must first use SC_LOAD_TKCONFIG
279AC_DEFUN([CY_AC_TK_PRIVATE_HEADERS], [
280 AC_MSG_CHECKING([for Tk private headers])
281 private_dir=""
282 dir=`echo ${TK_INCLUDE_SPEC}/tk-private/generic | sed -e s/-I//`
283 if test -f ${dir}/tkInt.h; then
284 private_dir=${dir}
285 fi
286
287 if test x"${private_dir}" = x; then
288 AC_ERROR(could not find Tk private headers)
289 else
290 TK_PRIVATE_INCLUDE="-I${private_dir}"
291 AC_MSG_RESULT(${private_dir})
292 fi
293])
b14b1491 294
0c4a4063
DE
295dnl GDB_AC_DEFINE_RELOCATABLE([VARIABLE], [ARG-NAME], [SHELL-VARIABLE])
296dnl For use in processing directory values for --with-foo.
297dnl If the path in SHELL_VARIABLE is relative to the prefix, then the
b14b1491
TT
298dnl result is relocatable, then this will define the C macro
299dnl VARIABLE_RELOCATABLE to 1; otherwise it is defined as 0.
0c4a4063 300AC_DEFUN([GDB_AC_DEFINE_RELOCATABLE], [
b14b1491
TT
301 if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
302 if test "x$prefix" = xNONE; then
303 test_prefix=/usr/local
304 else
305 test_prefix=$prefix
306 fi
307 else
308 test_prefix=$exec_prefix
309 fi
310 value=0
0c4a4063 311 case [$3] in
b14b1491
TT
312 "${test_prefix}"|"${test_prefix}/"*|\
313 '${exec_prefix}'|'${exec_prefix}/'*)
314 value=1
315 ;;
316 esac
317 AC_DEFINE_UNQUOTED([$1]_RELOCATABLE, $value, [Define if the $2 directory should be relocated when GDB is moved.])
0c4a4063
DE
318])
319
320dnl GDB_AC_WITH_DIR([VARIABLE], [ARG-NAME], [HELP], [DEFAULT])
321dnl Add a new --with option that defines a directory.
322dnl The result is stored in VARIABLE. AC_DEFINE_DIR is called
323dnl on this variable, as is AC_SUBST.
324dnl ARG-NAME is the base name of the argument (without "--with").
325dnl HELP is the help text to use.
326dnl If the user's choice is relative to the prefix, then the
327dnl result is relocatable, then this will define the C macro
328dnl VARIABLE_RELOCATABLE to 1; otherwise it is defined as 0.
329dnl DEFAULT is the default value, which is used if the user
330dnl does not specify the argument.
331AC_DEFUN([GDB_AC_WITH_DIR], [
332 AC_ARG_WITH([$2], AS_HELP_STRING([--with-][$2][=PATH], [$3]), [
333 [$1]=$withval], [[$1]=[$4]])
334 AC_DEFINE_DIR([$1], [$1], [$3])
335 AC_SUBST([$1])
336 GDB_AC_DEFINE_RELOCATABLE([$1], [$2], ${ac_define_dir})
b14b1491 337 ])
def63ff0
TT
338
339dnl GDB_AC_CHECK_BFD([MESSAGE], [CV], [CODE], [HEADER])
340dnl Check whether BFD provides a feature.
341dnl MESSAGE is the "checking" message to display.
342dnl CV is the name of the cache variable where the result is stored.
343dnl The result will be "yes" or "no".
344dnl CODE is some code to compile that checks for the feature.
345dnl A link test is run.
346dnl HEADER is the name of an extra BFD header to include.
347AC_DEFUN([GDB_AC_CHECK_BFD], [
348 OLD_CFLAGS=$CFLAGS
349 OLD_LDFLAGS=$LDFLAGS
350 OLD_LIBS=$LIBS
351 # Put the old CFLAGS/LDFLAGS last, in case the user's (C|LD)FLAGS
352 # points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We
353 # always want our bfd.
354 CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
5a2d4533
L
355 ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'`
356 LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS"
def63ff0 357 intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
711a72d3 358 LIBS="-lbfd -liberty -lz $intl $LIBS"
def63ff0
TT
359 AC_CACHE_CHECK([$1], [$2],
360 [AC_TRY_LINK(
361 [#include <stdlib.h>
362 #include "bfd.h"
363 #include "$4"
364 ],
365 [return $3;], [[$2]=yes], [[$2]=no])])
366 CFLAGS=$OLD_CFLAGS
367 LDFLAGS=$OLD_LDFLAGS
368 LIBS=$OLD_LIBS])
e76c5d17
DE
369
370dnl GDB_GUILE_PROGRAM_NAMES([PKG-CONFIG], [VERSION])
371dnl
372dnl Define and substitute 'GUILD' to contain the absolute file name of
373dnl the 'guild' command for VERSION, using PKG-CONFIG. (This is
374dnl similar to Guile's 'GUILE_PROGS' macro.)
375AC_DEFUN([GDB_GUILE_PROGRAM_NAMES], [
376 AC_CACHE_CHECK([for the absolute file name of the 'guild' command],
377 [ac_cv_guild_program_name],
d342a0da 378 [ac_cv_guild_program_name="`$1 --variable guild $2`"
e76c5d17
DE
379
380 # In Guile up to 2.0.11 included, guile-2.0.pc would not define
381 # the 'guild' and 'bindir' variables. In that case, try to guess
382 # what the program name is, at the risk of getting it wrong if
383 # Guile was configured with '--program-suffix' or similar.
384 if test "x$ac_cv_guild_program_name" = "x"; then
d342a0da 385 guile_exec_prefix="`$1 --variable exec_prefix $2`"
e76c5d17
DE
386 ac_cv_guild_program_name="$guile_exec_prefix/bin/guild"
387 fi
388 ])
389
390 if ! "$ac_cv_guild_program_name" --version >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
391 AC_MSG_ERROR(['$ac_cv_guild_program_name' appears to be unusable])
392 fi
393
394 GUILD="$ac_cv_guild_program_name"
395 AC_SUBST([GUILD])
396])
397
398dnl GDB_GUILD_TARGET_FLAG
399dnl
400dnl Compute the value of GUILD_TARGET_FLAG.
401dnl For native builds this is empty.
402dnl For cross builds this is --target=<host>.
403AC_DEFUN([GDB_GUILD_TARGET_FLAG], [
404 if test "$cross_compiling" = no; then
405 GUILD_TARGET_FLAG=
406 else
407 GUILD_TARGET_FLAG="--target=$host"
408 fi
409 AC_SUBST(GUILD_TARGET_FLAG)
410])
411
412dnl GDB_TRY_GUILD([SRC-FILE])
413dnl
414dnl We precompile the .scm files and install them with gdb, so make sure
415dnl guild works for this host.
416dnl The .scm files are precompiled for several reasons:
417dnl 1) To silence Guile during gdb startup (Guile's auto-compilation output
418dnl is unnecessarily verbose).
419dnl 2) Make gdb developers see compilation errors/warnings during the build,
420dnl and not leave it to later when the user runs gdb.
421dnl 3) As a convenience for the user, so that one copy of the files is built
422dnl instead of one copy per user.
423dnl
424dnl Make sure guild can handle this host by trying to compile SRC-FILE, and
425dnl setting ac_cv_guild_ok to yes or no.
426dnl Note that guild can handle cross-compilation.
427dnl It could happen that guild can't handle the host, but guile would still
428dnl work. For the time being we're conservative, and if guild doesn't work
429dnl we punt.
430AC_DEFUN([GDB_TRY_GUILD], [
431 AC_REQUIRE([GDB_GUILD_TARGET_FLAG])
432 AC_CACHE_CHECK([whether guild supports this host],
433 [ac_cv_guild_ok],
434 [echo "$ac_cv_guild_program_name compile $GUILD_TARGET_FLAG -o conftest.go $1" >&AS_MESSAGE_LOG_FD
435 if "$ac_cv_guild_program_name" compile $GUILD_TARGET_FLAG -o conftest.go "$1" >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
436 ac_cv_guild_ok=yes
437 else
438 ac_cv_guild_ok=no
439 fi])
440])
This page took 1.174864 seconds and 4 git commands to generate.