Thu Jul 10 00:02:41 1997 Martin M. Hunt <hunt@cygnus.com>
[deliverable/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 case "${target}" in
284 *-cygwin32)
285 configdir="win"
286 ;;
287 *)
288 configdir="unix"
289 ;;
290 esac
291
292 if test "${enable_gdbtk}" = "yes"; then
293
294 CY_AC_PATH_TCLCONFIG
295 if test -z "${no_tcl}"; then
296 CY_AC_LOAD_TCLCONFIG
297 CY_AC_PATH_TKCONFIG
298
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
302 CY_AC_LOAD_TKCONFIG
303 CY_AC_PATH_TCLH
304 CY_AC_PATH_TKH
305 CY_AC_PATH_ITCLH
306 CY_AC_PATH_TIX
307
308 ENABLE_GDBTK=1
309
310 # Include some libraries that Tcl and Tk want.
311 if test "${enable_ide}" = "yes"; then
312 TCL_LIBS='$(IDE) $(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
313 else
314 TCL_LIBS='$(ITCL) $(TIX) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
315 fi
316 # Yes, the ordering seems wrong here. But it isn't.
317 # TK_LIBS is the list of libraries that need to be linked
318 # after Tcl/Tk.
319 LIBS="${LIBS} ${TCL_LIBS} ${TK_LIBS}"
320 CONFIG_OBS="${CONFIG_OBS} gdbtk.o"
321 fi
322 fi
323 fi
324
325 AC_SUBST(ENABLE_GDBTK)
326 AC_SUBST(X_CFLAGS)
327 AC_SUBST(X_LDFLAGS)
328 AC_SUBST(X_LIBS)
329 # end-sanitize-gdbtk
330
331 AC_SUBST(ENABLE_CFLAGS)
332
333 AC_SUBST(CONFIG_OBS)
334
335 # Begin stuff to support --enable-shared
336 AC_ARG_ENABLE(shared,
337 [ --enable-shared use shared libraries],
338 [case "${enableval}" in
339 yes) shared=true ;;
340 no) shared=false ;;
341 *) shared=true ;;
342 esac])dnl
343
344 HLDFLAGS=
345 HLDENV=
346 # If we have shared libraries, try to set rpath reasonably.
347 if test "${shared}" = "true"; then
348 case "${host}" in
349 *-*-hpux*)
350 HLDFLAGS='-Wl,+s,+b,$(libdir)'
351 ;;
352 *-*-irix5* | *-*-irix6*)
353 HLDFLAGS='-Wl,-rpath,$(libdir)'
354 ;;
355 *-*-linux*aout*)
356 ;;
357 *-*-linux* | *-pc-linux-gnu)
358 HLDFLAGS='-Wl,-rpath,$(libdir)'
359 ;;
360 *-*-solaris*)
361 HLDFLAGS='-R $(libdir)'
362 ;;
363 *-*-sysv4*)
364 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;'
365 ;;
366 esac
367 fi
368
369 # On SunOS, if the linker supports the -rpath option, use it to
370 # prevent ../bfd and ../opcodes from being included in the run time
371 # search path.
372 case "${host}" in
373 *-*-sunos*)
374 echo 'main () { }' > conftest.c
375 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
376 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
377 :
378 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
379 :
380 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
381 :
382 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
383 :
384 elif test "${shared}" = "true"; then
385 HLDFLAGS='-Wl,-rpath=$(libdir)'
386 else
387 HLDFLAGS='-Wl,-rpath='
388 fi
389 rm -f conftest.t conftest.c conftest
390 ;;
391 esac
392 AC_SUBST(HLDFLAGS)
393 AC_SUBST(HLDENV)
394 # End stuff to support --enable-shared
395
396 # target_subdir is used by the testsuite to find the target libraries.
397 target_subdir=
398 if test "${host}" != "${target}"; then
399 target_subdir="${target_alias}/"
400 fi
401 AC_SUBST(target_subdir)
402
403 frags=
404 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
405 if test ! -f ${host_makefile_frag}; then
406 AC_MSG_ERROR("*** Gdb does not support host ${host}")
407 fi
408 frags="$frags $host_makefile_frag"
409
410 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
411 if test ! -f ${target_makefile_frag}; then
412 AC_MSG_ERROR("*** Gdb does not support target ${target}")
413 fi
414 frags="$frags $target_makefile_frag"
415
416 AC_SUBST_FILE(host_makefile_frag)
417 AC_SUBST_FILE(target_makefile_frag)
418 AC_SUBST(frags)
419
420 changequote(,)dnl
421 hostfile=`sed -n '
422 s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
423 ' ${host_makefile_frag}`
424
425 targetfile=`sed -n '
426 s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
427 ' ${target_makefile_frag}`
428
429 # these really aren't orthogonal true/false values of the same condition,
430 # but shells are slow enough that I like to reuse the test conditions
431 # whenever possible
432 if test "${target}" = "${host}"; then
433 nativefile=`sed -n '
434 s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
435 ' ${host_makefile_frag}`
436 # else
437 # GDBserver is only useful in a "native" enviroment
438 # configdirs=`echo $configdirs | sed 's/gdbserver//'`
439 fi
440 changequote([,])
441
442 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
443 # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
444 # corresponding links. But we have to remove the xm.h files and tm.h
445 # files anyway, e.g. when switching from "configure host" to
446 # "configure none".
447
448 files=
449 links=
450 rm -f xm.h
451 if test "${hostfile}" != ""; then
452 files="${files} config/${gdb_host_cpu}/${hostfile}"
453 links="${links} xm.h"
454 fi
455 rm -f tm.h
456 if test "${targetfile}" != ""; then
457 files="${files} config/${gdb_target_cpu}/${targetfile}"
458 links="${links} tm.h"
459 fi
460 rm -f nm.h
461 if test "${nativefile}" != ""; then
462 files="${files} config/${gdb_host_cpu}/${nativefile}"
463 links="${links} nm.h"
464 else
465 # A cross-only configuration.
466 files="${files} config/nm-empty.h"
467 links="${links} nm.h"
468 fi
469 # start-sanitize-gdbtk
470 AC_PROG_LN_S
471 # Make it possible to use the GUI without doing a full install
472 if test "${enable_gdbtk}" = "yes" -a ! -d gdbtcl ; then
473 if test "$LN_S" = "ln -s" -a ! -f gdbtcl ; then
474 echo linking $srcdir/gdbtcl to gdbtcl
475 $LN_S $srcdir/gdbtcl gdbtcl
476 else
477 echo Warning: Unable to link $srcdir/gdbtcl to gdbtcl. You will need to do a
478 echo " " make install before you are able to run the GUI.
479 fi
480 fi
481 # end-sanitize-gdbtk
482
483 AC_LINK_FILES($files, $links)
484
485 AC_CONFIG_SUBDIRS($configdirs)
486 AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
487 [
488 dnl Autoconf doesn't provide a mechanism for modifying definitions
489 dnl provided by makefile fragments.
490 dnl
491 if test "${nativefile}" = ""; then
492 sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
493 < Makefile > Makefile.tem
494 mv -f Makefile.tem Makefile
495 fi
496
497 changequote(,)dnl
498 sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
499 /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
500 /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
501 mv -f Makefile.tmp Makefile
502 changequote([,])dnl
503
504 case x$CONFIG_HEADERS in
505 xconfig.h:config.in)
506 echo > stamp-h ;;
507 esac
508 ],
509 [
510 gdb_host_cpu=$gdb_host_cpu
511 gdb_target_cpu=$gdb_target_cpu
512 nativefile=$nativefile
513 ])
514
515 exit 0
516
This page took 0.090731 seconds and 5 git commands to generate.