Commit | Line | Data |
---|---|---|
c906108c SS |
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 | ||
7d928dac PA |
4 | # Keep these includes in sync with the aclocal_m4_deps list in |
5 | # Makefile.in. | |
6 | ||
7e3941ac MF |
7 | dnl NB: When possible, try to avoid explicit includes of ../config/ files. |
8 | dnl They're normally found by aclocal automatically and recorded in aclocal.m4. | |
9 | dnl However, some are kept here explicitly to silence harmless warnings from | |
10 | dnl aclocal when it finds AM_xxx macros via local search paths instead of | |
11 | dnl system search paths. | |
12 | ||
4d0b984b | 13 | m4_include(acx_configure_dir.m4) |
c971b7fa | 14 | |
f6a88844 | 15 | # This gets GDB_AC_TRANSFORM. |
4d0b984b | 16 | m4_include(transform.m4) |
f6a88844 | 17 | |
b835bb52 | 18 | # This gets AM_GDB_WARNINGS. |
58df732b | 19 | m4_include(../gdbsupport/warning.m4) |
b835bb52 | 20 | |
f35d5ade | 21 | # AM_GDB_UBSAN |
4d0b984b | 22 | m4_include(sanitize.m4) |
f35d5ade | 23 | |
8ecfd7bd | 24 | # This gets GDB_AC_SELFTEST. |
272cd5a3 | 25 | m4_include(../gdbsupport/selftest.m4) |
8ecfd7bd | 26 | |
c906108c | 27 | dnl gdb/configure.in uses BFD_NEED_DECLARATION, so get its definition. |
4d0b984b | 28 | m4_include(../bfd/bfd.m4) |
c906108c | 29 | |
a8111142 | 30 | dnl For AM_LC_MESSAGES |
4d0b984b | 31 | m4_include([../config/lcmessage.m4]) |
a8111142 | 32 | |
6c7a06a3 | 33 | dnl For AM_LANGINFO_CODESET. |
4d0b984b | 34 | m4_include([../config/codeset.m4]) |
6c7a06a3 | 35 | |
7e3941ac MF |
36 | dnl We need to explicitly include these before iconv.m4 to avoid warnings. |
37 | m4_include([../config/lib-ld.m4]) | |
38 | m4_include([../config/lib-prefix.m4]) | |
39 | m4_include([../config/lib-link.m4]) | |
4d0b984b | 40 | m4_include([../config/iconv.m4]) |
016a3251 | 41 | |
4d0b984b | 42 | m4_include([../config/zlib.m4]) |
b040ad30 | 43 | |
01027315 | 44 | m4_include([../gdbsupport/common.m4]) |
3266f10b | 45 | |
07697489 PA |
46 | dnl For libiberty_INIT. |
47 | m4_include(libiberty.m4) | |
48 | ||
eb7aa561 | 49 | dnl For GDB_AC_PTRACE. |
006811bc | 50 | m4_include(../gdbsupport/ptrace.m4) |
eb7aa561 | 51 | |
0bcda685 PA |
52 | m4_include(ax_cxx_compile_stdcxx.m4) |
53 | ||
5b5d99cf JB |
54 | dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva |
55 | dnl Version 1.3 (2001/03/02) | |
56 | dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html | |
57 | ||
58 | AC_DEFUN([AC_DEFINE_DIR], [ | |
59 | test "x$prefix" = xNONE && prefix="$ac_default_prefix" | |
60 | test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' | |
61 | ac_define_dir=`eval echo [$]$2` | |
62 | ac_define_dir=`eval echo [$]ac_define_dir` | |
63 | ifelse($3, , | |
64 | AC_DEFINE_UNQUOTED($1, "$ac_define_dir"), | |
65 | AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3)) | |
66 | ]) | |
67 | ||
b9362cc7 AC |
68 | dnl See whether we need a declaration for a function. |
69 | dnl The result is highly dependent on the INCLUDES passed in, so make sure | |
70 | dnl to use a different cache variable name in this macro if it is invoked | |
71 | dnl in a different context somewhere else. | |
72 | dnl gcc_AC_CHECK_DECL(SYMBOL, | |
73 | dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]]) | |
294f2697 SM |
74 | AC_DEFUN( |
75 | [gcc_AC_CHECK_DECL], | |
76 | [AC_MSG_CHECKING([whether $1 is declared]) | |
77 | AC_CACHE_VAL( | |
78 | [gcc_cv_have_decl_$1], | |
79 | [AC_COMPILE_IFELSE( | |
80 | [AC_LANG_PROGRAM( | |
81 | [$4], | |
82 | [#ifndef $1 | |
83 | char *(*pfn) = (char *(*)) $1 ; | |
84 | #endif] | |
85 | )], | |
86 | [eval "gcc_cv_have_decl_$1=yes"], | |
87 | [eval "gcc_cv_have_decl_$1=no"] | |
88 | )] | |
89 | ) | |
b9362cc7 AC |
90 | if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then |
91 | AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2]) | |
92 | else | |
93 | AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3]) | |
94 | fi | |
95 | ])dnl | |
96 | ||
97 | dnl Check multiple functions to see whether each needs a declaration. | |
98 | dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate. | |
99 | dnl gcc_AC_CHECK_DECLS(SYMBOLS, | |
100 | dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]]) | |
da78b0e7 | 101 | AC_DEFUN([gcc_AC_CHECK_DECLS], |
b9362cc7 AC |
102 | [for ac_func in $1 |
103 | do | |
104 | changequote(, )dnl | |
105 | ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` | |
106 | changequote([, ])dnl | |
107 | gcc_AC_CHECK_DECL($ac_func, | |
108 | [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2], | |
109 | [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3], | |
110 | dnl It is possible that the include files passed in here are local headers | |
111 | dnl which supply a backup declaration for the relevant prototype based on | |
112 | dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test | |
113 | dnl will always return success. E.g. see libiberty.h's handling of | |
114 | dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to | |
115 | dnl 1 so that any local headers used do not provide their own prototype | |
116 | dnl during this test. | |
117 | #undef $ac_tr_decl | |
118 | #define $ac_tr_decl 1 | |
119 | $4 | |
120 | ) | |
121 | done | |
122 | dnl Automatically generate config.h entries via autoheader. | |
123 | if test x = y ; then | |
124 | patsubst(translit([$1], [a-z], [A-Z]), [\w+], | |
125 | [AC_DEFINE([HAVE_DECL_\&], 1, | |
126 | [Define to 1 if we found this declaration otherwise define to 0.])])dnl | |
127 | fi | |
128 | ]) | |
129 | ||
5062cc19 KS |
130 | dnl Find the location of the private Tcl headers |
131 | dnl When Tcl is installed, this is TCL_INCLUDE_SPEC/tcl-private/generic | |
132 | dnl When Tcl is in the build tree, this is not needed. | |
133 | dnl | |
134 | dnl Note: you must use first use SC_LOAD_TCLCONFIG! | |
135 | AC_DEFUN([CY_AC_TCL_PRIVATE_HEADERS], [ | |
136 | AC_MSG_CHECKING([for Tcl private headers]) | |
137 | private_dir="" | |
138 | dir=`echo ${TCL_INCLUDE_SPEC}/tcl-private/generic | sed -e s/-I//` | |
139 | if test -f ${dir}/tclInt.h ; then | |
140 | private_dir=${dir} | |
141 | fi | |
142 | ||
143 | if test x"${private_dir}" = x; then | |
294f2697 | 144 | AC_MSG_ERROR(could not find private Tcl headers) |
5062cc19 KS |
145 | else |
146 | TCL_PRIVATE_INCLUDE="-I${private_dir}" | |
147 | AC_MSG_RESULT(${private_dir}) | |
148 | fi | |
149 | ]) | |
150 | ||
151 | dnl Find the location of the private Tk headers | |
152 | dnl When Tk is installed, this is TK_INCLUDE_SPEC/tk-private/generic | |
153 | dnl When Tk is in the build tree, this not needed. | |
154 | dnl | |
155 | dnl Note: you must first use SC_LOAD_TKCONFIG | |
156 | AC_DEFUN([CY_AC_TK_PRIVATE_HEADERS], [ | |
157 | AC_MSG_CHECKING([for Tk private headers]) | |
158 | private_dir="" | |
159 | dir=`echo ${TK_INCLUDE_SPEC}/tk-private/generic | sed -e s/-I//` | |
160 | if test -f ${dir}/tkInt.h; then | |
161 | private_dir=${dir} | |
162 | fi | |
163 | ||
164 | if test x"${private_dir}" = x; then | |
294f2697 | 165 | AC_MSG_ERROR(could not find Tk private headers) |
5062cc19 KS |
166 | else |
167 | TK_PRIVATE_INCLUDE="-I${private_dir}" | |
168 | AC_MSG_RESULT(${private_dir}) | |
169 | fi | |
170 | ]) | |
b14b1491 | 171 | |
0c4a4063 DE |
172 | dnl GDB_AC_DEFINE_RELOCATABLE([VARIABLE], [ARG-NAME], [SHELL-VARIABLE]) |
173 | dnl For use in processing directory values for --with-foo. | |
174 | dnl If the path in SHELL_VARIABLE is relative to the prefix, then the | |
b14b1491 TT |
175 | dnl result is relocatable, then this will define the C macro |
176 | dnl VARIABLE_RELOCATABLE to 1; otherwise it is defined as 0. | |
0c4a4063 | 177 | AC_DEFUN([GDB_AC_DEFINE_RELOCATABLE], [ |
b14b1491 TT |
178 | if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then |
179 | if test "x$prefix" = xNONE; then | |
180 | test_prefix=/usr/local | |
181 | else | |
182 | test_prefix=$prefix | |
183 | fi | |
184 | else | |
185 | test_prefix=$exec_prefix | |
186 | fi | |
187 | value=0 | |
0c4a4063 | 188 | case [$3] in |
b14b1491 TT |
189 | "${test_prefix}"|"${test_prefix}/"*|\ |
190 | '${exec_prefix}'|'${exec_prefix}/'*) | |
191 | value=1 | |
192 | ;; | |
193 | esac | |
194 | AC_DEFINE_UNQUOTED([$1]_RELOCATABLE, $value, [Define if the $2 directory should be relocated when GDB is moved.]) | |
0c4a4063 DE |
195 | ]) |
196 | ||
197 | dnl GDB_AC_WITH_DIR([VARIABLE], [ARG-NAME], [HELP], [DEFAULT]) | |
198 | dnl Add a new --with option that defines a directory. | |
199 | dnl The result is stored in VARIABLE. AC_DEFINE_DIR is called | |
200 | dnl on this variable, as is AC_SUBST. | |
201 | dnl ARG-NAME is the base name of the argument (without "--with"). | |
202 | dnl HELP is the help text to use. | |
203 | dnl If the user's choice is relative to the prefix, then the | |
204 | dnl result is relocatable, then this will define the C macro | |
205 | dnl VARIABLE_RELOCATABLE to 1; otherwise it is defined as 0. | |
206 | dnl DEFAULT is the default value, which is used if the user | |
207 | dnl does not specify the argument. | |
208 | AC_DEFUN([GDB_AC_WITH_DIR], [ | |
209 | AC_ARG_WITH([$2], AS_HELP_STRING([--with-][$2][=PATH], [$3]), [ | |
210 | [$1]=$withval], [[$1]=[$4]]) | |
211 | AC_DEFINE_DIR([$1], [$1], [$3]) | |
212 | AC_SUBST([$1]) | |
213 | GDB_AC_DEFINE_RELOCATABLE([$1], [$2], ${ac_define_dir}) | |
b14b1491 | 214 | ]) |
def63ff0 TT |
215 | |
216 | dnl GDB_AC_CHECK_BFD([MESSAGE], [CV], [CODE], [HEADER]) | |
217 | dnl Check whether BFD provides a feature. | |
218 | dnl MESSAGE is the "checking" message to display. | |
219 | dnl CV is the name of the cache variable where the result is stored. | |
220 | dnl The result will be "yes" or "no". | |
221 | dnl CODE is some code to compile that checks for the feature. | |
222 | dnl A link test is run. | |
223 | dnl HEADER is the name of an extra BFD header to include. | |
224 | AC_DEFUN([GDB_AC_CHECK_BFD], [ | |
225 | OLD_CFLAGS=$CFLAGS | |
226 | OLD_LDFLAGS=$LDFLAGS | |
227 | OLD_LIBS=$LIBS | |
228 | # Put the old CFLAGS/LDFLAGS last, in case the user's (C|LD)FLAGS | |
229 | # points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We | |
230 | # always want our bfd. | |
231 | CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS" | |
5a2d4533 L |
232 | ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'` |
233 | LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS" | |
def63ff0 | 234 | intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` |
711a72d3 | 235 | LIBS="-lbfd -liberty -lz $intl $LIBS" |
294f2697 SM |
236 | AC_CACHE_CHECK( |
237 | [$1], | |
238 | [$2], | |
239 | [AC_LINK_IFELSE( | |
240 | [AC_LANG_PROGRAM( | |
241 | [#include <stdlib.h> | |
b4132322 | 242 | #include <string.h> |
294f2697 SM |
243 | #include "bfd.h" |
244 | #include "$4"], | |
245 | [return $3;] | |
246 | )], | |
247 | [[$2]=yes], | |
248 | [[$2]=no] | |
249 | )] | |
250 | ) | |
def63ff0 TT |
251 | CFLAGS=$OLD_CFLAGS |
252 | LDFLAGS=$OLD_LDFLAGS | |
253 | LIBS=$OLD_LIBS]) | |
e76c5d17 DE |
254 | |
255 | dnl GDB_GUILE_PROGRAM_NAMES([PKG-CONFIG], [VERSION]) | |
256 | dnl | |
257 | dnl Define and substitute 'GUILD' to contain the absolute file name of | |
258 | dnl the 'guild' command for VERSION, using PKG-CONFIG. (This is | |
259 | dnl similar to Guile's 'GUILE_PROGS' macro.) | |
260 | AC_DEFUN([GDB_GUILE_PROGRAM_NAMES], [ | |
261 | AC_CACHE_CHECK([for the absolute file name of the 'guild' command], | |
262 | [ac_cv_guild_program_name], | |
d342a0da | 263 | [ac_cv_guild_program_name="`$1 --variable guild $2`" |
e76c5d17 DE |
264 | |
265 | # In Guile up to 2.0.11 included, guile-2.0.pc would not define | |
266 | # the 'guild' and 'bindir' variables. In that case, try to guess | |
267 | # what the program name is, at the risk of getting it wrong if | |
268 | # Guile was configured with '--program-suffix' or similar. | |
269 | if test "x$ac_cv_guild_program_name" = "x"; then | |
d342a0da | 270 | guile_exec_prefix="`$1 --variable exec_prefix $2`" |
e76c5d17 DE |
271 | ac_cv_guild_program_name="$guile_exec_prefix/bin/guild" |
272 | fi | |
273 | ]) | |
274 | ||
275 | if ! "$ac_cv_guild_program_name" --version >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then | |
276 | AC_MSG_ERROR(['$ac_cv_guild_program_name' appears to be unusable]) | |
277 | fi | |
278 | ||
279 | GUILD="$ac_cv_guild_program_name" | |
280 | AC_SUBST([GUILD]) | |
281 | ]) | |
282 | ||
283 | dnl GDB_GUILD_TARGET_FLAG | |
284 | dnl | |
285 | dnl Compute the value of GUILD_TARGET_FLAG. | |
286 | dnl For native builds this is empty. | |
287 | dnl For cross builds this is --target=<host>. | |
288 | AC_DEFUN([GDB_GUILD_TARGET_FLAG], [ | |
289 | if test "$cross_compiling" = no; then | |
290 | GUILD_TARGET_FLAG= | |
291 | else | |
292 | GUILD_TARGET_FLAG="--target=$host" | |
293 | fi | |
294 | AC_SUBST(GUILD_TARGET_FLAG) | |
295 | ]) | |
296 | ||
297 | dnl GDB_TRY_GUILD([SRC-FILE]) | |
298 | dnl | |
299 | dnl We precompile the .scm files and install them with gdb, so make sure | |
300 | dnl guild works for this host. | |
301 | dnl The .scm files are precompiled for several reasons: | |
302 | dnl 1) To silence Guile during gdb startup (Guile's auto-compilation output | |
303 | dnl is unnecessarily verbose). | |
304 | dnl 2) Make gdb developers see compilation errors/warnings during the build, | |
305 | dnl and not leave it to later when the user runs gdb. | |
306 | dnl 3) As a convenience for the user, so that one copy of the files is built | |
307 | dnl instead of one copy per user. | |
308 | dnl | |
309 | dnl Make sure guild can handle this host by trying to compile SRC-FILE, and | |
310 | dnl setting ac_cv_guild_ok to yes or no. | |
311 | dnl Note that guild can handle cross-compilation. | |
312 | dnl It could happen that guild can't handle the host, but guile would still | |
313 | dnl work. For the time being we're conservative, and if guild doesn't work | |
314 | dnl we punt. | |
315 | AC_DEFUN([GDB_TRY_GUILD], [ | |
316 | AC_REQUIRE([GDB_GUILD_TARGET_FLAG]) | |
317 | AC_CACHE_CHECK([whether guild supports this host], | |
318 | [ac_cv_guild_ok], | |
319 | [echo "$ac_cv_guild_program_name compile $GUILD_TARGET_FLAG -o conftest.go $1" >&AS_MESSAGE_LOG_FD | |
320 | if "$ac_cv_guild_program_name" compile $GUILD_TARGET_FLAG -o conftest.go "$1" >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then | |
321 | ac_cv_guild_ok=yes | |
322 | else | |
323 | ac_cv_guild_ok=no | |
324 | fi]) | |
325 | ]) |