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