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