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