OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [acsupport/] [acinclude.m4] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
dnl Process this file with aclocal to get an aclocal.m4 file. Then
2
dnl process that with autoconf.
3
dnl ====================================================================
4
dnl
5
dnl     acinclude.m4
6
dnl
7
dnl     Various autoconf macros that are shared between different
8
dnl     eCos packages.
9
dnl
10
dnl ====================================================================
11
dnl ####ECOSHOSTGPLCOPYRIGHTBEGIN####
12
dnl -------------------------------------------
13
dnl This file is part of the eCos host tools.
14
dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
15
dnl
16
dnl This program is free software; you can redistribute it and/or modify
17
dnl it under the terms of the GNU General Public License as published by
18
dnl the Free Software Foundation; either version 2 or (at your option) any
19
dnl later version.
20
dnl
21
dnl This program is distributed in the hope that it will be useful, but
22
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
23
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24
dnl General Public License for more details.
25
dnl
26
dnl You should have received a copy of the GNU General Public License
27
dnl along with this program; if not, write to the
28
dnl Free Software Foundation, Inc., 51 Franklin Street,
29
dnl Fifth Floor, Boston, MA  02110-1301, USA.
30
dnl -------------------------------------------
31
dnl ####ECOSHOSTGPLCOPYRIGHTEND####
32
dnl ====================================================================
33
dnl#####DESCRIPTIONBEGIN####
34
dnl
35
dnl Author(s):  bartv
36
dnl Contact(s): bartv
37
dnl Date:       1998/12/16
38
dnl Version:    0.01
39
dnl
40
dnl####DESCRIPTIONEND####
41
dnl ====================================================================
42
 
43
dnl ====================================================================
44
dnl Ensure that configure is not being run in the source tree, i.e.
45
dnl that a separate build tree has been created. This is not absolutely
46
dnl necessary at the time of writing but may become so in future, and
47
dnl is good practice.
48
 
49
AC_DEFUN([ECOS_CHECK_BUILD_ne_SRC],[
50
  AC_MSG_CHECKING([that a separate build tree is being used])
51
  ecos_cwd=`/bin/pwd`
52
  if test "${srcdir}" = "." ; then
53
    srcdir=${ecos_cwd}
54
  fi
55
  if test "${ecos_cwd}" = "${srcdir}" ; then
56
    AC_MSG_RESULT([no])
57
    AC_MSG_ERROR([This configure script should not be run inside the source tree. Instead please use a separate build tree])
58
  else
59
    AC_MSG_RESULT([yes])
60
  fi
61
])
62
 
63
dnl ====================================================================
64
dnl The AM_INIT_AUTOMAKE() will define a symbol VERSION for the
65
dnl package's version number. Unfortunately this symbol is rather
66
dnl hard to share if several different packages are involved, so this
67
dnl macro is used to define an alternative symbol
68
 
