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 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
34 dnl List of object files added by configure.
38 configdirs="doc testsuite"
43 . ${srcdir}/configure.host
45 . ${srcdir}/configure.tgt
52 AC_CHECK_TOOL(RANLIB, ranlib, :)
61 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)
66 AC_CHECK_FUNCS(setpgid sbrk select poll)
68 # If we are configured native on Linux, work around problems with sys/procfs.h
69 if test "${target}" = "${host}"; then
72 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,"2")
73 AC_DEFINE(sys_quotactl)
78 AC_MSG_CHECKING([for gregset_t type])
79 AC_CACHE_VAL(gdb_cv_have_gregset_t,
80 [AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0],
81 gdb_cv_have_gregset_t=yes, gdb_cv_have_gregset_t=no)])
82 AC_MSG_RESULT($gdb_cv_have_gregset_t)
83 if test $gdb_cv_have_gregset_t = yes; then
84 AC_DEFINE(HAVE_GREGSET_T)
87 AC_MSG_CHECKING([for fpregset_t type])
88 AC_CACHE_VAL(gdb_cv_have_fpregset_t,
89 [AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0],
90 gdb_cv_have_fpregset_t=yes, gdb_cv_have_fpregset_t=no)])
91 AC_MSG_RESULT($gdb_cv_have_fpregset_t)
92 if test $gdb_cv_have_fpregset_t = yes; then
93 AC_DEFINE(HAVE_FPREGSET_T)
96 dnl See if host has libm. This is usually needed by simulators.
99 dnl See if compiler supports "long long" type.
101 AC_MSG_CHECKING(for long long support in compiler)
102 AC_CACHE_VAL(gdb_cv_c_long_long,
104 extern long long foo;
105 switch (foo & 2) { case 0: return 1; }
107 gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
108 AC_MSG_RESULT($gdb_cv_c_long_long)
109 if test $gdb_cv_c_long_long = yes; then
110 AC_DEFINE(CC_HAS_LONG_LONG)
113 dnl See if the compiler and runtime support printing long long
115 AC_MSG_CHECKING(for long long support in printf)
116 AC_CACHE_VAL(gdb_cv_printf_has_long_long,
120 long long l = 0x12345;
121 sprintf (buf, "%llx", l);
122 return (strcmp ("12345", buf));
124 gdb_cv_printf_has_long_long=yes,
125 gdb_cv_printf_has_long_long=no,
126 gdb_cv_printf_has_long_long=no)])
127 if test $gdb_cv_printf_has_long_long = yes; then
128 AC_DEFINE(PRINTF_HAS_LONG_LONG)
130 AC_MSG_RESULT($gdb_cv_printf_has_long_long)
132 dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
133 dnl because autoconf complains about cross-compilation issues. However, this
134 dnl code uses the same variables as the macro for compatibility.
136 AC_MSG_CHECKING(for long double support in compiler)
137 AC_CACHE_VAL(ac_cv_c_long_double,
138 [AC_TRY_COMPILE(, [long double foo;],
139 ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
140 AC_MSG_RESULT($ac_cv_c_long_double)
141 if test $ac_cv_c_long_double = yes; then
142 AC_DEFINE(HAVE_LONG_DOUBLE)
145 dnl See if the compiler and runtime support printing long doubles
147 AC_MSG_CHECKING(for long double support in printf)
148 AC_CACHE_VAL(gdb_cv_printf_has_long_double,
152 long double f = 3.141592653;
153 sprintf (buf, "%Lg", f);
154 return (strncmp ("3.14159", buf, 7));
156 gdb_cv_printf_has_long_double=yes,
157 gdb_cv_printf_has_long_double=no,
158 gdb_cv_printf_has_long_double=no)])
159 if test $gdb_cv_printf_has_long_double = yes; then
160 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
162 AC_MSG_RESULT($gdb_cv_printf_has_long_double)
166 BFD_NEED_DECLARATION(malloc)
167 BFD_NEED_DECLARATION(realloc)
168 BFD_NEED_DECLARATION(free)
170 dnl See if thread_db library is around for Solaris thread debugging. Note that
171 dnl we must explicitly test for version 1 of the library because version 0
172 dnl (present on Solaris 2.4 or earlier) doesn't have the same API.
174 dnl Note that we only want this if we are both native (host == target), and
175 dnl not doing a canadian cross build (build == host).
177 if test ${build} = ${host} -a ${host} = ${target} ; then
180 AC_MSG_CHECKING(for HPUX/OSF thread support)
181 if test -f /usr/include/dce/cma_config.h ; then
182 if test "$GCC" = "yes" ; then
184 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
185 CONFIG_OBS="${CONFIG_OJS} hpux-thread.o"
187 AC_MSG_RESULT(no (suppressed because you are not using GCC))
194 AC_MSG_CHECKING(for Solaris thread debugging library)
195 if test -f /usr/lib/libthread_db.so.1 ; then
197 AC_DEFINE(HAVE_THREAD_DB_LIB)
198 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
199 AC_CHECK_LIB(dl, dlopen)
200 if test "$GCC" = "yes" ; then
201 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Xlinker -export-dynamic"
208 AC_SUBST(CONFIG_LDFLAGS)
211 dnl Handle optional features that can be enabled.
214 AC_ARG_ENABLE(netrom,
216 [case "${enableval}" in
217 yes) enable_netrom=yes ;;
218 no) enable_netrom=no ;;
219 *) AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;;
222 if test "${enable_netrom}" = "yes"; then
223 CONFIG_OBS="${CONFIG_OBS} remote-nrom.o"
231 [case "${enableval}" in
232 yes) CONFIG_OBS="${CONFIG_OBS} gmagic.o"
233 ENABLE_CFLAGS=-DGENERAL_MAGIC
236 *) AC_MSG_ERROR(bad value ${enableval} given for gm option) ;;
241 # start-sanitize-gdbtk
243 AC_ARG_ENABLE(ide, [ --enable-ide Enable IDE support])
244 if test "$enable_ide" = yes; then
256 [case "${enableval}" in
260 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
263 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
271 AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
274 # Default is on for everything but go32 and cygwin32
292 if test "${enable_gdbtk}" = "yes"; then
295 if test -z "${no_tcl}"; then
299 # If $no_tk is nonempty, then we can't do Tk, and there is no
300 # point to doing Tcl.
301 if test -z "${no_tk}"; then
308 # now look for tix library stuff
310 . ${ac_cv_c_tclconfig}/tclConfig.sh
313 tixdir=../tix/win/tcl7.6
316 tixdir=../tix/unix/tk4.2
319 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
320 TIXLIB="-L${tixdir} -ltix${TIXVERSION}"
322 TIXLIB="-L${tixdir} -ltix`echo ${TIXVERSION} | tr -d .`"
327 # Include some libraries that Tcl and Tk want.
328 if test "${enable_ide}" = "yes"; then
329 TCL_LIBS='$(IDE) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
331 TCL_LIBS='$(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
333 # Yes, the ordering seems wrong here. But it isn't.
334 # TK_LIBS is the list of libraries that need to be linked
336 LIBS="${LIBS} ${TCL_LIBS} ${TK_LIBS}"
337 CONFIG_OBS="${CONFIG_OBS} gdbtk.o"
342 AC_SUBST(ENABLE_GDBTK)
349 AC_SUBST(ENABLE_CFLAGS)
353 # Begin stuff to support --enable-shared
354 AC_ARG_ENABLE(shared,
355 [ --enable-shared use shared libraries],
356 [case "${enableval}" in
364 # If we have shared libraries, try to set rpath reasonably.
365 if test "${shared}" = "true"; then
368 HLDFLAGS='-Wl,+s,+b,$(libdir)'
370 *-*-irix5* | *-*-irix6*)
371 HLDFLAGS='-Wl,-rpath,$(libdir)'
375 *-*-linux* | *-pc-linux-gnu)
376 HLDFLAGS='-Wl,-rpath,$(libdir)'
379 HLDFLAGS='-R $(libdir)'
382 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;'
387 # On SunOS, if the linker supports the -rpath option, use it to
388 # prevent ../bfd and ../opcodes from being included in the run time
392 echo 'main () { }' > conftest.c
393 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
394 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
396 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
398 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
400 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
402 elif test "${shared}" = "true"; then
403 HLDFLAGS='-Wl,-rpath=$(libdir)'
405 HLDFLAGS='-Wl,-rpath='
407 rm -f conftest.t conftest.c conftest
412 # End stuff to support --enable-shared
414 # target_subdir is used by the testsuite to find the target libraries.
416 if test "${host}" != "${target}"; then
417 target_subdir="${target_alias}/"
419 AC_SUBST(target_subdir)
422 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
423 if test ! -f ${host_makefile_frag}; then
424 AC_MSG_ERROR("*** Gdb does not support host ${host}")
426 frags="$frags $host_makefile_frag"
428 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
429 if test ! -f ${target_makefile_frag}; then
430 AC_MSG_ERROR("*** Gdb does not support target ${target}")
432 frags="$frags $target_makefile_frag"
434 AC_SUBST_FILE(host_makefile_frag)
435 AC_SUBST_FILE(target_makefile_frag)
440 s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
441 ' ${host_makefile_frag}`
444 s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
445 ' ${target_makefile_frag}`
447 # these really aren't orthogonal true/false values of the same condition,
448 # but shells are slow enough that I like to reuse the test conditions
450 if test "${target}" = "${host}"; then
452 s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
453 ' ${host_makefile_frag}`
455 # GDBserver is only useful in a "native" enviroment
456 # configdirs=`echo $configdirs | sed 's/gdbserver//'`
460 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
461 # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
462 # corresponding links. But we have to remove the xm.h files and tm.h
463 # files anyway, e.g. when switching from "configure host" to
469 if test "${hostfile}" != ""; then
470 files="${files} config/${gdb_host_cpu}/${hostfile}"
471 links="${links} xm.h"
474 if test "${targetfile}" != ""; then
475 files="${files} config/${gdb_target_cpu}/${targetfile}"
476 links="${links} tm.h"
479 if test "${nativefile}" != ""; then
480 files="${files} config/${gdb_host_cpu}/${nativefile}"
481 links="${links} nm.h"
483 # A cross-only configuration.
484 files="${files} config/nm-empty.h"
485 links="${links} nm.h"
487 # start-sanitize-gdbtk
489 # Make it possible to use the GUI without doing a full install
490 if test "${enable_gdbtk}" = "yes" -a ! -d gdbtcl ; then
491 if test "$LN_S" = "ln -s" -a ! -f gdbtcl ; then
492 echo linking $srcdir/gdbtcl to gdbtcl
493 $LN_S $srcdir/gdbtcl gdbtcl
495 echo Warning: Unable to link $srcdir/gdbtcl to gdbtcl. You will need to do a
496 echo " " make install before you are able to run the GUI.
501 AC_LINK_FILES($files, $links)
503 AC_CONFIG_SUBDIRS($configdirs)
504 AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
506 dnl Autoconf doesn't provide a mechanism for modifying definitions
507 dnl provided by makefile fragments.
509 if test "${nativefile}" = ""; then
510 sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
511 < Makefile > Makefile.tem
512 mv -f Makefile.tem Makefile
516 sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
517 /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
518 /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
519 mv -f Makefile.tmp Makefile
522 case x$CONFIG_HEADERS in
528 gdb_host_cpu=$gdb_host_cpu
529 gdb_target_cpu=$gdb_target_cpu
530 nativefile=$nativefile