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