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