69
AC_DEFUN([ECOS_SUBST_VERSION],[
70
  AC_REQUIRE([AM_INIT_AUTOMAKE])
71
  ifelse($#,1,,AC_MSG_ERROR([Invalid number of arguments passed to ECOS SUBST_VERSION]))
72
  AC_DEFINE_UNQUOTED($1, "$VERSION", "eCos host-side package version")
73
])
74
 
75
dnl --------------------------------------------------------------------
76
dnl Convert a cygwin pathname to something acceptable to VC++ (but
77
dnl still invoked from bash and cygwin's make). This means using
78
dnl the cygpath utility and then translating any backslashes into
79
dnl forward slashes to avoid confusing make.
80
 
81
AC_DEFUN([ECOS_MSVC_PATH], [
82
dnl    AC_REQUIRE([ECOS_PROG_MSVC])
83
  ifelse($#, 1, , AC_MSG_ERROR("Invalid number of arguments passed to ECOS MSVC_PATH"))
84
  if test "${MSVC}" = "yes" ; then
85
    $1=`cygpath -w ${$1} | tr \\\\\\\\ /`
86
  fi
87
])
88
 
89
dnl ====================================================================
90
dnl An internal utility to define eCos variants of various compilation
91
dnl related flags. The aim is to avoid messing with CFLAGS, LIBS, and
92
dnl so on because those are used for feature tests as well as for
93
dnl passing on to the application.
94
AC_DEFUN([ECOS_PROG_DEFINE_COMPILER_FLAGS],[
95
  ecos_CFLAGS=""
96
  ecos_CXXFLAGS=""
97
  ecos_LDADD=""
98
  ecos_INCLUDES=""
99
  ecos_LIBS=""
100
  AC_SUBST(ecos_CFLAGS)
101
  AC_SUBST(ecos_CXXFLAGS)
102
  AC_SUBST(ecos_LDADD)
103
  AC_SUBST(ecos_INCLUDES)
104
  AC_SUBST(ecos_LIBS)
105
])
106
 
107
dnl For historical reasons some of the eCos host-side software can be
108
dnl built with Visual C++ as well as g++. The user can specify this
109
dnl at configure time using CC=cl, where cl.exe is the compiler driver.
110
dnl This macro will set the variable MSVC to "yes" or to "no" depending
111
dnl on whether or not VC++ is being used, analogous to the variable
112
dnl GCC set by AC_PROG_CC. It provides support for an automake
113
dnl conditional thus allowing the makefile to adapt somewhat to the
114
dnl compiler being used. Finally it fills in the ECOS_INCLUDES,
115
dnl ECOS_LIBS and ECOS_LDADD variables with suitable initial values.
116
 
117
AC_DEFUN([ECOS_PROG_MSVC],[
118
  AC_REQUIRE([AC_PROG_CC])
119
  AC_REQUIRE([AC_PROG_CXX])
120
  AC_REQUIRE([ECOS_PROG_DEFINE_COMPILER_FLAGS])
121
 
122
  AC_MSG_CHECKING("for Visual C++")
123
  MSVC="no";
124
  if test "${CC}" = "cl" ; then
125
     MSVC="yes"
126
     CXX="cl"
127
     MSVC_SRCDIR=${srcdir}
128
     ECOS_MSVC_PATH(MSVC_SRCDIR)
129
     AC_SUBST(MSVC_SRCDIR)
130
     ecos_INCLUDES="${ecos_INCLUDES} \"-I${MSVC_SRCDIR}\""
131
     ecos_LDADD="-link"
132
     ecos_LIBS="advapi32.lib"
133
  fi
134
  AM_CONDITIONAL(MSVC, test "${MSVC}" = "yes")
135
  if test "${MSVC}" = "yes" ; then
136
    AC_MSG_RESULT([unfortunately yes])
137
  else
138
    AC_MSG_RESULT([no])
139
  fi
140
])
141
 
142
dnl ====================================================================
143
dnl Set up sensible flags for the various different compilers. This
144
dnl is achieved by manipulating AM-CFLAGS and AM-CXXFLAGS via a subst,
145
dnl plus undoing the setting of CFLAGS and CXXFLAGS done by
146
dnl the AC_PROC_CC and AC_PROG_CXX macros (e.g. setting the default
147
dnl compilation flags to -O2). Note that this relies
148
dnl on knowing about the internals of those macros.
149
dnl
150
dnl There is little point in checking the cache: this macro does
151
dnl not do any feature tests so checking the cache would probably
152
dnl be more expensive than doing the work here.
153
dnl
154
dnl For now the only supported compilers are gcc/g++ and VC++. Attempts
155
dnl to use another compiler will result in an error at configure-time.
156
AC_DEFUN([ECOS_PROG_STANDARD_COMPILER_FLAGS], [
157
  AC_REQUIRE([AC_PROG_CC])
158
  AC_REQUIRE([AC_PROG_CXX])
159
  AC_REQUIRE([ECOS_PROG_DEFINE_COMPILER_FLAGS])
160
  AC_REQUIRE([ECOS_PROG_MSVC])
161
 
162
  AC_MSG_CHECKING("the default compiler flags")
163
 
164
  dnl Add a user-settable flag to control whether or debugging info is
165
  dnl incorporated at compile-time.
166
  ecosflags_enable_debug="no"
167
  AC_ARG_ENABLE(debug,[ --enable-debug           do a debug rather than a release build],
168
  [case "${enableval}" in
169
     yes) ecosflags_enable_debug="yes" ;;
170
     *)   ecosflags_enable_debug="no" ;;
171
  esac])
172
 
173
  dnl For VC++ builds also provide a flag for ANSI vs. unicode builds.
174
  dnl For now this does not actually affect the compiler flags.
175
  dnl NOTE: there may also have to be a flag to control whether or
176
  dnl the VC++ multi-threading flags are enabled.
177
  ecosflags_enable_ansi="no"
178
  if test "${MSVC}" = "yes" ; then
179
    AC_ARG_ENABLE(ansi,[ --enable-ansi            do an ANSI rather than a unicode build],
180
    [case "${enableval}" in
181
       yes) ecosflags_enable_ansi="yes" ;;
182
       *)   ecosflags_enable_ansi="no" ;;
183
    esac])
184
  fi
185
 
186
  dnl Now we know what the user is after.
187
  if test "${GCC}" = "yes" ; then
188
    ecos_CFLAGS="${ecos_CFLAGS} -pipe -Wall -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs"
189
    ecos_CXXFLAGS="${ecos_CXXFLAGS} -pipe -Wall -Wpointer-arith -Wcast-qual -Woverloaded-virtual"
190
  elif test "${MSVC}" = "yes" ; then
191
    ecos_CFLAGS="${ecos_CFLAGS} -nologo -W3"
192
    ecos_CXXFLAGS="${ecos_CXXFLAGS} -nologo -W3 -GR -GX"
193
  else
194
    AC_MSG_ERROR("default flags for ${CC} are not known")
195
  fi
196
 
197
  dnl Choose between debugging and optimization.
198
  if test "${ecosflags_enable_debug}" = "yes" ; then
199
    if test "${GCC}" = "yes" ; then
200
      ecos_CFLAGS="${ecos_CFLAGS} -g -O0"
201
      ecos_CXXFLAGS="${ecos_CXXFLAGS} -g -O0"
202
    elif test "${MSVC}" = "yes" ; then
203
      ecos_CFLAGS="${ecos_CFLAGS} -MDd -Zi"
204
      ecos_CXXFLAGS="${ecos_CXXFLAGS} -MDd -Zi"
205
    fi
206
  else
207
    dnl With older versions of g++ building the host-side tools with
208
    dnl -O2 took forever. These problems should now have gone away.
209
    if test "${GCC}" = "yes" ; then
210
      ecos_CFLAGS="${ecos_CFLAGS} -O2"
211
      ecos_CXXFLAGS="${ecos_CXXFLAGS} -O2"
212
    elif test "${MSVC}" = "yes" ; then
213
      ecos_CFLAGS="${ecos_CFLAGS} -MD -O2"
214
      ecos_CXXFLAGS="${ecos_CXXFLAGS} -MD -O2"
215
    fi
216
  fi
217
 
218
  CFLAGS="${ac_save_CFLAGS}"
219
  CXXFLAGS="${ac_save_CXXFLAGS}"
220
 
221
  AC_MSG_RESULT(done)
222
])
223
 
224
dnl --------------------------------------------------------------------
225
dnl User-settable options for assertions and tracing.
226
dnl
227
dnl The settable options are:
228
dnl   --disable-asserts
229
dnl   --disable-preconditions
230
dnl   --disable-postconditions
231
dnl   --disable-invariants
232
dnl   --disable-loopinvariants
233
dnl   --disable-tracing
234
dnl   --disable-fntracing
235
 
236
AC_DEFUN([ECOS_ARG_INFRASTRUCTURE], [
237
 
238
  AC_REQUIRE([ECOS_PROG_STANDARD_COMPILER_FLAGS])
239
 
240
  if test "${ecosflags_enable_debug}" = "yes" ; then
241
    ecosinfra_asserts="yes"
242
    ecosinfra_preconditions="yes"
243
    ecosinfra_postconditions="yes"
244
    ecosinfra_invariants="yes"
245
    ecosinfra_loopinvariants="yes"
246
    ecosinfra_tracing="yes"
247
    ecosinfra_fntracing="yes"
248
  else
249
    ecosinfra_asserts="no"
250
    ecosinfra_preconditions="no"
251
    ecosinfra_postconditions="no"
252
    ecosinfra_invariants="no"
253
    ecosinfra_loopinvariants="no"
254
    ecosinfra_tracing="no"
255
    ecosinfra_fntracing="no"
256
  fi
257
 
258
  AC_ARG_ENABLE(asserts,[ --disable-asserts        disable all assertions],
259
    [case "${enableval}" in
260
      yes) ecosinfra_asserts="yes" ;;
261
      no)  ecosinfra_asserts="no"  ;;
262
      *)   AC_MSG_ERROR([bad value ${enableval} for disable-asserts option]) ;;
263
    esac])
264
  if test "${ecosinfra_asserts}" = "yes"; then
265
    AC_DEFINE(CYGDBG_USE_ASSERTS,[1],[assertions enabled])
266
  fi
267
 
268
  AC_ARG_ENABLE(preconditions, [ --disable-preconditions  disable a subset of the assertions],
269
    [case "${enableval}" in
270
      yes) ecosinfra_preconditions="yes" ;;
271
      no)  ecosinfra_preconditions="no"  ;;
272
      *)   AC_MSG_ERROR([bad value ${enableval} for disable-preconditions option]) ;;
273
    esac])
274
  if test "${ecosinfra_preconditions}" = "yes"; then
