1 dnl Autoconf configure script for GDB, the GNU debugger.
2 dnl Copyright 1995, 1996 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 DLLTOOL=${DLLTOOL-dlltool}
34 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
37 dnl List of object files added by configure.
43 configdirs="doc testsuite"
48 . ${srcdir}/configure.host
50 . ${srcdir}/configure.tgt
57 AC_CHECK_TOOL(RANLIB, ranlib, :)
66 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)
71 AC_CHECK_FUNCS(setpgid sbrk select poll sigaction)
73 # If we are configured native on GNU/Linux, work around problems with sys/procfs.h
74 if test "${target}" = "${host}"; then
77 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2)
78 AC_DEFINE(sys_quotactl)
83 AC_MSG_CHECKING([for gregset_t type])
84 AC_CACHE_VAL(gdb_cv_have_gregset_t,
85 [AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0],
86 gdb_cv_have_gregset_t=yes, gdb_cv_have_gregset_t=no)])
87 AC_MSG_RESULT($gdb_cv_have_gregset_t)
88 if test $gdb_cv_have_gregset_t = yes; then
89 AC_DEFINE(HAVE_GREGSET_T)
92 AC_MSG_CHECKING([for fpregset_t type])
93 AC_CACHE_VAL(gdb_cv_have_fpregset_t,
94 [AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0],
95 gdb_cv_have_fpregset_t=yes, gdb_cv_have_fpregset_t=no)])
96 AC_MSG_RESULT($gdb_cv_have_fpregset_t)
97 if test $gdb_cv_have_fpregset_t = yes; then
98 AC_DEFINE(HAVE_FPREGSET_T)
101 dnl See if host has libm. This is usually needed by simulators.
102 AC_CHECK_LIB(m, main)
104 dnl See if compiler supports "long long" type.
106 AC_MSG_CHECKING(for long long support in compiler)
107 AC_CACHE_VAL(gdb_cv_c_long_long,
109 extern long long foo;
110 switch (foo & 2) { case 0: return 1; }
112 gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
113 AC_MSG_RESULT($gdb_cv_c_long_long)
114 if test $gdb_cv_c_long_long = yes; then
115 AC_DEFINE(CC_HAS_LONG_LONG)
118 dnl See if the compiler and runtime support printing long long
120 AC_MSG_CHECKING(for long long support in printf)
121 AC_CACHE_VAL(gdb_cv_printf_has_long_long,
126 l = (l << 16) + 0x0123;
127 l = (l << 16) + 0x4567;
128 l = (l << 16) + 0x89ab;
129 l = (l << 16) + 0xcdef;
130 sprintf (buf, "0x%016llx", l);
131 return (strcmp ("0x0123456789abcdef", buf));
133 gdb_cv_printf_has_long_long=yes,
134 gdb_cv_printf_has_long_long=no,
135 gdb_cv_printf_has_long_long=no)])
136 if test $gdb_cv_printf_has_long_long = yes; then
137 AC_DEFINE(PRINTF_HAS_LONG_LONG)
139 AC_MSG_RESULT($gdb_cv_printf_has_long_long)
141 dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
142 dnl because autoconf complains about cross-compilation issues. However, this
143 dnl code uses the same variables as the macro for compatibility.
145 AC_MSG_CHECKING(for long double support in compiler)
146 AC_CACHE_VAL(ac_cv_c_long_double,
147 [AC_TRY_COMPILE(, [long double foo;],
148 ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
149 AC_MSG_RESULT($ac_cv_c_long_double)
150 if test $ac_cv_c_long_double = yes; then
151 AC_DEFINE(HAVE_LONG_DOUBLE)
154 dnl See if the compiler and runtime support printing long doubles
156 AC_MSG_CHECKING(for long double support in printf)
157 AC_CACHE_VAL(gdb_cv_printf_has_long_double,
161 long double f = 3.141592653;
162 sprintf (buf, "%Lg", f);
163 return (strncmp ("3.14159", buf, 7));
165 gdb_cv_printf_has_long_double=yes,
166 gdb_cv_printf_has_long_double=no,
167 gdb_cv_printf_has_long_double=no)])
168 if test $gdb_cv_printf_has_long_double = yes; then
169 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
171 AC_MSG_RESULT($gdb_cv_printf_has_long_double)
173 dnl See if the compiler and runtime support scanning long doubles
175 AC_MSG_CHECKING(for long double support in scanf)
176 AC_CACHE_VAL(gdb_cv_scanf_has_long_double,
179 char *buf = "3.141592653";
181 sscanf (buf, "%Lg", &f);
182 return !(f > 3.14159 && f < 3.14160);
184 gdb_cv_scanf_has_long_double=yes,
185 gdb_cv_scanf_has_long_double=no,
186 gdb_cv_scanf_has_long_double=no)])
187 if test $gdb_cv_scanf_has_long_double = yes; then
188 AC_DEFINE(SCANF_HAS_LONG_DOUBLE)
190 AC_MSG_RESULT($gdb_cv_scanf_has_long_double)
194 BFD_NEED_DECLARATION(malloc)
195 BFD_NEED_DECLARATION(realloc)
196 BFD_NEED_DECLARATION(free)
198 dnl See if thread_db library is around for Solaris thread debugging. Note that
199 dnl we must explicitly test for version 1 of the library because version 0
200 dnl (present on Solaris 2.4 or earlier) doesn't have the same API.
202 dnl Note that we only want this if we are both native (host == target), and
203 dnl not doing a canadian cross build (build == host).
205 if test ${build} = ${host} -a ${host} = ${target} ; then
208 AC_MSG_CHECKING(for HPUX/OSF thread support)
209 if test -f /usr/include/dce/cma_config.h ; then
210 if test "$GCC" = "yes" ; then
212 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
213 CONFIG_OBS="${CONFIG_OJS} hpux-thread.o"
214 CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
216 AC_MSG_RESULT(no (suppressed because you are not using GCC))
223 AC_MSG_CHECKING(for Solaris thread debugging library)
224 if test -f /usr/lib/libthread_db.so.1 ; then
226 AC_DEFINE(HAVE_THREAD_DB_LIB)
227 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
228 CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
229 AC_CHECK_LIB(dl, dlopen)
230 if test "$GCC" = "yes" ; then
231 # The GNU linker requires the -export-dynamic option to make
232 # all symbols visible in the dynamic symbol table.
233 hold_ldflags=$LDFLAGS
234 AC_MSG_CHECKING(for the ld -export-dynamic flag)
235 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
236 AC_TRY_LINK(, [int i;], found=yes, found=no)
237 LDFLAGS=$hold_ldflags
238 AC_MSG_RESULT($found)
239 if test $found = yes; then
240 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
248 AC_SUBST(CONFIG_LDFLAGS)
251 dnl Handle optional features that can be enabled.
254 AC_ARG_ENABLE(netrom,
256 [case "${enableval}" in
257 yes) enable_netrom=yes ;;
258 no) enable_netrom=no ;;
259 *) AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;;
262 if test "${enable_netrom}" = "yes"; then
263 CONFIG_OBS="${CONFIG_OBS} remote-nrom.o"
264 CONFIG_SRCS="${CONFIG_SRCS} remote-nrom.c"
269 AC_SUBST(MMALLOC_CFLAGS)
273 [ --with-mmalloc use memory mapped malloc package],
274 [case "${withval}" in
275 yes) want_mmalloc=true ;;
276 no) want_mmalloc=false;;
277 *) AC_MSG_ERROR(bad value ${withval} for GDB with-mmalloc option) ;;
278 esac],[want_mmalloc=false])dnl
280 if test x$want_mmalloc = xtrue; then
281 AC_DEFINE(USE_MMALLOC)
282 AC_DEFINE(MMCHECK_FORCE)
283 MMALLOC_CFLAGS="-I$srcdir/../mmalloc"
284 MMALLOC='../mmalloc/libmmalloc.a'
287 # start-sanitize-gdbtk
289 AC_ARG_ENABLE(ide, [ --enable-ide Enable IDE support])
290 if test "$enable_ide" = yes; then
302 [case "${enableval}" in
306 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
309 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
317 AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
320 # Default is on for everything but go32 and cygwin32
329 # In the cygwin32 environment, we need some additional flags.
330 AC_CACHE_CHECK([for cygwin32], gdb_cv_os_cygwin32,
331 [AC_EGREP_CPP(lose, [
334 #endif],[gdb_cv_os_cygwin32=yes],[gdb_cv_os_cygwin32=no])])
341 WINDRES=${WINDRES-windres}
344 if test x$gdb_cv_os_cygwin32 = xyes; then
345 if test x$enable_ide = xyes; then
346 WIN32LIBS="-ladvapi32"
352 if test "${enable_gdbtk}" = "yes"; then
355 if test -z "${no_tcl}"; then
359 # If $no_tk is nonempty, then we can't do Tk, and there is no
360 # point to doing Tcl.
361 if test -z "${no_tk}"; then
368 # now look for tix library stuff
370 . ${ac_cv_c_tclconfig}/tclConfig.sh
373 tixdir=../tix/win/tcl8.0
376 tixdir=../tix/unix/tk8.0
379 if test "${TCL_SHARED_BUILD}" = "1"; then
380 TIX_LIB_EXT="${TCL_SHLIB_SUFFIX}"
382 # Can't win them all: SunOS 4 (others?) appends a version
383 # number after the ".so"
386 TIX_LIB_EXT="${TIX_LIB_EXT}.1.0" ;;
393 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
394 TIXLIB="-L${tixdir} -ltix${TIXVERSION}"
395 TIX_DEPS="${tixdir}/libtix${TIXVERSION}${TIX_LIB_EXT}"
397 TIXLIB="-L${tixdir} -ltix`echo ${TIXVERSION} | tr -d .`"
398 TIX_DEPS="${tixdir}/libtix`echo ${TIXVERSION} | tr -d .`${TIX_LIB_EXT}"
403 # Include some libraries that Tcl and Tk want.
404 if test "${enable_ide}" = "yes"; then
405 TCL_LIBS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
406 CONFIG_DEPS='$(LIBIDETCL) $(LIBIDE) $(LIBGUI) $(IDE_DEPS) $(ITCL_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
408 TCL_LIBS='$(LIBGUI) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
409 CONFIG_DEPS='$(LIBGUI) $(ITCL_DEPS) $(TIX_DEPS) $(TK_DEPS) $(TCL_DEPS)'
411 # Yes, the ordering seems wrong here. But it isn't.
412 # TK_LIBS is the list of libraries that need to be linked
414 LIBS="${LIBS} ${TCL_LIBS} ${TK_LIBS}"
415 CONFIG_OBS="${CONFIG_OBS} gdbtk.o"
417 if test x$gdb_cv_os_cygwin32 = xyes; then
418 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32 -luser32"
419 WIN32LDAPP="-Wl,--subsystem,windows"
420 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
426 AC_SUBST(ENABLE_GDBTK)
436 # Enable GPU2 library for MIPS simulator
437 AC_ARG_WITH(sim-gpu2,
438 [ --with-sim-gpu2=path Use GPU2 library under given directory],
441 if test -d "${withval}"
443 LIBS="${LIBS} -L${withval}/lib -lgpu2 -L${x_libraries} -lX11"
445 AC_MSG_WARN([Directory ${withval} does not exist.])
447 *) AC_MSG_WARN([--with-sim-gpu2 option invalid for target ${target}])
450 # Enable target accurate FP library
451 AC_ARG_WITH(sim-funit,
452 [ --with-sim-funit=path Use target FP lib under given directory],
455 if test -d "${withval}"
457 LIBS="${LIBS} -L${withval}/lib -lfunit"
459 AC_MSG_WARN([Directory ${withval} does not exist.])
461 *) AC_MSG_WARN([--with-sim-funit option invalid for target ${target}])
465 AC_SUBST(ENABLE_CFLAGS)
468 AC_SUBST(CONFIG_DEPS)
469 AC_SUBST(CONFIG_SRCS)
471 # Begin stuff to support --enable-shared
472 AC_ARG_ENABLE(shared,
473 [ --enable-shared use shared libraries],
474 [case "${enableval}" in
482 # If we have shared libraries, try to set rpath reasonably.
483 if test "${shared}" = "true"; then
486 HLDFLAGS='-Wl,+s,+b,$(libdir)'
488 *-*-irix5* | *-*-irix6*)
489 HLDFLAGS='-Wl,-rpath,$(libdir)'
493 *-*-linux* | *-pc-linux-gnu)
494 HLDFLAGS='-Wl,-rpath,$(libdir)'
497 HLDFLAGS='-R $(libdir)'
500 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;'
505 # On SunOS, if the linker supports the -rpath option, use it to
506 # prevent ../bfd and ../opcodes from being included in the run time
510 echo 'main () { }' > conftest.c
511 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
512 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
514 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
516 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
518 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
520 elif test "${shared}" = "true"; then
521 HLDFLAGS='-Wl,-rpath=$(libdir)'
523 HLDFLAGS='-Wl,-rpath='
525 rm -f conftest.t conftest.c conftest
530 # End stuff to support --enable-shared
532 # target_subdir is used by the testsuite to find the target libraries.
534 if test "${host}" != "${target}"; then
535 target_subdir="${target_alias}/"
537 AC_SUBST(target_subdir)
540 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
541 if test ! -f ${host_makefile_frag}; then
542 AC_MSG_ERROR("*** Gdb does not support host ${host}")
544 frags="$frags $host_makefile_frag"
546 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
547 if test ! -f ${target_makefile_frag}; then
548 AC_MSG_ERROR("*** Gdb does not support target ${target}")
550 frags="$frags $target_makefile_frag"
552 AC_SUBST_FILE(host_makefile_frag)
553 AC_SUBST_FILE(target_makefile_frag)
558 s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
559 ' ${host_makefile_frag}`
562 s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
563 ' ${target_makefile_frag}`
565 # these really aren't orthogonal true/false values of the same condition,
566 # but shells are slow enough that I like to reuse the test conditions
568 if test "${target}" = "${host}"; then
570 s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
571 ' ${host_makefile_frag}`
573 # GDBserver is only useful in a "native" enviroment
574 # configdirs=`echo $configdirs | sed 's/gdbserver//'`
578 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
579 # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
580 # corresponding links. But we have to remove the xm.h files and tm.h
581 # files anyway, e.g. when switching from "configure host" to
587 if test "${hostfile}" != ""; then
588 files="${files} config/${gdb_host_cpu}/${hostfile}"
589 links="${links} xm.h"
592 if test "${targetfile}" != ""; then
593 files="${files} config/${gdb_target_cpu}/${targetfile}"
594 links="${links} tm.h"
597 if test "${nativefile}" != ""; then
598 files="${files} config/${gdb_host_cpu}/${nativefile}"
599 links="${links} nm.h"
601 # A cross-only configuration.
602 files="${files} config/nm-empty.h"
603 links="${links} nm.h"
605 # start-sanitize-gdbtk
607 # Make it possible to use the GUI without doing a full install
608 if test "${enable_gdbtk}" = "yes" -a ! -d gdbtcl ; then
609 if test "$LN_S" = "ln -s" -a ! -f gdbtcl ; then
610 echo linking $srcdir/gdbtcl to gdbtcl
611 $LN_S $srcdir/gdbtcl gdbtcl
613 echo Warning: Unable to link $srcdir/gdbtcl to gdbtcl. You will need to do a
614 echo " " make install before you are able to run the GUI.
619 AC_LINK_FILES($files, $links)
621 dnl Check for exe extension set on certain hosts (e.g. Win32)
624 AC_CONFIG_SUBDIRS($configdirs)
625 AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
627 dnl Autoconf doesn't provide a mechanism for modifying definitions
628 dnl provided by makefile fragments.
630 if test "${nativefile}" = ""; then
631 sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
632 < Makefile > Makefile.tem
633 mv -f Makefile.tem Makefile
637 sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
638 /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
639 /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
640 mv -f Makefile.tmp Makefile
643 case x$CONFIG_HEADERS in
649 gdb_host_cpu=$gdb_host_cpu
650 gdb_target_cpu=$gdb_target_cpu
651 nativefile=$nativefile