]>
Commit | Line | Data |
---|---|---|
c906108c SS |
1 | dnl Autoconf configure script for GDB, the GNU debugger. |
2 | dnl Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. | |
3 | dnl | |
4 | dnl This file is part of GDB. | |
5 | dnl | |
6 | dnl This program is free software; you can redistribute it and/or modify | |
7 | dnl it under the terms of the GNU General Public License as published by | |
8 | dnl the Free Software Foundation; either version 2 of the License, or | |
9 | dnl (at your option) any later version. | |
10 | dnl | |
11 | dnl This program is distributed in the hope that it will be useful, | |
12 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | dnl GNU General Public License for more details. | |
15 | dnl | |
16 | dnl You should have received a copy of the GNU General Public License | |
17 | dnl along with this program; if not, write to the Free Software | |
18 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 | ||
20 | dnl Process this file with autoconf to produce a configure script. | |
21 | ||
22 | AC_PREREQ(2.13)dnl | |
23 | AC_INIT(main.c) | |
24 | AC_CONFIG_HEADER(config.h:config.in) | |
25 | ||
26 | AC_PROG_CC | |
27 | AC_AIX | |
28 | AC_ISC_POSIX | |
29 | AM_PROG_CC_STDC | |
30 | ||
31 | AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) | |
32 | AC_CANONICAL_SYSTEM | |
33 | ||
34 | dnl gdb doesn't use gettext, but bfd does. We call this to ensure we | |
35 | dnl link with the correct libraries. | |
36 | ALL_LINGUAS= | |
37 | CY_GNU_GETTEXT | |
38 | ||
39 | dnl List of object files added by configure. | |
40 | ||
41 | CONFIG_OBS= | |
42 | CONFIG_DEPS= | |
43 | CONFIG_SRCS= | |
44 | ||
45 | configdirs="doc testsuite" | |
46 | ||
47 | dnl | |
48 | changequote(,)dnl | |
49 | ||
50 | . ${srcdir}/configure.host | |
51 | ||
52 | . ${srcdir}/configure.tgt | |
53 | ||
54 | dnl | |
55 | changequote([,])dnl | |
56 | ||
57 | AC_PROG_INSTALL | |
58 | AC_CHECK_TOOL(AR, ar) | |
59 | AC_CHECK_TOOL(RANLIB, ranlib, :) | |
60 | AC_PROG_YACC | |
61 | ||
62 | AC_ARG_PROGRAM | |
63 | ||
64 | AC_TYPE_SIGNAL | |
65 | ||
66 | AC_HEADER_STDC | |
67 | ||
68 | AC_CHECK_HEADERS(ctype.h curses.h endian.h link.h \ | |
69 | memory.h objlist.h ptrace.h sgtty.h stddef.h stdlib.h \ | |
70 | string.h sys/procfs.h sys/ptrace.h sys/reg.h \ | |
71 | term.h termio.h termios.h unistd.h wait.h sys/wait.h \ | |
72 | wchar.h wctype.h asm/debugreg.h sys/debugreg.h) | |
73 | AC_HEADER_STAT | |
74 | ||
75 | AC_C_CONST | |
76 | ||
77 | AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc) | |
78 | AC_FUNC_ALLOCA | |
79 | ||
80 | BFD_NEED_DECLARATION(malloc) | |
81 | BFD_NEED_DECLARATION(realloc) | |
82 | BFD_NEED_DECLARATION(free) | |
83 | BFD_NEED_DECLARATION(strerror) | |
84 | BFD_NEED_DECLARATION(strdup) | |
85 | ||
86 | ||
87 | # The following save_state_t checkery is only necessary for HPUX | |
88 | # versions earlier than 10.20. When those fade from memory, this | |
89 | # could be expunged. --jsm 1999-03-22 | |
90 | ||
91 | AC_MSG_CHECKING(for HPUX save_state structure) | |
92 | AC_EGREP_HEADER(save_state_t, machine/save_state.h, | |
93 | gdb_cv_hpux_savestate=yes, gdb_cv_hpux_savestate=no) | |
94 | AC_EGREP_HEADER(ss_wide, machine/save_state.h, gdb_cv_hpux_sswide=yes, | |
95 | gdb_cv_hpux_sswide=no) | |
96 | if test $gdb_cv_hpux_savestate = yes | |
97 | then | |
98 | AC_DEFINE(HAVE_STRUCT_SAVE_STATE_T, 1) | |
99 | fi | |
100 | if test $gdb_cv_hpux_sswide = yes | |
101 | then | |
102 | AC_DEFINE(HAVE_STRUCT_MEMBER_SS_WIDE, 1) | |
103 | fi | |
104 | AC_MSG_RESULT($gdb_cv_hpux_sswide) | |
105 | ||
106 | ||
107 | # If we are configured native on GNU/Linux, work around problems with | |
108 | # sys/procfs.h | |
109 | # Also detect which type of /proc is in use, such as for Unixware. | |
110 | ||
111 | if test "${target}" = "${host}"; then | |
112 | case "${host}" in | |
113 | i[[3456]]86-*-linux*) | |
114 | AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2) | |
115 | AC_DEFINE(sys_quotactl) | |
116 | ;; | |
117 | esac | |
118 | AC_MSG_CHECKING(for directory proc entries) | |
119 | # The [gdb_host != sun4sol2] hack is because Solaris does provide the | |
120 | # multiple procfs files as of Solaris 2.6, but GDB can't use it right now. | |
121 | if test "$ac_cv_header_sys_procfs_h" = yes -a "$gdb_host" != sun4sol2 \ | |
122 | -a -d /proc/$$ \ | |
123 | -a -f /proc/$$/ctl \ | |
124 | -a -f /proc/$$/as \ | |
125 | -a -f /proc/$$/map \ | |
126 | -a -f /proc/$$/status; then | |
127 | AC_MSG_RESULT(yes) | |
128 | AC_DEFINE(HAVE_MULTIPLE_PROC_FDS) | |
129 | else | |
130 | AC_MSG_RESULT(no) | |
131 | fi | |
132 | fi | |
133 | ||
134 | if test "$ac_cv_header_sys_procfs_h" = yes; then | |
135 | BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t) | |
136 | BFD_HAVE_SYS_PROCFS_TYPE(prrun_t) | |
137 | BFD_HAVE_SYS_PROCFS_TYPE(gregset_t) | |
138 | BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t) | |
139 | ||
140 | dnl Check for PIOCSET ioctl entry | |
141 | ||
142 | AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h) | |
143 | AC_CACHE_VAL(gdb_cv_have_procfs_piocset, | |
144 | [AC_TRY_COMPILE([#include <unistd.h> | |
145 | #include <sys/types.h> | |
146 | #include <sys/procfs.h> | |
147 | ], [ | |
148 | int dummy;; | |
149 | dummy = ioctl(0, PIOCSET, &dummy); | |
150 | ], | |
151 | gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)]) | |
152 | AC_MSG_RESULT($gdb_cv_have_procfs_piocset) | |
153 | if test $gdb_cv_have_procfs_piocset = yes; then | |
154 | AC_DEFINE(HAVE_PROCFS_PIOCSET) | |
155 | fi | |
156 | fi | |
157 | ||
158 | dnl See if host has libm. This is usually needed by simulators. | |
159 | AC_CHECK_LIB(m, main) | |
160 | ||
161 | dnl Solaris puts wctype in /usr/lib/libw.a before Solaris 2.6. | |
162 | dnl | |
163 | dnl A bug in GNU ld 2.9.1 causes a problem if we link in -lw | |
164 | dnl under Solaris 2.6 because it is some funky empty library. | |
165 | dnl So only link in libw if we have to. | |
166 | AC_CHECK_LIB(c, wctype,: ,AC_CHECK_LIB(w, wctype)) | |
167 | ||
168 | dnl See if compiler supports "long long" type. | |
169 | ||
170 | AC_MSG_CHECKING(for long long support in compiler) | |
171 | AC_CACHE_VAL(gdb_cv_c_long_long, | |
172 | [AC_TRY_COMPILE(, [ | |
173 | extern long long foo; | |
174 | switch (foo & 2) { case 0: return 1; } | |
175 | ], | |
176 | gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)]) | |
177 | AC_MSG_RESULT($gdb_cv_c_long_long) | |
178 | if test $gdb_cv_c_long_long = yes; then | |
179 | AC_DEFINE(CC_HAS_LONG_LONG) | |
180 | fi | |
181 | ||
182 | dnl See if the compiler and runtime support printing long long | |
183 | ||
184 | AC_MSG_CHECKING(for long long support in printf) | |
185 | AC_CACHE_VAL(gdb_cv_printf_has_long_long, | |
186 | [AC_TRY_RUN([ | |
187 | int main () { | |
188 | char buf[32]; | |
189 | long long l = 0; | |
190 | l = (l << 16) + 0x0123; | |
191 | l = (l << 16) + 0x4567; | |
192 | l = (l << 16) + 0x89ab; | |
193 | l = (l << 16) + 0xcdef; | |
194 | sprintf (buf, "0x%016llx", l); | |
195 | return (strcmp ("0x0123456789abcdef", buf)); | |
196 | }], | |
197 | gdb_cv_printf_has_long_long=yes, | |
198 | gdb_cv_printf_has_long_long=no, | |
199 | gdb_cv_printf_has_long_long=no)]) | |
200 | if test $gdb_cv_printf_has_long_long = yes; then | |
201 | AC_DEFINE(PRINTF_HAS_LONG_LONG) | |
202 | fi | |
203 | AC_MSG_RESULT($gdb_cv_printf_has_long_long) | |
204 | ||
205 | dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE | |
206 | dnl because autoconf complains about cross-compilation issues. However, this | |
207 | dnl code uses the same variables as the macro for compatibility. | |
208 | ||
209 | AC_MSG_CHECKING(for long double support in compiler) | |
210 | AC_CACHE_VAL(ac_cv_c_long_double, | |
211 | [AC_TRY_COMPILE(, [long double foo;], | |
212 | ac_cv_c_long_double=yes, ac_cv_c_long_double=no)]) | |
213 | AC_MSG_RESULT($ac_cv_c_long_double) | |
214 | if test $ac_cv_c_long_double = yes; then | |
215 | AC_DEFINE(HAVE_LONG_DOUBLE) | |
216 | fi | |
217 | ||
218 | dnl See if the compiler and runtime support printing long doubles | |
219 | ||
220 | AC_MSG_CHECKING(for long double support in printf) | |
221 | AC_CACHE_VAL(gdb_cv_printf_has_long_double, | |
222 | [AC_TRY_RUN([ | |
223 | int main () { | |
224 | char buf[16]; | |
225 | long double f = 3.141592653; | |
226 | sprintf (buf, "%Lg", f); | |
227 | return (strncmp ("3.14159", buf, 7)); | |
228 | }], | |
229 | gdb_cv_printf_has_long_double=yes, | |
230 | gdb_cv_printf_has_long_double=no, | |
231 | gdb_cv_printf_has_long_double=no)]) | |
232 | if test $gdb_cv_printf_has_long_double = yes; then | |
233 | AC_DEFINE(PRINTF_HAS_LONG_DOUBLE) | |
234 | fi | |
235 | AC_MSG_RESULT($gdb_cv_printf_has_long_double) | |
236 | ||
237 | dnl See if the compiler and runtime support scanning long doubles | |
238 | ||
239 | AC_MSG_CHECKING(for long double support in scanf) | |
240 | AC_CACHE_VAL(gdb_cv_scanf_has_long_double, | |
241 | [AC_TRY_RUN([ | |
242 | int main () { | |
243 | char *buf = "3.141592653"; | |
244 | long double f = 0; | |
245 | sscanf (buf, "%Lg", &f); | |
246 | return !(f > 3.14159 && f < 3.14160); | |
247 | }], | |
248 | gdb_cv_scanf_has_long_double=yes, | |
249 | gdb_cv_scanf_has_long_double=no, | |
250 | gdb_cv_scanf_has_long_double=no)]) | |
251 | if test $gdb_cv_scanf_has_long_double = yes; then | |
252 | AC_DEFINE(SCANF_HAS_LONG_DOUBLE) | |
253 | fi | |
254 | AC_MSG_RESULT($gdb_cv_scanf_has_long_double) | |
255 | ||
256 | AC_FUNC_MMAP | |
257 | ||
258 | dnl See if thread_db library is around for Solaris thread debugging. Note that | |
259 | dnl we must explicitly test for version 1 of the library because version 0 | |
260 | dnl (present on Solaris 2.4 or earlier) doesn't have the same API. | |
261 | ||
262 | dnl Note that we only want this if we are both native (host == target), and | |
263 | dnl not doing a canadian cross build (build == host). | |
264 | ||
265 | if test ${build} = ${host} -a ${host} = ${target} ; then | |
266 | case ${host_os} in | |
267 | hpux*) | |
268 | AC_MSG_CHECKING(for HPUX/OSF thread support) | |
269 | if test -f /usr/include/dce/cma_config.h ; then | |
270 | if test "$GCC" = "yes" ; then | |
271 | AC_MSG_RESULT(yes) | |
272 | AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT) | |
273 | CONFIG_OBS="${CONFIG_OJS} hpux-thread.o" | |
274 | CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c" | |
275 | else | |
276 | AC_MSG_RESULT(no (suppressed because you are not using GCC)) | |
277 | fi | |
278 | else | |
279 | AC_MSG_RESULT(no) | |
280 | fi | |
281 | ;; | |
282 | solaris*) | |
283 | AC_MSG_CHECKING(for Solaris thread debugging library) | |
284 | if test -f /usr/lib/libthread_db.so.1 ; then | |
285 | AC_MSG_RESULT(yes) | |
286 | AC_DEFINE(HAVE_THREAD_DB_LIB) | |
287 | CONFIG_OBS="${CONFIG_OBS} sol-thread.o" | |
288 | CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" | |
289 | AC_CHECK_LIB(dl, dlopen) | |
290 | if test "$GCC" = "yes" ; then | |
291 | # The GNU linker requires the -export-dynamic option to make | |
292 | # all symbols visible in the dynamic symbol table. | |
293 | hold_ldflags=$LDFLAGS | |
294 | AC_MSG_CHECKING(for the ld -export-dynamic flag) | |
295 | LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" | |
296 | AC_TRY_LINK(, [int i;], found=yes, found=no) | |
297 | LDFLAGS=$hold_ldflags | |
298 | AC_MSG_RESULT($found) | |
299 | if test $found = yes; then | |
300 | CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic" | |
301 | fi | |
302 | fi | |
303 | # Sun randomly tweaked the prototypes in <proc_service.h> | |
304 | # at one point. | |
305 | AC_MSG_CHECKING(if <proc_service.h> is old) | |
306 | AC_CACHE_VAL(gdb_cv_proc_service_is_old,[ | |
307 | AC_TRY_COMPILE([ | |
308 | #include <proc_service.h> | |
309 | ps_err_e ps_pdwrite | |
310 | (struct ps_prochandle*, psaddr_t, const void*, size_t); | |
311 | ],, gdb_cv_proc_service_is_old=no, | |
312 | gdb_cv_proc_service_is_old=yes) | |
313 | ]) | |
314 | AC_MSG_RESULT($gdb_cv_proc_service_is_old) | |
315 | if test $gdb_cv_proc_service_is_old = yes; then | |
316 | AC_DEFINE(PROC_SERVICE_IS_OLD) | |
317 | fi | |
318 | else | |
319 | AC_MSG_RESULT(no) | |
320 | fi | |
321 | ;; | |
322 | esac | |
323 | AC_SUBST(CONFIG_LDFLAGS) | |
324 | fi | |
325 | ||
326 | dnl Handle optional features that can be enabled. | |
327 | ENABLE_CFLAGS= | |
328 | ||
329 | AC_ARG_ENABLE(tui, | |
330 | [ --enable-tui Enable full-screen terminal user interface], | |
331 | [ | |
332 | case "${enable_tui}" in | |
333 | yes | no) ;; | |
334 | "") enable_tui=yes ;; | |
335 | *) | |
336 | AC_MSG_ERROR(Bad value for --enable-tui: ${enableval}) | |
337 | ;; | |
338 | esac | |
339 | ]) | |
340 | case ${enable_tui} in | |
341 | "yes" ) | |
342 | AC_DEFINE(TUI) | |
343 | BUILD_TUI=all-tui | |
344 | TUI_LIBRARY=tui/libtui.a | |
345 | ;; | |
346 | * ) | |
347 | BUILD_TUI= | |
348 | TUI_LIBRARY= | |
349 | ;; | |
350 | esac | |
351 | AC_SUBST(BUILD_TUI) | |
352 | AC_SUBST(TUI_LIBRARY) | |
353 | ||
354 | AC_ARG_ENABLE(netrom, | |
355 | [ --enable-netrom Enable NetROM support], | |
356 | [case "${enableval}" in | |
357 | yes) enable_netrom=yes ;; | |
358 | no) enable_netrom=no ;; | |
359 | *) AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;; | |
360 | esac]) | |
361 | ||
362 | if test "${enable_netrom}" = "yes"; then | |
363 | CONFIG_OBS="${CONFIG_OBS} remote-nrom.o" | |
364 | CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c" | |
365 | fi | |
366 | ||
367 | AC_ARG_ENABLE(build-warnings, | |
368 | [ --enable-build-warnings Enable build-time compiler warnings if gcc is used], | |
369 | [build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" | |
370 | case "${enableval}" in | |
371 | yes) ;; | |
372 | no) build_warnings="-w";; | |
373 | ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
374 | build_warnings="${build_warnings} ${t}";; | |
375 | *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
376 | build_warnings="${t} ${build_warnings}";; | |
377 | *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
378 | esac],[build_warnings=""])dnl | |
379 | ||
380 | if test "x${build_warnings}" != x -a "x$GCC" = xyes | |
381 | then | |
382 | WARN_CFLAGS="${build_warnings}" | |
383 | else | |
384 | WARN_CFLAGS="" | |
385 | fi | |
386 | AC_SUBST(WARN_CFLAGS) | |
387 | ||
388 | MMALLOC_CFLAGS= | |
389 | MMALLOC= | |
390 | AC_SUBST(MMALLOC_CFLAGS) | |
391 | AC_SUBST(MMALLOC) | |
392 | ||
393 | AC_ARG_WITH(mmalloc, | |
394 | [ --with-mmalloc Use memory mapped malloc package], | |
395 | [case "${withval}" in | |
396 | yes) want_mmalloc=true ;; | |
397 | no) want_mmalloc=false;; | |
398 | *) AC_MSG_ERROR(bad value ${withval} for GDB with-mmalloc option) ;; | |
399 | esac],[want_mmalloc=false])dnl | |
400 | ||
401 | if test x$want_mmalloc = xtrue; then | |
402 | AC_DEFINE(USE_MMALLOC) | |
403 | AC_DEFINE(MMCHECK_FORCE) | |
404 | MMALLOC_CFLAGS="-I$srcdir/../mmalloc" | |
405 | MMALLOC='../mmalloc/libmmalloc.a' | |
406 | fi | |
407 | ||
408 | dnl Figure out which term library to use. | |
409 | if test x$gdb_cv_os_cygwin = xyes; then | |
410 | TERM_LIB='`if test -r ../libtermcap/libtermcap.a; then echo ../libtermcap/libtermcap.a; else echo -ltermcap; fi`' | |
411 | else | |
412 | TERM_LIB= | |
413 | AC_CHECK_LIB(ncurses, tgetent, TERM_LIB=-lncurses, | |
414 | AC_CHECK_LIB(Hcurses, tgetent, TERM_LIB=-lHcurses, | |
415 | AC_CHECK_LIB(termlib, tgetent, TERM_LIB=-ltermlib, | |
416 | AC_CHECK_LIB(termcap, tgetent, TERM_LIB=-ltermcap, | |
417 | AC_CHECK_LIB(curses, tgetent, TERM_LIB=-lcurses, | |
418 | AC_CHECK_LIB(terminfo, tgetent, TERM_LIB=-lterminfo)))))) | |
419 | ||
420 | if test "x$TERM_LIB" = x | |
421 | then | |
422 | AC_MSG_ERROR(Could not find a term library, e.g. termcap or termlib!) | |
423 | fi | |
424 | fi | |
425 | AC_SUBST(TERM_LIB) | |
426 | ||
427 | ||
428 | AC_PATH_X | |
429 | ||
430 | AC_SUBST(ENABLE_CFLAGS) | |
431 | ||
432 | AC_SUBST(CONFIG_OBS) | |
433 | AC_SUBST(CONFIG_DEPS) | |
434 | AC_SUBST(CONFIG_SRCS) | |
435 | ||
436 | # Begin stuff to support --enable-shared | |
437 | AC_ARG_ENABLE(shared, | |
438 | [ --enable-shared Use shared libraries], | |
439 | [case "${enableval}" in | |
440 | yes) shared=true ;; | |
441 | no) shared=false ;; | |
442 | *) shared=true ;; | |
443 | esac])dnl | |
444 | ||
445 | HLDFLAGS= | |
446 | HLDENV= | |
447 | # If we have shared libraries, try to set rpath reasonably. | |
448 | if test "${shared}" = "true"; then | |
449 | case "${host}" in | |
450 | *-*-hpux*) | |
451 | HLDFLAGS='-Wl,+s,+b,$(libdir)' | |
452 | ;; | |
453 | *-*-irix5* | *-*-irix6*) | |
454 | HLDFLAGS='-Wl,-rpath,$(libdir)' | |
455 | ;; | |
456 | *-*-linux*aout*) | |
457 | ;; | |
458 | *-*-linux* | *-pc-linux-gnu) | |
459 | HLDFLAGS='-Wl,-rpath,$(libdir)' | |
460 | ;; | |
461 | *-*-solaris*) | |
462 | HLDFLAGS='-R $(libdir)' | |
463 | ;; | |
464 | *-*-sysv4*) | |
465 | HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;' | |
466 | ;; | |
467 | esac | |
468 | fi | |
469 | ||
470 | # On SunOS, if the linker supports the -rpath option, use it to | |
471 | # prevent ../bfd and ../opcodes from being included in the run time | |
472 | # search path. | |
473 | case "${host}" in | |
474 | *-*-sunos*) | |
475 | echo 'main () { }' > conftest.c | |
476 | ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t | |
477 | if grep 'unrecognized' conftest.t >/dev/null 2>&1; then | |
478 | : | |
479 | elif grep 'No such file' conftest.t >/dev/null 2>&1; then | |
480 | : | |
481 | elif grep 'do not mix' conftest.t >/dev/null 2>&1; then | |
482 | : | |
483 | elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then | |
484 | : | |
485 | elif test "${shared}" = "true"; then | |
486 | HLDFLAGS='-Wl,-rpath=$(libdir)' | |
487 | else | |
488 | HLDFLAGS='-Wl,-rpath=' | |
489 | fi | |
490 | rm -f conftest.t conftest.c conftest | |
491 | ;; | |
492 | esac | |
493 | AC_SUBST(HLDFLAGS) | |
494 | AC_SUBST(HLDENV) | |
495 | # End stuff to support --enable-shared | |
496 | ||
497 | # target_subdir is used by the testsuite to find the target libraries. | |
498 | target_subdir= | |
499 | if test "${host}" != "${target}"; then | |
500 | target_subdir="${target_alias}/" | |
501 | fi | |
502 | AC_SUBST(target_subdir) | |
503 | ||
504 | frags= | |
505 | host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh | |
506 | if test ! -f ${host_makefile_frag}; then | |
507 | AC_MSG_ERROR("*** Gdb does not support host ${host}") | |
508 | fi | |
509 | frags="$frags $host_makefile_frag" | |
510 | ||
511 | target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt | |
512 | if test ! -f ${target_makefile_frag}; then | |
513 | AC_MSG_ERROR("*** Gdb does not support target ${target}") | |
514 | fi | |
515 | frags="$frags $target_makefile_frag" | |
516 | ||
517 | AC_SUBST_FILE(host_makefile_frag) | |
518 | AC_SUBST_FILE(target_makefile_frag) | |
519 | AC_SUBST(frags) | |
520 | ||
521 | changequote(,)dnl | |
522 | hostfile=`sed -n ' | |
523 | s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p | |
524 | ' ${host_makefile_frag}` | |
525 | ||
526 | targetfile=`sed -n ' | |
527 | s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p | |
528 | ' ${target_makefile_frag}` | |
529 | ||
530 | # these really aren't orthogonal true/false values of the same condition, | |
531 | # but shells are slow enough that I like to reuse the test conditions | |
532 | # whenever possible | |
533 | if test "${target}" = "${host}"; then | |
534 | nativefile=`sed -n ' | |
535 | s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p | |
536 | ' ${host_makefile_frag}` | |
537 | # else | |
538 | # GDBserver is only useful in a "native" enviroment | |
539 | # configdirs=`echo $configdirs | sed 's/gdbserver//'` | |
540 | fi | |
541 | changequote([,]) | |
542 | ||
543 | # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile | |
544 | # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the | |
545 | # corresponding links. But we have to remove the xm.h files and tm.h | |
546 | # files anyway, e.g. when switching from "configure host" to | |
547 | # "configure none". | |
548 | ||
549 | files= | |
550 | links= | |
551 | rm -f xm.h | |
552 | if test "${hostfile}" != ""; then | |
553 | files="${files} config/${gdb_host_cpu}/${hostfile}" | |
554 | links="${links} xm.h" | |
555 | fi | |
556 | rm -f tm.h | |
557 | if test "${targetfile}" != ""; then | |
558 | files="${files} config/${gdb_target_cpu}/${targetfile}" | |
559 | links="${links} tm.h" | |
560 | fi | |
561 | rm -f nm.h | |
562 | if test "${nativefile}" != ""; then | |
563 | files="${files} config/${gdb_host_cpu}/${nativefile}" | |
564 | links="${links} nm.h" | |
565 | else | |
566 | # A cross-only configuration. | |
567 | files="${files} config/nm-empty.h" | |
568 | links="${links} nm.h" | |
569 | fi | |
570 | ||
571 | AC_LINK_FILES($files, $links) | |
572 | ||
573 | dnl Check for exe extension set on certain hosts (e.g. Win32) | |
574 | AC_EXEEXT | |
575 | ||
576 | AC_CONFIG_SUBDIRS($configdirs) | |
577 | AC_OUTPUT(Makefile tui/Makefile .gdbinit:gdbinit.in, | |
578 | [ | |
579 | dnl Autoconf doesn't provide a mechanism for modifying definitions | |
580 | dnl provided by makefile fragments. | |
581 | dnl | |
582 | if test "${nativefile}" = ""; then | |
583 | sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \ | |
584 | < Makefile > Makefile.tem | |
585 | mv -f Makefile.tem Makefile | |
586 | fi | |
587 | ||
588 | changequote(,)dnl | |
589 | sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/, | |
590 | /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/, | |
591 | /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp | |
592 | mv -f Makefile.tmp Makefile | |
593 | changequote([,])dnl | |
594 | ||
595 | case x$CONFIG_HEADERS in | |
596 | xconfig.h:config.in) | |
597 | echo > stamp-h ;; | |
598 | esac | |
599 | ], | |
600 | [ | |
601 | gdb_host_cpu=$gdb_host_cpu | |
602 | gdb_target_cpu=$gdb_target_cpu | |
603 | nativefile=$nativefile | |
604 | ]) | |
605 | ||
606 | exit 0 |