275
    AC_DEFINE(CYGDBG_INFRA_DEBUG_PRECONDITIONS,[1],[precondition asserts enabled])
276
  fi
277
 
278
  AC_ARG_ENABLE(postconditions, [ --disable-postconditions disable a subset of the assertions],
279
    [case "${enableval}" in
280
      yes) ecosinfra_postconditions="yes" ;;
281
      no)  ecosinfra_postconditions="no"  ;;
282
      *)   AC_MSG_ERROR([bad value ${enableval} for disable-postconditions option]) ;;
283
    esac])
284
  if test "${ecosinfra_postconditions}" = "yes"; then
285
    AC_DEFINE(CYGDBG_INFRA_DEBUG_POSTCONDITIONS,[1], [postcondition asserts enabled])
286
  fi
287
 
288
  AC_ARG_ENABLE(invariants, [ --disable-invariants     disable a subset of the assertions],
289
    [case "${enableval}" in
290
      yes) ecosinfra_invariants="yes" ;;
291
      no)  ecosinfra_invariants="no"  ;;
292
      *)   AC_MSG_ERROR([bad value ${enableval} for disable-invariants option]) ;;
293
    esac])
294
  if test "${ecosinfra_invariants}" = "yes"; then
295
    AC_DEFINE(CYGDBG_INFRA_DEBUG_INVARIANTS,[1],[invariant asserts enabled])
296
  fi
297
 
298
  AC_ARG_ENABLE(loopinvariants, [ --disable-loopinvariants disable a subset of the assertions],
299
    [case "${enableval}" in
300
      yes) ecosinfra_loopinvariants="yes" ;;
301
      no)  ecosinfra_loopinvariants="no"  ;;
302
      *)   AC_MSG_ERROR([bad value ${enableval} for disable-loopinvariants option]) ;;
303
    esac])
304
  if test "${ecosinfra_loopinvariants}" = "yes"; then
305
    AC_DEFINE(CYGDBG_INFRA_DEBUG_LOOP_INVARIANTS,[1],[loop invariant asserts enabled])
306
  fi
307
 
308
  AC_ARG_ENABLE(tracing,[ --disable-tracing        disable tracing],
309
    [case "${enableval}" in
310
      yes) ecosinfra_tracing="yes" ;;
311
      no)  ecosinfra_tracing="no"  ;;
312
      *)   AC_MSG_ERROR([bad value ${enableval} for disable-tracing option]) ;;
313
    esac])
314
  if test "${ecosinfra_tracing}" = "yes"; then
315
    AC_DEFINE(CYGDBG_USE_TRACING,[1],[tracing enabled])
316
  fi
317
 
318
  AC_ARG_ENABLE(fntracing,[ --disable-fntracing      disable function entry/exit tracing],
319
    [case "${enableval}" in
320
       yes) ecosinfra_fntracing="yes" ;;
321
       no)  ecosinfra_fntracing=no  ;;
322
       *)   AC_MSG_ERROR([bad value ${enableval} for disable-fntracing option]) ;;
323
  esac])
324
  if test "${ecosinfra_fntracing}" = "yes"; then
325
    AC_DEFINE(CYGDBG_INFRA_DEBUG_FUNCTION_REPORTS,[1],[function entry/exit reporting enabled])
326
  fi
327
])
328
 
329
dnl ====================================================================
330
dnl Inspired by KDE's autoconfig
331
dnl This macro takes three Arguments like this:
332
dnl AC_FIND_FILE(foo.h, $incdirs, incdir)
333
dnl the filename to look for, the list of paths to check and
334
dnl the variable with the result.
335
 
336
AC_DEFUN([AC_FIND_FILE],[
337
  $3=""
338
  for i in $2; do
339
    if test -r "$i/$1"; then
340
      $3=$i
341
      break
342
    fi
343
  done
344
])
345
 
346
dnl ====================================================================
347
dnl Variation of the above.
348
dnl This macro takes three Arguments like this:
349
dnl AC_FIND_DIR(infra, $incdirs, incdir)
350
dnl the directory name to look for, the list of paths to check and
351
dnl the variable with the result.
352
 
353
AC_DEFUN([AC_FIND_DIR],[
354
  $3=""
355
  for i in $2; do
356
    if test -d "$i/$1"; then
357
      $3=$i
358
      break
359
    fi
360
  done
361
])
362
 
363
dnl ====================================================================
364
dnl Work out details of the Tcl/tk installation that should be used.
365
dnl In theory this is simple: when Tcl is installed in <tcl_prefix>
366
dnl (usually /usr) there should be a file <tcl_prefix>/lib/tclConfig.sh
367
dnl which defines exactly how to build Tcl-based applications. Of course
368
dnl Tcl may be installed anywhere, not just in /usr, so it is necessary
369
dnl to do some searching. There is a command-line argument
370
dnl --with-tcl=<path> to specify the Tcl installation, so the macro
371
dnl can search for <with_tcl>/lib/tclConfig.sh, <prefix>/lib/tclConfig.sh
372
dnl and /usr/lib/tclConfig.sh
373
dnl
374
dnl Unfortunately not all systems use this convention. For example,
375
dnl at the time of writing Debian installs tclConfig.sh in a versioned
376
dnl subdirectory /usr/lib/tcl8.3/tclConfig.sh. Hence there is an
377
dnl additional argument --with-tcl-version=<vsn> which is used to
378
dnl extend the search path.
379
dnl
380
dnl For VC++ builds the situation is different again. Tcl may be
381
dnl installed anywhere, so the data in tclConfig.sh is not useful
382
dnl (and that file may not be provided at all). Instead --with-tcl
383
dnl must be used to specify the path. Alternatively separate paths
384
dnl for headers and libraries can be specified using --with-tcl-header
385
dnl and --with-tcl-lib. Usually it will also be necessary to specify
386
dnl the library version number using --with-tcl-version.
387
 
388
dnl This adds two main command-line options, --with-tcl=<prefix> to
389
dnl specify the Tcl install directory, and --with-tcl-version=<vsn>
390
dnl to control which version of Tcl should be used. For finer-grained
391
dnl control there are additional options --with-tcl-header and
392
dnl --with-tcl-version. It is assumed that Tcl and Tk are installed
393
dnl in the same place.
394
dnl
395
dnl On Unix systems and under cygwin there should be a file
396
dnl $(tcl_prefix)/lib/tclConfig.sh containing all the information
397
dnl needed for Tcl. This file is consulted and the appropriate
398
dnl variables extracted. Similar information for Tk lives in
399
dnl tkConfig.sh. As a useful side effect all variables defined
400
dnl in those scripts can be accessed.
401
dnl
402
dnl To confuse matters, subtly different naming conventions are used
403
dnl under Unix and NT. Under Unix the Tcl library will be called
404
dnl libtcl8.0.a, libtcl8.1.a, etc. with a dot between the major and
405
dnl minor version. Under NT (including cygwin) the library will be
406
dnl called tcl80.lib, tcl81.lib, libtcl80.a, libtcl81.a, etc.
407
dnl without a dot.
408
dnl
409
dnl Currently this macro assumes that Tcl is preinstalled, and not
410
dnl built alongside eCos. Specifically the macro checks that
411
dnl tcl.h  can be found, plus on Unix systems tclConfig.sh and
412
dnl tkConfig.sh as well.
413
dnl
414
dnl This macro updates the build-related variables ecos_INCLUDES,
415
dnl ecos_LDADD, and ecos_LIBS. The latter assumes the application
416
dnl only needs Tcl. If Tk is needed as well then the variable
417
dnl ecos_tklibs should be used in addition.
418
 
