1 dnl Autoconf configure script for GDB, the GNU debugger.
2 dnl Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
4 dnl This file is part of GDB.
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.
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.
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.
20 dnl Process this file with autoconf to produce a configure script.
24 AC_CONFIG_HEADER(config.h:config.in)
31 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
34 dnl gdb doesn't use gettext, but bfd does. We call this to ensure we
35 dnl link with the correct libraries.
39 dnl List of object files added by configure.
45 configdirs="doc testsuite"
50 . ${srcdir}/configure.host
52 . ${srcdir}/configure.tgt
59 AC_CHECK_TOOL(RANLIB, ranlib, :)
68 AC_CHECK_HEADERS(ctype.h curses.h endian.h libintl.h link.h \
69 memory.h objlist.h ptrace.h sgtty.h stddef.h stdlib.h \
70 string.h sys/procfs.h sys/ptrace.h sys/reg.h \
71 term.h termio.h termios.h unistd.h wait.h sys/wait.h \
72 wchar.h wctype.h asm/debugreg.h)
77 AC_CHECK_FUNCS(setpgid sbrk sigaction isascii bzero bcopy btowc)
80 BFD_NEED_DECLARATION(malloc)
81 BFD_NEED_DECLARATION(realloc)
82 BFD_NEED_DECLARATION(free)
83 BFD_NEED_DECLARATION(strerror)
84 BFD_NEED_DECLARATION(strdup)
86 # If we are configured native on GNU/Linux, work around problems with sys/procfs.h
87 if test "${target}" = "${host}"; then
90 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2)
91 AC_DEFINE(sys_quotactl)
96 AC_MSG_CHECKING([for gregset_t type])
97 AC_CACHE_VAL(gdb_cv_have_gregset_t,
98 [AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0],
99 gdb_cv_have_gregset_t=yes, gdb_cv_have_gregset_t=no)])
100 AC_MSG_RESULT($gdb_cv_have_gregset_t)
101 if test $gdb_cv_have_gregset_t = yes; then
102 AC_DEFINE(HAVE_GREGSET_T)
105 AC_MSG_CHECKING([for fpregset_t type])
106 AC_CACHE_VAL(gdb_cv_have_fpregset_t,
107 [AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0],
108 gdb_cv_have_fpregset_t=yes, gdb_cv_have_fpregset_t=no)])
109 AC_MSG_RESULT($gdb_cv_have_fpregset_t)
110 if test $gdb_cv_have_fpregset_t = yes; then
111 AC_DEFINE(HAVE_FPREGSET_T)
114 dnl See if host has libm. This is usually needed by simulators.
115 AC_CHECK_LIB(m, main)
117 dnl Solaris puts wctype in /usr/lib/libw.a before Solaris 2.6.
119 dnl A bug in GNU ld 2.9.1 causes a problem if we link in -lw
120 dnl under Solaris 2.6 because it is some funky empty library.
121 dnl So only link in libw if we have to.
122 AC_CHECK_LIB(c, wctype,: ,AC_CHECK_LIB(w, wctype))
124 dnl Figure out which term library to use.
126 AC_CHECK_LIB(ncurses, tgetent, TERM_LIB=-lncurses,
127 AC_CHECK_LIB(termlib, tgetent, TERM_LIB=-ltermlib,
128 AC_CHECK_LIB(termcap, tgetent, TERM_LIB=-ltermcap,
129 AC_CHECK_LIB(curses, tgetent, TERM_LIB=-lcurses,
130 AC_CHECK_LIB(terminfo, tgetent, TERM_LIB=-lterminfo)))))
132 if test "x$TERM_LIB" = x
134 AC_MSG_ERROR(Could not find a term library, e.g. termcap or termlib!)
139 dnl See if compiler supports "long long" type.
141 AC_MSG_CHECKING(for long long support in compiler)
142 AC_CACHE_VAL(gdb_cv_c_long_long,
144 extern long long foo;
145 switch (foo & 2) { case 0: return 1; }
147 gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
148 AC_MSG_RESULT($gdb_cv_c_long_long)
149 if test $gdb_cv_c_long_long = yes; then
150 AC_DEFINE(CC_HAS_LONG_LONG)
153 dnl See if the compiler and runtime support printing long long
155 AC_MSG_CHECKING(for long long support in printf)
156 AC_CACHE_VAL(gdb_cv_printf_has_long_long,
161 l = (l << 16) + 0x0123;
162 l = (l << 16) + 0x4567;
163 l = (l << 16) + 0x89ab;
164 l = (l << 16) + 0xcdef;
165 sprintf (buf, "0x%016llx", l);
166 return (strcmp ("0x0123456789abcdef", buf));
168 gdb_cv_printf_has_long_long=yes,
169 gdb_cv_printf_has_long_long=no,
170 gdb_cv_printf_has_long_long=no)])
171 if test $gdb_cv_printf_has_long_long = yes; then
172 AC_DEFINE(PRINTF_HAS_LONG_LONG)
174 AC_MSG_RESULT($gdb_cv_printf_has_long_long)
176 dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
177 dnl because autoconf complains about cross-compilation issues. However, this
178 dnl code uses the same variables as the macro for compatibility.
180 AC_MSG_CHECKING(for long double support in compiler)
181 AC_CACHE_VAL(ac_cv_c_long_double,
182 [AC_TRY_COMPILE(, [long double foo;],
183 ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
184 AC_MSG_RESULT($ac_cv_c_long_double)
185 if test $ac_cv_c_long_double = yes; then
186 AC_DEFINE(HAVE_LONG_DOUBLE)
189 dnl See if the compiler and runtime support printing long doubles
191 AC_MSG_CHECKING(for long double support in printf)
192 AC_CACHE_VAL(gdb_cv_printf_has_long_double,
196 long double f = 3.141592653;
197 sprintf (buf, "%Lg", f);
198 return (strncmp ("3.14159", buf, 7));
200 gdb_cv_printf_has_long_double=yes,
201 gdb_cv_printf_has_long_double=no,
202 gdb_cv_printf_has_long_double=no)])
203 if test $gdb_cv_printf_has_long_double = yes; then
204 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
206 AC_MSG_RESULT($gdb_cv_printf_has_long_double)
208 dnl See if the compiler and runtime support scanning long doubles
210 AC_MSG_CHECKING(for long double support in scanf)
211 AC_CACHE_VAL(gdb_cv_scanf_has_long_double,
214 char *buf = "3.141592653";
216 sscanf (buf, "%Lg", &f);
217 return !(f > 3.14159 && f < 3.14160);
219 gdb_cv_scanf_has_long_double=yes,
220 gdb_cv_scanf_has_long_double=no,
221 gdb_cv_scanf_has_long_double=no)])
222 if test $gdb_cv_scanf_has_long_double = yes; then
223 AC_DEFINE(SCANF_HAS_LONG_DOUBLE)
225 AC_MSG_RESULT($gdb_cv_scanf_has_long_double)
229 dnl See if thread_db library is around for Solaris thread debugging. Note that
230 dnl we must explicitly test for version 1 of the library because version 0
231 dnl (present on Solaris 2.4 or earlier) doesn't have the same API.
233 dnl Note that we only want this if we are both native (host == target), and
234 dnl not doing a canadian cross build (build == host).
236 if test ${build} = ${host} -a ${host} = ${target} ; then
239 AC_MSG_CHECKING(for HPUX/OSF thread support)
240 if test -f /usr/include/dce/cma_config.h ; then
241 if test "$GCC" = "yes" ; then
243 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
244 CONFIG_OBS="${CONFIG_OJS} hpux-thread.o"
245 CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
247 AC_MSG_RESULT(no (suppressed because you are not using GCC))
254 AC_MSG_CHECKING(for Solaris thread debugging library)
255 if test -f /usr/lib/libthread_db.so.1 ; then
257 AC_DEFINE(HAVE_THREAD_DB_LIB)
258 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
259 CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
260 AC_CHECK_LIB(dl, dlopen)
261 if test "$GCC" = "yes" ; then
262 # The GNU linker requires the -export-dynamic option to make
263 # all symbols visible in the dynamic symbol table.
264 hold_ldflags=$LDFLAGS
265 AC_MSG_CHECKING(for the ld -export-dynamic flag)
266 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
267 AC_TRY_LINK(, [int i;], found=yes, found=no)
268 LDFLAGS=$hold_ldflags
269 AC_MSG_RESULT($found)
270 if test $found = yes; then
271 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
274 # Sun randomly tweaked the prototypes in <proc_service.h>
276 AC_MSG_CHECKING(if <proc_service.h> is old)
277 AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
279 #include <proc_service.h>
281 (struct ps_prochandle*, psaddr_t, const void*, size_t);
282 ],, gdb_cv_proc_service_is_old=no,
283 gdb_cv_proc_service_is_old=yes)
285 AC_MSG_RESULT($gdb_cv_proc_service_is_old)
286 if test $gdb_cv_proc_service_is_old = yes; then
287 AC_DEFINE(PROC_SERVICE_IS_OLD)
294 AC_SUBST(CONFIG_LDFLAGS)
297 dnl Handle optional features that can be enabled.
301 [ --enable-tui Enable full-screen terminal user interface],
303 case "${enable_tui}" in
305 "") enable_tui=yes ;;
307 AC_MSG_ERROR(Bad value for --enable-tui: ${enableval})
311 case ${enable_tui} in
315 TUI_LIBRARY=tui/libtui.a
323 AC_SUBST(TUI_LIBRARY)
325 AC_ARG_ENABLE(netrom,
326 [ --enable-netrom Enable NetROM support],
327 [case "${enableval}" in
328 yes) enable_netrom=yes ;;
329 no) enable_netrom=no ;;
330 *) AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;;
333 if test "${enable_netrom}" = "yes"; then
334 CONFIG_OBS="${CONFIG_OBS} remote-nrom.o"
335 CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c"
338 AC_ARG_ENABLE(build-warnings,
339 [ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
340 [build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
341 case "${enableval}" in
343 no) build_warnings="-w";;
344 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
345 build_warnings="${build_warnings} ${t}";;
346 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
347 build_warnings="${t} ${build_warnings}";;
348 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
349 esac],[build_warnings=""])dnl
351 if test "x${build_warnings}" != x -a "x$GCC" = xyes
353 WARN_CFLAGS="${build_warnings}"
357 AC_SUBST(WARN_CFLAGS)
361 AC_SUBST(MMALLOC_CFLAGS)
365 [ --with-mmalloc Use memory mapped malloc package],
366 [case "${withval}" in
367 yes) want_mmalloc=true ;;
368 no) want_mmalloc=false;;
369 *) AC_MSG_ERROR(bad value ${withval} for GDB with-mmalloc option) ;;
370 esac],[want_mmalloc=false])dnl
372 if test x$want_mmalloc = xtrue; then
373 AC_DEFINE(USE_MMALLOC)
374 AC_DEFINE(MMCHECK_FORCE)
375 MMALLOC_CFLAGS="-I$srcdir/../mmalloc"
376 MMALLOC='../mmalloc/libmmalloc.a'
379 # start-sanitize-carp
380 # The below takes an educated guess at the targets that
381 # should be built. It is an interum version that provides
382 # significant backward compatibility.
385 [ --enable-carp Configure alternative readaptive paradigm ],
386 [case "${enableval}" in
387 yes) enable_carp=yes ;;
388 no) enable_carp=no ;;
389 *) AC_MSG_ERROR([bad value ${enableval} for carp option]) ;;
390 esac],[enable_carp=no])dnl
392 AC_ARG_ENABLE(targets,
393 [ --enable-targets alternative target configurations],
394 [case "${enableval}" in
395 yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
397 no) enable_targets= ;;
398 *) enable_targets="$enableval" ;;
401 # Canonicalize the secondary target names.
403 if test -n "$enable_targets" ; then
404 if test "$enable_targets" = all ; then
407 for targ in `echo $enable_targets | sed 's/,/ /g'`
409 result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
410 if test -n "$result" ; then
411 canon_targets="$canon_targets $result"
417 # Convert the target names into GDB [*]-tdep.c names
420 for targ in $target $canon_targets
422 if test "x$targ" = "xall" ; then
425 t_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
426 t_vendor=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
427 t_os=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
431 target_vendor=$t_vendor
433 . ${srcdir}/configure.tgt
434 echo ${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt`
435 if test -r ${mt} ; then
436 # This gets confused over .mt files that have multiple -tdep.o
438 s/^.*[ =]\([^ ]*\)-tdep.o.*/\1/p
440 selarchs="$selarchs $tdep"
446 # We don't do any links based on the target system, just makefile config.
448 if test x${all_targets} = xfalse ; then
450 # Target architecture .o files.
453 for arch in $selarchs
455 archdefs="$archdefs -DARCH_$arch"
456 ta="$ta ${arch}-tdep.o"
459 dvp) ta="$ta mips-tdep.o dvp-tdep.o" ;;
463 # Weed out duplicate .o files.
473 # And duplicate -D flags.
475 for i in $archdefs ; do
485 else # all_targets is true
487 MACHINE_OBS='$(ALL_MACHINES)'
490 dnl Don't define an archdefs list
491 dnl AC_SUBST(archdefs)
492 dnl XXXX this name will change several more times
493 if test "${enable_carp}" = yes ; then
497 MACHINE_OBS="# $MACHINE_OBS"
499 AC_SUBST(MACHINE_OBS)
502 # start-sanitize-gdbtk
505 AC_ARG_ENABLE(ide, [ --enable-ide Enable IDE support])
506 if test "$enable_ide" = yes; then
514 AC_ARG_WITH(foundry-libs,
515 [ --with-foundry-libs=DIR Use the Foundry SDK in DIR],
516 [FOUNDRY_LIB_BASE=${withval}])
517 AC_SUBST(FOUNDRY_LIB_BASE)
520 # This is the Foundry SDK
522 # These variables are used to determine where the Foundry libs and
523 # header files are located.
525 if test "$FOUNDRY_LIB_BASE" != ""; then
526 LIBGUI="${FOUNDRY_LIB_BASE}/lib/libgui.a"
527 GUI_CFLAGS_X="-I${FOUNDRY_LIB_BASE}/include"
528 if test x$enable_ide = xyes; then
529 IDE_CFLAGS_X="-I${FOUNDRY_LIB_BASE}/include -DIDE"
530 IDE_X="-L${FOUNDRY_LIB_BASE}/lib -lilu-Tk -lilu-c -lilu"
532 IDE_CFLAGS_X="-I${FOUNDRY_LIB_BASE}/include"
534 LIBIDETCL="${FOUNDRY_LIB_BASE}/lib/libidetcl.a"
535 LIBIDE="${FOUNDRY_LIB_BASE}/lib/libide.a"
536 IDE_DEPS="${FOUNDRY_LIB_BASE}/lib/libilu-Tk.a ${FOUNDRY_LIB_BASE}/lib/libilu-c.a ${FOUNDRY_LIB_BASE}/lib/libilu.a"
539 LIBGUI="../libgui/src/libgui.a"
540 GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
542 if test x$enable_ide = xyes; then
543 IDE_CFLAGS_X="-I${srcdir}/../libidetcl/src -I${srcdir}/../libide/src -DIDE -I${srcdir}/../ilu/runtime/mainloop"
544 IDE_X="-L../ilu/runtime/mainloop -lilu-Tk -L../ilu/runtime/c -lilu-c -L../ilu/runtime/kernel -lilu"
546 IDE_CFLAGS_X="-I${srcdir}/../libidetcl/src -I${srcdir}/../libide/src"
548 LIBIDETCL="../libidetcl/src/libidetcl.a"
549 LIBIDE="../libide/src/libide.a"
550 IDE_DEPS="../ilu/runtime/mainloop/libilu-Tk.a ../ilu/runtime/c/libilu-c.a ../ilu/runtime/kernel/libilu.a"
555 AC_SUBST(GUI_CFLAGS_X)
557 AC_SUBST(IDE_CFLAGS_X)
567 [ --enable-gdbtk Enable GDBTK GUI front end],
568 [case "${enableval}" in
572 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
575 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
583 AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
586 # Default is on for everything but go32 and Cygwin
595 # In the Cygwin environment, we need some additional flags.
596 AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
597 [AC_EGREP_CPP(lose, [
600 #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
607 DLLTOOL=${DLLTOOL-dlltool}
608 WINDRES=${WINDRES-windres}
612 if test x$gdb_cv_os_cygwin = xyes; then
614 if test x$enable_ide = xyes; then
615 WIN32LIBS="$WIN32LIBS -ladvapi32"
622 if test "${enable_gdbtk}" = "yes"; then
625 if test -z "${no_tcl}"; then
629 # If $no_tk is nonempty, then we can't do Tk, and there is no
630 # point to doing Tcl.
631 if test -z "${no_tk}"; then
639 # now look for Itcl library stuff
641 CY_AC_PATH_ITCLCONFIG
642 if test -z "${no_itcl}"; then
643 CY_AC_LOAD_ITCLCONFIG
646 itcldir=../itcl/itcl/win/
649 itcldir=../itcl/itcl/unix/
654 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
655 ITCL_DEPS="${itcldir}${ITCL_LIB_FILE}"
659 # now look for Itk library stuff
661 if test -z "${no_itcl}"; then
666 itkdir=../itcl/itk/win/
669 itkdir=../itcl/itk/unix/
673 ITKLIB="${ITK_BUILD_LIB_SPEC}"
674 ITK_DEPS="${itkdir}${ITK_LIB_FILE}"
677 # now look for tix library stuff
679 . ${ac_cv_c_tclconfig}/tclConfig.sh
682 tixdir=../tix/win/tcl8.0
685 tixdir=../tix/unix/tk8.0
688 if test "${TCL_SHARED_BUILD}" = "1"; then
689 TIX_LIB_EXT="${TCL_SHLIB_SUFFIX}"
691 # Can't win them all: SunOS 4 (others?) appends a version
692 # number after the ".so"
695 TIX_LIB_EXT="${TIX_LIB_EXT}.1.0" ;;
702 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
703 TIXLIB="-L${tixdir} -ltix${TIXVERSION}"
704 TIX_DEPS="${tixdir}/libtix${TIXVERSION}${TIX_LIB_EXT}"
706 TIXLIB="-L${tixdir} -ltix`echo ${TIXVERSION} | tr -d .`"
707 TIX_DEPS="${tixdir}/libtix`echo ${TIXVERSION} | tr -d .`${TIX_LIB_EXT}"
711 ENABLE_CFLAGS="${ENABLE_CFLAGS} -DGDBTK"
713 # Include some libraries that Tcl and Tk want.
714 if test "${enable_ide}" = "yes"; then
715 TCL_LIBS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
716 CONFIG_DEPS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE_DEPS) $(ITCL_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
718 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
719 CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(ITK_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
721 # Yes, the ordering seems wrong here. But it isn't.
722 # TK_LIBS is the list of libraries that need to be linked
723 # after Tcl/Tk. Note that this isn't put into LIBS. If it
724 # were in LIBS then any link tests after this point would
725 # try to include things like `$(LIBGUI)', which wouldn't work.
726 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
727 CONFIG_OBS="${CONFIG_OBS} gdbtk.o gdbtk-cmds.o gdbtk-hooks.o gdbtk-variable.o gdbtk-wrapper.o"
729 if test x$gdb_cv_os_cygwin = xyes; then
730 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
731 WIN32LDAPP="-Wl,--subsystem,console"
732 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
738 AC_SUBST(ENABLE_GDBTK)
753 # Enable GPU2 library for MIPS simulator
754 AC_ARG_WITH(sim-gpu2,
755 [ --with-sim-gpu2=DIR Use GPU2 library under given DIR],
758 if test -d "${withval}"
760 if test x${x_libraries} != x
762 LIBS="${LIBS} -L${withval}/lib -lgpu2 -L${x_libraries} -lX11 -lXext -lm"
764 LIBS="${LIBS} -L${withval}/lib -lgpu2 -lX11 -lXext -lm"
767 AC_MSG_WARN([Directory ${withval} does not exist.])
769 *) AC_MSG_WARN([--with-sim-gpu2 option invalid for target ${target}])
772 # Enable target accurate FP library
773 AC_ARG_WITH(sim-funit,
774 [ --with-sim-funit=DIR Use target FP lib under given DIR],
777 if test -d "${withval}"
779 LIBS="${LIBS} -L${withval}/lib -lfunit"
781 AC_MSG_WARN([Directory ${withval} does not exist.])
783 *) AC_MSG_WARN([--with-sim-funit option invalid for target ${target}])
787 AC_SUBST(ENABLE_CFLAGS)
790 AC_SUBST(CONFIG_DEPS)
791 AC_SUBST(CONFIG_SRCS)
793 # Begin stuff to support --enable-shared
794 AC_ARG_ENABLE(shared,
795 [ --enable-shared Use shared libraries],
796 [case "${enableval}" in
804 # If we have shared libraries, try to set rpath reasonably.
805 if test "${shared}" = "true"; then
808 HLDFLAGS='-Wl,+s,+b,$(libdir)'
810 *-*-irix5* | *-*-irix6*)
811 HLDFLAGS='-Wl,-rpath,$(libdir)'
815 *-*-linux* | *-pc-linux-gnu)
816 HLDFLAGS='-Wl,-rpath,$(libdir)'
819 HLDFLAGS='-R $(libdir)'
822 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;'
827 # On SunOS, if the linker supports the -rpath option, use it to
828 # prevent ../bfd and ../opcodes from being included in the run time
832 echo 'main () { }' > conftest.c
833 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
834 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
836 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
838 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
840 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
842 elif test "${shared}" = "true"; then
843 HLDFLAGS='-Wl,-rpath=$(libdir)'
845 HLDFLAGS='-Wl,-rpath='
847 rm -f conftest.t conftest.c conftest
852 # End stuff to support --enable-shared
854 # target_subdir is used by the testsuite to find the target libraries.
856 if test "${host}" != "${target}"; then
857 target_subdir="${target_alias}/"
859 AC_SUBST(target_subdir)
862 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
863 if test ! -f ${host_makefile_frag}; then
864 AC_MSG_ERROR("*** Gdb does not support host ${host}")
866 frags="$frags $host_makefile_frag"
868 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
869 if test ! -f ${target_makefile_frag}; then
870 AC_MSG_ERROR("*** Gdb does not support target ${target}")
872 frags="$frags $target_makefile_frag"
874 AC_SUBST_FILE(host_makefile_frag)
875 AC_SUBST_FILE(target_makefile_frag)
880 s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
881 ' ${host_makefile_frag}`
884 s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
885 ' ${target_makefile_frag}`
887 # these really aren't orthogonal true/false values of the same condition,
888 # but shells are slow enough that I like to reuse the test conditions
890 if test "${target}" = "${host}"; then
892 s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
893 ' ${host_makefile_frag}`
895 # GDBserver is only useful in a "native" enviroment
896 # configdirs=`echo $configdirs | sed 's/gdbserver//'`
900 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
901 # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
902 # corresponding links. But we have to remove the xm.h files and tm.h
903 # files anyway, e.g. when switching from "configure host" to
909 if test "${hostfile}" != ""; then
910 files="${files} config/${gdb_host_cpu}/${hostfile}"
911 links="${links} xm.h"
914 if test "${targetfile}" != ""; then
915 files="${files} config/${gdb_target_cpu}/${targetfile}"
916 links="${links} tm.h"
919 if test "${nativefile}" != ""; then
920 files="${files} config/${gdb_host_cpu}/${nativefile}"
921 links="${links} nm.h"
923 # A cross-only configuration.
924 files="${files} config/nm-empty.h"
925 links="${links} nm.h"
927 # start-sanitize-gdbtk
929 # Make it possible to use the GUI without doing a full install
930 if test "${enable_gdbtk}" = "yes" -a ! -d gdbtcl2 ; then
931 if test "$LN_S" = "ln -s" -a ! -f gdbtcl2 ; then
932 echo linking $srcdir/gdbtcl2 to gdbtcl2
933 $LN_S $srcdir/gdbtcl2 gdbtcl2
935 echo Warning: Unable to link $srcdir/gdbtcl2 to gdbtcl2. You will need to do a
936 echo " " make install before you are able to run the GUI.
941 AC_LINK_FILES($files, $links)
943 dnl Check for exe extension set on certain hosts (e.g. Win32)
946 AC_CONFIG_SUBDIRS($configdirs)
947 AC_OUTPUT(Makefile tui/Makefile .gdbinit:gdbinit.in,
949 dnl Autoconf doesn't provide a mechanism for modifying definitions
950 dnl provided by makefile fragments.
952 if test "${nativefile}" = ""; then
953 sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
954 < Makefile > Makefile.tem
955 mv -f Makefile.tem Makefile
959 sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
960 /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
961 /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
962 mv -f Makefile.tmp Makefile
965 case x$CONFIG_HEADERS in
971 gdb_host_cpu=$gdb_host_cpu
972 gdb_target_cpu=$gdb_target_cpu
973 nativefile=$nativefile