* TODO: Add item suggesting an "info bfd" command.
[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_CANONICAL_SYSTEM
32
33 AC_PROG_INSTALL
34 AC_CHECK_TOOL(AR, ar)
35 AC_CHECK_TOOL(RANLIB, ranlib, :)
36 AC_PROG_YACC
37 AC_PROG_AWK
38
39 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
40 AC_ARG_PROGRAM
41
42 AC_HEADER_STDC
43 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)
44 AC_HEADER_STAT
45
46 AC_C_CONST
47
48 AC_CHECK_FUNCS(setpgid sbrk select poll)
49
50 # If we are configured native on Linux, work around problems with sys/procfs.h
51 if test "${target}" = "${host}"; then
52 case "${host}" in
53 i[3456]86-*-linux*)
54 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,"2")
55 AC_DEFINE(sys_quotactl)
56 ;;
57 esac
58 fi
59
60 AC_MSG_CHECKING([for gregset_t type])
61 AC_CACHE_VAL(gdb_cv_have_gregset_t,
62 [AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0],
63 gdb_cv_have_gregset_t=yes, gdb_cv_have_gregset_t=no)])
64 AC_MSG_RESULT($gdb_cv_have_gregset_t)
65 if test $gdb_cv_have_gregset_t = yes; then
66 AC_DEFINE(HAVE_GREGSET_T)
67 fi
68
69 AC_MSG_CHECKING([for fpregset_t type])
70 AC_CACHE_VAL(gdb_cv_have_fpregset_t,
71 [AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0],
72 gdb_cv_have_fpregset_t=yes, gdb_cv_have_fpregset_t=no)])
73 AC_MSG_RESULT($gdb_cv_have_fpregset_t)
74 if test $gdb_cv_have_fpregset_t = yes; then
75 AC_DEFINE(HAVE_FPREGSET_T)
76 fi
77
78 dnl See if compiler supports "long long" type.
79
80 AC_MSG_CHECKING(for long long support in compiler)
81 AC_CACHE_VAL(gdb_cv_c_long_long,
82 [AC_TRY_COMPILE(, [
83 extern long long foo;
84 switch (foo & 2) { case 0: return 1; }
85 ],
86 gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
87 AC_MSG_RESULT($gdb_cv_c_long_long)
88 if test $gdb_cv_c_long_long = yes; then
89 AC_DEFINE(CC_HAS_LONG_LONG)
90 fi
91
92 dnl See if the compiler and runtime support printing long long
93
94 AC_MSG_CHECKING(for long long support in printf)
95 AC_CACHE_VAL(gdb_cv_printf_has_long_long,
96 [AC_TRY_RUN([
97 int main () {
98 char buf[16];
99 long long l = 0x12345;
100 sprintf (buf, "%llx", l);
101 return (strcmp ("12345", buf));
102 }],
103 gdb_cv_printf_has_long_long=yes,
104 gdb_cv_printf_has_long_long=no,
105 gdb_cv_printf_has_long_long=no)])
106 if test $gdb_cv_printf_has_long_long = yes; then
107 AC_DEFINE(PRINTF_HAS_LONG_LONG)
108 fi
109 AC_MSG_RESULT($gdb_cv_printf_has_long_long)
110
111 dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
112 dnl because autoconf complains about cross-compilation issues. However, this
113 dnl code uses the same variables as the macro for compatibility.
114
115 AC_MSG_CHECKING(for long double support in compiler)
116 AC_CACHE_VAL(ac_cv_c_long_double,
117 [AC_TRY_COMPILE(, [long double foo;],
118 ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
119 AC_MSG_RESULT($ac_cv_c_long_double)
120 if test $ac_cv_c_long_double = yes; then
121 AC_DEFINE(HAVE_LONG_DOUBLE)
122 fi
123
124 dnl See if the compiler and runtime support printing long doubles
125
126 AC_MSG_CHECKING(for long double support in printf)
127 AC_CACHE_VAL(gdb_cv_printf_has_long_double,
128 [AC_TRY_RUN([
129 int main () {
130 char buf[16];
131 long double f = 3.141592653;
132 sprintf (buf, "%Lg", f);
133 return (strncmp ("3.14159", buf, 7));
134 }],
135 gdb_cv_printf_has_long_double=yes,
136 gdb_cv_printf_has_long_double=no,
137 gdb_cv_printf_has_long_double=no)])
138 if test $gdb_cv_printf_has_long_double = yes; then
139 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
140 fi
141 AC_MSG_RESULT($gdb_cv_printf_has_long_double)
142
143 AC_FUNC_MMAP
144
145 BFD_NEED_DECLARATION(malloc)
146 BFD_NEED_DECLARATION(realloc)
147 BFD_NEED_DECLARATION(free)
148
149 dnl See if thread_db library is around for Solaris thread debugging. Note that
150 dnl we must explicitly test for version 1 of the library because version 0
151 dnl (present on Solaris 2.4 or earlier) doesn't have the same API.
152
153 dnl Note that we only want this if we are both native (host == target), and
154 dnl not doing a canadian cross build (build == host).
155
156 if test ${build} = ${host} -a ${host} = ${target} ; then
157 AC_MSG_CHECKING(for Solaris thread debugging library)
158 if test -f /usr/lib/libthread_db.so.1 ; then
159 AC_MSG_RESULT(yes)
160 THREAD_DB_OBS=sol-thread.o
161 AC_DEFINE(HAVE_THREAD_DB_LIB)
162 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Xlinker -export-dynamic"
163 else
164 AC_MSG_RESULT(no)
165 fi
166 case ${host_os} in
167 hpux*)
168 AC_MSG_CHECKING(for HPUX/OSF thread support)
169 if test -f /usr/include/dce/cma_config.h ; then
170 AC_MSG_RESULT(yes)
171 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
172 THREAD_DB_OBS=hpux-thread.o
173 else
174 AC_MSG_RESULT(no)
175 fi
176 ;;
177 esac
178 AC_SUBST(THREAD_DB_OBS)
179 AC_SUBST(CONFIG_LDFLAGS)
180 fi
181
182 dnl Handle optional features that can be enabled.
183 ENABLE_CFLAGS=
184 ENABLE_CLIBS=
185 ENABLE_OBS=
186
187 AC_ARG_ENABLE(netrom,
188 [ --enable-netrom ],
189 [case "${enableval}" in
190 yes) enable_netrom=yes ;;
191 no) enable_netrom=no ;;
192 *) AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;;
193 esac])
194
195 if test "${enable_netrom}" = "yes"; then
196 ENABLE_OBS="${ENABLE_OBS} remote-nrom.o"
197 fi
198
199 # start-sanitize-gm
200 ENABLE_GM=
201
202 AC_ARG_ENABLE(gm,
203 [ --enable-gm ],
204 [case "${enableval}" in
205 yes) ENABLE_OBS="${ENABLE_OBS} gmagic.o"
206 ENABLE_CFLAGS=-DGENERAL_MAGIC
207 ;;
208 no) ;;
209 *) AC_MSG_ERROR(bad value ${enableval} given for gm option) ;;
210 esac])
211
212 # end-sanitize-gm
213
214 AC_ARG_ENABLE(sim-powerpc,
215 [ --enable-sim-powerpc ],
216 [case "${enableval}" in
217 yes) powerpc_sim=yes ;;
218 no) powerpc_sim=no ;;
219 *) AC_MSG_ERROR(bad value ${enableval} given for sim-powerpc option) ;;
220 esac],[if test x"$GCC" != x""; then powerpc_sim=yes; else powerpc_sim=no; fi])
221
222 # start-sanitize-gdbtk
223 ENABLE_GDBTK=
224
225 AC_ARG_ENABLE(gdbtk,
226 [ --enable-gdbtk ],
227 [case "${enableval}" in
228 yes)
229 case "$host" in
230 *go32*)
231 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
232 enable_gdbtk=no ;;
233 *cygwin32* | *windows*)
234 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
235 enable_gdbtk=no ;;
236 *)
237 enable_gdbtk=yes ;;
238 esac ;;
239 no)
240 enable_gdbtk=no ;;
241 *)
242 AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
243 esac],
244 [
245 # Default is on for everything but go32 and cygwin32
246 case "$host" in
247 *go32* | *cygwin32* | *windows*)
248 ;;
249 *)
250 enable_gdbtk=yes ;;
251 esac
252 ])
253
254 if test "${enable_gdbtk}" = "yes"; then
255
256 CY_AC_PATH_TCLCONFIG
257 if test -z "${no_tcl}"; then
258 CY_AC_LOAD_TCLCONFIG
259 CY_AC_PATH_TKCONFIG
260
261 # If $no_tk is nonempty, then we can't do Tk, and there is no
262 # point to doing Tcl.
263 if test -z "${no_tk}"; then
264 CY_AC_LOAD_TKCONFIG
265 CY_AC_PATH_TCLH
266 CY_AC_PATH_TKH
267
268 # Include some libraries that Tcl and Tk want.
269 LIBS="$LIBS $TK_LIBS"
270
271 ENABLE_GDBTK=1
272
273 TCL_LIBS='$(TCL) $(TK) $(X11_LDFLAGS) $(X11_LIBS)'
274 ENABLE_CLIBS="${ENABLE_CLIBS} ${TCL_LIBS}"
275 ENABLE_OBS="${ENABLE_OBS} gdbtk.o"
276 fi
277 fi
278 fi
279
280 AC_SUBST(ENABLE_GDBTK)
281 AC_SUBST(X_CFLAGS)
282 AC_SUBST(X_LDFLAGS)
283 AC_SUBST(X_LIBS)
284 # end-sanitize-gdbtk
285
286 AC_SUBST(ENABLE_CFLAGS)
287 AC_SUBST(ENABLE_CLIBS)
288 AC_SUBST(ENABLE_OBS)
289
290 # Begin stuff to support --enable-shared
291 AC_ARG_ENABLE(shared,
292 [ --enable-shared use shared libraries],
293 [case "${enableval}" in
294 yes) shared=true ;;
295 no) shared=false ;;
296 *) shared=true ;;
297 esac])dnl
298
299 HLDFLAGS=
300 HLDENV=
301 # If we have shared libraries, try to set rpath reasonably.
302 if test "${shared}" = "true"; then
303 case "${host}" in
304 *-*-hpux*)
305 HLDFLAGS='-Wl,+s,+b,$(libdir)'
306 ;;
307 *-*-irix5* | *-*-irix6*)
308 HLDFLAGS='-Wl,-rpath,$(libdir)'
309 ;;
310 *-*-linux*aout*)
311 ;;
312 *-*-linux* | *-pc-linux-gnu)
313 HLDFLAGS='-Wl,-rpath,$(libdir)'
314 ;;
315 *-*-solaris*)
316 HLDFLAGS='-R $(libdir)'
317 ;;
318 *-*-sysv4*)
319 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;'
320 ;;
321 esac
322 fi
323
324 # On SunOS, if the linker supports the -rpath option, use it to
325 # prevent ../bfd and ../opcodes from being included in the run time
326 # search path.
327 case "${host}" in
328 *-*-sunos*)
329 echo 'main () { }' > conftest.c
330 ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
331 if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
332 :
333 elif grep 'No such file' conftest.t >/dev/null 2>&1; then
334 :
335 elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
336 :
337 elif test "${shared}" = "true"; then
338 HLDFLAGS='-Wl,-rpath=$(libdir)'
339 else
340 HLDFLAGS='-Wl,-rpath='
341 fi
342 rm -f conftest.t conftest.c conftest
343 ;;
344 esac
345 AC_SUBST(HLDFLAGS)
346 AC_SUBST(HLDENV)
347 # End stuff to support --enable-shared
348
349 # target_subdir is used by the testsuite to find the target libraries.
350 target_subdir=
351 if test "${host}" != "${target}"; then
352 target_subdir="${target_alias}/"
353 fi
354 AC_SUBST(target_subdir)
355
356 configdirs="doc testsuite"
357
358 dnl
359 changequote(,)dnl
360
361 . ${srcdir}/configure.host
362
363 . ${srcdir}/configure.tgt
364
365 dnl
366 changequote([,])dnl
367
368 frags=
369 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
370 if test ! -f ${host_makefile_frag}; then
371 AC_MSG_ERROR("*** Gdb does not support host ${host}")
372 fi
373 frags="$frags $host_makefile_frag"
374
375 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
376 if test ! -f ${target_makefile_frag}; then
377 AC_MSG_ERROR("*** Gdb does not support target ${target}")
378 fi
379 frags="$frags $target_makefile_frag"
380
381 AC_SUBST_FILE(host_makefile_frag)
382 AC_SUBST_FILE(target_makefile_frag)
383 AC_SUBST(frags)
384
385 changequote(,)dnl
386 hostfile=`sed -n '
387 s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
388 ' ${host_makefile_frag}`
389
390 targetfile=`sed -n '
391 s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
392 ' ${target_makefile_frag}`
393
394 # these really aren't orthogonal true/false values of the same condition,
395 # but shells are slow enough that I like to reuse the test conditions
396 # whenever possible
397 if test "${target}" = "${host}"; then
398 nativefile=`sed -n '
399 s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
400 ' ${host_makefile_frag}`
401 else
402 # GDBserver is only useful in a "native" enviroment
403 configdirs=`echo $configdirs | sed 's/gdbserver//'`
404 fi
405 changequote([,])
406
407 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
408 # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
409 # corresponding links. But we have to remove the xm.h files and tm.h
410 # files anyway, e.g. when switching from "configure host" to
411 # "configure none".
412
413 files=
414 links=
415 rm -f xm.h
416 if test "${hostfile}" != ""; then
417 files="${files} config/${gdb_host_cpu}/${hostfile}"
418 links="${links} xm.h"
419 fi
420 rm -f tm.h
421 if test "${targetfile}" != ""; then
422 files="${files} config/${gdb_target_cpu}/${targetfile}"
423 links="${links} tm.h"
424 fi
425 rm -f nm.h
426 if test "${nativefile}" != ""; then
427 files="${files} config/${gdb_host_cpu}/${nativefile}"
428 links="${links} nm.h"
429 else
430 # A cross-only configuration.
431 files="${files} config/nm-empty.h"
432 links="${links} nm.h"
433 fi
434 # start-sanitize-gdbtk
435
436 # Make it possible to use the GUI without doing a full install
437 if test "${enable_gdbtk}" = "yes" -a ! -f gdbtk.tcl ; then
438 files="${files} gdbtk.tcl"
439 links="${links} gdbtk.tcl"
440 fi
441 # end-sanitize-gdbtk
442
443 AC_LINK_FILES($files, $links)
444
445 AC_CONFIG_SUBDIRS($configdirs)
446 AC_OUTPUT(Makefile,
447 [
448 dnl Autoconf doesn't provide a mechanism for modifying definitions
449 dnl provided by makefile fragments.
450 dnl
451 if test "${nativefile}" = ""; then
452 sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
453 < Makefile > Makefile.tem
454 mv -f Makefile.tem Makefile
455 fi
456
457 changequote(,)dnl
458 sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
459 /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
460 /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
461 mv -f Makefile.tmp Makefile
462 changequote([,])dnl
463
464 case ${srcdir} in
465 .)
466 ;;
467 *)
468 grep "source ${srcdir}/.gdbinit" .gdbinit >/dev/null 2>/dev/null || \
469 echo "source ${srcdir}/.gdbinit" >> .gdbinit
470 esac
471
472 case x$CONFIG_HEADERS in
473 xconfig.h:config.in)
474 echo > stamp-h ;;
475 esac
476 ],
477 [
478 gdb_host_cpu=$gdb_host_cpu
479 gdb_target_cpu=$gdb_target_cpu
480 nativefile=$nativefile
481 ])
482
483 exit 0
484
This page took 0.050702 seconds and 4 git commands to generate.