419
AC_DEFUN([ECOS_PATH_TCL], [
420
 
421
  AC_REQUIRE([ECOS_PROG_MSVC])
422
 
423
  dnl Where is the Tcl installation, and what version should be used?
424
  dnl This macro is rather more verbose than usual because of the many
425
  dnl problems encountered over the years with Tcl installations.
426
  AC_MSG_CHECKING(for Tcl/Tk installation)
427
  AC_MSG_RESULT()
428
 
429
  AC_ARG_WITH(tcl,[ --with-tcl=<path>        location of Tcl header and libraries])
430
  AC_ARG_WITH(tcl,[ --with-tk=<path>         location of Tk header and libraries])
431
  AC_ARG_WITH(tcl-version,[ --with-tcl-version=<vsn> version of Tcl/Tk to be used])
432
 
433
  dnl If using VC++ then there are no sensible default directories
434
  dnl to search for a Tcl installation. Instead the user must
435
  dnl supply either --with-tcl, or both --with-tcl-header and
436
  dnl --with-tcl-lib.
437
  dnl
438
  dnl Also when using VC++ there is no tclConfig.sh file to
439
  dnl consult about which libraries are needed. Instead that
440
  dnl information is hard-wired here.
441
  if test "${MSVC}" = "yes" ; then
442
    AC_ARG_WITH(tcl-header,[ --with-tcl-header=<path> location of Tcl header])
443
    AC_ARG_WITH(tcl-lib,[ --with-tcl-lib=<path>    location of Tcl libraries])
444
    ecos_tcl_incdir=""
445
    ecos_tcl_libdir=""
446
    if test "${with_tcl_version+set}" != set ; then
447
      AC_MSG_ERROR(You must specify a Tcl version using --with-tcl-version=<vsn>)
448
    fi
449
    if test "${with_tcl_header+set}" = set ; then
450
      ecos_tcl_incdir=${with_tcl_header}
451
    elif test "${with_tcl+set}" = set ; then
452
      ecos_tcl_incdir="${with_tcl}/include"
453
    else
454
      AC_MSG_ERROR(You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-header=<path>)
455
    fi
456
    if test "${with_tcl_lib+set}" = set; then
457
        ecos_tcl_libdir=${with_tcl_lib}
458
    elif test "${with_tcl+set}" = set; then
459
        ecos_tcl_libdir="${with_tcl}/lib"
460
    else
461
        AC_MSG_ERROR(You must specify a Tcl installation with either --with-tcl=<path> or --with-tcl-lib=<path>)
462
    fi
463
 
464
    dnl Sanity check, make sure that there is a tcl.h header file.
465
    dnl If not then there is no point in proceeding.
466
    if test \! -r "${ecos_tcl_incdir}/tcl.h" ; then
467
      AC_MSG_ERROR([unable to locate Tcl header file tcl.h])
468
    fi
469
 
470
    ECOS_MSVC_PATH(ecos_tcl_incdir)
471
    ECOS_MSVC_PATH(ecos_tcl_libdir)
472
    ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_tcl_incdir}\""
473
    ecos_LIBS="${ecos_LIBS} tcl${with_tcl_version}.lib"
474
    ecos_LDADD="${ecos_LDADD} \"-libpath=${ecos_tcl_libdir}\""
475
 
476
    dnl FIXME: what libraries are needed for a tk application under VC++?
477
    dnl        and can the version be determined more accurately?
478
    ecos_tk_libs=""
479
 
480
  else
481
    dnl ------------------------------------------------------------
482
    dnl Not Visual C++ so try to do things properly by finding and
483
    dnl using tclConfig.sh
484
    possibles=""
485
    if test "${with_tcl+set}" = set ; then
486
      possibles="${with_tcl}/lib"
487
      if test "${with_tcl_version+set}" = set ; then
488
        possibles="${possibles} ${with_tcl}/lib/tcl${with_tcl_version}"
489
      fi
490
    fi
491
    possibles="${possibles} ${prefix}/lib"
492
    if test "${with_tcl_version+set}" = set ; then
493
      possibles="${possibles} ${prefix}/lib/tcl${with_tcl_version}"
494
    fi
495
    possibles="${possibles} /usr/lib"
496
    if test "${with_tcl_version+set}" = set ; then
497
      possibles="${possibles} /usr/lib/tcl${with_tcl_version}"
498
    fi
499
    AC_MSG_NOTICE(looking for tclConfig.sh in ${possibles})
500
    AC_FIND_FILE("tclConfig.sh", ${possibles}, tclconfig)
501
    if test \! -r "${tclconfig}/tclConfig.sh" ; then
502
      AC_MSG_ERROR(unable to locate Tcl configuration file tclConfig.sh)
503
    else
504
      AC_MSG_NOTICE(found ${tclconfig}/tclConfig.sh)
505
      . ${tclconfig}/tclConfig.sh
506
 
507
      dnl Now we need to figure out where to find the Tcl header files.
508
      dnl tclConfig.sh may define a variable TCL_INCLUDE_SPEC or
509
      dnl TCL_INCLUDE_DIR, otherwise use TCL_PREFIX/include
510
      if test -n "${TCL_INCLUDE_SPEC}" ; then
511
        ecos_tcl_incdir="${TCL_INCLUDE_SPEC}"
512
        AC_MSG_NOTICE(trying TCL_INCLUDE_SPEC - looking for tcl.h in ${ecos_tcl_incdir})
513
      elif test -n "${TCL_INC_DIR}" ; then
514
        ecos_tcl_incdir="${TCL_INC_DIR}"
515
        AC_MSG_NOTICE(trying TCL_INC_DIR - looking for tcl.h in ${ecos_tcl_incdir})
516
      else
517
        ecos_tcl_incdir="-I${TCL_PREFIX}/include"
518
        AC_MSG_WARN(no TCL_INCLUDE_SPEC or TCL_INC_DIR in tclConfig.sh)
519
        AC_MSG_NOTICE(fallback - looking for tcl.h in ${ecos_tcl_incdir})
520
      fi
521
      dnl But verify that the resulting incdir is valid.
522
      ecos_tcl_tmpdir=`echo ${ecos_tcl_incdir} | sed -e "s:-I::g"`
523
      if test \! -r "${ecos_tcl_tmpdir}/tcl.h" ; then
524
        AC_MSG_ERROR(unable to locate Tcl header file tcl.h)
525
      else
526
        dnl On Unix systems -I/usr/include is unnecessary, and can
527
        dnl cause problems on hosts where gcc is not the platform's
528
        dnl default compiler because of the use of unfixed headers.
529
        dnl Hence it is explicitly removed here.
530
        AC_MSG_NOTICE(using ${ecos_tcl_incdir})
531
        if test "${ecos_tcl_incdir}" != "-I/usr/include" ; then
532
          ecos_INCLUDES="${ecos_INCLUDES} ${ecos_tcl_incdir}"
533
        fi
534
      fi
535
 
536
      dnl There should be a variable TCL_LIB_SPEC which defines
537
      dnl exactly how to link with Tcl. Without that, try to search
538
      dnl for a libtcl.a
539
      ecos_tcl_libs=""
540
      if test -n "${TCL_LIB_SPEC}" ; then
541
        ecos_tcl_libs="${ecos_LIBS} ${TCL_LIB_SPEC}"
542
        AC_MSG_NOTICE(using TCL_LIB_SPEC ${TCL_LIB_SPEC})
543
      else
544
        AC_MSG_WARN(no TCL_LIB_SPEC in tclConfig.sh)
545
        if test "${with_tcl_version+set}" = set ; then
546
          AC_MSG_NOTICE(fallback - looking for libtcl${with_tcl_version}.a in ${possibles})
547
          AC_FIND_FILE("libtcl${with_tcl_version}.a", ${possibles}, libtcl)
548
          if test -r "${libtcl}/libtcl${with_tcl_version}.a" ; then
549
              ecos_tcl_libs="-L${libtcl} -ltcl${with_tcl_version}"
550
              AC_MSG_NOTICE(using ${ecos_tcl_libs})
551
          fi
552
        fi
553
        if test -z "${ecos_tcl_libs}" ; then
554
          AC_MSG_NOTICE(fallback - looking for libtcl.a in ${possibles})
555
          AC_FIND_FILE("libtcl.a", ${possibles}, libtcl)
556
          if test -r "${libtcl}/libtcl.a" ; then
557
              ecos_tcl_libs="-L${libtcl} -ltcl"
558
              AC_MSG_NOTICE(using ${ecos_tcl_libs})
559
          fi
560
        fi
561
      fi
562
 
563
      dnl If at this stage we have not found a libtcl.a, complain.
564
      if test -z "${ecos_tcl_libs}" ; then
565
        AC_MSG_ERROR(${tclconfig}/tclConfig.sh does not define TCL_LIB_SPEC, and unable to find libtcl.a)
566
      fi
567
 
568
      dnl tclConfig.sh may specify additional flags and libraries.
569
      if test -n "${TCL_LIBS}" ; then
570
        ecos_tcl_libs="${ecos_tcl_libs} ${TCL_LIBS}"
571
        AC_MSG_NOTICE(using additional libraries for Tcl ${TCL_LIBS})
572
      fi
573
      if test -n "${TCL_LD_FLAGS}" ; then
574
        ecos_tcl_libs="${ecos_tcl_libs} ${TCL_LD_FLAGS}"
575
        AC_MSG_NOTICE(using additional linker flags for Tcl ${TCL_LD_FLAGS})
576
      fi
577
      ecos_LIBS="${ecos_LIBS} ${ecos_tcl_libs}"
578
    fi
579
 
580
 
581
    dnl --------------------------------------------------------
582
    dnl We now repeat the exercise for tk and tkConfig.sh.
583
    dnl Typically this will be in a similar location to tclConfig.sh,
584
    dnl but allow for separate
585
    dnl we assume that the Tk installation is in a similar
586
    dnl location to the Tcl one, but allow for different ones
587
    dnl just in case.
588
    possibles=""
589
    if test "${with_tk+set}" = set ; then
590
      possibles="${possibles} ${with_tk}/lib"
591
      if test "${with_tcl_version+set}" = set ; then
592
        possibles="${possibles} ${with_tk}/lib/tcl${with_tcl_version}"
593
        possibles="${possibles} ${with_tk}/lib/tk${with_tcl_version}"
594
      fi
595
    fi
596
    if test "${with_tcl+set}" = set ; then
597
      possibles="${possibles} ${with_tcl}/lib"
598
      if test "${with_tcl_version+set}" = set ; then
599
        possibles="${possibles} ${with_tcl}/lib/tcl${with_tcl_version}"
600
        possibles="${possibles} ${with_tcl}/lib/tk${with_tcl_version}"
601
      fi
602
    fi
603
    possibles="${possibles} ${prefix}/lib"
604
    if test "${with_tcl_version+set}" = set ; then
605
      possibles="${possibles} ${prefix}/lib/tcl${with_tcl_version}"
606
      possibles="${possibles} ${prefix}/lib/tk${with_tcl_version}"
607
    fi
608
    possibles="${possibles} /usr/lib"
609
    if test "${with_tcl_version+set}" = set ; then
610
      possibles="${possibles} /usr/lib/tcl${with_tcl_version}"
611
      possibles="${possibles} /usr/lib/tk${with_tcl_version}"
612
    fi
613
 
614
    AC_MSG_NOTICE(looking for tkConfig.sh in ${possibles})
615
    AC_FIND_FILE("tkConfig.sh", ${possibles}, tkconfig)
616
    if test \! -r "${tkconfig}/tkConfig.sh" ; then
617
      AC_MSG_ERROR(unable to locate Tk config file tkConfig.sh)
618
    else
619
      AC_MSG_NOTICE(found ${tkconfig}/tkConfig.sh)
620
      . ${tkconfig}/tkConfig.sh
621
 
622
      if test -n "${TK_INCLUDE_SPEC}" ; then
623
        ecos_tk_includes="${TK_INCLUDE_SPEC}"
624
        AC_MSG_NOTICE(trying TK_INCLUDE_SPEC - looking for tk.h in ${ecos_tk_includes})
625
      elif test -n "${TK_INC_DIR}" ; then
626
          ecos_tk_includes="${TK_INC_DIR}"
627
          AC_MSG_NOTICE(trying TK_INC_DIR - looking for tk.h in ${ecos_tk_includes})
628
      else
629
          ecos_tk_includes="-I${TCL_PREFIX}/include"
630
          AC_MSG_WARN(no TK_INCLUDE_SPEC or TK_INC_DIR in tkConfig.sh)
631
          AC_MSG_NOTICE(fallback - looking for tk.h in ${ecos_tk_includes})
632
      fi
633
      dnl But verify that the resulting incdir is valid.
634
      ecos_tk_tmpdir=`echo ${ecos_tk_includes} | sed -e "s:-I::g"`
635
      if test \! -r "${ecos_tk_tmpdir}/tk.h" ; then
636
        AC_MSG_ERROR(unable to locate Tk header file tk.h)
637
      else
638
        dnl On Unix systems -I/usr/include is unnecessary, and can
639
        dnl cause problems on hosts where gcc is not the platform's
640
        dnl default compiler because of the use of unfixed headers.
641
        dnl Hence it is explicitly removed here.
642
        AC_MSG_NOTICE(using ${ecos_tk_includes})
643
        if test "${ecos_tk_includes}" = "-I/usr/include" ; then
644
          ecos_tk_includes=""
645
        fi
646
      fi
647
      dnl There may be additional include directories for X, although
648
      dnl unlikely on a Unix system.
649
      if test -n "${TK_XINCLUDES}" ; then
650
        AC_MSG_NOTICE(adding TK_XINCLUDES ${TK_XINCLUDES})
651
        ecos_tk_includes="${ecos_tk_includes} ${TK_XINCLUDES}"
652
      fi
653
 
654
      ecos_tk_libs=""
655
      if test -n "${TK_LIB_SPEC}" ; then
656
        ecos_tk_libs="${TK_LIB_SPEC}"
657
        AC_MSG_NOTICE(trying TK_LIB_SPEC ${TK_LIB_SPEC})
658
      else
659
        AC_MSG_WARN(no TK_LIB_SPEC in tkConfig.sh)
660
        if test "${with_tcl_version+set}" = set ; then
661
          AC_MSG_NOTICE(fallback - looking for libtk${with_tcl_version}.a in ${possibles})
662
          AC_FIND_FILE("libtk${with_tcl_version}.a", ${possibles}, libtk)
663
          if test -r "${libtk}/libtk${with_tcl_version}.a" ; then
664
            ecos_tk_libs="-L${libtk} -ltk${with_tcl_version}"
665
          fi
666
        fi
667
        if test -z "${ecos_tk_libs}" ; then
668
          AC_MSG_NOTICE(fallback - looking for libtk.a in ${possibles})
669
          AC_FIND_FILE("libtk.a", ${possibles}, libtk)
670
          if test -r "${libtk}/libtk.a" ; then
671
            ecos_tk_libs="-L${libtk} -ltk"
672
          fi
673
        fi
674
      fi
675
      if test -z "${ecos_tk_libs}" ; then
676
        AC_MSG_ERROR(${tkconfig}/tkConfig.sh does not define TK_LIB_SPEC, and unable to find libtk.a)
677
      else
678
        AC_MSG_NOTICE(using ${ecos_tk_libs})
679
      fi
680
 
681
      dnl Tk may need additional libraries. Unfortunately some of these
682
      dnl duplicate the Tcl ones, causing occasional linker upsets. It
683
      dnl is assumed here that Tk will only be used in conjunction with
684
      dnl tcl.
685
      if test -n "${TK_LIBS}" ; then
686
        if test -n "${TCL_LIBS}" ; then
687
          ecos_tk_tmp="${TK_LIBS}"
688
          for i in ${TCL_LIBS} ; do
689
            ecos_tk_tmp=`echo ${ecos_tk_tmp} | sed -e "s:${i}::g"`
690
          done
691
          ecos_tk_libs="${ecos_tk_libs} ${ecos_tk_tmp}"
692
          AC_MSG_NOTICE(using additional libraries for Tk ${ecos_tk_tmp})
693
        else
694
          ecos_tk_libs="${ecos_tk_libs} ${TK_LIBS}"
695
          AC_MSG_NOTICE(using additional libraries for Tk ${TK_LIBS})
696
        fi
697
      fi
698
    fi
699
  fi
700
 
701
  AC_MSG_CHECKING(for Tcl/Tk installation)
702
  AC_MSG_RESULT(done)
703
  AC_SUBST(ecos_tk_includes)
704
  AC_SUBST(ecos_tk_libs)
705
])
706
 
