| 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 |
| 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.5)dnl |
| 23 | AC_INIT(main.c) |
| 24 | AC_CONFIG_HEADER(config.h:config.in) |
| 25 | |
| 26 | AC_PROG_CC |
| 27 | AC_AIX |
| 28 | AC_MINIX |
| 29 | AC_ISC_POSIX |
| 30 | |
| 31 | DLLTOOL=${DLLTOOL-dlltool} |
| 32 | AC_SUBST(DLLTOOL) |
| 33 | |
| 34 | AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) |
| 35 | AC_CANONICAL_SYSTEM |
| 36 | |
| 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 | |
| 42 | dnl List of object files added by configure. |
| 43 | |
| 44 | CONFIG_OBS= |
| 45 | CONFIG_DEPS= |
| 46 | CONFIG_SRCS= |
| 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 | |
| 60 | AC_PROG_INSTALL |
| 61 | AC_CHECK_TOOL(AR, ar) |
| 62 | AC_CHECK_TOOL(RANLIB, ranlib, :) |
| 63 | AC_PROG_YACC |
| 64 | AC_PROG_AWK |
| 65 | |
| 66 | AC_ARG_PROGRAM |
| 67 | |
| 68 | AC_TYPE_SIGNAL |
| 69 | |
| 70 | AC_HEADER_STDC |
| 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) |
| 72 | AC_HEADER_STAT |
| 73 | |
| 74 | AC_C_CONST |
| 75 | |
| 76 | AC_CHECK_FUNCS(setpgid sbrk select poll sigaction) |
| 77 | AC_FUNC_ALLOCA |
| 78 | |
| 79 | # If we are configured native on GNU/Linux, work around problems with sys/procfs.h |
| 80 | if test "${target}" = "${host}"; then |
| 81 | case "${host}" in |
| 82 | i[[3456]]86-*-linux*) |
| 83 | AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2) |
| 84 | AC_DEFINE(sys_quotactl) |
| 85 | ;; |
| 86 | esac |
| 87 | fi |
| 88 | |
| 89 | AC_MSG_CHECKING([for gregset_t type]) |
| 90 | AC_CACHE_VAL(gdb_cv_have_gregset_t, |
| 91 | [AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0], |
| 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 |
| 95 | AC_DEFINE(HAVE_GREGSET_T) |
| 96 | fi |
| 97 | |
| 98 | AC_MSG_CHECKING([for fpregset_t type]) |
| 99 | AC_CACHE_VAL(gdb_cv_have_fpregset_t, |
| 100 | [AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0], |
| 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 |
| 104 | AC_DEFINE(HAVE_FPREGSET_T) |
| 105 | fi |
| 106 | |
| 107 | dnl See if host has libm. This is usually needed by simulators. |
| 108 | AC_CHECK_LIB(m, main) |
| 109 | |
| 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, |
| 114 | [AC_TRY_COMPILE(, [ |
| 115 | extern long long foo; |
| 116 | switch (foo & 2) { case 0: return 1; } |
| 117 | ], |
| 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 () { |
| 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)); |
| 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 | |
| 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 | |
| 151 | AC_MSG_CHECKING(for long double support in compiler) |
| 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 | |
| 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 | |
| 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 | |
| 198 | AC_FUNC_MMAP |
| 199 | |
| 200 | BFD_NEED_DECLARATION(malloc) |
| 201 | BFD_NEED_DECLARATION(realloc) |
| 202 | BFD_NEED_DECLARATION(free) |
| 203 | |
| 204 | BFD_NEED_DECLARATION(strerror) |
| 205 | |
| 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 | |
| 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 |
| 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" |
| 222 | CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c" |
| 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" |
| 236 | CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" |
| 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) |
| 257 | fi |
| 258 | |
| 259 | dnl Handle optional features that can be enabled. |
| 260 | ENABLE_CFLAGS= |
| 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 |
| 271 | CONFIG_OBS="${CONFIG_OBS} remote-nrom.o" |
| 272 | CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c" |
| 273 | fi |
| 274 | |
| 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) |
| 290 | AC_DEFINE(MMCHECK_FORCE) |
| 291 | MMALLOC_CFLAGS="-I$srcdir/../mmalloc" |
| 292 | MMALLOC='../mmalloc/libmmalloc.a' |
| 293 | fi |
| 294 | |
| 295 | # start-sanitize-gdbtk |
| 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 | |
| 306 | ENABLE_GDBTK= |
| 307 | |
| 308 | AC_ARG_ENABLE(gdbtk, |
| 309 | [ --enable-gdbtk ], |
| 310 | [case "${enableval}" in |
| 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 ;; |
| 316 | *windows*) |
| 317 | AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.]) |
| 318 | enable_gdbtk=no ;; |
| 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 | [ |
| 328 | # Default is on for everything but go32 and cygwin32 |
| 329 | case "$host" in |
| 330 | *go32* | *windows*) |
| 331 | ;; |
| 332 | *) |
| 333 | enable_gdbtk=yes ;; |
| 334 | esac |
| 335 | ]) |
| 336 | |
| 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 | |
| 349 | WINDRES=${WINDRES-windres} |
| 350 | AC_SUBST(WINDRES) |
| 351 | |
| 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" |
| 359 | |
| 360 | GDBTKLIBS= |
| 361 | if test "${enable_gdbtk}" = "yes"; then |
| 362 | |
| 363 | CY_AC_PATH_TCLCONFIG |
| 364 | if test -z "${no_tcl}"; then |
| 365 | CY_AC_LOAD_TCLCONFIG |
| 366 | CY_AC_PATH_TKCONFIG |
| 367 | |
| 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 |
| 374 | CY_AC_PATH_ITCLH |
| 375 | CY_AC_PATH_TIX |
| 376 | |
| 377 | # now look for tix library stuff |
| 378 | TIXVERSION=4.1.8.0 |
| 379 | . ${ac_cv_c_tclconfig}/tclConfig.sh |
| 380 | case "${host}" in |
| 381 | *-*-cygwin32*) |
| 382 | tixdir=../tix/win/tcl8.0 |
| 383 | ;; |
| 384 | *) |
| 385 | tixdir=../tix/unix/tk8.0 |
| 386 | ;; |
| 387 | esac |
| 388 | if test "${TCL_SHARED_BUILD}" = "1"; then |
| 389 | TIX_LIB_EXT="${TCL_SHLIB_SUFFIX}" |
| 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 | |
| 398 | else |
| 399 | TIX_LIB_EXT=".a" |
| 400 | fi |
| 401 | |
| 402 | if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then |
| 403 | TIXLIB="-L${tixdir} -ltix${TIXVERSION}" |
| 404 | TIX_DEPS="${tixdir}/libtix${TIXVERSION}${TIX_LIB_EXT}" |
| 405 | else |
| 406 | TIXLIB="-L${tixdir} -ltix`echo ${TIXVERSION} | tr -d .`" |
| 407 | TIX_DEPS="${tixdir}/libtix`echo ${TIXVERSION} | tr -d .`${TIX_LIB_EXT}" |
| 408 | fi |
| 409 | |
| 410 | ENABLE_GDBTK=1 |
| 411 | |
| 412 | # Include some libraries that Tcl and Tk want. |
| 413 | if test "${enable_ide}" = "yes"; then |
| 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)' |
| 416 | else |
| 417 | TCL_LIBS='$(LIBGUI) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)' |
| 418 | CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)' |
| 419 | fi |
| 420 | # Yes, the ordering seems wrong here. But it isn't. |
| 421 | # TK_LIBS is the list of libraries that need to be linked |
| 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}" |
| 426 | CONFIG_OBS="${CONFIG_OBS} gdbtk.o" |
| 427 | |
| 428 | if test x$gdb_cv_os_cygwin32 = xyes; then |
| 429 | WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32 -luser32" |
| 430 | WIN32LDAPP="-Wl,--subsystem,windows" |
| 431 | CONFIG_OBS="${CONFIG_OBS} gdbres.o" |
| 432 | fi |
| 433 | fi |
| 434 | fi |
| 435 | fi |
| 436 | |
| 437 | AC_SUBST(ENABLE_GDBTK) |
| 438 | AC_SUBST(X_CFLAGS) |
| 439 | AC_SUBST(X_LDFLAGS) |
| 440 | AC_SUBST(X_LIBS) |
| 441 | AC_SUBST(TIXLIB) |
| 442 | AC_SUBST(TIX_DEPS) |
| 443 | AC_SUBST(GDBTKLIBS) |
| 444 | # end-sanitize-gdbtk |
| 445 | |
| 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], |
| 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 |
| 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 |
| 475 | # end-sanitize-sky |
| 476 | |
| 477 | AC_SUBST(ENABLE_CFLAGS) |
| 478 | |
| 479 | AC_SUBST(CONFIG_OBS) |
| 480 | AC_SUBST(CONFIG_DEPS) |
| 481 | AC_SUBST(CONFIG_SRCS) |
| 482 | |
| 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 | ;; |
| 505 | *-*-linux* | *-pc-linux-gnu) |
| 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 | : |
| 530 | elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then |
| 531 | : |
| 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 | |
| 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) |
| 550 | |
| 551 | frags= |
| 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}") |
| 555 | fi |
| 556 | frags="$frags $host_makefile_frag" |
| 557 | |
| 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}") |
| 561 | fi |
| 562 | frags="$frags $target_makefile_frag" |
| 563 | |
| 564 | AC_SUBST_FILE(host_makefile_frag) |
| 565 | AC_SUBST_FILE(target_makefile_frag) |
| 566 | AC_SUBST(frags) |
| 567 | |
| 568 | changequote(,)dnl |
| 569 | hostfile=`sed -n ' |
| 570 | s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p |
| 571 | ' ${host_makefile_frag}` |
| 572 | |
| 573 | targetfile=`sed -n ' |
| 574 | s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p |
| 575 | ' ${target_makefile_frag}` |
| 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 |
| 580 | if test "${target}" = "${host}"; then |
| 581 | nativefile=`sed -n ' |
| 582 | s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p |
| 583 | ' ${host_makefile_frag}` |
| 584 | # else |
| 585 | # GDBserver is only useful in a "native" enviroment |
| 586 | # configdirs=`echo $configdirs | sed 's/gdbserver//'` |
| 587 | fi |
| 588 | changequote([,]) |
| 589 | |
| 590 | # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile |
| 591 | # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the |
| 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 | |
| 596 | files= |
| 597 | links= |
| 598 | rm -f xm.h |
| 599 | if test "${hostfile}" != ""; then |
| 600 | files="${files} config/${gdb_host_cpu}/${hostfile}" |
| 601 | links="${links} xm.h" |
| 602 | fi |
| 603 | rm -f tm.h |
| 604 | if test "${targetfile}" != ""; then |
| 605 | files="${files} config/${gdb_target_cpu}/${targetfile}" |
| 606 | links="${links} tm.h" |
| 607 | fi |
| 608 | rm -f nm.h |
| 609 | if test "${nativefile}" != ""; then |
| 610 | files="${files} config/${gdb_host_cpu}/${nativefile}" |
| 611 | links="${links} nm.h" |
| 612 | else |
| 613 | # A cross-only configuration. |
| 614 | files="${files} config/nm-empty.h" |
| 615 | links="${links} nm.h" |
| 616 | fi |
| 617 | # start-sanitize-gdbtk |
| 618 | AC_PROG_LN_S |
| 619 | # Make it possible to use the GUI without doing a full install |
| 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 |
| 628 | fi |
| 629 | # end-sanitize-gdbtk |
| 630 | |
| 631 | AC_LINK_FILES($files, $links) |
| 632 | |
| 633 | dnl Check for exe extension set on certain hosts (e.g. Win32) |
| 634 | AM_EXEEXT |
| 635 | |
| 636 | AC_CONFIG_SUBDIRS($configdirs) |
| 637 | AC_OUTPUT(Makefile .gdbinit:gdbinit.in, |
| 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 |
| 643 | sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \ |
| 644 | < Makefile > Makefile.tem |
| 645 | mv -f Makefile.tem Makefile |
| 646 | fi |
| 647 | |
| 648 | changequote(,)dnl |
| 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 |
| 653 | changequote([,])dnl |
| 654 | |
| 655 | case x$CONFIG_HEADERS in |
| 656 | xconfig.h:config.in) |
| 657 | echo > stamp-h ;; |
| 658 | esac |
| 659 | ], |
| 660 | [ |
| 661 | gdb_host_cpu=$gdb_host_cpu |
| 662 | gdb_target_cpu=$gdb_target_cpu |
| 663 | nativefile=$nativefile |
| 664 | ]) |
| 665 | |
| 666 | exit 0 |
| 667 | |