]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/configure.in
* gdbtk.c (Tcl_Alloc): Don't provide our own version of this if
[thirdparty/binutils-gdb.git] / gdb / configure.in
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 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
32 AC_CANONICAL_SYSTEM
33
34 dnl List of object files added by configure.
35
36 CONFIG_OBS=
37
38 configdirs="doc testsuite"
39
40 dnl
41 changequote(,)dnl
42
43 . ${srcdir}/configure.host
44
45 . ${srcdir}/configure.tgt
46
47 dnl
48 changequote([,])dnl
49
50 AC_PROG_INSTALL
51 AC_CHECK_TOOL(AR, ar)
52 AC_CHECK_TOOL(RANLIB, ranlib, :)
53 AC_PROG_YACC
54 AC_PROG_AWK
55
56 AC_ARG_PROGRAM
57
58 AC_TYPE_SIGNAL
59
60 AC_HEADER_STDC
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)
62 AC_HEADER_STAT
63
64 AC_C_CONST
65
66 AC_CHECK_FUNCS(setpgid sbrk select poll)
67
68 # If we are configured native on Linux, work around problems with sys/procfs.h
69 if test "${target}" = "${host}"; then
70 case "${host}" in
71 i[3456]86-*-linux*)
72 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,"2")
73 AC_DEFINE(sys_quotactl)
74 ;;
75 esac
76 fi
77
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)
85 fi
86
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)
94 fi
95
96 dnl See if host has libm. This is usually needed by simulators.
97 AC_CHECK_LIB(m, main)
98
99 dnl See if compiler supports "long long" type.
100
101 AC_MSG_CHECKING(for long long support in compiler)
102 AC_CACHE_VAL(gdb_cv_c_long_long,
103 [AC_TRY_COMPILE(, [
104 extern long long foo;
105 switch (foo & 2) { case 0: return 1; }
106 ],
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)
111 fi
112
113 dnl See if the compiler and runtime support printing long long
114
115 AC_MSG_CHECKING(for long long support in printf)
116 AC_CACHE_VAL(gdb_cv_printf_has_long_long,
117 [AC_TRY_RUN([
118 int main () {
119 char buf[16];
120 long long l = 0x12345;
121 sprintf (buf, "%llx", l);
122 return (strcmp ("12345", buf));
123 }],
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)
129 fi
130 AC_MSG_RESULT($gdb_cv_printf_has_long_long)
131
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.
135
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)
143 fi
144
145 dnl See if the compiler and runtime support printing long doubles
146
147 AC_MSG_CHECKING(for long double support in printf)
148 AC_CACHE_VAL(gdb_cv_printf_has_long_double,
149 [AC_TRY_RUN([
150 int main () {
151 char buf[16];
152 long double f = 3.141592653;
153 sprintf (buf, "%Lg", f);
154 return (strncmp ("3.14159", buf, 7));
155 }],
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)
161 fi
162 AC_MSG_RESULT($gdb_cv_printf_has_long_double)
163
164 AC_FUNC_MMAP
165
166 BFD_NEED_DECLARATION(malloc)
167 BFD_NEED_DECLARATION(realloc)
168 BFD_NEED_DECLARATION(free)
169
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.
173
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).
176
177 if test ${build} = ${host} -a ${host} = ${target} ; then
178 case ${host_os} in
179 hpux*)
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
183 AC_MSG_RESULT(yes)
184 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
185 CONFIG_OBS="${CONFIG_OJS} hpux-thread.o"
186 else
187 AC_MSG_RESULT(no (suppressed because you are not using GCC))
188 fi
189 else
190 AC_MSG_RESULT(no)
191 fi
192 ;;
193 solaris*)
194 AC_MSG_CHECKING(for Solaris thread debugging library)
195 if test -f /usr/lib/libthread_db.so.1 ; then
196 AC_MSG_RESULT(yes)
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"
202 fi
203 else
204 AC_MSG_RESULT(no)
205 fi
206 ;;
207 esac
208 AC_SUBST(CONFIG_LDFLAGS)
209 fi
210
211 dnl Handle optional features that can be enabled.
212 ENABLE_CFLAGS=
213
214 AC_ARG_ENABLE(netrom,
215 [ --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) ;;
220 esac])
221
222 if test "${enable_netrom}" = "yes"; then
223 CONFIG_OBS="${CONFIG_OBS} remote-nrom.o"
224 fi
225
226 # start-sanitize-gm
227 ENABLE_GM=
228
229 AC_ARG_ENABLE(gm,
230 [ --enable-gm ],
231 [case "${enableval}" in
232 yes) CONFIG_OBS="${CONFIG_OBS} gmagic.o"
233 ENABLE_CFLAGS=-DGENERAL_MAGIC
234 ;;
235 no) ;;
236 *) AC_MSG_ERROR(bad value ${enableval} given for gm option) ;;
237 esac])
238
239 # end-sanitize-gm
240
241 # start-sanitize-gdbtk
242 ENABLE_IDE=
243 AC_ARG_ENABLE(ide, [ --enable-ide Enable IDE support])
244 if test "$enable_ide" = yes; then
245 enable_ide=yes
246 ENABLE_IDE=1
247 else
248 enable_ide=no
249 fi
250 AC_SUBST(ENABLE_IDE)
251
252 ENABLE_GDBTK=
253
254 AC_ARG_ENABLE(gdbtk,
255 [ --enable-gdbtk ],
256 [case "${enableval}" in
257 yes)
258 case "$host" in
259 *go32*)
260 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
261 enable_gdbtk=no ;;
262 *windows*)
263 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
264 enable_gdbtk=no ;;
265 *)
266 enable_gdbtk=yes ;;
267 esac ;;
268 no)
269 enable_gdbtk=no ;;
270 *)
271 AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
272 esac],
273 [
274 # Default is on for everything but go32 and cygwin32
275 case "$host" in
276 *go32* | *windows*)
277 ;;
278 *)
279 enable_gdbtk=yes ;;
280 esac
281 ])
282
283 # In the cygwin32 environment, we need some additional flags.
284 AC_CACHE_CHECK([for cygwin32], gdb_cv_os_cygwin32,
285 [AC_EGREP_CPP(lose, [
286 #ifdef __CYGWIN32__
287 lose
288 #endif],[gdb_cv_os_cygwin32=yes],[gdb_cv_os_cygwin32=no])])
289
290 WIN32LIBS=
291 WIN32LDAPP=
292 AC_SUBST(WIN32LIBS)
293 AC_SUBST(WIN32LDAPP)
294
295 if test x$gdb_cv_os_cygwin32 = xyes; then
296 if test x$enable_ide = xyes; then
297 WIN32LIBS="-ladvapi32"
298 fi
299 fi
300
301 configdir="unix"
302
303 if test "${enable_gdbtk}" = "yes"; then
304
305 CY_AC_PATH_TCLCONFIG
306 if test -z "${no_tcl}"; then
307 CY_AC_LOAD_TCLCONFIG
308 CY_AC_PATH_TKCONFIG
309
310 # If $no_tk is nonempty, then we can't do Tk, and there is no
311 # point to doing Tcl.
312 if test -z "${no_tk}"; then
313 CY_AC_LOAD_TKCONFIG
314 CY_AC_PATH_TCLH
315 CY_AC_PATH_TKH
316 CY_AC_PATH_ITCLH
317 CY_AC_PATH_TIX
318
319 # now look for tix library stuff
320 TIXVERSION=4.1.7.6
321 . ${ac_cv_c_tclconfig}/tclConfig.sh
322 case "${host}" in
323 *-*-cygwin32*)
324 tixdir=../tix/win/tcl7.6
325 ;;
326 *)
327 tixdir=../tix/unix/tk4.2
328 ;;
329 esac
330 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
331 TIXLIB="-L${tixdir} -ltix${TIXVERSION}"
332 else
333 TIXLIB="-L${tixdir} -ltix`echo ${TIXVERSION} | tr -d .`"
334 fi
335
336 ENABLE_GDBTK=1
337
338 # Include some libraries that Tcl and Tk want.
339 if test "${enable_ide}" = "yes"; then
340 TCL_LIBS='$(IDE) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
341 else
342 TCL_LIBS='$(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
343 fi
344 # Yes, the ordering seems wrong here. But it isn't.
345 # TK_LIBS is the list of libraries that need to be linked
346 # after Tcl/Tk.
347 LIBS="${LIBS} ${TCL_LIBS} ${TK_LIBS}"
348 CONFIG_OBS="${CONFIG_OBS} gdbtk.o"
349
350 if test x$gdb_cv_os_cygwin32 = xyes; then
351 WIN32LIBS="${WIN32LIBS} -luser32"
352 WIN32LDAPP="-Wl,--subsystem,windows"
353 fi
354 fi
355 fi
356 fi
357
358 AC_SUBST(ENABLE_GDBTK)
359 AC_SUBST(X_CFLAGS)
360 AC_SUBST(X_LDFLAGS)
361 AC_SUBST(X_LIBS)
362 AC_SUBST(TIXLIB)
363 # end-sanitize-gdbtk
364
365 AC_SUBST(ENABLE_CFLAGS)
366
367 AC_SUBST(CONFIG_OBS)
368
369 # Begin stuff to support --enable-shared
370 AC_ARG_ENABLE(shared,
371 [ --enable-shared use shared libraries],
372 [case "${enableval}" in
373 yes) shared=true ;;
374 no) shared=false ;;
375 *) shared=true ;;
376 esac])dnl
377
378 HLDFLAGS=
379 HLDENV=
380 # If we have shared libraries, try to set rpath reasonably.
381 if test "${shared}" = "true"; then
382 case "${host}" in
383 *-*-hpux*)
384 HLDFLAGS='-Wl,+s,+b,$(libdir)'
385 ;;
386 *-*-irix5* | *-*-irix6*)
387 HLDFLAGS='-Wl,-rpath,$(libdir)'
388 ;;
389 *-*-linux*aout*)
390 ;;
391 *-*-linux* | *-pc-linux-gnu)
392 HLDFLAGS='-Wl,-rpath,$(libdir)'
393 ;;
394 *-*-solaris*)
395 HLDFLAGS='-R $(libdir)'
396 ;;
397 *-*-sysv4*)
398 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;'
399 ;;
400 esac
401 fi
402
403 # On SunOS, if the linker supports the -rpath option, use it to
404 # prevent ../bfd and ../opcodes from being included in the run time
405 # search path.
406 case "${host}" in
407 *-*-sunos*)
408 echo 'main () { }' > conftest.c
409 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
410 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
411 :
412 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
413 :
414 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
415 :
416 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
417 :
418 elif test "${shared}" = "true"; then
419 HLDFLAGS='-Wl,-rpath=$(libdir)'
420 else
421 HLDFLAGS='-Wl,-rpath='
422 fi
423 rm -f conftest.t conftest.c conftest
424 ;;
425 esac
426 AC_SUBST(HLDFLAGS)
427 AC_SUBST(HLDENV)
428 # End stuff to support --enable-shared
429
430 # target_subdir is used by the testsuite to find the target libraries.
431 target_subdir=
432 if test "${host}" != "${target}"; then
433 target_subdir="${target_alias}/"
434 fi
435 AC_SUBST(target_subdir)
436
437 frags=
438 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
439 if test ! -f ${host_makefile_frag}; then
440 AC_MSG_ERROR("*** Gdb does not support host ${host}")
441 fi
442 frags="$frags $host_makefile_frag"
443
444 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
445 if test ! -f ${target_makefile_frag}; then
446 AC_MSG_ERROR("*** Gdb does not support target ${target}")
447 fi
448 frags="$frags $target_makefile_frag"
449
450 AC_SUBST_FILE(host_makefile_frag)
451 AC_SUBST_FILE(target_makefile_frag)
452 AC_SUBST(frags)
453
454 changequote(,)dnl
455 hostfile=`sed -n '
456 s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
457 ' ${host_makefile_frag}`
458
459 targetfile=`sed -n '
460 s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
461 ' ${target_makefile_frag}`
462
463 # these really aren't orthogonal true/false values of the same condition,
464 # but shells are slow enough that I like to reuse the test conditions
465 # whenever possible
466 if test "${target}" = "${host}"; then
467 nativefile=`sed -n '
468 s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
469 ' ${host_makefile_frag}`
470 # else
471 # GDBserver is only useful in a "native" enviroment
472 # configdirs=`echo $configdirs | sed 's/gdbserver//'`
473 fi
474 changequote([,])
475
476 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
477 # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
478 # corresponding links. But we have to remove the xm.h files and tm.h
479 # files anyway, e.g. when switching from "configure host" to
480 # "configure none".
481
482 files=
483 links=
484 rm -f xm.h
485 if test "${hostfile}" != ""; then
486 files="${files} config/${gdb_host_cpu}/${hostfile}"
487 links="${links} xm.h"
488 fi
489 rm -f tm.h
490 if test "${targetfile}" != ""; then
491 files="${files} config/${gdb_target_cpu}/${targetfile}"
492 links="${links} tm.h"
493 fi
494 rm -f nm.h
495 if test "${nativefile}" != ""; then
496 files="${files} config/${gdb_host_cpu}/${nativefile}"
497 links="${links} nm.h"
498 else
499 # A cross-only configuration.
500 files="${files} config/nm-empty.h"
501 links="${links} nm.h"
502 fi
503 # start-sanitize-gdbtk
504 AC_PROG_LN_S
505 # Make it possible to use the GUI without doing a full install
506 if test "${enable_gdbtk}" = "yes" -a ! -d gdbtcl ; then
507 if test "$LN_S" = "ln -s" -a ! -f gdbtcl ; then
508 echo linking $srcdir/gdbtcl to gdbtcl
509 $LN_S $srcdir/gdbtcl gdbtcl
510 else
511 echo Warning: Unable to link $srcdir/gdbtcl to gdbtcl. You will need to do a
512 echo " " make install before you are able to run the GUI.
513 fi
514 fi
515 # end-sanitize-gdbtk
516
517 AC_LINK_FILES($files, $links)
518
519 AC_CONFIG_SUBDIRS($configdirs)
520 AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
521 [
522 dnl Autoconf doesn't provide a mechanism for modifying definitions
523 dnl provided by makefile fragments.
524 dnl
525 if test "${nativefile}" = ""; then
526 sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
527 < Makefile > Makefile.tem
528 mv -f Makefile.tem Makefile
529 fi
530
531 changequote(,)dnl
532 sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
533 /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
534 /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
535 mv -f Makefile.tmp Makefile
536 changequote([,])dnl
537
538 case x$CONFIG_HEADERS in
539 xconfig.h:config.in)
540 echo > stamp-h ;;
541 esac
542 ],
543 [
544 gdb_host_cpu=$gdb_host_cpu
545 gdb_target_cpu=$gdb_target_cpu
546 nativefile=$nativefile
547 ])
548
549 exit 0
550