707
dnl ====================================================================
708
dnl Search for the infrastructure headers. Usually these can be picked
709
dnl up from host/infra in the build tree. This macro updates
710
dnl ecos_INCLUDES, ecos_LDADD and ecos_LIBS appropriately. In addition
711
dnl it defines new variables ecos_infra_incdir and ecos_infra_libdir,
712
dnl useful for listing explicit dependencies.
713
dnl
714
dnl This macro should only be used in configure scripts that run after
715
dnl the infrastructure has been configured because it relies on the
716
dnl infra directory already having been created in the build tree.
717
 
718
AC_DEFUN([ECOS_PATH_INFRA], [
719
  AC_MSG_CHECKING([for eCos host-side infrastructure])
720
 
721
  dnl Where are we in the build tree? First assume that we are in the host
722
  dnl tree, thus allowing configury of just the host-side. If that fails
723
  dnl assume we can be anywhere.
724
  infra_builddir=""
725
  possibles=".. ../.. ../../.. ../../../.. ../../../../.."
726
  AC_FIND_DIR("infra", ${possibles}, infra_builddir)
727
  if test "${infra_builddir}" = "" ; then
728
    possibles="../host ../../host ../../../host ../../../../host ../../../../../host ../../../../../../host"
729
    AC_FIND_DIR("infra", ${possibles}, infra_builddir)
730
  fi
731
  if test "${infra_builddir}" != "" ; then
732
    infra_builddir="${infra_builddir}/infra"
733
    infra_builddir=`cd ${infra_builddir} && /bin/pwd`
734
  fi
735
 
736
  ecos_infra_incdir=""
737
  ecos_infra_libdir=""
738
  ecos_infra_libs=""
739
 
740
  AC_ARG_WITH(infra-header,[ --with-infra-header=<path> location of eCos infrastructure headers])
741
  AC_ARG_WITH(infra-lib,[ --with-infra-lib=<path>    location of eCos infrastructure library])
742
  AC_ARG_WITH(infra,[ --with-infra=<path>        location of eCos infrastructure installation])
743
 
744
  if test "${with_infra_header+set}" = "set"; then
745
    ecos_infra_incdir="${with_infra_header}"
746
  elif test "${with_infra+set}" = "set"; then
747
    ecos_infra_incdir="${with_infra}/include"
748
  elif test "${infra_builddir}" != "" ; then
749
    ecos_infra_incdir="${infra_builddir}"
750
  else
751
    AC_MSG_ERROR([infrastructure headers not found])
752
  fi
753
  if test "${MSVC}" = "yes" ; then
754
    ecos_msvc_infra_incdir=${ecos_infra_incdir}
755
    ECOS_MSVC_PATH(ecos_msvc_infra_incdir)
756
    ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_msvc_infra_incdir}\""
757
  else
758
    ecos_INCLUDES="${ecos_INCLUDES} -I${ecos_infra_incdir}"
759
  fi
760
 
761
  if test "${with_infra_lib+set}" = "set"; then
762
    ecos_infra_libdir="${with_infra_lib}"
763
  elif test "${with_infra+set}" = "set"; then
764
    ecos_infra_libdir="${with_infra}/lib"
765
  elif test "${infra_builddir}" != "" ; then
766
    ecos_infra_libdir="${infra_builddir}"
767
  else
768
    AC_MSG_ERROR([infrastructure library not found])
769
  fi
770
  if test "${MSVC}" = "yes" ; then
771
    ecos_msvc_infra_libdir=${ecos_infra_libdir}
772
    ECOS_MSVC_PATH(ecos_msvc_infra_libdir)
773
    ecos_LIBS="${ecos_LIBS} cyginfra.lib"
774
    ecos_LDADD="${ecos_LDADD} \"-libpath=${ecos_msvc_infra_libdir}\""
775
  else
776
    ecos_LIBS="${ecos_LIBS} -lcyginfra"
777
    ecos_LDADD="${ecos_LDADD} -L${ecos_infra_libdir}"
778
  fi
779
 
780
  AC_SUBST(ecos_infra_incdir)
781
  AC_SUBST(ecos_infra_libdir)
782
  AC_MSG_RESULT(-I[${ecos_infra_incdir} -L${ecos_infra_libdir}])
783
])
784
 
