* configure.in, configure: Handle mips*-sgi-irix6*.
[deliverable/binutils-gdb.git] / gdb / configure.in
CommitLineData
2f4973f8
SG
1dnl Autoconf configure script for GDB, the GNU debugger.
2dnl Copyright 1995, 1996 Free Software Foundation, Inc.
3dnl
4dnl This file is part of GDB.
5dnl
6dnl This program is free software; you can redistribute it and/or modify
7dnl it under the terms of the GNU General Public License as published by
8dnl the Free Software Foundation; either version 2 of the License, or
9dnl (at your option) any later version.
10dnl
11dnl This program is distributed in the hope that it will be useful,
12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14dnl GNU General Public License for more details.
15dnl
16dnl You should have received a copy of the GNU General Public License
17dnl along with this program; if not, write to the Free Software
476a283f 18dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2f4973f8 19
5436fc65 20dnl Process this file with autoconf to produce a configure script.
2f4973f8 21
5d8b7982 22AC_PREREQ(2.5)dnl
5436fc65 23AC_INIT(main.c)
18ea4416 24AC_CONFIG_HEADER(config.h:config.in)
5436fc65 25
5436fc65
C
26AC_PROG_CC
27AC_AIX
28AC_MINIX
29AC_ISC_POSIX
30
0579b53d
GN
31AC_CANONICAL_SYSTEM
32
5436fc65 33AC_PROG_INSTALL
d8efbc66
FF
34AC_CHECK_TOOL(AR, ar)
35AC_CHECK_TOOL(RANLIB, ranlib, :)
1e02f078 36AC_PROG_YACC
d8efbc66 37AC_PROG_AWK
5436fc65
C
38
39AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
5436fc65
C
40AC_ARG_PROGRAM
41
2b576293 42AC_HEADER_STDC
fef1696f 43AC_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)
2b576293
C
44AC_HEADER_STAT
45
8501c742
SG
46AC_C_CONST
47
5d394f70 48AC_CHECK_FUNCS(setpgid sbrk select poll)
72ae15f6 49
54225fd0
MA
50# If we are configured native on Linux, work around problems with sys/procfs.h
51if 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
58fi
59
4708ac65 60AC_MSG_CHECKING([for gregset_t type])
07b77f5c 61AC_CACHE_VAL(gdb_cv_have_gregset_t,
4708ac65 62[AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0],
07b77f5c
FF
63gdb_cv_have_gregset_t=yes, gdb_cv_have_gregset_t=no)])
64AC_MSG_RESULT($gdb_cv_have_gregset_t)
65if test $gdb_cv_have_gregset_t = yes; then
4708ac65
FF
66 AC_DEFINE(HAVE_GREGSET_T)
67fi
68
69AC_MSG_CHECKING([for fpregset_t type])
07b77f5c 70AC_CACHE_VAL(gdb_cv_have_fpregset_t,
4708ac65 71[AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0],
07b77f5c
FF
72gdb_cv_have_fpregset_t=yes, gdb_cv_have_fpregset_t=no)])
73AC_MSG_RESULT($gdb_cv_have_fpregset_t)
74if test $gdb_cv_have_fpregset_t = yes; then
4708ac65
FF
75 AC_DEFINE(HAVE_FPREGSET_T)
76fi
77
3f550b59
FF
78dnl See if compiler supports "long long" type.
79
80AC_MSG_CHECKING(for long long support in compiler)
81AC_CACHE_VAL(gdb_cv_c_long_long,
80f600a4 82[AC_TRY_COMPILE(, [
d538f9cf
FF
83 extern long long foo;
84 switch (foo & 2) { case 0: return 1; }
85],
3f550b59
FF
86gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
87AC_MSG_RESULT($gdb_cv_c_long_long)
88if test $gdb_cv_c_long_long = yes; then
89 AC_DEFINE(CC_HAS_LONG_LONG)
90fi
91
92dnl See if the compiler and runtime support printing long long
93
94AC_MSG_CHECKING(for long long support in printf)
95AC_CACHE_VAL(gdb_cv_printf_has_long_long,
96[AC_TRY_RUN([
97int main () {
98 char buf[16];
99 long long l = 0x12345;
100 sprintf (buf, "%llx", l);
101 return (strcmp ("12345", buf));
102}],
103gdb_cv_printf_has_long_long=yes,
104gdb_cv_printf_has_long_long=no,
105gdb_cv_printf_has_long_long=no)])
106if test $gdb_cv_printf_has_long_long = yes; then
107 AC_DEFINE(PRINTF_HAS_LONG_LONG)
108fi
109AC_MSG_RESULT($gdb_cv_printf_has_long_long)
110
aa220473
SG
111dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
112dnl because autoconf complains about cross-compilation issues. However, this
113dnl code uses the same variables as the macro for compatibility.
114
07b77f5c 115AC_MSG_CHECKING(for long double support in compiler)
aa220473
SG
116AC_CACHE_VAL(ac_cv_c_long_double,
117[AC_TRY_COMPILE(, [long double foo;],
118ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
119AC_MSG_RESULT($ac_cv_c_long_double)
120if test $ac_cv_c_long_double = yes; then
121 AC_DEFINE(HAVE_LONG_DOUBLE)
122fi
123
07b77f5c
FF
124dnl See if the compiler and runtime support printing long doubles
125
126AC_MSG_CHECKING(for long double support in printf)
127AC_CACHE_VAL(gdb_cv_printf_has_long_double,
128[AC_TRY_RUN([
129int main () {
130 char buf[16];
131 long double f = 3.141592653;
132 sprintf (buf, "%Lg", f);
133 return (strncmp ("3.14159", buf, 7));
134}],
135gdb_cv_printf_has_long_double=yes,
136gdb_cv_printf_has_long_double=no,
137gdb_cv_printf_has_long_double=no)])
138if test $gdb_cv_printf_has_long_double = yes; then
139 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
140fi
141AC_MSG_RESULT($gdb_cv_printf_has_long_double)
142
2b576293 143AC_FUNC_MMAP
5436fc65 144
fef1696f
ILT
145BFD_NEED_DECLARATION(malloc)
146BFD_NEED_DECLARATION(realloc)
147BFD_NEED_DECLARATION(free)
148
4915acad
SG
149dnl See if thread_db library is around for Solaris thread debugging. Note that
150dnl we must explicitly test for version 1 of the library because version 0
151dnl (present on Solaris 2.4 or earlier) doesn't have the same API.
152
89e673a4
SG
153dnl Note that we only want this if we are both native (host == target), and
154dnl not doing a canadian cross build (build == host).
155
156if test ${build} = ${host} -a ${host} = ${target} ; then
4915acad
SG
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
5d394f70
SG
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
4915acad
SG
178 AC_SUBST(THREAD_DB_OBS)
179 AC_SUBST(CONFIG_LDFLAGS)
89e673a4 180fi
47ef0da5 181
5436fc65
C
182dnl Handle optional features that can be enabled.
183ENABLE_CFLAGS=
184ENABLE_CLIBS=
185ENABLE_OBS=
186
187AC_ARG_ENABLE(netrom,
188[ --enable-netrom ],
189[case "${enableval}" in
190yes) enable_netrom=yes ;;
191no) enable_netrom=no ;;
192*) AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;;
193esac])
194
195if test "${enable_netrom}" = "yes"; then
196 ENABLE_OBS="${ENABLE_OBS} remote-nrom.o"
197fi
198
188c635f
SG
199# start-sanitize-gm
200ENABLE_GM=
201
202AC_ARG_ENABLE(gm,
203[ --enable-gm ],
204[case "${enableval}" in
640086fd 205yes) ENABLE_OBS="${ENABLE_OBS} gmagic.o"
188c635f
SG
206 ENABLE_CFLAGS=-DGENERAL_MAGIC
207 ;;
208no) ;;
209*) AC_MSG_ERROR(bad value ${enableval} given for gm option) ;;
210esac])
211
212# end-sanitize-gm
213
3c0bf315
MM
214AC_ARG_ENABLE(sim-powerpc,
215[ --enable-sim-powerpc ],
216[case "${enableval}" in
217yes) powerpc_sim=yes ;;
218no) powerpc_sim=no ;;
219*) AC_MSG_ERROR(bad value ${enableval} given for sim-powerpc option) ;;
220esac],[if test x"$GCC" != x""; then powerpc_sim=yes; else powerpc_sim=no; fi])
221
5436fc65
C
222# start-sanitize-gdbtk
223ENABLE_GDBTK=
224
225AC_ARG_ENABLE(gdbtk,
226[ --enable-gdbtk ],
227[case "${enableval}" in
0fe1522a
SG
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 ;;
d9951af4 233 *cygwin32* | *windows*)
b613bfbf
GN
234 AC_MSG_WARN([GDB does not support GDBtk on host ${host}. GDBtk will be disabled.])
235 enable_gdbtk=no ;;
0fe1522a
SG
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) ;;
243esac],
244[
b613bfbf 245# Default is on for everything but go32 and cygwin32
0fe1522a 246case "$host" in
d9951af4 247 *go32* | *cygwin32* | *windows*)
b613bfbf 248 ;;
0fe1522a
SG
249 *)
250 enable_gdbtk=yes ;;
251 esac
252])
5436fc65
C
253
254if test "${enable_gdbtk}" = "yes"; then
0fe1522a 255
047465fd 256 CY_AC_PATH_TCLCONFIG
0cf433d9
ILT
257 if test -z "${no_tcl}"; then
258 CY_AC_LOAD_TCLCONFIG
259 CY_AC_PATH_TKCONFIG
047465fd 260
0cf433d9
ILT
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
047465fd 267
0cf433d9
ILT
268 # Include some libraries that Tcl and Tk want.
269 LIBS="$LIBS $TK_LIBS"
047465fd 270
0cf433d9 271 ENABLE_GDBTK=1
1a57cd09 272
0cf433d9
ILT
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
a2b63bbd 277 fi
5436fc65 278fi
a2b63bbd 279
5436fc65 280AC_SUBST(ENABLE_GDBTK)
9c0bc1da 281AC_SUBST(X_CFLAGS)
a2b63bbd
JM
282AC_SUBST(X_LDFLAGS)
283AC_SUBST(X_LIBS)
5436fc65
C
284# end-sanitize-gdbtk
285
286AC_SUBST(ENABLE_CFLAGS)
287AC_SUBST(ENABLE_CLIBS)
288AC_SUBST(ENABLE_OBS)
6ec7e4d3 289
1d5eb137
FF
290# Begin stuff to support --enable-shared
291AC_ARG_ENABLE(shared,
292[ --enable-shared use shared libraries],
293[case "${enableval}" in
294 yes) shared=true ;;
295 no) shared=false ;;
296 *) shared=true ;;
297esac])dnl
298
299HLDFLAGS=
300HLDENV=
301# If we have shared libraries, try to set rpath reasonably.
302if 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 ;;
8ddf07a2 312 *-*-linux* | *-pc-linux-gnu)
1d5eb137
FF
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
322fi
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.
327case "${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 :
074d813d
PS
337 elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
338 :
1d5eb137
FF
339 elif test "${shared}" = "true"; then
340 HLDFLAGS='-Wl,-rpath=$(libdir)'
341 else
342 HLDFLAGS='-Wl,-rpath='
343 fi
344 rm -f conftest.t conftest.c conftest
345 ;;
346esac
347AC_SUBST(HLDFLAGS)
348AC_SUBST(HLDENV)
349# End stuff to support --enable-shared
350
9c0bc1da
DE
351# target_subdir is used by the testsuite to find the target libraries.
352target_subdir=
353if test "${host}" != "${target}"; then
354 target_subdir="${target_alias}/"
355fi
356AC_SUBST(target_subdir)
bc028766 357
6ec7e4d3
SS
358configdirs="doc testsuite"
359
5436fc65
C
360dnl
361changequote(,)dnl
0df06ca0 362
943e243c 363. ${srcdir}/configure.host
1a0edbc7 364
943e243c 365. ${srcdir}/configure.tgt
6c815bbe 366
5436fc65
C
367dnl
368changequote([,])dnl
369
5f107900 370frags=
5436fc65
C
371host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
372if test ! -f ${host_makefile_frag}; then
373AC_MSG_ERROR("*** Gdb does not support host ${host}")
912e0732 374fi
5f107900 375frags="$frags $host_makefile_frag"
912e0732 376
5436fc65
C
377target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
378if test ! -f ${target_makefile_frag}; then
379AC_MSG_ERROR("*** Gdb does not support target ${target}")
912e0732 380fi
5f107900 381frags="$frags $target_makefile_frag"
912e0732 382
5436fc65
C
383AC_SUBST_FILE(host_makefile_frag)
384AC_SUBST_FILE(target_makefile_frag)
5f107900 385AC_SUBST(frags)
5436fc65 386
094fd4ae
C
387changequote(,)dnl
388hostfile=`sed -n '
389s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
390' ${host_makefile_frag}`
5436fc65 391
094fd4ae
C
392targetfile=`sed -n '
393s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
394' ${target_makefile_frag}`
79f68f0f
DZ
395
396# these really aren't orthogonal true/false values of the same condition,
397# but shells are slow enough that I like to reuse the test conditions
398# whenever possible
5436fc65 399if test "${target}" = "${host}"; then
094fd4ae
C
400nativefile=`sed -n '
401s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
402' ${host_makefile_frag}`
79f68f0f 403else
5436fc65
C
404# GDBserver is only useful in a "native" enviroment
405configdirs=`echo $configdirs | sed 's/gdbserver//'`
d40309c7 406fi
094fd4ae 407changequote([,])
d40309c7 408
d40309c7 409# If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
6573c898 410# (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
d40309c7
JG
411# corresponding links. But we have to remove the xm.h files and tm.h
412# files anyway, e.g. when switching from "configure host" to
413# "configure none".
414
bdf3621b
JG
415files=
416links=
dc0c3f64 417rm -f xm.h
5436fc65
C
418if test "${hostfile}" != ""; then
419files="${files} config/${gdb_host_cpu}/${hostfile}"
420links="${links} xm.h"
bdf3621b 421fi
dc0c3f64 422rm -f tm.h
5436fc65
C
423if test "${targetfile}" != ""; then
424files="${files} config/${gdb_target_cpu}/${targetfile}"
425links="${links} tm.h"
bdf3621b 426fi
1a0edbc7 427rm -f nm.h
5436fc65
C
428if test "${nativefile}" != ""; then
429files="${files} config/${gdb_host_cpu}/${nativefile}"
430links="${links} nm.h"
c9c23412 431else
5436fc65
C
432# A cross-only configuration.
433files="${files} config/nm-empty.h"
434links="${links} nm.h"
d40309c7 435fi
d3d75ec9 436# start-sanitize-gdbtk
912e0732 437
5436fc65
C
438# Make it possible to use the GUI without doing a full install
439if test "${enable_gdbtk}" = "yes" -a ! -f gdbtk.tcl ; then
440files="${files} gdbtk.tcl"
441links="${links} gdbtk.tcl"
754e5da2 442fi
d3d75ec9 443# end-sanitize-gdbtk
754e5da2 444
5436fc65
C
445AC_LINK_FILES($files, $links)
446
447AC_CONFIG_SUBDIRS($configdirs)
448AC_OUTPUT(Makefile,
449[
450dnl Autoconf doesn't provide a mechanism for modifying definitions
451dnl provided by makefile fragments.
452dnl
453if test "${nativefile}" = ""; then
7bd1f0c5 454sed -e '/^NATDEPFILES[[ ]]*=[[ ]]*/s//# NATDEPFILES=/' \
5436fc65
C
455 < Makefile > Makefile.tem
456mv -f Makefile.tem Makefile
33bc979d
SS
457fi
458
5436fc65 459changequote(,)dnl
94d4b713
JK
460sed -e '/^TM_FILE[ ]*=/s,^TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
461/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
462/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
463mv -f Makefile.tmp Makefile
5436fc65
C
464changequote([,])dnl
465
466case ${srcdir} in
467.)
468;;
469*)
470grep "source ${srcdir}/.gdbinit" .gdbinit >/dev/null 2>/dev/null || \
471echo "source ${srcdir}/.gdbinit" >> .gdbinit
472esac
31520669
FF
473
474case x$CONFIG_HEADERS in
18ea4416 475xconfig.h:config.in)
31520669
FF
476echo > stamp-h ;;
477esac
0a5a1821
C
478],
479[
480gdb_host_cpu=$gdb_host_cpu
481gdb_target_cpu=$gdb_target_cpu
482nativefile=$nativefile
5436fc65 483])
5e711e7f
PS
484
485exit 0
b7f3b6d5 486
This page took 0.260436 seconds and 4 git commands to generate.