Commit | Line | Data |
---|---|---|
2f4973f8 SG |
1 | dnl Autoconf configure script for GDB, the GNU debugger. |
2 | dnl Copyright 1995, 1996 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 | |
476a283f | 18 | dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
2f4973f8 | 19 | |
5436fc65 | 20 | dnl Process this file with autoconf to produce a configure script. |
2f4973f8 | 21 | |
5d8b7982 | 22 | AC_PREREQ(2.5)dnl |
5436fc65 | 23 | AC_INIT(main.c) |
18ea4416 | 24 | AC_CONFIG_HEADER(config.h:config.in) |
5436fc65 | 25 | |
5436fc65 C |
26 | AC_PROG_CC |
27 | AC_AIX | |
28 | AC_MINIX | |
29 | AC_ISC_POSIX | |
30 | ||
35ce4f08 GN |
31 | DLLTOOL=${DLLTOOL-dlltool} |
32 | AC_SUBST(DLLTOOL) | |
33 | ||
f02156cf | 34 | AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) |
0579b53d GN |
35 | AC_CANONICAL_SYSTEM |
36 | ||
fcfc3c0c TT |
37 | dnl gdb doesn't use gettext, but bfd does. We call this to ensure we |
38 | dnl link with the correct libraries. | |
39 | ALL_LINGUAS= | |
40 | CY_GNU_GETTEXT | |
41 | ||
bfde4a67 SG |
42 | dnl List of object files added by configure. |
43 | ||
44 | CONFIG_OBS= | |
018d76dd | 45 | CONFIG_DEPS= |
c7bb1531 | 46 | CONFIG_SRCS= |
bfde4a67 SG |
47 | |
48 | configdirs="doc testsuite" | |
49 | ||
50 | dnl | |
51 | changequote(,)dnl | |
52 | ||
53 | . ${srcdir}/configure.host | |
54 | ||
55 | . ${srcdir}/configure.tgt | |
56 | ||
57 | dnl | |
58 | changequote([,])dnl | |
59 | ||
5436fc65 | 60 | AC_PROG_INSTALL |
d8efbc66 FF |
61 | AC_CHECK_TOOL(AR, ar) |
62 | AC_CHECK_TOOL(RANLIB, ranlib, :) | |
1e02f078 | 63 | AC_PROG_YACC |
d8efbc66 | 64 | AC_PROG_AWK |
5436fc65 | 65 | |
5436fc65 C |
66 | AC_ARG_PROGRAM |
67 | ||
c14cabba AC |
68 | AC_TYPE_SIGNAL |
69 | ||
2b576293 | 70 | AC_HEADER_STDC |
0db3fe94 | 71 | AC_CHECK_HEADERS(limits.h memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h stddef.h stdlib.h sys/procfs.h link.h endian.h objlist.h) |
2b576293 C |
72 | AC_HEADER_STAT |
73 | ||
8501c742 SG |
74 | AC_C_CONST |
75 | ||
e7ab2a47 | 76 | AC_CHECK_FUNCS(setpgid sbrk select poll sigaction) |
0aa3233e | 77 | AC_FUNC_ALLOCA |
72ae15f6 | 78 | |
e3147bf2 | 79 | # If we are configured native on GNU/Linux, work around problems with sys/procfs.h |
54225fd0 MA |
80 | if test "${target}" = "${host}"; then |
81 | case "${host}" in | |
3435297a | 82 | i[[3456]]86-*-linux*) |
0728afad | 83 | AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2) |
54225fd0 MA |
84 | AC_DEFINE(sys_quotactl) |
85 | ;; | |
86 | esac | |
87 | fi | |
88 | ||
4708ac65 | 89 | AC_MSG_CHECKING([for gregset_t type]) |
07b77f5c | 90 | AC_CACHE_VAL(gdb_cv_have_gregset_t, |
4708ac65 | 91 | [AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0], |
07b77f5c FF |
92 | gdb_cv_have_gregset_t=yes, gdb_cv_have_gregset_t=no)]) |
93 | AC_MSG_RESULT($gdb_cv_have_gregset_t) | |
94 | if test $gdb_cv_have_gregset_t = yes; then | |
4708ac65 FF |
95 | AC_DEFINE(HAVE_GREGSET_T) |
96 | fi | |
97 | ||
98 | AC_MSG_CHECKING([for fpregset_t type]) | |
07b77f5c | 99 | AC_CACHE_VAL(gdb_cv_have_fpregset_t, |
4708ac65 | 100 | [AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0], |
07b77f5c FF |
101 | gdb_cv_have_fpregset_t=yes, gdb_cv_have_fpregset_t=no)]) |
102 | AC_MSG_RESULT($gdb_cv_have_fpregset_t) | |
103 | if test $gdb_cv_have_fpregset_t = yes; then | |
4708ac65 FF |
104 | AC_DEFINE(HAVE_FPREGSET_T) |
105 | fi | |
106 | ||
ef6c51d1 SG |
107 | dnl See if host has libm. This is usually needed by simulators. |
108 | AC_CHECK_LIB(m, main) | |
109 | ||
3f550b59 FF |
110 | dnl See if compiler supports "long long" type. |
111 | ||
112 | AC_MSG_CHECKING(for long long support in compiler) | |
113 | AC_CACHE_VAL(gdb_cv_c_long_long, | |
80f600a4 | 114 | [AC_TRY_COMPILE(, [ |
d538f9cf FF |
115 | extern long long foo; |
116 | switch (foo & 2) { case 0: return 1; } | |
117 | ], | |
3f550b59 FF |
118 | gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)]) |
119 | AC_MSG_RESULT($gdb_cv_c_long_long) | |
120 | if test $gdb_cv_c_long_long = yes; then | |
121 | AC_DEFINE(CC_HAS_LONG_LONG) | |
122 | fi | |
123 | ||
124 | dnl See if the compiler and runtime support printing long long | |
125 | ||
126 | AC_MSG_CHECKING(for long long support in printf) | |
127 | AC_CACHE_VAL(gdb_cv_printf_has_long_long, | |
128 | [AC_TRY_RUN([ | |
129 | int main () { | |
f7b8c9ce AC |
130 | char buf[32]; |
131 | long long l = 0; | |
132 | l = (l << 16) + 0x0123; | |
133 | l = (l << 16) + 0x4567; | |
134 | l = (l << 16) + 0x89ab; | |
135 | l = (l << 16) + 0xcdef; | |
136 | sprintf (buf, "0x%016llx", l); | |
137 | return (strcmp ("0x0123456789abcdef", buf)); | |
3f550b59 FF |
138 | }], |
139 | gdb_cv_printf_has_long_long=yes, | |
140 | gdb_cv_printf_has_long_long=no, | |
141 | gdb_cv_printf_has_long_long=no)]) | |
142 | if test $gdb_cv_printf_has_long_long = yes; then | |
143 | AC_DEFINE(PRINTF_HAS_LONG_LONG) | |
144 | fi | |
145 | AC_MSG_RESULT($gdb_cv_printf_has_long_long) | |
146 | ||
aa220473 SG |
147 | dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE |
148 | dnl because autoconf complains about cross-compilation issues. However, this | |
149 | dnl code uses the same variables as the macro for compatibility. | |
150 | ||
07b77f5c | 151 | AC_MSG_CHECKING(for long double support in compiler) |
aa220473 SG |
152 | AC_CACHE_VAL(ac_cv_c_long_double, |
153 | [AC_TRY_COMPILE(, [long double foo;], | |
154 | ac_cv_c_long_double=yes, ac_cv_c_long_double=no)]) | |
155 | AC_MSG_RESULT($ac_cv_c_long_double) | |
156 | if test $ac_cv_c_long_double = yes; then | |
157 | AC_DEFINE(HAVE_LONG_DOUBLE) | |
158 | fi | |
159 | ||
07b77f5c FF |
160 | dnl See if the compiler and runtime support printing long doubles |
161 | ||
162 | AC_MSG_CHECKING(for long double support in printf) | |
163 | AC_CACHE_VAL(gdb_cv_printf_has_long_double, | |
164 | [AC_TRY_RUN([ | |
165 | int main () { | |
166 | char buf[16]; | |
167 | long double f = 3.141592653; | |
168 | sprintf (buf, "%Lg", f); | |
169 | return (strncmp ("3.14159", buf, 7)); | |
170 | }], | |
171 | gdb_cv_printf_has_long_double=yes, | |
172 | gdb_cv_printf_has_long_double=no, | |
173 | gdb_cv_printf_has_long_double=no)]) | |
174 | if test $gdb_cv_printf_has_long_double = yes; then | |
175 | AC_DEFINE(PRINTF_HAS_LONG_DOUBLE) | |
176 | fi | |
177 | AC_MSG_RESULT($gdb_cv_printf_has_long_double) | |
178 | ||
f7b8c9ce AC |
179 | dnl See if the compiler and runtime support scanning long doubles |
180 | ||
181 | AC_MSG_CHECKING(for long double support in scanf) | |
182 | AC_CACHE_VAL(gdb_cv_scanf_has_long_double, | |
183 | [AC_TRY_RUN([ | |
184 | int main () { | |
185 | char *buf = "3.141592653"; | |
186 | long double f = 0; | |
187 | sscanf (buf, "%Lg", &f); | |
188 | return !(f > 3.14159 && f < 3.14160); | |
189 | }], | |
190 | gdb_cv_scanf_has_long_double=yes, | |
191 | gdb_cv_scanf_has_long_double=no, | |
192 | gdb_cv_scanf_has_long_double=no)]) | |
193 | if test $gdb_cv_scanf_has_long_double = yes; then | |
194 | AC_DEFINE(SCANF_HAS_LONG_DOUBLE) | |
195 | fi | |
196 | AC_MSG_RESULT($gdb_cv_scanf_has_long_double) | |
197 | ||
2b576293 | 198 | AC_FUNC_MMAP |
5436fc65 | 199 | |
fef1696f ILT |
200 | BFD_NEED_DECLARATION(malloc) |
201 | BFD_NEED_DECLARATION(realloc) | |
202 | BFD_NEED_DECLARATION(free) | |
203 | ||
21cbc60c JM |
204 | BFD_NEED_DECLARATION(strerror) |
205 | ||
4915acad SG |
206 | dnl See if thread_db library is around for Solaris thread debugging. Note that |
207 | dnl we must explicitly test for version 1 of the library because version 0 | |
208 | dnl (present on Solaris 2.4 or earlier) doesn't have the same API. | |
209 | ||
89e673a4 SG |
210 | dnl Note that we only want this if we are both native (host == target), and |
211 | dnl not doing a canadian cross build (build == host). | |
212 | ||
213 | if test ${build} = ${host} -a ${host} = ${target} ; then | |
4b95e9a1 JM |
214 | case ${host_os} in |
215 | hpux*) | |
216 | AC_MSG_CHECKING(for HPUX/OSF thread support) | |
217 | if test -f /usr/include/dce/cma_config.h ; then | |
218 | if test "$GCC" = "yes" ; then | |
219 | AC_MSG_RESULT(yes) | |
220 | AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT) | |
221 | CONFIG_OBS="${CONFIG_OJS} hpux-thread.o" | |
c7bb1531 | 222 | CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c" |
4b95e9a1 JM |
223 | else |
224 | AC_MSG_RESULT(no (suppressed because you are not using GCC)) | |
225 | fi | |
226 | else | |
227 | AC_MSG_RESULT(no) | |
228 | fi | |
229 | ;; | |
230 | solaris*) | |
231 | AC_MSG_CHECKING(for Solaris thread debugging library) | |
232 | if test -f /usr/lib/libthread_db.so.1 ; then | |
233 | AC_MSG_RESULT(yes) | |
234 | AC_DEFINE(HAVE_THREAD_DB_LIB) | |
235 | CONFIG_OBS="${CONFIG_OBS} sol-thread.o" | |
c7bb1531 | 236 | CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" |
4b95e9a1 JM |
237 | AC_CHECK_LIB(dl, dlopen) |
238 | if test "$GCC" = "yes" ; then | |
239 | # The GNU linker requires the -export-dynamic option to make | |
240 | # all symbols visible in the dynamic symbol table. | |
241 | hold_ldflags=$LDFLAGS | |
242 | AC_MSG_CHECKING(for the ld -export-dynamic flag) | |
243 | LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" | |
244 | AC_TRY_LINK(, [int i;], found=yes, found=no) | |
245 | LDFLAGS=$hold_ldflags | |
246 | AC_MSG_RESULT($found) | |
247 | if test $found = yes; then | |
248 | CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic" | |
249 | fi | |
250 | fi | |
251 | else | |
252 | AC_MSG_RESULT(no) | |
253 | fi | |
254 | ;; | |
255 | esac | |
256 | AC_SUBST(CONFIG_LDFLAGS) | |
89e673a4 | 257 | fi |
47ef0da5 | 258 | |
5436fc65 C |
259 | dnl Handle optional features that can be enabled. |
260 | ENABLE_CFLAGS= | |
5436fc65 C |
261 | |
262 | AC_ARG_ENABLE(netrom, | |
263 | [ --enable-netrom ], | |
264 | [case "${enableval}" in | |
265 | yes) enable_netrom=yes ;; | |
266 | no) enable_netrom=no ;; | |
267 | *) AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;; | |
268 | esac]) | |
269 | ||
270 | if test "${enable_netrom}" = "yes"; then | |
6c310da8 | 271 | CONFIG_OBS="${CONFIG_OBS} remote-nrom.o" |
c7bb1531 | 272 | CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c" |
5436fc65 C |
273 | fi |
274 | ||
0728afad FF |
275 | MMALLOC_CFLAGS= |
276 | MMALLOC= | |
277 | AC_SUBST(MMALLOC_CFLAGS) | |
278 | AC_SUBST(MMALLOC) | |
279 | ||
280 | AC_ARG_WITH(mmalloc, | |
281 | [ --with-mmalloc use memory mapped malloc package], | |
282 | [case "${withval}" in | |
283 | yes) want_mmalloc=true ;; | |
284 | no) want_mmalloc=false;; | |
285 | *) AC_MSG_ERROR(bad value ${withval} for GDB with-mmalloc option) ;; | |
286 | esac],[want_mmalloc=false])dnl | |
287 | ||
288 | if test x$want_mmalloc = xtrue; then | |
289 | AC_DEFINE(USE_MMALLOC) | |
dd600735 | 290 | AC_DEFINE(MMCHECK_FORCE) |
0728afad FF |
291 | MMALLOC_CFLAGS="-I$srcdir/../mmalloc" |
292 | MMALLOC='../mmalloc/libmmalloc.a' | |
293 | fi | |
294 | ||
5436fc65 | 295 | # start-sanitize-gdbtk |
2476848a MH |
296 | ENABLE_IDE= |
297 | AC_ARG_ENABLE(ide, [ --enable-ide Enable IDE support]) | |
298 | if test "$enable_ide" = yes; then | |
299 | enable_ide=yes | |
300 | ENABLE_IDE=1 | |
301 | else | |
302 | enable_ide=no | |
303 | fi | |
304 | AC_SUBST(ENABLE_IDE) | |
305 | ||
5436fc65 C |
306 | ENABLE_GDBTK= |
307 | ||
308 | AC_ARG_ENABLE(gdbtk, | |
309 | [ --enable-gdbtk ], | |
310 | [case "${enableval}" in | |
0fe1522a SG |
311 | yes) |
312 | case "$host" in | |
313 | *go32*) | |
314 | AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.]) | |
315 | enable_gdbtk=no ;; | |
8a19b35a | 316 | *windows*) |
b613bfbf GN |
317 | AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.]) |
318 | enable_gdbtk=no ;; | |
0fe1522a SG |
319 | *) |
320 | enable_gdbtk=yes ;; | |
321 | esac ;; | |
322 | no) | |
323 | enable_gdbtk=no ;; | |
324 | *) | |
325 | AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;; | |
326 | esac], | |
327 | [ | |
b613bfbf | 328 | # Default is on for everything but go32 and cygwin32 |
0fe1522a | 329 | case "$host" in |
8a19b35a | 330 | *go32* | *windows*) |
b613bfbf | 331 | ;; |
0fe1522a SG |
332 | *) |
333 | enable_gdbtk=yes ;; | |
334 | esac | |
335 | ]) | |
5436fc65 | 336 | |
9b119644 ILT |
337 | # In the cygwin32 environment, we need some additional flags. |
338 | AC_CACHE_CHECK([for cygwin32], gdb_cv_os_cygwin32, | |
339 | [AC_EGREP_CPP(lose, [ | |
340 | #ifdef __CYGWIN32__ | |
341 | lose | |
342 | #endif],[gdb_cv_os_cygwin32=yes],[gdb_cv_os_cygwin32=no])]) | |
343 | ||
344 | WIN32LIBS= | |
345 | WIN32LDAPP= | |
346 | AC_SUBST(WIN32LIBS) | |
347 | AC_SUBST(WIN32LDAPP) | |
348 | ||
929db6e5 EZ |
349 | WINDRES=${WINDRES-windres} |
350 | AC_SUBST(WINDRES) | |
351 | ||
9b119644 ILT |
352 | if test x$gdb_cv_os_cygwin32 = xyes; then |
353 | if test x$enable_ide = xyes; then | |
354 | WIN32LIBS="-ladvapi32" | |
355 | fi | |
356 | fi | |
357 | ||
358 | configdir="unix" | |
8a19b35a | 359 | |
b177bf84 | 360 | GDBTKLIBS= |
5436fc65 | 361 | if test "${enable_gdbtk}" = "yes"; then |
0fe1522a | 362 | |
047465fd | 363 | CY_AC_PATH_TCLCONFIG |
0cf433d9 ILT |
364 | if test -z "${no_tcl}"; then |
365 | CY_AC_LOAD_TCLCONFIG | |
366 | CY_AC_PATH_TKCONFIG | |
047465fd | 367 | |
0cf433d9 ILT |
368 | # If $no_tk is nonempty, then we can't do Tk, and there is no |
369 | # point to doing Tcl. | |
370 | if test -z "${no_tk}"; then | |
371 | CY_AC_LOAD_TKCONFIG | |
372 | CY_AC_PATH_TCLH | |
373 | CY_AC_PATH_TKH | |
2476848a MH |
374 | CY_AC_PATH_ITCLH |
375 | CY_AC_PATH_TIX | |
047465fd | 376 | |
6bc5b2fa | 377 | # now look for tix library stuff |
1154b47a | 378 | TIXVERSION=4.1.8.0 |
6bc5b2fa MH |
379 | . ${ac_cv_c_tclconfig}/tclConfig.sh |
380 | case "${host}" in | |
381 | *-*-cygwin32*) | |
f1f6dd9c | 382 | tixdir=../tix/win/tcl8.0 |
6bc5b2fa MH |
383 | ;; |
384 | *) | |
1154b47a | 385 | tixdir=../tix/unix/tk8.0 |
6bc5b2fa MH |
386 | ;; |
387 | esac | |
bb3d9f43 KS |
388 | if test "${TCL_SHARED_BUILD}" = "1"; then |
389 | TIX_LIB_EXT="${TCL_SHLIB_SUFFIX}" | |
11f91b2b KS |
390 | |
391 | # Can't win them all: SunOS 4 (others?) appends a version | |
392 | # number after the ".so" | |
393 | case "${host}" in | |
394 | *-*-sunos4*) | |
395 | TIX_LIB_EXT="${TIX_LIB_EXT}.1.0" ;; | |
396 | esac | |
397 | ||
bb3d9f43 KS |
398 | else |
399 | TIX_LIB_EXT=".a" | |
400 | fi | |
11f91b2b | 401 | |
6bc5b2fa MH |
402 | if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then |
403 | TIXLIB="-L${tixdir} -ltix${TIXVERSION}" | |
bb3d9f43 | 404 | TIX_DEPS="${tixdir}/libtix${TIXVERSION}${TIX_LIB_EXT}" |
6bc5b2fa MH |
405 | else |
406 | TIXLIB="-L${tixdir} -ltix`echo ${TIXVERSION} | tr -d .`" | |
bb3d9f43 | 407 | TIX_DEPS="${tixdir}/libtix`echo ${TIXVERSION} | tr -d .`${TIX_LIB_EXT}" |
6bc5b2fa MH |
408 | fi |
409 | ||
0cf433d9 | 410 | ENABLE_GDBTK=1 |
1a57cd09 | 411 | |
6c310da8 | 412 | # Include some libraries that Tcl and Tk want. |
2476848a | 413 | if test "${enable_ide}" = "yes"; then |
8b5befef ILT |
414 | TCL_LIBS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)' |
415 | CONFIG_DEPS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE_DEPS) $(ITCL_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)' | |
2476848a | 416 | else |
dafec9dd ILT |
417 | TCL_LIBS='$(LIBGUI) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)' |
418 | CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)' | |
2476848a | 419 | fi |
46964086 TT |
420 | # Yes, the ordering seems wrong here. But it isn't. |
421 | # TK_LIBS is the list of libraries that need to be linked | |
b177bf84 TT |
422 | # after Tcl/Tk. Note that this isn't put into LIBS. If it |
423 | # were in LIBS then any link tests after this point would | |
424 | # try to include things like `$(LIBGUI)', which wouldn't work. | |
425 | GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}" | |
dd3dd918 | 426 | CONFIG_OBS="${CONFIG_OBS} gdbtk.o" |
9b119644 ILT |
427 | |
428 | if test x$gdb_cv_os_cygwin32 = xyes; then | |
018d76dd | 429 | WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32 -luser32" |
9b119644 | 430 | WIN32LDAPP="-Wl,--subsystem,windows" |
929db6e5 | 431 | CONFIG_OBS="${CONFIG_OBS} gdbres.o" |
9b119644 | 432 | fi |
0cf433d9 | 433 | fi |
a2b63bbd | 434 | fi |
5436fc65 | 435 | fi |
a2b63bbd | 436 | |
5436fc65 | 437 | AC_SUBST(ENABLE_GDBTK) |
9c0bc1da | 438 | AC_SUBST(X_CFLAGS) |
a2b63bbd JM |
439 | AC_SUBST(X_LDFLAGS) |
440 | AC_SUBST(X_LIBS) | |
6bc5b2fa | 441 | AC_SUBST(TIXLIB) |
018d76dd | 442 | AC_SUBST(TIX_DEPS) |
b177bf84 | 443 | AC_SUBST(GDBTKLIBS) |
5436fc65 C |
444 | # end-sanitize-gdbtk |
445 | ||
b236defa FCE |
446 | AC_PATH_X |
447 | # start-sanitize-sky | |
448 | # Enable GPU2 library for MIPS simulator | |
449 | AC_ARG_WITH(sim-gpu2, | |
450 | [ --with-sim-gpu2=path Use GPU2 library under given directory], | |
bd5eafcd FCE |
451 | [case "${target}" in |
452 | mips*-sky-*) | |
453 | if test -d "${withval}" | |
454 | then | |
455 | LIBS="${LIBS} -L${withval}/lib -lgpu2 -L${x_libraries} -lX11" | |
456 | else | |
457 | AC_MSG_WARN([Directory ${withval} does not exist.]) | |
458 | fi ;; | |
459 | *) AC_MSG_WARN([--with-sim-gpu2 option invalid for target ${target}]) | |
460 | esac])dnl | |
3e5fbf91 JL |
461 | |
462 | # Enable target accurate FP library | |
463 | AC_ARG_WITH(sim-funit, | |
464 | [ --with-sim-funit=path Use target FP lib under given directory], | |
465 | [case "${target}" in | |
466 | mips*-sky-*) | |
467 | if test -d "${withval}" | |
468 | then | |
469 | LIBS="${LIBS} -L${withval}/lib -lfunit" | |
470 | else | |
471 | AC_MSG_WARN([Directory ${withval} does not exist.]) | |
472 | fi ;; | |
473 | *) AC_MSG_WARN([--with-sim-funit option invalid for target ${target}]) | |
474 | esac])dnl | |
b236defa FCE |
475 | # end-sanitize-sky |
476 | ||
5436fc65 | 477 | AC_SUBST(ENABLE_CFLAGS) |
6c310da8 SG |
478 | |
479 | AC_SUBST(CONFIG_OBS) | |
018d76dd | 480 | AC_SUBST(CONFIG_DEPS) |
c7bb1531 | 481 | AC_SUBST(CONFIG_SRCS) |
6ec7e4d3 | 482 | |
1d5eb137 FF |
483 | # Begin stuff to support --enable-shared |
484 | AC_ARG_ENABLE(shared, | |
485 | [ --enable-shared use shared libraries], | |
486 | [case "${enableval}" in | |
487 | yes) shared=true ;; | |
488 | no) shared=false ;; | |
489 | *) shared=true ;; | |
490 | esac])dnl | |
491 | ||
492 | HLDFLAGS= | |
493 | HLDENV= | |
494 | # If we have shared libraries, try to set rpath reasonably. | |
495 | if test "${shared}" = "true"; then | |
496 | case "${host}" in | |
497 | *-*-hpux*) | |
498 | HLDFLAGS='-Wl,+s,+b,$(libdir)' | |
499 | ;; | |
500 | *-*-irix5* | *-*-irix6*) | |
501 | HLDFLAGS='-Wl,-rpath,$(libdir)' | |
502 | ;; | |
503 | *-*-linux*aout*) | |
504 | ;; | |
8ddf07a2 | 505 | *-*-linux* | *-pc-linux-gnu) |
1d5eb137 FF |
506 | HLDFLAGS='-Wl,-rpath,$(libdir)' |
507 | ;; | |
508 | *-*-solaris*) | |
509 | HLDFLAGS='-R $(libdir)' | |
510 | ;; | |
511 | *-*-sysv4*) | |
512 | 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;' | |
513 | ;; | |
514 | esac | |
515 | fi | |
516 | ||
517 | # On SunOS, if the linker supports the -rpath option, use it to | |
518 | # prevent ../bfd and ../opcodes from being included in the run time | |
519 | # search path. | |
520 | case "${host}" in | |
521 | *-*-sunos*) | |
522 | echo 'main () { }' > conftest.c | |
523 | ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t | |
524 | if grep 'unrecognized' conftest.t >/dev/null 2>&1; then | |
525 | : | |
526 | elif grep 'No such file' conftest.t >/dev/null 2>&1; then | |
527 | : | |
528 | elif grep 'do not mix' conftest.t >/dev/null 2>&1; then | |
529 | : | |
074d813d PS |
530 | elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then |
531 | : | |
1d5eb137 FF |
532 | elif test "${shared}" = "true"; then |
533 | HLDFLAGS='-Wl,-rpath=$(libdir)' | |
534 | else | |
535 | HLDFLAGS='-Wl,-rpath=' | |
536 | fi | |
537 | rm -f conftest.t conftest.c conftest | |
538 | ;; | |
539 | esac | |
540 | AC_SUBST(HLDFLAGS) | |
541 | AC_SUBST(HLDENV) | |
542 | # End stuff to support --enable-shared | |
543 | ||
9c0bc1da DE |
544 | # target_subdir is used by the testsuite to find the target libraries. |
545 | target_subdir= | |
546 | if test "${host}" != "${target}"; then | |
547 | target_subdir="${target_alias}/" | |
548 | fi | |
549 | AC_SUBST(target_subdir) | |
bc028766 | 550 | |
5f107900 | 551 | frags= |
5436fc65 C |
552 | host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh |
553 | if test ! -f ${host_makefile_frag}; then | |
554 | AC_MSG_ERROR("*** Gdb does not support host ${host}") | |
912e0732 | 555 | fi |
5f107900 | 556 | frags="$frags $host_makefile_frag" |
912e0732 | 557 | |
5436fc65 C |
558 | target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt |
559 | if test ! -f ${target_makefile_frag}; then | |
560 | AC_MSG_ERROR("*** Gdb does not support target ${target}") | |
912e0732 | 561 | fi |
5f107900 | 562 | frags="$frags $target_makefile_frag" |
912e0732 | 563 | |
5436fc65 C |
564 | AC_SUBST_FILE(host_makefile_frag) |
565 | AC_SUBST_FILE(target_makefile_frag) | |
5f107900 | 566 | AC_SUBST(frags) |
5436fc65 | 567 | |
094fd4ae C |
568 | changequote(,)dnl |
569 | hostfile=`sed -n ' | |
570 | s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p | |
571 | ' ${host_makefile_frag}` | |
5436fc65 | 572 | |
094fd4ae C |
573 | targetfile=`sed -n ' |
574 | s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p | |
575 | ' ${target_makefile_frag}` | |
79f68f0f DZ |
576 | |
577 | # these really aren't orthogonal true/false values of the same condition, | |
578 | # but shells are slow enough that I like to reuse the test conditions | |
579 | # whenever possible | |
5436fc65 | 580 | if test "${target}" = "${host}"; then |
094fd4ae C |
581 | nativefile=`sed -n ' |
582 | s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p | |
583 | ' ${host_makefile_frag}` | |
33ef0f93 | 584 | # else |
5436fc65 | 585 | # GDBserver is only useful in a "native" enviroment |
33ef0f93 | 586 | # configdirs=`echo $configdirs | sed 's/gdbserver//'` |
d40309c7 | 587 | fi |
094fd4ae | 588 | changequote([,]) |
d40309c7 | 589 | |
d40309c7 | 590 | # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile |
6573c898 | 591 | # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the |
d40309c7 JG |
592 | # corresponding links. But we have to remove the xm.h files and tm.h |
593 | # files anyway, e.g. when switching from "configure host" to | |
594 | # "configure none". | |
595 | ||
bdf3621b JG |
596 | files= |
597 | links= | |
dc0c3f64 | 598 | rm -f xm.h |
5436fc65 C |
599 | if test "${hostfile}" != ""; then |
600 | files="${files} config/${gdb_host_cpu}/${hostfile}" | |
601 | links="${links} xm.h" | |
bdf3621b | 602 | fi |
dc0c3f64 | 603 | rm -f tm.h |
5436fc65 C |
604 | if test "${targetfile}" != ""; then |
605 | files="${files} config/${gdb_target_cpu}/${targetfile}" | |
606 | links="${links} tm.h" | |
bdf3621b | 607 | fi |
1a0edbc7 | 608 | rm -f nm.h |
5436fc65 C |
609 | if test "${nativefile}" != ""; then |
610 | files="${files} config/${gdb_host_cpu}/${nativefile}" | |
611 | links="${links} nm.h" | |
c9c23412 | 612 | else |
5436fc65 C |
613 | # A cross-only configuration. |
614 | files="${files} config/nm-empty.h" | |
615 | links="${links} nm.h" | |
d40309c7 | 616 | fi |
d3d75ec9 | 617 | # start-sanitize-gdbtk |
99174711 | 618 | AC_PROG_LN_S |
5436fc65 | 619 | # Make it possible to use the GUI without doing a full install |
99174711 JM |
620 | if test "${enable_gdbtk}" = "yes" -a ! -d gdbtcl ; then |
621 | if test "$LN_S" = "ln -s" -a ! -f gdbtcl ; then | |
622 | echo linking $srcdir/gdbtcl to gdbtcl | |
623 | $LN_S $srcdir/gdbtcl gdbtcl | |
624 | else | |
625 | echo Warning: Unable to link $srcdir/gdbtcl to gdbtcl. You will need to do a | |
626 | echo " " make install before you are able to run the GUI. | |
627 | fi | |
754e5da2 | 628 | fi |
d3d75ec9 | 629 | # end-sanitize-gdbtk |
754e5da2 | 630 | |
5436fc65 C |
631 | AC_LINK_FILES($files, $links) |
632 | ||
98fa4ade GN |
633 | dnl Check for exe extension set on certain hosts (e.g. Win32) |
634 | AM_EXEEXT | |
635 | ||
5436fc65 | 636 | AC_CONFIG_SUBDIRS($configdirs) |
0cb7d01d | 637 | AC_OUTPUT(Makefile .gdbinit:gdbinit.in, |
5436fc65 C |
638 | [ |
639 | dnl Autoconf doesn't provide a mechanism for modifying definitions | |
640 | dnl provided by makefile fragments. | |
641 | dnl | |
642 | if test "${nativefile}" = ""; then | |
7bd1f0c5 | 643 | sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \ |
5436fc65 C |
644 | < Makefile > Makefile.tem |
645 | mv -f Makefile.tem Makefile | |
33bc979d SS |
646 | fi |
647 | ||
5436fc65 | 648 | changequote(,)dnl |
94d4b713 JK |
649 | sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/, |
650 | /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/, | |
651 | /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp | |
652 | mv -f Makefile.tmp Makefile | |
5436fc65 C |
653 | changequote([,])dnl |
654 | ||
31520669 | 655 | case x$CONFIG_HEADERS in |
18ea4416 | 656 | xconfig.h:config.in) |
31520669 FF |
657 | echo > stamp-h ;; |
658 | esac | |
0a5a1821 C |
659 | ], |
660 | [ | |
661 | gdb_host_cpu=$gdb_host_cpu | |
662 | gdb_target_cpu=$gdb_target_cpu | |
663 | nativefile=$nativefile | |
5436fc65 | 664 | ]) |
5e711e7f PS |
665 | |
666 | exit 0 | |
b7f3b6d5 | 667 |