785
dnl ====================================================================
786
dnl And a very similar macro for libcdl, but note that the headers
787
dnl are in the source tree rather than the build tree.
788
 
789
AC_DEFUN([ECOS_PATH_LIBCDL], [
790
  AC_MSG_CHECKING([for libcdl])
791
 
792
  dnl Where are we in the source tree?
793
  libcdl_srcdir=""
794
  possibles="${srcdir}/.. ${srcdir}/../.. ${srcdir}/../../.. ${srcdir}/../../../.. ${srcdir}/../../../../.."
795
  AC_FIND_DIR("libcdl", ${possibles}, libcdl_srcdir)
796
  if test "${libcdl_srcdir}" = "" ; then
797
    possibles="${srcdir}/../host ${srcdir}/../../host ${srcdir}/../../../host ${srcdir}/../../../../host ${srcdir}/../../../../../host ${srcdir}/../../../../../../host"
798
    AC_FIND_DIR("libcdl", ${possibles}, libcdl_srcdir)
799
  fi
800
  if test "${libcdl_srcdir}" != "" ; then
801
    libcdl_srcdir="${libcdl_srcdir}/libcdl"
802
    libcdl_srcdir=`cd ${libcdl_srcdir} && /bin/pwd`
803
  fi
804
 
805
  dnl And where are we in the build tree?
806
  libcdl_builddir=""
807
  possibles=".. ../.. ../../.. ../../../.. ../../../../.."
808
  AC_FIND_DIR("libcdl", ${possibles}, libcdl_builddir)
809
  if test "${libcdl_builddir}" = "" ; then
810
    possibles="../host ../../host ../../../host ../../../../host ../../../../../host ../../../../../../host"
811
    AC_FIND_DIR("libcdl", ${possibles}, libcdl_builddir)
812
  fi
813
  if test "${libcdl_builddir}" != "" ; then
814
    libcdl_builddir="${libcdl_builddir}/libcdl"
815
    libcdl_builddir=`cd ${libcdl_builddir} && /bin/pwd`
816
  fi
817
 
818
  ecos_libcdl_incdir=""
819
  ecos_libcdl_libdir=""
820
  ecos_libcdl_libs=""
821
 
822
  AC_ARG_WITH(libcdl-header,[ --with-libcdl-header=<path> location of eCos libcdl headers])
823
  AC_ARG_WITH(libcdl-lib,[ --with-libcdl-lib=<path>    location of eCos libcdl library])
824
  AC_ARG_WITH(libcdl,[ --with-libcdl=<path>        location of eCos libcdl installation])
825
 
826
  if test "${with_libcdl_header+set}" = "set"; then
827
    ecos_libcdl_incdir="${with_libcdl_header}"
828
  elif test "${with_libcdl+set}" = "set"; then
829
    ecos_libcdl_incdir="${with_libcdl}/include"
830
  elif test "${libcdl_srcdir}" != "" ; then
831
    ecos_libcdl_incdir="${libcdl_srcdir}"
832
  fi
833
  if test \! -r "${ecos_libcdl_incdir}/cdl.hxx" ; then
834
    AC_MSG_ERROR([libcdl headers not found])
835
  fi
836
  if test "${MSVC}" = "yes" ; then
837
    ecos_msvc_libcdl_incdir="${ecos_libcdl_incdir}"
838
    ECOS_MSVC_PATH(ecos_msvc_libcdl_incdir)
839
    ecos_INCLUDES="${ecos_INCLUDES} \"-I${ecos_msvc_libcdl_incdir}\""
840
  else
841
    ecos_INCLUDES="${ecos_INCLUDES} -I${ecos_libcdl_incdir}"
842
  fi
843
 
844
  if test "${with_libcdl_lib+set}" = "set"; then
845
    ecos_libcdl_libdir="${with_libcdl_lib}"
846
  elif test "${with_libcdl+set}" = "set"; then
847
    ecos_libcdl_libdir="${with_libcdl}/lib"
848
  elif test "${libcdl_builddir}" != "" ; then
849
    ecos_libcdl_libdir="${libcdl_builddir}"
850
  else
851
    AC_MSG_ERROR([libcdl library not found])
852
  fi
853
  if test "${MSVC}" = "yes" ; then
854
    ecos_msvc_libcdl_libdir=${ecos_libcdl_libdir}
855
    ECOS_MSVC_PATH(ecos_msvc_libcdl_libdir)
856
    ecos_LIBS="${ecos_LIBS} cdl.lib"
857
    ecos_LDADD="${ecos_LDADD} \"-libpath=${ecos_msvc_libcdl_libdir}\""
858
  else
859
    ecos_LIBS="${ecos_LIBS} -lcdl"
860
    ecos_LDADD="${ecos_LDADD} -L${ecos_libcdl_libdir}"
861
  fi
862
 
863
  AC_SUBST(ecos_libcdl_incdir)
864
  AC_SUBST(ecos_libcdl_libdir)
865
  AC_MSG_RESULT([-I${ecos_libcdl_incdir} -L${ecos_libcdl_libdir}])
866
])
867
 
