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