]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/aclocal.m4
Wed Mar 19 11:37:57 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
[thirdparty/binutils-gdb.git] / gdb / aclocal.m4
CommitLineData
4e327047 1dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
047465fd
TT
2dnl major rewriting for Tcl 7.5 by Don Libes <libes@nist.gov>
3
fef1696f
ILT
4sinclude(../bfd/aclocal.m4)
5
047465fd
TT
6dnl CY_AC_PATH_TCLCONFIG and CY_AC_LOAD_TCLCONFIG should be invoked
7dnl (in that order) before any other TCL macros. Similarly for TK.
8
4e327047
TT
9dnl CYGNUS LOCAL: This gets the right posix flag for gcc
10AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
11[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
047465fd 12AC_MSG_CHECKING([if running LynxOS])
4e327047
TT
13AC_CACHE_VAL(ac_cv_os_lynx,
14[AC_EGREP_CPP(yes,
15[/*
16 * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
17 */
18#if defined(__Lynx__) || defined(Lynx)
19yes
20#endif
21], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
5436fc65 22#
4e327047
TT
23if test "$ac_cv_os_lynx" = "yes" ; then
24 AC_MSG_RESULT(yes)
25 AC_DEFINE(LYNX)
26 AC_MSG_CHECKING([whether -mposix or -X is available])
27 AC_CACHE_VAL(ac_cv_c_posix_flag,
28 [AC_TRY_COMPILE(,[
29 /*
30 * This flag varies depending on how old the compiler is.
31 * -X is for the old "cc" and "gcc" (based on 1.42).
32 * -mposix is for the new gcc (at least 2.5.8).
33 */
34 #if defined(__GNUC__) && __GNUC__ >= 2
35 choke me
36 #endif
37 ], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
38 CC="$CC $ac_cv_c_posix_flag"
39 AC_MSG_RESULT($ac_cv_c_posix_flag)
40 else
41 AC_MSG_RESULT(no)
42fi
43])
4bd9f70f 44
047465fd
TT
45#
46# Sometimes the native compiler is a bogus stub for gcc or /usr/ucb/cc. This
47# makes configure think it's cross compiling. If --target wasn't used, then
48# we can't configure, so something is wrong. We don't use the cache
49# here cause if somebody fixes their compiler install, we want this to work.
50AC_DEFUN(CY_AC_C_WORKS,
51[# If we cannot compile and link a trivial program, we can't expect anything to work
52AC_MSG_CHECKING(whether the compiler ($CC) actually works)
53AC_TRY_COMPILE(, [/* don't need anything here */],
54 c_compiles=yes, c_compiles=no)
55
56AC_TRY_LINK(, [/* don't need anything here */],
57 c_links=yes, c_links=no)
58
59if test x"${c_compiles}" = x"no" ; then
60 AC_MSG_ERROR(the native compiler is broken and won't compile.)
61fi
62
63if test x"${c_links}" = x"no" ; then
64 AC_MSG_ERROR(the native compiler is broken and won't link.)
65fi
66AC_MSG_RESULT(yes)
67])
68
4e327047
TT
69AC_DEFUN(CY_AC_PATH_TCLH, [
70#
71# Ok, lets find the tcl source trees so we can use the headers
72# Warning: transition of version 9 to 10 will break this algorithm
73# because 10 sorts before 9. We also look for just tcl. We have to
74# be careful that we don't match stuff like tclX by accident.
75# the alternative search directory is involked by --with-tclinclude
76#
77no_tcl=true
78AC_MSG_CHECKING(for Tcl private headers)
79AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl private headers are], with_tclinclude=${withval})
80AC_CACHE_VAL(ac_cv_c_tclh,[
81# first check to see if --with-tclinclude was specified
82if test x"${with_tclinclude}" != x ; then
83 if test -f ${with_tclinclude}/tclInt.h ; then
84 ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
047465fd
TT
85 elif test -f ${with_tclinclude}/generic/tclInt.h ; then
86 ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
5436fc65 87 else
4e327047 88 AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
5436fc65 89 fi
4e327047 90fi
047465fd
TT
91
92# next check if it came with Tcl configuration file
93if test x"${ac_cv_c_tclconfig}" = x ; then
94 if test -f $ac_cv_c_tclconfig/../generic/tclInt.h ; then
95 ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/..; pwd)`
96 fi
97fi
98
4e327047
TT
99# next check in private source directory
100#
101# since ls returns lowest version numbers first, reverse its output
102if test x"${ac_cv_c_tclh}" = x ; then
103 for i in \
104 ${srcdir}/../tcl \
047465fd 105 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` \
4e327047 106 ${srcdir}/../../tcl \
047465fd 107 `ls -dr ${srcdir}/../../tcl[[7-9]]* 2>/dev/null` \
4e327047 108 ${srcdir}/../../../tcl \
047465fd 109 `ls -dr ${srcdir}/../../../tcl[[7-9]]* 2>/dev/null ` ; do
4e327047 110 if test -f $i/generic/tclInt.h ; then
047465fd 111 ac_cv_c_tclh=`(cd $i/generic; pwd)`
4bd9f70f 112 break
4e327047
TT
113 fi
114 done
115fi
116# finally check in a few common install locations
117#
118# since ls returns lowest version numbers first, reverse its output
119if test x"${ac_cv_c_tclh}" = x ; then
120 for i in \
047465fd
TT
121 `ls -dr /usr/local/src/tcl[[7-9]]* 2>/dev/null` \
122 `ls -dr /usr/local/lib/tcl[[7-9]]* 2>/dev/null` \
4e327047
TT
123 /usr/local/src/tcl \
124 /usr/local/lib/tcl \
125 ${prefix}/include ; do
047465fd
TT
126 if test -f $i/generic/tclInt.h ; then
127 ac_cv_c_tclh=`(cd $i/generic; pwd)`
4e327047
TT
128 break
129 fi
130 done
131fi
132# see if one is installed
133if test x"${ac_cv_c_tclh}" = x ; then
134 AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
135fi
136])
137if test x"${ac_cv_c_tclh}" = x ; then
138 TCLHDIR="# no Tcl private headers found"
139 AC_MSG_ERROR([Can't find Tcl private headers])
140fi
141if test x"${ac_cv_c_tclh}" != x ; then
142 no_tcl=""
4bd9f70f 143 if test x"${ac_cv_c_tclh}" = x"installed" ; then
4e327047
TT
144 AC_MSG_RESULT([is installed])
145 TCLHDIR=""
146 else
147 AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
148 # this hack is cause the TCLHDIR won't print if there is a "-I" in it.
149 TCLHDIR="-I${ac_cv_c_tclh}"
5436fc65
C
150 fi
151fi
4e327047 152
4e327047
TT
153AC_SUBST(TCLHDIR)
154])
047465fd
TT
155
156
157AC_DEFUN(CY_AC_PATH_TCLCONFIG, [
5436fc65 158#
047465fd 159# Ok, lets find the tcl configuration
5436fc65 160# First, look for one uninstalled.
047465fd 161# the alternative search directory is invoked by --with-tclconfig
5436fc65 162#
4e327047 163
4e327047 164if test x"${no_tcl}" = x ; then
047465fd 165 # we reset no_tcl in case something fails here
4e327047 166 no_tcl=true
047465fd
TT
167 AC_ARG_WITH(tclconfig, [ --with-tclconfig directory containing tcl configuration (tclConfig.sh)],
168 with_tclconfig=${withval})
169 AC_MSG_CHECKING([for Tcl configuration])
170 AC_CACHE_VAL(ac_cv_c_tclconfig,[
171
172 # First check to see if --with-tclconfig was specified.
173 if test x"${with_tclconfig}" != x ; then
174 if test -f "${with_tclconfig}/tclConfig.sh" ; then
175 ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
4e327047 176 else
047465fd 177 AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
4e327047 178 fi
5436fc65 179 fi
047465fd
TT
180
181 # then check for a private Tcl installation
182 if test x"${ac_cv_c_tclconfig}" = x ; then
4e327047
TT
183 for i in \
184 ../tcl \
047465fd 185 `ls -dr ../tcl[[7-9]]* 2>/dev/null` \
4e327047 186 ../../tcl \
047465fd 187 `ls -dr ../../tcl[[7-9]]* 2>/dev/null` \
4e327047 188 ../../../tcl \
047465fd
TT
189 `ls -dr ../../../tcl[[7-9]]* 2>/dev/null` ; do
190 if test -f "$i/unix/tclConfig.sh" ; then
191 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
4e327047
TT
192 break
193 fi
194 done
5436fc65 195 fi
4e327047 196 # check in a few common install locations
047465fd 197 if test x"${ac_cv_c_tclconfig}" = x ; then
4e327047 198 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
047465fd
TT
199 if test -f "$i/tclConfig.sh" ; then
200 ac_cv_c_tclconfig=`(cd $i; pwd)`
4e327047
TT
201 break
202 fi
203 done
5436fc65 204 fi
4e327047 205 # check in a few other private locations
047465fd 206 if test x"${ac_cv_c_tclconfig}" = x ; then
4e327047
TT
207 for i in \
208 ${srcdir}/../tcl \
047465fd
TT
209 `ls -dr ${srcdir}/../tcl[[7-9]]* 2>/dev/null` ; do
210 if test -f "$i/unix/tclConfig.sh" ; then
211 ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
4e327047
TT
212 break
213 fi
214 done
5436fc65 215 fi
4e327047 216 ])
047465fd
TT
217 if test x"${ac_cv_c_tclconfig}" = x ; then
218 TCLCONFIG="# no Tcl configs found"
219 AC_MSG_WARN(Can't find Tcl configuration definitions)
4e327047 220 else
4e327047 221 no_tcl=
047465fd
TT
222 TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
223 AC_MSG_RESULT(found $TCLCONFIG)
4e327047 224 fi
5436fc65 225fi
047465fd
TT
226])
227
228# Defined as a separate macro so we don't have to cache the values
229# from PATH_TCLCONFIG (because this can also be cached).
230AC_DEFUN(CY_AC_LOAD_TCLCONFIG, [
231 . $TCLCONFIG
232
233 AC_SUBST(TCL_VERSION)
234 AC_SUBST(TCL_MAJOR_VERSION)
235 AC_SUBST(TCL_MINOR_VERSION)
236 AC_SUBST(TCL_CC)
237 AC_SUBST(TCL_DEFS)
238
239dnl not used, don't export to save symbols
240dnl AC_SUBST(TCL_LIB_FILE)
241
242dnl don't export, not used outside of configure
243dnl AC_SUBST(TCL_LIBS)
244dnl not used, don't export to save symbols
245dnl AC_SUBST(TCL_PREFIX)
246
247dnl not used, don't export to save symbols
248dnl AC_SUBST(TCL_EXEC_PREFIX)
5436fc65 249
047465fd
TT
250 AC_SUBST(TCL_SHLIB_CFLAGS)
251 AC_SUBST(TCL_SHLIB_LD)
252dnl don't export, not used outside of configure
253 AC_SUBST(TCL_SHLIB_LD_LIBS)
254 AC_SUBST(TCL_SHLIB_SUFFIX)
255dnl not used, don't export to save symbols
256 AC_SUBST(TCL_DL_LIBS)
257 AC_SUBST(TCL_LD_FLAGS)
258dnl don't export, not used outside of configure
259 AC_SUBST(TCL_LD_SEARCH_FLAGS)
260 AC_SUBST(TCL_COMPAT_OBJS)
261 AC_SUBST(TCL_RANLIB)
262 AC_SUBST(TCL_BUILD_LIB_SPEC)
263 AC_SUBST(TCL_LIB_SPEC)
264 AC_SUBST(TCL_LIB_VERSIONS_OK)
265
266dnl not used, don't export to save symbols
267dnl AC_SUBST(TCL_SHARED_LIB_SUFFIX)
268
269dnl not used, don't export to save symbols
270dnl AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
5436fc65 271])
047465fd
TT
272
273# Warning: Tk definitions are very similar to Tcl definitions but
274# are not precisely the same. There are a couple of differences,
275# so don't do changes to Tcl thinking you can cut and paste it do
276# the Tk differences and later simply substitute "Tk" for "Tcl".
277# Known differences:
278# - Acceptable Tcl major version #s is 7-9 while Tk is 4-9
279# - Searching for Tcl includes looking for tclInt.h, Tk looks for tk.h
280# - Computing major/minor versions is different because Tk depends on
281# headers to Tcl, Tk, and X.
282# - Symbols in tkConfig.sh are different than tclConfig.sh
283# - Acceptable for Tk to be missing but not Tcl.
284
4e327047 285AC_DEFUN(CY_AC_PATH_TKH, [
5436fc65 286#
4e327047
TT
287# Ok, lets find the tk source trees so we can use the headers
288# If the directory (presumably symlink) named "tk" exists, use that one
289# in preference to any others. Same logic is used when choosing library
290# and again with Tcl. The search order is the best place to look first, then in
291# decreasing significance. The loop breaks if the trigger file is found.
292# Note the gross little conversion here of srcdir by cd'ing to the found
293# directory. This converts the path from a relative to an absolute, so
294# recursive cache variables for the path will work right. We check all
295# the possible paths in one loop rather than many seperate loops to speed
296# things up.
047465fd 297# the alternative search directory is involked by --with-tkinclude
5436fc65 298#
4e327047 299no_tk=true
047465fd
TT
300AC_MSG_CHECKING(for Tk private headers)
301AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where tk private headers are], with_tkinclude=${withval})
4e327047
TT
302AC_CACHE_VAL(ac_cv_c_tkh,[
303# first check to see if --with-tkinclude was specified
304if test x"${with_tkinclude}" != x ; then
305 if test -f ${with_tkinclude}/tk.h ; then
306 ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
047465fd
TT
307 elif test -f ${with_tkinclude}/generic/tk.h ; then
308 ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
5436fc65 309 else
4e327047 310 AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
5436fc65 311 fi
4e327047 312fi
047465fd
TT
313
314# next check if it came with Tk configuration file
315if test x"${ac_cv_c_tkconfig}" = x ; then
316 if test -f $ac_cv_c_tkconfig/../generic/tk.h ; then
317 ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/..; pwd)`
318 fi
319fi
320
4e327047
TT
321# next check in private source directory
322#
047465fd 323# since ls returns lowest version numbers first, reverse its output
4e327047
TT
324if test x"${ac_cv_c_tkh}" = x ; then
325 for i in \
326 ${srcdir}/../tk \
047465fd 327 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` \
4e327047 328 ${srcdir}/../../tk \
047465fd 329 `ls -dr ${srcdir}/../../tk[[4-9]]* 2>/dev/null` \
4e327047 330 ${srcdir}/../../../tk \
047465fd
TT
331 `ls -dr ${srcdir}/../../../tk[[4-9]]* 2>/dev/null ` ; do
332 if test -f $i/generic/tk.h ; then
333 ac_cv_c_tkh=`(cd $i/generic; pwd)`
4e327047
TT
334 break
335 fi
4e327047
TT
336 done
337fi
338# finally check in a few common install locations
339#
047465fd 340# since ls returns lowest version numbers first, reverse its output
4e327047
TT
341if test x"${ac_cv_c_tkh}" = x ; then
342 for i in \
047465fd
TT
343 `ls -dr /usr/local/src/tk[[4-9]]* 2>/dev/null` \
344 `ls -dr /usr/local/lib/tk[[4-9]]* 2>/dev/null` \
4e327047
TT
345 /usr/local/src/tk \
346 /usr/local/lib/tk \
347 ${prefix}/include ; do
047465fd
TT
348 if test -f $i/generic/tk.h ; then
349 ac_cv_c_tkh=`(cd $i/generic; pwd)`
4e327047
TT
350 break
351 fi
352 done
353fi
354# see if one is installed
355if test x"${ac_cv_c_tkh}" = x ; then
047465fd 356 AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed, ac_cv_c_tkh="")
4e327047
TT
357fi
358])
359if test x"${ac_cv_c_tkh}" != x ; then
360 no_tk=""
361 if test x"${ac_cv_c_tkh}" = x"installed" ; then
362 AC_MSG_RESULT([is installed])
363 TKHDIR=""
364 else
047465fd 365 AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
4e327047
TT
366 # this hack is cause the TKHDIR won't print if there is a "-I" in it.
367 TKHDIR="-I${ac_cv_c_tkh}"
5436fc65
C
368 fi
369else
4e327047
TT
370 TKHDIR="# no Tk directory found"
371 AC_MSG_WARN([Can't find Tk private headers])
372 no_tk=true
5436fc65
C
373fi
374
4e327047
TT
375AC_SUBST(TKHDIR)
376])
047465fd
TT
377
378
379AC_DEFUN(CY_AC_PATH_TKCONFIG, [
5436fc65 380#
047465fd
TT
381# Ok, lets find the tk configuration
382# First, look for one uninstalled.
383# the alternative search directory is invoked by --with-tkconfig
5436fc65 384#
4e327047
TT
385
386if test x"${no_tk}" = x ; then
047465fd
TT
387 # we reset no_tk in case something fails here
388 no_tk=true
389 AC_ARG_WITH(tkconfig, [ --with-tkconfig directory containing tk configuration (tkConfig.sh)],
390 with_tkconfig=${withval})
391 AC_MSG_CHECKING([for Tk configuration])
392 AC_CACHE_VAL(ac_cv_c_tkconfig,[
4e327047 393
047465fd
TT
394 # First check to see if --with-tkconfig was specified.
395 if test x"${with_tkconfig}" != x ; then
396 if test -f "${with_tkconfig}/tkConfig.sh" ; then
397 ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
4e327047 398 else
047465fd 399 AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
4e327047 400 fi
5436fc65 401 fi
047465fd 402
4e327047 403 # then check for a private Tk library
047465fd 404 if test x"${ac_cv_c_tkconfig}" = x ; then
4e327047
TT
405 for i in \
406 ../tk \
047465fd 407 `ls -dr ../tk[[4-9]]* 2>/dev/null` \
4e327047 408 ../../tk \
047465fd 409 `ls -dr ../../tk[[4-9]]* 2>/dev/null` \
4e327047 410 ../../../tk \
047465fd
TT
411 `ls -dr ../../../tk[[4-9]]* 2>/dev/null` ; do
412 if test -f "$i/unix/tkConfig.sh" ; then
413 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
4e327047 414 break
4e327047
TT
415 fi
416 done
417 fi
047465fd
TT
418 # check in a few common install locations
419 if test x"${ac_cv_c_tkconfig}" = x ; then
4e327047 420 for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
047465fd
TT
421 if test -f "$i/tkConfig.sh" ; then
422 ac_cv_c_tkconfig=`(cd $i; pwd)`
4e327047 423 break
4e327047
TT
424 fi
425 done
426 fi
427 # check in a few other private locations
047465fd 428 if test x"${ac_cv_c_tkconfig}" = x ; then
4e327047
TT
429 for i in \
430 ${srcdir}/../tk \
047465fd
TT
431 `ls -dr ${srcdir}/../tk[[4-9]]* 2>/dev/null` ; do
432 if test -f "$i/unix/tkConfig.sh" ; then
433 ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
4e327047 434 break
4e327047
TT
435 fi
436 done
437 fi
4e327047 438 ])
047465fd
TT
439 if test x"${ac_cv_c_tkconfig}" = x ; then
440 TKCONFIG="# no Tk configs found"
441 AC_MSG_WARN(Can't find Tk configuration definitions)
4e327047 442 else
4e327047 443 no_tk=
047465fd
TT
444 TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
445 AC_MSG_RESULT(found $TKCONFIG)
5436fc65 446 fi
5436fc65 447fi
047465fd 448
4e327047 449])
047465fd
TT
450
451# Defined as a separate macro so we don't have to cache the values
452# from PATH_TKCONFIG (because this can also be cached).
453AC_DEFUN(CY_AC_LOAD_TKCONFIG, [
454 if test -f "$TKCONFIG" ; then
455 . $TKCONFIG
456 fi
457
458 AC_SUBST(TK_VERSION)
459dnl not actually used, don't export to save symbols
460dnl AC_SUBST(TK_MAJOR_VERSION)
461dnl AC_SUBST(TK_MINOR_VERSION)
462 AC_SUBST(TK_DEFS)
463
464dnl not used, don't export to save symbols
465 dnl AC_SUBST(TK_LIB_FILE)
466
467dnl not used outside of configure
468dnl AC_SUBST(TK_LIBS)
469dnl not used, don't export to save symbols
470dnl AC_SUBST(TK_PREFIX)
471
472dnl not used, don't export to save symbols
473dnl AC_SUBST(TK_EXEC_PREFIX)
474
475 AC_SUBST(TK_XINCLUDES)
476 AC_SUBST(TK_XLIBSW)
477 AC_SUBST(TK_BUILD_LIB_SPEC)
478 AC_SUBST(TK_LIB_SPEC)
4e327047 479])
047465fd 480