868
dnl ====================================================================
869
dnl Look for a 64 bit data type. It is necessary to check both C and C++
870
dnl compilers.
871
dnl
872
dnl A better implementation would check whether or not AC_PROG_CC and
873
dnl AC_PROG_CXX have been invoked and only test the appropriate
874
dnl compiler.
875
dnl
876
dnl When cross-compiling, default to long long on the assumption that
877
dnl gcc/g++ must be used and long long is likely to be the 64 bit data
878
dnl type. This is not guaranteed, but sufficiently likely to meet
879
dnl the requirements for the time being. The CHECK_SIZEOF() macro
880
dnl might be another way to get the desired information.
881
 
882
AC_DEFUN([ECOS_TYPE_64bit], [
883
  AC_REQUIRE([AC_PROG_CC])
884
  AC_REQUIRE([AC_PROG_CXX])
885
 
886
  AC_CACHE_CHECK("for a 64 bit data type",ecos_cv_type_64bit,[
887
    for type in "long" "long long" "__int64"; do
888
      AC_LANG_SAVE
889
      AC_LANG_C
890
      AC_TRY_RUN([
891
        main() {
892
          return 8 != sizeof($type);
893
        }
894
      ],ctype_64bit=$type,ctype_64bit="unknown",ctype_64bit="long long")
895
      AC_LANG_CPLUSPLUS
896
      AC_TRY_RUN([
897
        int main(int argc, char ** argv) {
898
            return 8 != sizeof($type);
899
        }
900
      ],cxxtype_64bit=$type,cxxtype_64bit="unknown",cxxtype_64bit="long long")
901
      AC_LANG_RESTORE
902
      if test "${ctype_64bit}" = "${type}" -a "${cxxtype_64bit}" = "${type}"; then
903
        ecos_cv_type_64bit="${type}"
904
        break
905
      fi
906
    done
907
  ])
908
  if test "${ecos_cv_type_64bit}" = ""; then
909
    AC_MSG_ERROR(Unable to figure out how to do 64 bit arithmetic)
910
  else
911
    if test "${ecos_cv_type_64bit}" != "long long"; then
912
      AC_DEFINE_UNQUOTED(cyg_halint64,${ecos_cv_type_64bit},[size of 64-bit datatype])
913
      AC_DEFINE_UNQUOTED(cyg_halcount64,${ecos_cv_type_64bit},[size of >= 64-bit datatype])
914
    fi
915
  fi
916
])
917
 
