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