918
dnl ====================================================================
919
dnl Check that both the C and C++ compilers support __PRETTY_FUNCTION__
920
 
921
AC_DEFUN([ECOS_C_PRETTY_FUNCTION],[
922
  AC_REQUIRE([AC_PROG_CC])
923
  AC_REQUIRE([AC_PROG_CXX])
924
 
925
  AC_CACHE_CHECK("for __PRETTY_FUNCTION__ support",ecos_cv_c_pretty_function,[
926
    AC_LANG_SAVE
927
    AC_LANG_C
928
    AC_TRY_LINK(
929
      [#include <stdio.h>],
930
      [puts(__PRETTY_FUNCTION__);],
931
      c_ok="yes",
932
      c_ok="no"
933
    )
934
    AC_LANG_CPLUSPLUS
935
    AC_TRY_LINK(
936
      [#include <cstdio>],
937
      [puts(__PRETTY_FUNCTION__);],
938
      cxx_ok="yes",
939
      cxx_ok="no"
940
    )
941
    AC_LANG_RESTORE
942
    if test "${c_ok}" = "yes" -a "${cxx_ok}" = "yes"; then
943
      ecos_cv_c_pretty_function="yes"
944
    fi
945
  ])
946
  if test "${ecos_cv_c_pretty_function}" = "yes"; then
947
    AC_DEFINE(CYGDBG_INFRA_DEBUG_FUNCTION_PSEUDOMACRO,[1],[compiler supports __PRETTY_FUNCTION__])
948
  fi
949
])
950
 
951
dnl ====================================================================
952
dnl During installation eCos package-specific host-side code should be
953
dnl versioned in the same way as the packages themselves, allowing
954
dnl different versions to coexist in one installation. This is analogous
955
dnl to having multiple versions of a shared library installed so that
956
dnl applications can load whichever one they were linked with.
957
dnl
958
dnl To support all this the host-side code needs access to a number
959
dnl of directory names:
960
dnl     ECOS_REPOSITORY    e.g. ~/ecc/ecc
961
dnl     PACKAGE_DIR        e.g. hal/synth/arch
962
dnl     PACKAGE_VERSION    e.g. current
963
dnl     PACKAGE_INSTALL    e.g. hal/synth/arch/current
964
dnl
965
dnl These, together with the standard variable libexecdir, allow
966
dnl the host-side code to navigate around both source and install
967
dnl trees.
968
 
969
AC_DEFUN([ECOS_PACKAGE_DIRS],[
970
 
971
  dnl srcdir will be something like <path>/packages/<package_path>/<version>/host
972
  package_dir=`cd ${srcdir} && /bin/pwd`
973
  PACKAGE_VERSION=`dirname ${package_dir}`
974
  PACKAGE_VERSION=`basename ${PACKAGE_VERSION}`
975
 
976
  dnl Now look for an "acsupport" directory as a good way of identifying
977
  dnl the root of the repository. Assume that this does not clash with
978
  dnl any real packages in the repository. Also assume that no silly games
979
  dnl are being played with symlinks.
980
  package_dir=`dirname ${package_dir}`
981
  package_dir=`dirname ${package_dir}`
982
 
983
  possibles="${package_dir}/.. ${package_dir}/../.. ${package_dir}/../../.. ${package_dir}/../../../.."
984
  possibles="${possibles} ${package_dir}/../../../../.. ${package_dir}/../../../../../.."
985
  AC_FIND_DIR("acsupport", ${possibles}, repository_root)
986
  if test "${repository_root}" = "" ; then
987
    AC_MSG_ERROR([Failed to identify this package's position within the eCos repository])
988
  fi
989
  dnl repository_root will still contain the ..'s, instead of an absolute path
990
  ECOS_REPOSITORY=`cd "${repository_root}/packages/pkgconf/.." && /bin/pwd`
991
 
992
  dnl Now we have two absolute paths, so just remove one from the other
993
  PACKAGE_DIR=`echo ${package_dir} | sed -e "s:${ECOS_REPOSITORY}/::"`
994
 
995
  dnl To avoid creating too many subdirectories on the host-side, turn
996
  dnl e.g. hal/synth/arch into hal_synth_arch. Theoretically this could
997
  dnl go wrong because multiple packages could map onto the same string,
998
  dnl but in practice there should be a net reduction in complexity.
999
  dnl bartv: / to _ conversion disabled for now, 5 March 2002
1000
  PACKAGE_INSTALL="${PACKAGE_DIR}/${PACKAGE_VERSION}"
1001
  dnl PACKAGE_INSTALL=`echo ${PACKAGE_INSTALL} | sed -e "s:/:_:g"`
1002
 
1003
  AC_SUBST(ECOS_REPOSITORY)
1004
  AC_SUBST(PACKAGE_DIR)
1005
  AC_SUBST(PACKAGE_VERSION)
1006
  AC_SUBST(PACKAGE_INSTALL)
1007
])

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.