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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [config/] [acinclude.m4] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
dnl This file is included into all any other acinclude file that needs
2
dnl to use these macros.
3
 
4
dnl This is copied from autoconf 2.12, but does calls our own AC_PROG_CC_WORKS,
5
dnl and doesn't call AC_PROG_CXX_GNU, cause we test for that in  AC_PROG_CC_WORKS.
6
dnl We are probably using a cross compiler, which will not be able to fully
7
dnl link an executable.  This should really be fixed in autoconf itself.
8
dnl Find a working G++ cross compiler. This only works for the GNU C++ compiler.
9
AC_DEFUN(CYG_AC_PROG_CXX_CROSS,
10
[AC_BEFORE([$0], [AC_PROG_CXXCPP])
11
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
12
 
13
CYG_AC_PROG_GXX_WORKS
14
 
15
if test $ac_cv_prog_gxx = yes; then
16
  GXX=yes
17
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
18
dnl plays around with CXXFLAGS (such as to build both debugging and
19
dnl normal versions of a library), tasteless as that idea is.
20
  ac_test_CXXFLAGS="${CXXFLAGS+set}"
21
  ac_save_CXXFLAGS="$CXXFLAGS"
22
  CXXFLAGS=
23
  AC_PROG_CXX_G
24
  if test "$ac_test_CXXFLAGS" = set; then
25
    CXXFLAGS="$ac_save_CXXFLAGS"
26
  elif test $ac_cv_prog_cxx_g = yes; then
27
    CXXFLAGS="-g -O2"
28
  else
29
    CXXFLAGS="-O2"
30
  fi
31
else
32
  GXX=
33
  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
34
fi
35
])
36
 
37
dnl See if the G++ compiler we found works.
38
AC_DEFUN(CYG_AC_PROG_GXX_WORKS,
39
[AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) actually works])
40
AC_LANG_SAVE
41
AC_LANG_CPLUSPLUS
42
dnl Try a test case. We only compile, because it's close to impossible
43
dnl to get a correct fully linked executable with a cross compiler. For
44
dnl most cross compilers, this test is bogus. For G++, we can use various
45
dnl other compile line options to get a decent idea that the cross compiler
46
dnl actually does work, even though we can't produce an executable without
47
dnl more info about the target it's being compiled for. This only works
48
dnl for the GNU C++ compiler.
49
 
50
dnl Transform the name of the compiler to it's cross variant, unless
51
dnl CXX is set. This is also what CXX gets set to in the generated
52
dnl Makefile.
53
if test x"${CXX}" = xc++ ; then
54
    CXX=`echo gcc | sed -e "${program_transform_name}"`
55
fi
56
 
57
dnl Get G++'s full path to libgcc.a
58
libgccpath=`${CXX} --print-libgcc`
59
 
60
dnl If we don't have a path with libgcc.a on the end, this isn't G++.
61
if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
62
   ac_cv_prog_gxx=yes
63
else
64
   ac_cv_prog_gxx=no
65
fi
66
 
67
dnl If we are using G++, look for the files that need to exist if this
68
dnl compiler works.
69
if test x"${ac_cv_prog_gxx}" = xyes ; then
70
    gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
71
    if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
72
        gccfiles=yes
73
    else
74
        gccfiles=no
75
    fi
76
    gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
77
    if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
78
        gcclibs=yes
79
    else
80
        gcclibs=no
81
    fi
82
fi
83
 
84
dnl If everything is OK, then we can safely assume the compiler works.
85
if test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
86
    ac_cv_prog_cxx_works=no
87
    AC_MSG_ERROR(${CXX} is a non-working cross compiler)
88
else
89
   ac_cv_prog_cxx_works=yes
90
fi
91
 
92
AC_LANG_RESTORE
93
AC_MSG_RESULT($ac_cv_prog_cxx_works)
94
if test x"$ac_cv_prog_cxx_works" = xno; then
95
  AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
96
fi
97
AC_MSG_CHECKING([whether the G++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler])
98
AC_MSG_RESULT($ac_cv_prog_cxx_cross)
99
cross_compiling=$ac_cv_prog_cxx_cross
100
AC_SUBST(CXX)
101
])
102
 
103
dnl ====================================================================
104
dnl Find a working GCC cross compiler. This only works for the GNU gcc compiler.
105
dnl This is based on the macros above for G++.
106
AC_DEFUN(CYG_AC_PROG_CC_CROSS,
107
[AC_BEFORE([$0], [AC_PROG_CCPP])
108
AC_CHECK_PROGS(CC, cc, gcc)
109
 
110
CYG_AC_PROG_GCC_WORKS
111
 
112
if test $ac_cv_prog_gcc = yes; then
113
  GCC=yes
114
dnl Check whether -g works, even if CFLAGS is set, in case the package
115
dnl plays around with CFLAGS (such as to build both debugging and
116
dnl normal versions of a library), tasteless as that idea is.
117
  ac_test_CFLAGS="${CFLAGS+set}"
118
  ac_save_CFLAGS="$CFLAGS"
119
  CFLAGS=
120
  AC_PROG_CC_G
121
  if test "$ac_test_CFLAGS" = set; then
122
    CFLAGS="$ac_save_CFLAGS"
123
  elif test $ac_cv_prog_cc_g = yes; then
124
    CFLAGS="-g -O2"
125
  else
126
    CFLAGS="-O2"
127
  fi
128
else
129
  GXX=
130
  test "${CFLAGS+set}" = set || CFLAGS="-g"
131
fi
132
])
133
 
134
dnl See if the GCC compiler we found works.
135
AC_DEFUN(CYG_AC_PROG_GCC_WORKS,
136
[AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) actually works])
137
AC_LANG_SAVE
138
AC_LANG_C
139
dnl Try a test case. We only compile, because it's close to impossible
140
dnl to get a correct fully linked executable with a cross
141
dnl compiler. For most cross compilers, this test is bogus. For G++,
142
dnl we can use various other compile line options to get a decent idea
143
dnl that the cross compiler actually does work, even though we can't
144
dnl produce an executable without more info about the target it's
145
dnl being compiled for. This only works for the GNU C++ compiler.
146
 
147
dnl Transform the name of the compiler to it's cross variant, unless
148
dnl CXX is set. This is also what CC gets set to in the generated Makefile.
149
if test x"${CC}" = xcc ; then
150
    CC=`echo gcc | sed -e "${program_transform_name}"`
151
fi
152
 
153
dnl Get Gcc's full path to libgcc.a
154
libgccpath=`${CC} --print-libgcc`
155
 
156
dnl If we don't have a path with libgcc.a on the end, this isn't G++.
157
if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
158
   ac_cv_prog_gcc=yes
159
else
160
   ac_cv_prog_gcc=no
161
fi
162
 
163
dnl If we are using Gcc, look for the files that need to exist if this
164
dnl compiler works.
165
if test x"${ac_cv_prog_gcc}" = xyes ; then
166
    gccfiles=`echo $libgccpath | sed -e 's:/libgcc.a::'`
167
    if test -f ${gccfiles}/specs -a -f ${gccfiles}/cpp -a -f ${gccfiles}/cc1plus; then
168
        gccfiles=yes
169
    else
170
        gccfiles=no
171
    fi
172
    gcclibs=`echo $libgccpath | sed -e 's:lib/gcc-lib/::' -e 's:/libgcc.a::' -e 's,\(.*\)/.*,\1,g'`/lib
173
    if test -d ${gcclibs}/ldscripts -a -f ${gcclibs}/libc.a -a -f ${gcclibs}/libstdc++.a ; then
174
        gcclibs=yes
175
    else
176
        gcclibs=no
177
    fi
178
fi
179
 
180
dnl If everything is OK, then we can safely assume the compiler works.
181
if test x"${gccfiles}" = xno -o x"${gcclibs}" = xno; then
182
    ac_cv_prog_cc_works=no
183
    AC_MSG_ERROR(${CC} is a non-working cross compiler)
184
else
185
    ac_cv_prog_cc_works=yes
186
fi
187
 
188
AC_LANG_RESTORE
189
AC_MSG_RESULT($ac_cv_prog_cc_works)
190
if test x"$ac_cv_prog_cc_works" = xno; then
191
  AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.])
192
fi
193
AC_MSG_CHECKING([whether the Gcc compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
194
AC_MSG_RESULT($ac_cv_prog_cc_cross)
195
cross_compiling=$ac_cv_prog_cc_cross
196
AC_SUBST(CC)
197
])
198
 
199
dnl ====================================================================
200
dnl Find the BFD library in the build tree. This is used to access and
201
dnl manipulate object or executable files.
202
AC_DEFUN(CYG_AC_PATH_BFD, [
203
AC_MSG_CHECKING(for the bfd header in the build tree)
204
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
205
dnl Look for the header file
206
AC_CACHE_VAL(ac_cv_c_bfdh,[
207
for i in $dirlist; do
208
    if test -f "$i/bfd/bfd.h" ; then
209
        ac_cv_c_bfdh=`(cd $i/bfd; pwd)`
210
        break
211
    fi
212
done
213
])
214
if test x"${ac_cv_c_bfdh}" != x; then
215
    BFDHDIR="-I${ac_cv_c_bfdh}"
216
    AC_MSG_RESULT(${ac_cv_c_bfdh})
217
else
218
    AC_MSG_RESULT(none)
219
fi
220
AC_SUBST(BFDHDIR)
221
 
222
dnl Look for the library
223
AC_MSG_CHECKING(for the bfd library in the build tree)
224
AC_CACHE_VAL(ac_cv_c_bfdlib,[
225
for i in $dirlist; do
226
    if test -f "$i/bfd/Makefile" ; then
227
        ac_cv_c_bfdlib=`(cd $i/bfd; pwd)`
228
    fi
229
done
230
])
231
dnl We list two directories cause bfd now uses libtool
232
if test x"${ac_cv_c_bfdlib}" != x; then
233
    BFDLIB="-L${ac_cv_c_bfdlib} -L${ac_cv_c_bfdlib}/.libs"
234
    AC_MSG_RESULT(${ac_cv_c_bfdlib})
235
else
236
    AC_MSG_RESULT(none)
237
fi
238
AC_SUBST(BFDLIB)
239
])
240
 
241
dnl ====================================================================
242
dnl Find the libiberty library. This defines many commonly used C
243
dnl functions that exists in various states based on the underlying OS.
244
AC_DEFUN(CYG_AC_PATH_LIBERTY, [
245
AC_MSG_CHECKING(for the liberty library in the build tree)
246
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
247
AC_CACHE_VAL(ac_cv_c_liberty,[
248
for i in $dirlist; do
249
    if test -f "$i/libiberty/Makefile" ; then
250
        ac_cv_c_liberty=`(cd $i/libiberty; pwd)`
251
    fi
252
done
253
])
254
if test x"${ac_cv_c_liberty}" != x; then
255
    LIBERTY="-L${ac_cv_c_liberty}"
256
    AC_MSG_RESULT(${ac_cv_c_liberty})
257
else
258
    AC_MSG_RESULT(none)
259
fi
260
AC_SUBST(LIBERTY)
261
])
262
 
263
dnl ====================================================================
264
dnl Find the opcodes library. This is used to do dissasemblies.
265
AC_DEFUN(CYG_AC_PATH_OPCODES, [
266
AC_MSG_CHECKING(for the opcodes library in the build tree)
267
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
268
AC_CACHE_VAL(ac_cv_c_opc,[
269
for i in $dirlist; do
270
    if test -f "$i/opcodes/Makefile" ; then
271
        ac_cv_c_opc=`(cd $i/opcodes; pwd)`
272
    fi
273
done
274
])
275
if test x"${ac_cv_c_opc}" != x; then
276
    OPCODESLIB="-L${ac_cv_c_opc}"
277
    AC_MSG_RESULT(${ac_cv_c_opc})
278
else
279
    AC_MSG_RESULT(none)
280
fi
281
AC_SUBST(OPCODESLIB)
282
])
283
 
284
dnl ====================================================================
285
dnl Look for the DejaGnu header file in the source tree. This file
286
dnl defines the functions used to testing support.
287
AC_DEFUN(CYG_AC_PATH_DEJAGNU, [
288
AC_MSG_CHECKING(for the testing support files in the source tree)
289
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
290
AC_CACHE_VAL(ac_cv_c_dejagnu,[
291
for i in $dirlist; do
292
    if test -f "$srcdir/$i/ecc/ecc/infra/testlib/current/include/dejagnu.h" ; then
293
        ac_cv_c_dejagnu=`(cd $srcdir/$i/ecc/ecc/infra/testlib/current/include; pwd)`
294
    fi
295
done
296
])
297
if test x"${ac_cv_c_dejagnu}" != x; then
298
    DEJAGNUHDIR="-I${ac_cv_c_dejagnu}"
299
    AC_MSG_RESULT(${ac_cv_c_dejagnu})
300
else
301
    AC_MSG_RESULT(none)
302
fi
303
AC_CACHE_VAL(ac_cv_c_dejagnulib,[
304
for i in $dirlist; do
305
    if test -f "$srcdir/$i/infra/testlib/current/lib/hostutil.exp" ; then
306
        ac_cv_c_dejagnulib=`(cd $srcdir/$i/infra/testlib/current/lib; pwd)`
307
    fi
308
done
309
])
310
if test x"${ac_cv_c_dejagnulib}" != x; then
311
    DEJAGNULIB="${ac_cv_c_dejagnulib}"
312
else
313
    DEJAGNULIB=""
314
fi
315
AC_MSG_CHECKING(for runtest in the source tree)
316
AC_CACHE_VAL(ac_cv_c_runtest,[
317
for i in $dirlist; do
318
    if test -f "$srcdir/$i/dejagnu/runtest" ; then
319
        ac_cv_c_runtest=`(cd $srcdir/$i/dejagnu; pwd)`
320
    fi
321
done
322
])
323
if test x"${ac_cv_c_runtest}" != x; then
324
    RUNTESTDIR="${ac_cv_c_runtest}"
325
   AC_MSG_RESULT(${ac_cv_c_runtest})
326
else
327
    RUNTESTDIR=""
328
    AC_MSG_RESULT(none)
329
fi
330
AC_SUBST(RUNTESTDIR)
331
AC_SUBST(DEJAGNULIB)
332
AC_SUBST(DEJAGNUHDIR)
333
])
334
 
335
dnl ====================================================================
336
dnl Find the libintl library in the build tree. This is for
337
dnl  internationalization support.
338
AC_DEFUN(CYG_AC_PATH_INTL, [
339
AC_MSG_CHECKING(for the intl header in the build tree)
340
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
341
dnl Look for the header file
342
AC_CACHE_VAL(ac_cv_c_intlh,[
343
for i in $dirlist; do
344
    if test -f "$i/intl/libintl.h" ; then
345
        ac_cv_c_intlh=`(cd $i/intl; pwd)`
346
        break
347
    fi
348
done
349
])
350
if test x"${ac_cv_c_intlh}" != x; then
351
    INTLHDIR="-I${ac_cv_c_intlh}"
352
    AC_MSG_RESULT(${ac_cv_c_intlh})
353
else
354
    AC_MSG_RESULT(none)
355
fi
356
AC_SUBST(INTLHDIR)
357
 
358
dnl Look for the library
359
AC_MSG_CHECKING(for the libintl library in the build tree)
360
AC_CACHE_VAL(ac_cv_c_intllib,[
361
for i in $dirlist; do
362
    if test -f "$i/intl/Makefile" ; then
363
        ac_cv_c_intllib=`(cd $i/intl; pwd)`
364
    fi
365
done
366
])
367
if test x"${ac_cv_c_intllib}" != x; then
368
    INTLLIB="-L${ac_cv_c_intllib} -lintl"
369
    AC_MSG_RESULT(${ac_cv_c_intllib})
370
else
371
    AC_MSG_RESULT(none)
372
fi
373
AC_SUBST(INTLLIB)
374
])
375
 
376
dnl ====================================================================
377
dnl Find the simulator library.
378
AC_DEFUN(CYG_AC_PATH_SIM, [
379
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.. ../../../../../../../../../.."
380
case "$target_cpu" in
381
    powerpc)    target_dir=ppc ;;
382
    sparc*)     target_dir=erc32 ;;
383
    mips*)      target_dir=mips ;;
384
    *)          target_dir=$target_cpu ;;
385
esac
386
dnl First look for the header file
387
AC_MSG_CHECKING(for the simulator header file)
388
AC_CACHE_VAL(ac_cv_c_simh,[
389
for i in $dirlist; do
390
    if test -f "${srcdir}/$i/include/remote-sim.h" ; then
391
        ac_cv_c_simh=`(cd ${srcdir}/$i/include; pwd)`
392
        break
393
    fi
394
done
395
])
396
if test x"${ac_cv_c_simh}" != x; then
397
    SIMHDIR="-I${ac_cv_c_simh}"
398
    AC_MSG_RESULT(${ac_cv_c_simh})
399
else
400
    AC_MSG_RESULT(none)
401
fi
402
AC_SUBST(SIMHDIR)
403
 
404
dnl See whether it's a devo or Foundry branch simulator
405
AC_MSG_CHECKING(Whether this is a devo simulator )
406
AC_CACHE_VAL(ac_cv_c_simdevo,[
407
    CPPFLAGS="$CPPFLAGS $SIMHDIR"
408
    AC_EGREP_HEADER([SIM_DESC sim_open.*struct _bfd], remote-sim.h,
409
        ac_cv_c_simdevo=yes,
410
        ac_cv_c_simdevo=no)
411
])
412
if test x"$ac_cv_c_simdevo" = x"yes" ; then
413
    AC_DEFINE(HAVE_DEVO_SIM)
414
fi
415
AC_MSG_RESULT(${ac_cv_c_simdevo})
416
AC_SUBST(HAVE_DEVO_SIM)
417
 
418
dnl Next look for the library
419
AC_MSG_CHECKING(for the simulator library)
420
AC_CACHE_VAL(ac_cv_c_simlib,[
421
for i in $dirlist; do
422
    if test -f "$i/sim/$target_dir/Makefile" ; then
423
        ac_cv_c_simlib=`(cd $i/sim/$target_dir; pwd)`
424
    fi
425
done
426
])
427
if test x"${ac_cv_c_simlib}" != x; then
428
    SIMLIB="-L${ac_cv_c_simlib}"
429
else
430
    AC_MSG_RESULT(none)
431
    dnl FIXME: this is kinda bogus, cause umtimately the TM will build
432
    dnl all the libraries for several architectures. But for now, this
433
    dnl will work till then.
434
dnl     AC_MSG_CHECKING(for the simulator installed with the compiler libraries)
435
    dnl Transform the name of the compiler to it's cross variant, unless
436
    dnl CXX is set. This is also what CXX gets set to in the generated
437
    dnl Makefile.
438
    CROSS_GCC=`echo gcc | sed -e "s/^/$target/"`
439
 
440
    dnl Get G++'s full path to libgcc.a
441
changequote(,)
442
    gccpath=`${CROSS_GCC} --print-libgcc | sed -e 's:[a-z0-9A-Z\.\-]*/libgcc.a::' -e 's:lib/gcc-lib/::'`lib
443
changequote([,])
444
    if test -f $gccpath/libsim.a -o -f $gccpath/libsim.so ; then
445
        ac_cv_c_simlib="$gccpath/"
446
        SIMLIB="-L${ac_cv_c_simlib}"
447
        AC_MSG_RESULT(${ac_cv_c_simlib})
448
    else
449
        AM_CONDITIONAL(PSIM, test x$psim = xno)
450
        SIMLIB=""
451
        AC_MSG_RESULT(none)
452
dnl         ac_cv_c_simlib=none
453
    fi
454
fi
455
AC_SUBST(SIMLIB)
456
])
457
 
458
dnl ====================================================================
459
dnl Find the libiberty library.
460
AC_DEFUN(CYG_AC_PATH_LIBIBERTY, [
461
AC_MSG_CHECKING(for the libiberty library in the build tree)
462
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
463
AC_CACHE_VAL(ac_cv_c_libib,[
464
for i in $dirlist; do
465
    if test -f "$i/libiberty/Makefile" ; then
466
        ac_cv_c_libib=`(cd $i/libiberty/; pwd)`
467
    fi
468
done
469
])
470
if test x"${ac_cv_c_libib}" != x; then
471
    LIBIBERTY="-L${ac_cv_c_libib}"
472
    AC_MSG_RESULT(${ac_cv_c_libib})
473
else
474
    AC_MSG_RESULT(none)
475
fi
476
AC_SUBST(LIBIBERTY)
477
])
478
 
479
dnl ====================================================================
480
AC_DEFUN(CYG_AC_PATH_DEVO, [
481
AC_MSG_CHECKING(for devo headers in the source tree)
482
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
483
AC_CACHE_VAL(ac_cv_c_devoh,[
484
for i in $dirlist; do
485
    if test -f "${srcdir}/$i/include/remote-sim.h" ; then
486
        ac_cv_c_devoh=`(cd ${srcdir}/$i/include; pwd)`
487
    fi
488
done
489
])
490
if test x"${ac_cv_c_devoh}" != x; then
491
    DEVOHDIR="-I${ac_cv_c_devoh}"
492
    AC_MSG_RESULT(${ac_cv_c_devoh})
493
else
494
    AC_MSG_RESULT(none)
495
fi
496
AC_SUBST(DEVOHDIR)
497
])
498
 
499
dnl ====================================================================
500
dnl find the IDE library and headers.
501
AC_DEFUN(CYG_AC_PATH_IDE, [
502
AC_MSG_CHECKING(for IDE headers in the source tree)
503
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
504
IDEHDIR=
505
IDELIB=
506
AC_CACHE_VAL(ac_cv_c_ideh,[
507
for i in $dirlist; do
508
    if test -f "${srcdir}/$i/libide/src/event.h" ; then
509
        ac_cv_c_ideh=`(cd ${srcdir}/$i/libide/src; pwd)`;
510
    fi
511
done
512
])
513
if test x"${ac_cv_c_ideh}" != x; then
514
    IDEHDIR="-I${ac_cv_c_ideh}"
515
    AC_MSG_RESULT(${ac_cv_c_ideh})
516
else
517
    AC_MSG_RESULT(none)
518
fi
519
 
520
AC_MSG_CHECKING(for LIBIDE TCL headers in the source tree)
521
AC_CACHE_VAL(ac_cv_c_idetclh,[
522
for i in $dirlist; do
523
    if test -f "${srcdir}/$i/libidetcl/src/idetcl.h" ; then
524
        ac_cv_c_idetclh=`(cd ${srcdir}/$i/libidetcl/src; pwd)`;
525
    fi
526
done
527
])
528
if test x"${ac_cv_c_idetclh}" != x; then
529
    IDEHDIR="${IDEHDIR} -I${ac_cv_c_idetclh}"
530
    AC_MSG_RESULT(${ac_cv_c_idetclh})
531
else
532
    AC_MSG_RESULT(none)
533
fi
534
 
535
AC_MSG_CHECKING(for IDE headers in the build tree)
536
AC_CACHE_VAL(ac_cv_c_ideh2,[
537
for i in $dirlist; do
538
    if test -f "$i/libide/src/Makefile" ; then
539
        ac_cv_c_ideh2=`(cd $i/libide/src; pwd)`;
540
    fi
541
done
542
])
543
if test x"${ac_cv_c_ideh2}" != x; then
544
    IDEHDIR="${IDEHDIR} -I${ac_cv_c_ideh2}"
545
    AC_MSG_RESULT(${ac_cv_c_ideh2})
546
else
547
    AC_MSG_RESULT(none)
548
fi
549
 
550
dnl look for the library
551
AC_MSG_CHECKING(for IDE library)
552
AC_CACHE_VAL(ac_cv_c_idelib,[
553
if test x"${ac_cv_c_idelib}" = x ; then
554
    for i in $dirlist; do
555
      if test -f "$i/libide/src/Makefile" ; then
556
        ac_cv_c_idelib=`(cd $i/libide/src; pwd)`
557
        break
558
      fi
559
    done
560
fi])
561
if test x"${ac_cv_c_idelib}" != x ; then
562
     IDELIB="-L${ac_cv_c_idelib}"
563
     AC_MSG_RESULT(${ac_cv_c_idelib})
564
else
565
     AC_MSG_RESULT(none)
566
fi
567
 
568
dnl find libiddetcl.a if it exists
569
AC_MSG_CHECKING(for IDE TCL library)
570
AC_CACHE_VAL(ac_cv_c_idetcllib,[
571
if test x"${ac_cv_c_idetcllib}" = x ; then
572
    for i in $dirlist; do
573
      if test -f "$i/libidetcl/src/Makefile" ; then
574
        ac_cv_c_idetcllib=`(cd $i/libidetcl/src; pwd)`
575
        break
576
      fi
577
    done
578
fi
579
])
580
if test x"${ac_cv_c_idetcllib}" != x ; then
581
     IDELIB="${IDELIB} -L${ac_cv_c_idetcllib}"
582
     IDETCLLIB="-lidetcl"
583
     AC_MSG_RESULT(${ac_cv_c_idetcllib})
584
else
585
     AC_MSG_RESULT(none)
586
fi
587
AC_SUBST(IDEHDIR)
588
AC_SUBST(IDELIB)
589
AC_SUBST(IDETCLLIB)
590
])
591
 
592
dnl ====================================================================
593
dnl Find all the ILU headers and libraries
594
AC_DEFUN(CYG_AC_PATH_ILU, [
595
AC_MSG_CHECKING(for ILU kernel headers in the source tree)
596
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
597
AC_CACHE_VAL(ac_cv_c_iluh,[
598
for i in $dirlist; do
599
    if test -f "${srcdir}/$i/ilu/runtime/kernel/method.h" ; then
600
        ac_cv_c_iluh=`(cd ${srcdir}/$i/ilu/runtime/kernel; pwd)`
601
    fi
602
done
603
])
604
if test x"${ac_cv_c_iluh}" != x; then
605
    ILUHDIR="-I${ac_cv_c_iluh}"
606
    AC_MSG_RESULT(${ac_cv_c_iluh})
607
else
608
    AC_MSG_RESULT(none)
609
fi
610
 
611
AC_MSG_CHECKING(for ILU kernel headers in the build tree)
612
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
613
AC_CACHE_VAL(ac_cv_c_iluh5,[
614
for i in $dirlist; do
615
    if test -f "$i/ilu/runtime/kernel/iluconf.h" ; then
616
        ac_cv_c_iluh5=`(cd $i/ilu/runtime/kernel; pwd)`
617
    fi
618
done
619
])
620
if test x"${ac_cv_c_iluh5}" != x; then
621
    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh5}"
622
    AC_MSG_RESULT(${ac_cv_c_iluh5})
623
else
624
    AC_MSG_RESULT(none)
625
fi
626
 
627
AC_MSG_CHECKING(for ILU C++ headers in the source tree)
628
AC_CACHE_VAL(ac_cv_c_iluh2,[
629
for i in $dirlist; do
630
    if test -f "${srcdir}/$i/ilu/stubbers/cpp/resource.h" ; then
631
        ac_cv_c_iluh2=`(cd ${srcdir}/$i/ilu/stubbers/cpp; pwd)`
632
    fi
633
done
634
])
635
if test x"${ac_cv_c_iluh2}" != x; then
636
    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh2}"
637
    AC_MSG_RESULT(${ac_cv_c_iluh2})
638
else
639
    AC_MSG_RESULT(none)
640
fi
641
 
642
AC_MSG_CHECKING(for ILU C headers)
643
AC_CACHE_VAL(ac_cv_c_iluh3,[
644
for i in $dirlist; do
645
    if test -f "${srcdir}/$i/ilu/stubbers/c/resource.h" ; then
646
        ac_cv_c_iluh3=`(cd ${srcdir}/$i/ilu/stubbers/c  ; pwd)`
647
    fi
648
done
649
])
650
if test x"${ac_cv_c_iluh3}" != x; then
651
    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh3}"
652
    AC_MSG_RESULT(${ac_cv_c_iluh3})
653
else
654
    AC_MSG_RESULT(none)
655
fi
656
 
657
AC_MSG_CHECKING(for ILU C runtime headers)
658
AC_CACHE_VAL(ac_cv_c_iluh4,[
659
for i in $dirlist; do
660
    if test -f "${srcdir}/$i/ilu/runtime/c/ilucstub.h" ; then
661
        ac_cv_c_iluh4=`(cd ${srcdir}/$i/ilu/runtime/c  ; pwd)`
662
    fi
663
done
664
])
665
if test x"${ac_cv_c_iluh4}" != x; then
666
    ILUHDIR="${ILUHDIR} -I${ac_cv_c_iluh4}"
667
    AC_MSG_RESULT(${ac_cv_c_iluh4})
668
else
669
    AC_MSG_RESULT(none)
670
fi
671
 
672
AC_CACHE_VAL(ac_cv_c_ilupath,[
673
for i in $dirlist; do
674
    if test -f "$i/ilu/Makefile" ; then
675
        ac_cv_c_ilupath=`(cd $i/ilu; pwd)`
676
        break
677
    fi
678
done
679
])
680
ILUTOP=${ac_cv_c_ilupath}
681
 
682
AC_MSG_CHECKING(for the ILU library in the build tree)
683
AC_CACHE_VAL(ac_cv_c_ilulib,[
684
if test -f "$ac_cv_c_ilupath/runtime/kernel/Makefile" ; then
685
    ac_cv_c_ilulib=`(cd $ac_cv_c_ilupath/runtime/kernel; pwd)`
686
    AC_MSG_RESULT(found ${ac_cv_c_ilulib}/libilu.a)
687
else
688
    AC_MSG_RESULT(no)
689
fi])
690
 
691
AC_MSG_CHECKING(for the ILU C++ bindings library in the build tree)
692
AC_CACHE_VAL(ac_cv_c_ilulib2,[
693
if test -f "$ac_cv_c_ilupath/runtime/cpp/Makefile" ; then
694
    ac_cv_c_ilulib2=`(cd $ac_cv_c_ilupath/runtime/cpp; pwd)`
695
    AC_MSG_RESULT(found ${ac_cv_c_ilulib2}/libilu-c++.a)
696
else
697
    AC_MSG_RESULT(no)
698
fi])
699
 
700
AC_MSG_CHECKING(for the ILU C bindings library in the build tree)
701
AC_CACHE_VAL(ac_cv_c_ilulib3,[
702
if test -f "$ac_cv_c_ilupath/runtime/c/Makefile" ; then
703
    ac_cv_c_ilulib3=`(cd $ac_cv_c_ilupath/runtime/c; pwd)`
704
    AC_MSG_RESULT(found ${ac_cv_c_ilulib3}/libilu-c.a)
705
else
706
    AC_MSG_RESULT(no)
707
fi])
708
 
709
AC_MSG_CHECKING(for the ILU Tk bindings library in the build tree)
710
AC_CACHE_VAL(ac_cv_c_ilulib4,[
711
if test -f "$ac_cv_c_ilupath/runtime/mainloop/Makefile" ; then
712
    ac_cv_c_ilulib4=`(cd $ac_cv_c_ilupath/runtime/mainloop; pwd)`
713
    AC_MSG_RESULT(found ${ac_cv_c_ilulib4}/libilu-tk.a)
714
else
715
    AC_MSG_RESULT(no)
716
fi])
717
 
718
if test x"${ac_cv_c_ilulib}" = x -a x"${ac_cv_c_ilulib2}" = x; then
719
  ILUHDIR=""
720
fi
721
 
722
if test x"${ac_cv_c_ilulib}" != x -a x"${ac_cv_c_ilulib2}" != x; then
723
    ILULIB="-L${ac_cv_c_ilulib} -L${ac_cv_c_ilulib2} -L${ac_cv_c_ilulib3} -L${ac_cv_c_ilulib4}"
724
else
725
    ILULIB=""
726
fi
727
 
728
if test x"${ILULIB}" = x; then
729
    AC_MSG_CHECKING(for ILU libraries installed with the compiler)
730
    AC_CACHE_VAL(ac_cv_c_ilulib5,[
731
    NATIVE_GCC=`echo gcc | sed -e "${program_transform_name}"`
732
 
733
    dnl Get G++'s full path to it's libraries
734
    ac_cv_c_ilulib5=`${NATIVE_GCC} --print-libgcc | sed -e 's:lib/gcc-lib/.*::'`lib
735
    if test -f $ac_cv_c_ilulib5/libilu-c.a -o -f $ac_cv_c_ilulib5/libilu-c.so ; then
736
        if test x"${ILUHDIR}" = x; then
737
               ILUHDIR="-I${ac_cv_c_ilulib5}/../include"
738
        fi
739
        ILULIB="-L${ac_cv_c_ilulib5}"
740
        AC_MSG_RESULT(${ac_cv_c_ilulib5})
741
    else
742
        ac_cv_c_ilulib=none
743
        AC_MSG_RESULT(none)
744
    fi
745
fi])
746
AC_SUBST(ILUHDIR)
747
AC_SUBST(ILULIB)
748
AC_SUBST(ILUTOP)
749
])
750
 
751
dnl ====================================================================
752
dnl This defines the byte order for the host. We can't use
753
dnl AC_C_BIGENDIAN, cause we want to create a config file and
754
dnl substitue the real value, so the header files work right
755
AC_DEFUN(CYG_AC_C_ENDIAN, [
756
AC_MSG_CHECKING(to see if this is a little endian host)
757
AC_CACHE_VAL(ac_cv_c_little_endian, [
758
ac_cv_c_little_endian=unknown
759
# See if sys/param.h defines the BYTE_ORDER macro.
760
AC_TRY_COMPILE([#include <sys/types.h>
761
#include <sys/param.h>], [
762
#if !BYTE_ORDER || !_BIG_ENDIAN || !_LITTLE_ENDIAN
763
 bogus endian macros
764
#endif], [# It does; now see whether it defined to _LITTLE_ENDIAN or not.
765
AC_TRY_COMPILE([#include <sys/types.h>
766
#include <sys/param.h>], [
767
#if BYTE_ORDER != _LITTLE_ENDIAN
768
 not big endian
769
#endif], ac_cv_c_little_endian=yes, ac_cv_c_little_endian=no)
770
])
771
if test ${ac_cv_c_little_endian} = unknown; then
772
old_cflags=$CFLAGS
773
CFLAGS=-g
774
AC_TRY_RUN([
775
main () {
776
  /* Are we little or big endian?  From Harbison&Steele.  */
777
  union
778
  {
779
    long l;
780
    char c[sizeof (long)];
781
  } u;
782
  u.l = 1;
783
  exit (u.c[0] == 1);
784
}],
785
ac_cv_c_little_endian=no,
786
ac_cv_c_little_endian=yes,[
787
dnl Yes, this is ugly, and only used for a canadian cross anyway. This
788
dnl is just to keep configure from stopping here.
789
case "${host}" in
790
changequote(,)
791
   i[3456]86-*-*) ac_cv_c_little_endian=yes ;;
792
   sparc*-*-*)    ac_cv_c_little_endian=no ;;
793
changequote([,])
794
  *)    AC_MSG_WARN(Can't cross compile this test) ;;
795
esac])
796
CFLAGS=$old_cflags
797
fi])
798
 
799
if test x"${ac_cv_c_little_endian}" = xyes; then
800
    AC_DEFINE(LITTLE_ENDIAN_HOST)
801
    ENDIAN="CYG_LSBFIRST";
802
else
803
    ENDIAN="CYG_MSBFIRST";
804
fi
805
AC_MSG_RESULT(${ac_cv_c_little_endian})
806
AC_SUBST(ENDIAN)
807
])
808
 
809
dnl ====================================================================
810
dnl Look for the path to libgcc, so we can use it to directly link
811
dnl in libgcc.a with LD.
812
AC_DEFUN(CYG_AC_PATH_LIBGCC,
813
[AC_MSG_CHECKING([Looking for the path to libgcc.a])
814
AC_LANG_SAVE
815
AC_LANG_C
816
 
817
dnl Get Gcc's full path to libgcc.a
818
libgccpath=`${CC} --print-libgcc`
819
 
820
dnl If we don't have a path with libgcc.a on the end, this isn't G++.
821
if test `echo $libgccpath | sed -e 's:/.*/::'` = libgcc.a ; then
822
   ac_cv_prog_gcc=yes
823
else
824
   ac_cv_prog_gcc=no
825
fi
826
 
827
dnl
828
if test x"${ac_cv_prog_gcc}" = xyes ; then
829
   gccpath=`echo $libgccpath | sed -e 's:/libgcc.a::'`
830
   LIBGCC="-L${gccpath}"
831
   AC_MSG_RESULT(${gccpath})
832
else
833
   LIBGCC=""
834
   AC_MSG_ERROR(Not using gcc)
835
fi
836
 
837
AC_LANG_RESTORE
838
AC_SUBST(LIBGCC)
839
])
840
 
841
dnl ====================================================================
842
dnl Ok, lets find the tcl source trees so we can use the headers
843
dnl Warning: transition of version 9 to 10 will break this algorithm
844
dnl because 10 sorts before 9. We also look for just tcl. We have to
845
dnl be careful that we don't match stuff like tclX by accident.
846
dnl the alternative search directory is involked by --with-tclinclude
847
AC_DEFUN(CYG_AC_PATH_TCL, [
848
    CYG_AC_PATH_TCLH
849
    CYG_AC_PATH_TCLCONFIG
850
    CYG_AC_LOAD_TCLCONFIG
851
])
852
AC_DEFUN(CYG_AC_PATH_TCLH, [
853
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
854
no_tcl=true
855
AC_MSG_CHECKING(for Tcl headers in the source tree)
856
AC_ARG_WITH(tclinclude, [  --with-tclinclude       directory where tcl headers are], with_tclinclude=${withval})
857
AC_CACHE_VAL(ac_cv_c_tclh,[
858
dnl first check to see if --with-tclinclude was specified
859
if test x"${with_tclinclude}" != x ; then
860
  if test -f ${with_tclinclude}/tcl.h ; then
861
    ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
862
  elif test -f ${with_tclinclude}/generic/tcl.h ; then
863
    ac_cv_c_tclh=`(cd ${with_tclinclude}/generic; pwd)`
864
  else
865
    AC_MSG_ERROR([${with_tclinclude} directory doesn't contain headers])
866
  fi
867
fi
868
 
869
dnl next check if it came with Tcl configuration file
870
if test x"${ac_cv_c_tclconfig}" != x ; then
871
  for i in $dirlist; do
872
    if test -f $ac_cv_c_tclconfig/$i/generic/tcl.h ; then
873
      ac_cv_c_tclh=`(cd $ac_cv_c_tclconfig/$i/generic; pwd)`
874
      break
875
    fi
876
  done
877
fi
878
 
879
dnl next check in private source directory
880
dnl since ls returns lowest version numbers first, reverse its output
881
if test x"${ac_cv_c_tclh}" = x ; then
882
    dnl find the top level Tcl source directory
883
    for i in $dirlist; do
884
        if test -n "`ls -dr $srcdir/$i/tcl* 2>/dev/null`" ; then
885
            tclpath=$srcdir/$i
886
            break
887
        fi
888
    done
889
 
890
    dnl find the exact Tcl source dir. We do it this way, cause there
891
    dnl might be multiple version of Tcl, and we want the most recent one.
892
    for i in `ls -dr $tclpath/tcl* 2>/dev/null ` ; do
893
        if test -f $i/generic/tcl.h ; then
894
          ac_cv_c_tclh=`(cd $i/generic; pwd)`
895
          break
896
        fi
897
    done
898
fi
899
 
900
dnl check if its installed with the compiler
901
if test x"${ac_cv_c_tclh}" = x ; then
902
    dnl Get the path to the compiler
903
    ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/include
904
    if test -f $ccpath/tcl.h; then
905
        ac_cv_c_tclh=$ccpath
906
    fi
907
fi
908
 
909
dnl see if one is installed
910
if test x"${ac_cv_c_tclh}" = x ; then
911
   AC_MSG_RESULT(none)
912
   AC_CHECK_HEADER(tcl.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
913
else
914
   AC_MSG_RESULT(${ac_cv_c_tclh})
915
fi
916
])
917
  TCLHDIR=""
918
if test x"${ac_cv_c_tclh}" = x ; then
919
    AC_MSG_ERROR([Can't find any Tcl headers])
920
fi
921
if test x"${ac_cv_c_tclh}" != x ; then
922
    no_tcl=""
923
    if test x"${ac_cv_c_tclh}" != x"installed" ; then
924
        if test x"${CC}" = xcl ; then
925
            tmp="`cygpath --windows ${ac_cv_c_tclh}`"
926
            ac_cv_c_tclh="`echo $tmp | sed -e s#\\\\\\\\#/#g`"
927
        fi
928
        AC_MSG_RESULT(${ac_cv_c_tclh})
929
        TCLHDIR="-I${ac_cv_c_tclh}"
930
    fi
931
fi
932
 
933
AC_SUBST(TCLHDIR)
934
])
935
 
936
dnl ====================================================================
937
dnl Ok, lets find the tcl configuration
938
AC_DEFUN(CYG_AC_PATH_TCLCONFIG, [
939
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
940
dnl First, look for one uninstalled.
941
dnl the alternative search directory is invoked by --with-tclconfig
942
if test x"${no_tcl}" = x ; then
943
  dnl we reset no_tcl in case something fails here
944
    no_tcl=true
945
    AC_ARG_WITH(tclconfig, [  --with-tclconfig           directory containing tcl configuration (tclConfig.sh)],
946
         with_tclconfig=${withval})
947
    AC_MSG_CHECKING([for Tcl configuration script])
948
    AC_CACHE_VAL(ac_cv_c_tclconfig,[
949
 
950
    dnl First check to see if --with-tclconfig was specified.
951
    if test x"${with_tclconfig}" != x ; then
952
        if test -f "${with_tclconfig}/tclConfig.sh" ; then
953
            ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
954
        else
955
            AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
956
        fi
957
    fi
958
 
959
    dnl next check if it came with Tcl configuration file in the source tree
960
    if test x"${ac_cv_c_tclconfig}" = x ; then
961
        for i in $dirlist; do
962
            if test -f $srcdir/$i/unix/tclConfig.sh ; then
963
                ac_cv_c_tclconfig=`(cd $srcdir/$i/unix; pwd)`
964
                break
965
            fi
966
        done
967
    fi
968
    dnl check in a few other locations
969
    if test x"${ac_cv_c_tclconfig}" = x ; then
970
        dnl find the top level Tcl source directory
971
        for i in $dirlist; do
972
            if test -n "`ls -dr $i/tcl* 2>/dev/null`" ; then
973
                tclconfpath=$i
974
                break
975
            fi
976
        done
977
 
978
        dnl find the exact Tcl dir. We do it this way, cause there
979
        dnl might be multiple version of Tcl, and we want the most recent one.
980
        for i in `ls -dr $tclconfpath/tcl* 2>/dev/null ` ; do
981
            if test -f $i/unix/tclConfig.sh ; then
982
                ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
983
                break
984
            fi
985
        done
986
    fi
987
 
988
    dnl Check to see if it's installed. We have to look in the $CC path
989
    dnl to find it, cause our $prefix may not match the compilers.
990
    if test x"${ac_cv_c_tclconfig}" = x ; then
991
        dnl Get the path to the compiler
992
        ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/lib
993
        if test -f $ccpath/tclConfig.sh; then
994
            ac_cv_c_tclconfig=$ccpath
995
        fi
996
    fi
997
    ])  dnl end of cache_val
998
 
999
    if test x"${ac_cv_c_tclconfig}" = x ; then
1000
        TCLCONFIG=""
1001
        AC_MSG_WARN(Can't find Tcl configuration definitions)
1002
    else
1003
        no_tcl=""
1004
        TCLCONFIG=${ac_cv_c_tclconfig}/tclConfig.sh
1005
        AC_MSG_RESULT(${TCLCONFIG})
1006
     fi
1007
fi
1008
AC_SUBST(TCLCONFIG)
1009
])
1010
 
1011
dnl Defined as a separate macro so we don't have to cache the values
1012
dnl from PATH_TCLCONFIG (because this can also be cached).
1013
AC_DEFUN(CYG_AC_LOAD_TCLCONFIG, [
1014
    . $TCLCONFIG
1015
 
1016
dnl AC_SUBST(TCL_VERSION)
1017
dnl AC_SUBST(TCL_MAJOR_VERSION)
1018
dnl AC_SUBST(TCL_MINOR_VERSION)
1019
dnl AC_SUBST(TCL_CC)
1020
    AC_SUBST(TCL_DEFS)
1021
 
1022
dnl not used, don't export to save symbols
1023
    AC_SUBST(TCL_LIB_FILE)
1024
    AC_SUBST(TCL_LIB_FULL_PATH)
1025
    AC_SUBST(TCL_LIBS)
1026
dnl not used, don't export to save symbols
1027
dnl    AC_SUBST(TCL_PREFIX)
1028
 
1029
    AC_SUBST(TCL_CFLAGS)
1030
 
1031
dnl not used, don't export to save symbols
1032
dnl    AC_SUBST(TCL_EXEC_PREFIX)
1033
 
1034
    AC_SUBST(TCL_SHLIB_CFLAGS)
1035
    AC_SUBST(TCL_SHLIB_LD)
1036
dnl don't export, not used outside of configure
1037
dnl AC_SUBST(TCL_SHLIB_LD_LIBS)
1038
dnl AC_SUBST(TCL_SHLIB_SUFFIX)
1039
dnl not used, don't export to save symbols
1040
dnl AC_SUBST(TCL_DL_LIBS)
1041
    AC_SUBST(TCL_LD_FLAGS)
1042
    AC_SUBST(TCL_LD_SEARCH_FLAGS)
1043
dnl don't export, not used outside of configure
1044
dnl AC_SUBST(TCL_COMPAT_OBJS)
1045
    AC_SUBST(TCL_RANLIB)
1046
    AC_SUBST(TCL_BUILD_LIB_SPEC)
1047
    AC_SUBST(TCL_LIB_SPEC)
1048
    AC_SUBST(TCL_BIN_DIR)
1049
dnl AC_SUBST(TCL_LIB_VERSIONS_OK)
1050
 
1051
dnl not used, don't export to save symbols
1052
dnl    AC_SUBST(TCL_SHARED_LIB_SUFFIX)
1053
 
1054
dnl not used, don't export to save symbols
1055
dnl    AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
1056
])
1057
 
1058
dnl ====================================================================
1059
AC_DEFUN(CYG_AC_PATH_TK, [
1060
    CYG_AC_PATH_TKH
1061
    CYG_AC_PATH_TKCONFIG
1062
    CYG_AC_LOAD_TKCONFIG
1063
])
1064
AC_DEFUN(CYG_AC_PATH_TKH, [
1065
#
1066
# Ok, lets find the tk source trees so we can use the headers
1067
# If the directory (presumably symlink) named "tk" exists, use that one
1068
# in preference to any others.  Same logic is used when choosing library
1069
# and again with Tcl. The search order is the best place to look first, then in
1070
# decreasing significance. The loop breaks if the trigger file is found.
1071
# Note the gross little conversion here of srcdir by cd'ing to the found
1072
# directory. This converts the path from a relative to an absolute, so
1073
# recursive cache variables for the path will work right. We check all
1074
# the possible paths in one loop rather than many seperate loops to speed
1075
# things up.
1076
# the alternative search directory is involked by --with-tkinclude
1077
#
1078
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1079
no_tk=true
1080
AC_MSG_CHECKING(for Tk headers in the source tree)
1081
AC_ARG_WITH(tkinclude, [  --with-tkinclude       directory where tk headers are], with_tkinclude=${withval})
1082
AC_CACHE_VAL(ac_cv_c_tkh,[
1083
dnl first check to see if --with-tkinclude was specified
1084
if test x"${with_tkinclude}" != x ; then
1085
  if test -f ${with_tkinclude}/tk.h ; then
1086
    ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
1087
  elif test -f ${with_tkinclude}/generic/tk.h ; then
1088
    ac_cv_c_tkh=`(cd ${with_tkinclude}/generic; pwd)`
1089
  else
1090
    AC_MSG_ERROR([${with_tkinclude} directory doesn't contain headers])
1091
  fi
1092
fi
1093
 
1094
dnl next check if it came with Tk configuration file
1095
if test x"${ac_cv_c_tkconfig}" != x ; then
1096
  for i in $dirlist; do
1097
    if test -f $ac_cv_c_tkconfig/$i/generic/tk.h ; then
1098
      ac_cv_c_tkh=`(cd $ac_cv_c_tkconfig/$i/generic; pwd)`
1099
      break
1100
    fi
1101
  done
1102
fi
1103
 
1104
dnl next check in private source directory
1105
dnl since ls returns lowest version numbers first, reverse its output
1106
if test x"${ac_cv_c_tkh}" = x ; then
1107
    dnl find the top level Tk source directory
1108
    for i in $dirlist; do
1109
        if test -n "`ls -dr $srcdir/$i/tk* 2>/dev/null`" ; then
1110
            tkpath=$srcdir/$i
1111
            break
1112
        fi
1113
    done
1114
 
1115
    dnl find the exact Tk source dir. We do it this way, cause there
1116
    dnl might be multiple version of Tk, and we want the most recent one.
1117
    for i in `ls -dr $tkpath/tk* 2>/dev/null ` ; do
1118
        if test -f $i/generic/tk.h ; then
1119
          ac_cv_c_tkh=`(cd $i/generic; pwd)`
1120
          break
1121
        fi
1122
    done
1123
fi
1124
 
1125
dnl see if one is installed
1126
if test x"${ac_cv_c_tkh}" = x ; then
1127
    AC_MSG_RESULT(none)
1128
    dnl Get the path to the compiler. We do it this way instead of using
1129
    dnl AC_CHECK_HEADER, cause this doesn't depend in having X configured.
1130
    ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/include
1131
    if test -f $ccpath/tk.h; then
1132
        ac_cv_c_tkh=$ccpath
1133
    fi
1134
else
1135
   AC_MSG_RESULT(${ac_cv_c_tkh})
1136
fi
1137
])
1138
  TKHDIR=""
1139
if test x"${ac_cv_c_tkh}" = x ; then
1140
    AC_MSG_ERROR([Can't find any Tk headers])
1141
fi
1142
if test x"${ac_cv_c_tkh}" != x ; then
1143
    no_tk=""
1144
    if test x"${ac_cv_c_tkh}" != x"installed" ; then
1145
        if test x"${CC}" = xcl ; then
1146
            tmp="`cygpath --windows ${ac_cv_c_tkh}`"
1147
            ac_cv_c_tkh="`echo $tmp | sed -e s#\\\\\\\\#/#g`"
1148
        fi
1149
        AC_MSG_RESULT([found in ${ac_cv_c_tkh}])
1150
        TKHDIR="-I${ac_cv_c_tkh}"
1151
    fi
1152
fi
1153
 
1154
AC_SUBST(TKHDIR)
1155
])
1156
 
1157
AC_DEFUN(CYG_AC_PATH_TKCONFIG, [
1158
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1159
dnl First, look for one uninstalled.
1160
dnl the alternative search directory is invoked by --with-tkconfig
1161
if test x"${no_tk}" = x ; then
1162
  dnl we reset no_tk in case something fails here
1163
    no_tk=true
1164
    AC_ARG_WITH(tkconfig, [  --with-tkconfig           directory containing tk configuration (tkConfig.sh)],
1165
         with_tkconfig=${withval})
1166
    AC_MSG_CHECKING([for Tk configuration script])
1167
    AC_CACHE_VAL(ac_cv_c_tkconfig,[
1168
 
1169
    dnl First check to see if --with-tkconfig was specified.
1170
    if test x"${with_tkconfig}" != x ; then
1171
        if test -f "${with_tkconfig}/tkConfig.sh" ; then
1172
            ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
1173
        else
1174
            AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
1175
        fi
1176
    fi
1177
 
1178
    dnl next check if it came with Tk configuration file in the source tree
1179
    if test x"${ac_cv_c_tkconfig}" = x ; then
1180
        for i in $dirlist; do
1181
            if test -f $srcdir/$i/unix/tkConfig.sh ; then
1182
                ac_cv_c_tkconfig=`(cd $srcdir/$i/unix; pwd)`
1183
                break
1184
            fi
1185
        done
1186
    fi
1187
    dnl check in a few other locations
1188
    if test x"${ac_cv_c_tkconfig}" = x ; then
1189
        dnl find the top level Tk source directory
1190
        for i in $dirlist; do
1191
            if test -n "`ls -dr $i/tk* 2>/dev/null`" ; then
1192
                tkconfpath=$i
1193
                break
1194
            fi
1195
        done
1196
 
1197
        dnl find the exact Tk dir. We do it this way, cause there
1198
        dnl might be multiple version of Tk, and we want the most recent one.
1199
        for i in `ls -dr $tkconfpath/tk* 2>/dev/null ` ; do
1200
            if test -f $i/unix/tkConfig.sh ; then
1201
                ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
1202
                break
1203
            fi
1204
        done
1205
    fi
1206
 
1207
    dnl Check to see if it's installed. We have to look in the $CC path
1208
    dnl to find it, cause our $prefix may not match the compilers.
1209
    if test x"${ac_cv_c_tkconfig}" = x ; then
1210
        dnl Get the path to the compiler
1211
        ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/lib
1212
        if test -f $ccpath/tkConfig.sh; then
1213
            ac_cv_c_tkconfig=$ccpath
1214
        fi
1215
    fi
1216
    ])  dnl end of cache_val
1217
 
1218
    if test x"${ac_cv_c_tkconfig}" = x ; then
1219
        TKCONFIG=""
1220
        AC_MSG_WARN(Can't find Tk configuration definitions)
1221
    else
1222
        no_tk=""
1223
        TKCONFIG=${ac_cv_c_tkconfig}/tkConfig.sh
1224
        AC_MSG_RESULT(${TKCONFIG})
1225
     fi
1226
fi
1227
AC_SUBST(TKCONFIG)
1228
])
1229
 
1230
dnl Defined as a separate macro so we don't have to cache the values
1231
dnl from PATH_TKCONFIG (because this can also be cached).
1232
AC_DEFUN(CYG_AC_LOAD_TKCONFIG, [
1233
    if test -f "$TKCONFIG" ; then
1234
      . $TKCONFIG
1235
    fi
1236
 
1237
    AC_SUBST(TK_VERSION)
1238
dnl not actually used, don't export to save symbols
1239
dnl    AC_SUBST(TK_MAJOR_VERSION)
1240
dnl    AC_SUBST(TK_MINOR_VERSION)
1241
    AC_SUBST(TK_DEFS)
1242
 
1243
dnl not used, don't export to save symbols
1244
    AC_SUBST(TK_LIB_FILE)
1245
    AC_SUBST(TK_LIB_FULL_PATH)
1246
    AC_SUBST(TK_LIBS)
1247
dnl not used, don't export to save symbols
1248
dnl    AC_SUBST(TK_PREFIX)
1249
 
1250
dnl not used, don't export to save symbols
1251
dnl    AC_SUBST(TK_EXEC_PREFIX)
1252
    AC_SUBST(TK_BUILD_INCLUDES)
1253
    AC_SUBST(TK_XINCLUDES)
1254
    AC_SUBST(TK_XLIBSW)
1255
    AC_SUBST(TK_BUILD_LIB_SPEC)
1256
    AC_SUBST(TK_LIB_SPEC)
1257
])
1258
 
1259
dnl ====================================================================
1260
dnl Ok, lets find the itcl source trees so we can use the headers
1261
dnl the alternative search directory is involked by --with-itclinclude
1262
AC_DEFUN(CYG_AC_PATH_ITCL, [
1263
    CYG_AC_PATH_ITCLH
1264
    CYG_AC_PATH_ITCLLIB
1265
    CYG_AC_PATH_ITCLSH
1266
    CYG_AC_PATH_ITCLMKIDX
1267
])
1268
AC_DEFUN(CYG_AC_PATH_ITCLH, [
1269
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1270
no_itcl=true
1271
AC_MSG_CHECKING(for Itcl headers in the source tree)
1272
AC_ARG_WITH(itclinclude, [  --with-itclinclude       directory where itcl headers are], with_itclinclude=${withval})
1273
AC_CACHE_VAL(ac_cv_c_itclh,[
1274
dnl first check to see if --with-itclinclude was specified
1275
if test x"${with_itclinclude}" != x ; then
1276
  if test -f ${with_itclinclude}/itcl.h ; then
1277
    ac_cv_c_itclh=`(cd ${with_itclinclude}; pwd)`
1278
  elif test -f ${with_itclinclude}/src/itcl.h ; then
1279
    ac_cv_c_itclh=`(cd ${with_itclinclude}/src; pwd)`
1280
  else
1281
    AC_MSG_ERROR([${with_itclinclude} directory doesn't contain headers])
1282
  fi
1283
fi
1284
 
1285
dnl next check if it came with Itcl configuration file
1286
if test x"${ac_cv_c_itclconfig}" != x ; then
1287
  for i in $dirlist; do
1288
    if test -f $ac_cv_c_itclconfig/$i/src/itcl.h ; then
1289
      ac_cv_c_itclh=`(cd $ac_cv_c_itclconfig/$i/src; pwd)`
1290
      break
1291
    fi
1292
  done
1293
fi
1294
 
1295
dnl next check in private source directory
1296
dnl since ls returns lowest version numbers first, reverse its output
1297
if test x"${ac_cv_c_itclh}" = x ; then
1298
    dnl find the top level Itcl source directory
1299
    for i in $dirlist; do
1300
        if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
1301
            itclpath=$srcdir/$i
1302
            break
1303
        fi
1304
    done
1305
 
1306
    dnl find the exact Itcl source dir. We do it this way, cause there
1307
    dnl might be multiple version of Itcl, and we want the most recent one.
1308
    for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
1309
        if test -f $i/src/itcl.h ; then
1310
          ac_cv_c_itclh=`(cd $i/src; pwd)`
1311
          break
1312
        fi
1313
    done
1314
fi
1315
 
1316
dnl see if one is installed
1317
if test x"${ac_cv_c_itclh}" = x ; then
1318
   AC_MSG_RESULT(none)
1319
   AC_CHECK_HEADER(itcl.h, ac_cv_c_itclh=installed, ac_cv_c_itclh="")
1320
else
1321
   AC_MSG_RESULT(${ac_cv_c_itclh})
1322
fi
1323
])
1324
  ITCLHDIR=""
1325
if test x"${ac_cv_c_itclh}" = x ; then
1326
    AC_MSG_ERROR([Can't find any Itcl headers])
1327
fi
1328
if test x"${ac_cv_c_itclh}" != x ; then
1329
    no_itcl=""
1330
    if test x"${ac_cv_c_itclh}" != x"installed" ; then
1331
        AC_MSG_RESULT(${ac_cv_c_itclh})
1332
        ITCLHDIR="-I${ac_cv_c_itclh}"
1333
    fi
1334
fi
1335
 
1336
AC_SUBST(ITCLHDIR)
1337
])
1338
 
1339
dnl Ok, lets find the itcl library
1340
dnl First, look for one uninstalled.
1341
dnl the alternative search directory is invoked by --with-itcllib
1342
AC_DEFUN(CYG_AC_PATH_ITCLLIB, [
1343
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1344
if test x"${no_itcl}" = x ; then
1345
    dnl we reset no_itcl incase something fails here
1346
    no_itcl=true
1347
    AC_ARG_WITH(itcllib,
1348
        [  --with-itcllib           directory where the itcl library is],
1349
        with_itcllib=${withval})
1350
    AC_MSG_CHECKING([for Itcl library])
1351
    AC_CACHE_VAL(ac_cv_c_itcllib,[
1352
    dnl First check to see if --with-itcllib was specified.
1353
    if test x"${with_itcllib}" != x ; then
1354
        if test -f "${with_itcllib}/libitcl$TCL_SHARED_LIB_SUFFIX" ; then
1355
            ac_cv_c_itcllib=`(cd ${with_itcllib}; pwd)`/libitcl$TCL_SHARED_LIB_SUFFIX
1356
        else
1357
            if test -f "${with_itcllib}/libitcl$TCL_UNSHARED_LIB_SUFFIX"; then
1358
                ac_cv_c_itcllib=`(cd ${with_itcllib}; pwd)`/libitcl$TCL_UNSHARED_LIB_SUFFIX
1359
            fi
1360
        fi
1361
    fi
1362
    dnl then check for a  Itcl library. Since these are uninstalled,
1363
    dnl use the simple lib name root.
1364
    if test x"${ac_cv_c_itcllib}" = x ; then
1365
        dnl find the top level Itcl build directory
1366
        for i in $dirlist; do
1367
            if test -n "`ls -dr $i/itcl* 2>/dev/null`" ; then
1368
                itclpath=$i/itcl
1369
                break
1370
            fi
1371
        done
1372
        dnl Itcl 7.5 and greater puts library in subdir.  Look there first.
1373
        if test -f "$itclpath/src/libitcl.$TCL_SHLIB_SUFFIX" ; then
1374
             ac_cv_c_itcllib=`(cd $itclpath/src; pwd)`
1375
        elif test -f "$itclpath/src/libitcl.a"; then
1376
             ac_cv_c_itcllib=`(cd $itclpath/src; pwd)`
1377
        fi
1378
    fi
1379
    dnl check in a few other private locations
1380
    if test x"${ac_cv_c_itcllib}" = x ; then
1381
        for i in ${dirlist}; do
1382
            if test -n "`ls -dr ${srcdir}/$i/itcl* 2>/dev/null`" ; then
1383
                itclpath=${srcdir}/$i
1384
                break
1385
            fi
1386
        done
1387
        for i in `ls -dr ${itclpath}/itcl* 2>/dev/null` ; do
1388
            dnl Itcl 7.5 and greater puts library in subdir.  Look there first.
1389
            if test -f "$i/src/libitcl$TCL_SHLIB_SUFFIX" ; then
1390
                ac_cv_c_itcllib=`(cd $i/src; pwd)`
1391
                break
1392
            elif test -f "$i/src/libitcl.a"; then
1393
                ac_cv_c_itcllib=`(cd $i/src; pwd)`
1394
                break
1395
            fi
1396
        done
1397
    fi
1398
 
1399
    dnl see if one is conveniently installed with the compiler
1400
    if test x"${ac_cv_c_itcllib}" = x ; then
1401
        dnl Get the path to the compiler
1402
        ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/lib
1403
        dnl Itcl 7.5 and greater puts library in subdir.  Look there first.
1404
        if test -f "${ccpath}/libitcl$TCL_SHLIB_SUFFIX" ; then
1405
            ac_cv_c_itcllib=`(cd ${ccpath}; pwd)`
1406
        elif test -f "${ccpath}/libitcl.a"; then
1407
            ac_cv_c_itcllib=`(cd ${ccpath}; pwd)`
1408
        fi
1409
    fi
1410
    ])
1411
    if test x"${ac_cv_c_itcllib}" = x ; then
1412
        ITCLLIB=""
1413
        AC_MSG_WARN(Can't find Itcl library)
1414
    else
1415
        ITCLLIB="-L${ac_cv_c_itcllib}"
1416
        AC_MSG_RESULT(${ac_cv_c_itcllib})
1417
        no_itcl=""
1418
    fi
1419
fi
1420
 
1421
AC_PROVIDE([$0])
1422
AC_SUBST(ITCLLIB)
1423
])
1424
 
1425
 
1426
dnl ====================================================================
1427
dnl Ok, lets find the itcl source trees so we can use the itcl_sh script
1428
dnl the alternative search directory is involked by --with-itclinclude
1429
AC_DEFUN(CYG_AC_PATH_ITCLSH, [
1430
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1431
no_itcl=true
1432
AC_MSG_CHECKING(for the itcl_sh script)
1433
AC_ARG_WITH(itclinclude, [  --with-itclinclude       directory where itcl headers are], with_itclinclude=${withval})
1434
AC_CACHE_VAL(ac_cv_c_itclsh,[
1435
dnl first check to see if --with-itclinclude was specified
1436
if test x"${with_itclinclude}" != x ; then
1437
  if test -f ${with_itclinclude}/itcl_sh ; then
1438
    ac_cv_c_itclsh=`(cd ${with_itclinclude}; pwd)`
1439
  elif test -f ${with_itclinclude}/src/itcl_sh ; then
1440
    ac_cv_c_itclsh=`(cd ${with_itclinclude}/src; pwd)`
1441
  else
1442
    AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
1443
  fi
1444
fi
1445
 
1446
dnl next check in private source directory
1447
dnl since ls returns lowest version numbers first, reverse its output
1448
if test x"${ac_cv_c_itclsh}" = x ; then
1449
    dnl find the top level Itcl source directory
1450
    for i in $dirlist; do
1451
        if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
1452
            itclpath=$srcdir/$i
1453
            break
1454
        fi
1455
    done
1456
 
1457
    dnl find the exact Itcl source dir. We do it this way, cause there
1458
    dnl might be multiple version of Itcl, and we want the most recent one.
1459
    for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
1460
        if test -f $i/src/itcl_sh ; then
1461
          ac_cv_c_itclsh=`(cd $i/src; pwd)`/itcl_sh
1462
          break
1463
        fi
1464
    done
1465
fi
1466
 
1467
dnl see if one is installed
1468
if test x"${ac_cv_c_itclsh}" = x ; then
1469
   AC_MSG_RESULT(none)
1470
   AC_PATH_PROG(ac_cv_c_itclsh, itcl_sh)
1471
else
1472
   AC_MSG_RESULT(${ac_cv_c_itclsh})
1473
fi
1474
])
1475
 
1476
if test x"${ac_cv_c_itclsh}" = x ; then
1477
    AC_MSG_ERROR([Can't find the itcl_sh script])
1478
fi
1479
if test x"${ac_cv_c_itclsh}" != x ; then
1480
    no_itcl=""
1481
    AC_MSG_RESULT(${ac_cv_c_itclsh})
1482
    ITCLSH="${ac_cv_c_itclsh}"
1483
fi
1484
AC_SUBST(ITCLSH)
1485
])
1486
 
1487
 
1488
dnl ====================================================================
1489
dnl Ok, lets find the itcl source trees so we can use the itcl_sh script
1490
dnl the alternative search directory is involked by --with-itclinclude
1491
AC_DEFUN(CYG_AC_PATH_ITCLMKIDX, [
1492
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1493
no_itcl=true
1494
AC_MSG_CHECKING(for itcl_mkindex.tcl script)
1495
AC_ARG_WITH(itclinclude, [  --with-itclinclude       directory where itcl headers are], with_itclinclude=${withval})
1496
AC_CACHE_VAL(ac_cv_c_itclmkidx,[
1497
dnl first check to see if --with-itclinclude was specified
1498
if test x"${with_itclinclude}" != x ; then
1499
  if test -f ${with_itclinclude}/itcl_sh ; then
1500
    ac_cv_c_itclmkidx=`(cd ${with_itclinclude}; pwd)`
1501
  elif test -f ${with_itclinclude}/src/itcl_sh ; then
1502
    ac_cv_c_itclmkidx=`(cd ${with_itclinclude}/src; pwd)`
1503
  else
1504
    AC_MSG_ERROR([${with_itclinclude} directory doesn't contain itcl_sh])
1505
  fi
1506
fi
1507
 
1508
dnl next check in private source directory
1509
dnl since ls returns lowest version numbers first, reverse its output
1510
if test x"${ac_cv_c_itclmkidx}" = x ; then
1511
    dnl find the top level Itcl source directory
1512
    for i in $dirlist; do
1513
        if test -n "`ls -dr $srcdir/$i/itcl* 2>/dev/null`" ; then
1514
            itclpath=$srcdir/$i
1515
            break
1516
        fi
1517
    done
1518
 
1519
    dnl find the exact Itcl source dir. We do it this way, cause there
1520
    dnl might be multiple version of Itcl, and we want the most recent one.
1521
    for i in `ls -dr $itclpath/itcl* 2>/dev/null ` ; do
1522
        if test -f $i/library/itcl_mkindex.tcl ; then
1523
          ac_cv_c_itclmkidx=`(cd $i/library; pwd)`/itcl_mkindex.tcl
1524
          break
1525
        fi
1526
    done
1527
fi
1528
if test x"${ac_cv_c_itclmkidx}" = x ; then
1529
    dnl Get the path to the compiler
1530
    ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/share
1531
    dnl Itcl 7.5 and greater puts library in subdir.  Look there first.
1532
    for i in `ls -dr $ccpath/itcl* 2>/dev/null ` ; do
1533
        if test -f $i/itcl_mkindex.tcl ; then
1534
            ac_cv_c_itclmkidx=`(cd $i; pwd)`/itcl_mkindex.tcl
1535
            break
1536
        fi
1537
    done
1538
fi
1539
])
1540
 
1541
if test x"${ac_cv_c_itclmkidx}" = x ; then
1542
    AC_MSG_ERROR([Can't find the itcl_mkindex.tcl script])
1543
fi
1544
if test x"${ac_cv_c_itclmkidx}" != x ; then
1545
    no_itcl=""
1546
    AC_MSG_RESULT(${ac_cv_c_itclmkidx})
1547
    ITCLMKIDX="${ac_cv_c_itclmkidx}"
1548
else
1549
   AC_MSG_RESULT(none)
1550
fi
1551
AC_SUBST(ITCLMKIDX)
1552
])
1553
 
1554
dnl ====================================================================
1555
dnl Ok, lets find the tix source trees so we can use the headers
1556
dnl the alternative search directory is involked by --with-tixinclude
1557
AC_DEFUN(CYG_AC_PATH_TIX, [
1558
    CYG_AC_PATH_TIXH
1559
    CYG_AC_PATH_TIXLIB
1560
])
1561
AC_DEFUN(CYG_AC_PATH_TIXH, [
1562
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1563
no_tix=true
1564
AC_MSG_CHECKING(for Tix headers in the source tree)
1565
AC_ARG_WITH(tixinclude, [  --with-tixinclude       directory where tix headers are], with_tixinclude=${withval})
1566
AC_CACHE_VAL(ac_cv_c_tixh,[
1567
dnl first check to see if --with-tixinclude was specified
1568
if test x"${with_tixinclude}" != x ; then
1569
  if test -f ${with_tixinclude}/tix.h ; then
1570
    ac_cv_c_tixh=`(cd ${with_tixinclude}; pwd)`
1571
  elif test -f ${with_tixinclude}/generic/tix.h ; then
1572
    ac_cv_c_tixh=`(cd ${with_tixinclude}/generic; pwd)`
1573
  else
1574
    AC_MSG_ERROR([${with_tixinclude} directory doesn't contain headers])
1575
  fi
1576
fi
1577
 
1578
dnl next check if it came with Tix configuration file
1579
if test x"${ac_cv_c_tixconfig}" != x ; then
1580
  for i in $dirlist; do
1581
    if test -f $ac_cv_c_tixconfig/$i/generic/tix.h ; then
1582
      ac_cv_c_tixh=`(cd $ac_cv_c_tixconfig/$i/generic; pwd)`
1583
      break
1584
    fi
1585
  done
1586
fi
1587
 
1588
dnl next check in private source directory
1589
dnl since ls returns lowest version numbers first, reverse its output
1590
if test x"${ac_cv_c_tixh}" = x ; then
1591
    dnl find the top level Tix source directory
1592
    for i in $dirlist; do
1593
        if test -n "`ls -dr $srcdir/$i/tix* 2>/dev/null`" ; then
1594
            tixpath=$srcdir/$i
1595
            break
1596
        fi
1597
    done
1598
 
1599
    dnl find the exact Tix source dir. We do it this way, cause there
1600
    dnl might be multiple version of Tix, and we want the most recent one.
1601
    for i in `ls -dr $tixpath/tix* 2>/dev/null ` ; do
1602
        if test -f $i/generic/tix.h ; then
1603
          ac_cv_c_tixh=`(cd $i/generic; pwd)`
1604
          break
1605
        fi
1606
    done
1607
fi
1608
 
1609
dnl see if one is installed
1610
if test x"${ac_cv_c_tixh}" = x ; then
1611
    AC_MSG_RESULT(none)
1612
    dnl Get the path to the compiler
1613
 
1614
   dnl Get the path to the compiler. We do it this way instead of using
1615
    dnl AC_CHECK_HEADER, cause this doesn't depend in having X configured.
1616
    ccpath=`which ${CC}  | sed -e 's:/bin/.*::'`/include
1617
    if test -f $ccpath/tix.h; then
1618
        ac_cv_c_tixh=installed
1619
    fi
1620
else
1621
   AC_MSG_RESULT(${ac_cv_c_tixh})
1622
fi
1623
])
1624
if test x"${ac_cv_c_tixh}" = x ; then
1625
    AC_MSG_ERROR([Can't find any Tix headers])
1626
fi
1627
if test x"${ac_cv_c_tixh}" != x ; then
1628
    no_tix=""
1629
    AC_MSG_RESULT(${ac_cv_c_tixh})
1630
    if test x"${ac_cv_c_tixh}" != x"installed" ; then
1631
        TIXHDIR="-I${ac_cv_c_tixh}"
1632
    fi
1633
fi
1634
 
1635
AC_SUBST(TIXHDIR)
1636
])
1637
 
1638
AC_DEFUN(CYG_AC_PATH_TIXCONFIG, [
1639
#
1640
# Ok, lets find the tix configuration
1641
# First, look for one uninstalled.
1642
# the alternative search directory is invoked by --with-tixconfig
1643
#
1644
 
1645
if test x"${no_tix}" = x ; then
1646
  # we reset no_tix in case something fails here
1647
  no_tix=true
1648
  AC_ARG_WITH(tixconfig, [  --with-tixconfig           directory containing tix configuration (tixConfig.sh)],
1649
         with_tixconfig=${withval})
1650
  AC_MSG_CHECKING([for Tix configuration])
1651
  AC_CACHE_VAL(ac_cv_c_tixconfig,[
1652
 
1653
  # First check to see if --with-tixconfig was specified.
1654
  if test x"${with_tixconfig}" != x ; then
1655
    if test -f "${with_tixconfig}/tixConfig.sh" ; then
1656
      ac_cv_c_tixconfig=`(cd ${with_tixconfig}; pwd)`
1657
    else
1658
      AC_MSG_ERROR([${with_tixconfig} directory doesn't contain tixConfig.sh])
1659
    fi
1660
  fi
1661
 
1662
  # then check for a private Tix library
1663
  if test x"${ac_cv_c_tixconfig}" = x ; then
1664
    for i in \
1665
                ../tix \
1666
                `ls -dr ../tix[[4]]* 2>/dev/null` \
1667
                ../../tix \
1668
                `ls -dr ../../tix[[4]]* 2>/dev/null` \
1669
                ../../../tix \
1670
                `ls -dr ../../../tix[[4]]* 2>/dev/null` ; do
1671
      if test -f "$i/tixConfig.sh" ; then
1672
        ac_cv_c_tixconfig=`(cd $i; pwd)`
1673
        break
1674
      fi
1675
    done
1676
  fi
1677
  # check in a few common install locations
1678
  if test x"${ac_cv_c_tixconfig}" = x ; then
1679
    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
1680
      if test -f "$i/tixConfig.sh" ; then
1681
        ac_cv_c_tkconfig=`(cd $i; pwd)`
1682
        break
1683
      fi
1684
    done
1685
  fi
1686
  # check in a few other private locations
1687
  if test x"${ac_cv_c_tixconfig}" = x ; then
1688
    for i in \
1689
                ${srcdir}/../tix \
1690
                `ls -dr ${srcdir}/../tix[[4-9]]* 2>/dev/null` ; do
1691
      if test -f "$i/tixConfig.sh" ; then
1692
        ac_cv_c_tixconfig=`(cd $i; pwd)`
1693
        break
1694
      fi
1695
    done
1696
  fi
1697
  ])
1698
  if test x"${ac_cv_c_tixconfig}" = x ; then
1699
    TIXCONFIG="# no Tix configs found"
1700
    AC_MSG_WARN(Can't find Tix configuration definitions)
1701
  else
1702
    no_tix=
1703
    TIXCONFIG=${ac_cv_c_tixconfig}/tixConfig.sh
1704
    AC_MSG_RESULT(found $TIXCONFIG)
1705
  fi
1706
fi
1707
 
1708
])
1709
 
1710
# Defined as a separate macro so we don't have to cache the values
1711
# from PATH_TIXCONFIG (because this can also be cached).
1712
AC_DEFUN(CYG_AC_LOAD_TIXCONFIG, [
1713
    if test -f "$TIXCONFIG" ; then
1714
      . $TIXCONFIG
1715
    fi
1716
 
1717
    AC_SUBST(TIX_BUILD_LIB_SPEC)
1718
    AC_SUBST(TIX_LIB_FULL_PATH)
1719
])
1720
 
1721
AC_DEFUN(CYG_AC_PATH_ITCLCONFIG, [
1722
#
1723
# Ok, lets find the itcl configuration
1724
# First, look for one uninstalled.
1725
# the alternative search directory is invoked by --with-itclconfig
1726
#
1727
 
1728
if test x"${no_itcl}" = x ; then
1729
  # we reset no_itcl in case something fails here
1730
  no_itcl=true
1731
  AC_ARG_WITH(itclconfig, [  --with-itclconfig           directory containing itcl configuration (itclConfig.sh)],
1732
         with_itclconfig=${withval})
1733
  AC_MSG_CHECKING([for Itcl configuration])
1734
  AC_CACHE_VAL(ac_cv_c_itclconfig,[
1735
 
1736
  # First check to see if --with-itclconfig was specified.
1737
  if test x"${with_itclconfig}" != x ; then
1738
    if test -f "${with_itclconfig}/itclConfig.sh" ; then
1739
      ac_cv_c_itclconfig=`(cd ${with_itclconfig}; pwd)`
1740
    else
1741
      AC_MSG_ERROR([${with_itclconfig} directory doesn't contain itclConfig.sh])
1742
    fi
1743
  fi
1744
 
1745
  # then check for a private itcl library
1746
  if test x"${ac_cv_c_itclconfig}" = x ; then
1747
    for i in \
1748
                ../itcl/itcl \
1749
                `ls -dr ../itcl/itcl[[3]]* 2>/dev/null` \
1750
                ../../itcl/itcl \
1751
                `ls -dr ../../itcl/itcl[[3]]* 2>/dev/null` \
1752
                ../../../itcl/itcl \
1753
                `ls -dr ../../../itcl/itcl[[3]]* 2>/dev/null` ; do
1754
      if test -f "$i/itclConfig.sh" ; then
1755
        ac_cv_c_itclconfig=`(cd $i; pwd)`
1756
        break
1757
      fi
1758
    done
1759
  fi
1760
  # check in a few common install locations
1761
  if test x"${ac_cv_c_itclconfig}" = x ; then
1762
    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
1763
      if test -f "$i/itclConfig.sh" ; then
1764
        ac_cv_c_itclconfig=`(cd $i; pwd)`
1765
        break
1766
      fi
1767
    done
1768
  fi
1769
  # check in a few other private locations
1770
  if test x"${ac_cv_c_itclconfig}" = x ; then
1771
    for i in \
1772
                ${srcdir}/../itcl/itcl \
1773
                `ls -dr ${srcdir}/../itcl/itcl[[3]]* 2>/dev/null` ; do
1774
      if test -f "$i/itcl/itclConfig.sh" ; then
1775
        ac_cv_c_itclconfig=`(cd $i; pwd)`
1776
        break
1777
      fi
1778
    done
1779
  fi
1780
  ])
1781
  if test x"${ac_cv_c_itclconfig}" = x ; then
1782
    ITCLCONFIG="# no itcl configs found"
1783
    AC_MSG_WARN(Can't find itcl configuration definitions)
1784
  else
1785
    no_itcl=
1786
    ITCLCONFIG=${ac_cv_c_itclconfig}/itclConfig.sh
1787
    AC_MSG_RESULT(found $ITCLCONFIG)
1788
  fi
1789
fi
1790
 
1791
])
1792
 
1793
# Defined as a separate macro so we don't have to cache the values
1794
# from PATH_ITCLCONFIG (because this can also be cached).
1795
AC_DEFUN(CYG_AC_LOAD_ITCLCONFIG, [
1796
    if test -f "$ITCLCONFIG" ; then
1797
      . $ITCLCONFIG
1798
    fi
1799
 
1800
    AC_SUBST(ITCL_BUILD_LIB_SPEC)
1801
    AC_SUBST(ITCL_SH)
1802
    AC_SUBST(ITCL_LIB_FILE)
1803
    AC_SUBST(ITCL_LIB_FULL_PATH)
1804
 
1805
])
1806
 
1807
 
1808
AC_DEFUN(CYG_AC_PATH_ITKCONFIG, [
1809
#
1810
# Ok, lets find the itk configuration
1811
# First, look for one uninstalled.
1812
# the alternative search directory is invoked by --with-itkconfig
1813
#
1814
 
1815
if test x"${no_itk}" = x ; then
1816
  # we reset no_itk in case something fails here
1817
  no_itk=true
1818
  AC_ARG_WITH(itkconfig, [  --with-itkconfig           directory containing itk configuration (itkConfig.sh)],
1819
         with_itkconfig=${withval})
1820
  AC_MSG_CHECKING([for Itk configuration])
1821
  AC_CACHE_VAL(ac_cv_c_itkconfig,[
1822
 
1823
  # First check to see if --with-itkconfig was specified.
1824
  if test x"${with_itkconfig}" != x ; then
1825
    if test -f "${with_itkconfig}/itkConfig.sh" ; then
1826
      ac_cv_c_itkconfig=`(cd ${with_itkconfig}; pwd)`
1827
    else
1828
      AC_MSG_ERROR([${with_itkconfig} directory doesn't contain itkConfig.sh])
1829
    fi
1830
  fi
1831
 
1832
  # then check for a private itk library
1833
  if test x"${ac_cv_c_itkconfig}" = x ; then
1834
    for i in \
1835
                ../itcl/itk \
1836
                `ls -dr ../itcl/itk[[3]]* 2>/dev/null` \
1837
                ../../itcl/itk \
1838
                `ls -dr ../../itcl/itk[[3]]* 2>/dev/null` \
1839
                ../../../itcl/itk \
1840
                `ls -dr ../../../itcl/itk[[3]]* 2>/dev/null` ; do
1841
      if test -f "$i/itkConfig.sh" ; then
1842
        ac_cv_c_itkconfig=`(cd $i; pwd)`
1843
        break
1844
      fi
1845
    done
1846
  fi
1847
  # check in a few common install locations
1848
  if test x"${ac_cv_c_itkconfig}" = x ; then
1849
    for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
1850
      if test -f "$i/itcl/itkConfig.sh" ; then
1851
        ac_cv_c_itkconfig=`(cd $i; pwd)`
1852
        break
1853
      fi
1854
    done
1855
  fi
1856
  # check in a few other private locations
1857
  if test x"${ac_cv_c_itkconfig}" = x ; then
1858
    for i in \
1859
                ${srcdir}/../itcl/itk \
1860
                `ls -dr ${srcdir}/../itcl/itk[[3]]* 2>/dev/null` ; do
1861
      if test -f "$i/itkConfig.sh" ; then
1862
        ac_cv_c_itkconfig=`(cd $i; pwd)`
1863
        break
1864
      fi
1865
    done
1866
  fi
1867
  ])
1868
  if test x"${ac_cv_c_itkconfig}" = x ; then
1869
    ITCLCONFIG="# no itk configs found"
1870
    AC_MSG_WARN(Can't find itk configuration definitions)
1871
  else
1872
    no_itk=
1873
    ITKCONFIG=${ac_cv_c_itkconfig}/itkConfig.sh
1874
    AC_MSG_RESULT(found $ITKCONFIG)
1875
  fi
1876
fi
1877
 
1878
])
1879
 
1880
# Defined as a separate macro so we don't have to cache the values
1881
# from PATH_ITKCONFIG (because this can also be cached).
1882
AC_DEFUN(CYG_AC_LOAD_ITKCONFIG, [
1883
    if test -f "$ITKCONFIG" ; then
1884
      . $ITKCONFIG
1885
    fi
1886
 
1887
    AC_SUBST(ITK_BUILD_LIB_SPEC)
1888
    AC_SUBST(ITK_LIB_FILE)
1889
    AC_SUBST(ITK_LIB_FULL_PATH)
1890
])
1891
 
1892
 
1893
dnl ====================================================================
1894
dnl Ok, lets find the libgui source trees so we can use the headers
1895
dnl the alternative search directory is involked by --with-libguiinclude
1896
AC_DEFUN(CYG_AC_PATH_LIBGUI, [
1897
    CYG_AC_PATH_LIBGUIH
1898
    CYG_AC_PATH_LIBGUILIB
1899
])
1900
AC_DEFUN(CYG_AC_PATH_LIBGUIH, [
1901
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../..../../../../../../../../../../.."
1902
no_libgui=true
1903
AC_MSG_CHECKING(for Libgui headers in the source tree)
1904
AC_ARG_WITH(libguiinclude, [  --with-libguiinclude       directory where libgui headers are], with_libguiinclude=${withval})
1905
AC_CACHE_VAL(ac_cv_c_libguih,[
1906
dnl first check to see if --with-libguiinclude was specified
1907
if test x"${with_libguiinclude}" != x ; then
1908
  if test -f ${with_libguiinclude}/guitcl.h ; then
1909
    ac_cv_c_libguih=`(cd ${with_libguiinclude}; pwd)`
1910
  elif test -f ${with_libguiinclude}/src/guitcl.h ; then
1911
    ac_cv_c_libguih=`(cd ${with_libguiinclude}/src; pwd)`
1912
  else
1913
    AC_MSG_ERROR([${with_libguiinclude} directory doesn't contain headers])
1914
  fi
1915
fi
1916
 
1917
dnl next check if it came with Libgui configuration file
1918
if test x"${ac_cv_c_libguiconfig}" != x ; then
1919
  for i in $dirlist; do
1920
    if test -f $ac_cv_c_libguiconfig/$i/src/guitcl.h ; then
1921
      ac_cv_c_libguih=`(cd $ac_cv_c_libguiconfig/$i/src; pwd)`
1922
      break
1923
    fi
1924
  done
1925
fi
1926
 
1927
dnl next check in private source directory
1928
dnl since ls returns lowest version numbers first, reverse its output
1929
if test x"${ac_cv_c_libguih}" = x ; then
1930
    dnl find the top level Libgui source directory
1931
    for i in $dirlist; do
1932
        if test -n "`ls -dr $srcdir/$i/libgui* 2>/dev/null`" ; then
1933
            libguipath=$srcdir/$i
1934
            break
1935
        fi
1936
    done
1937
 
1938
    dnl find the exact Libgui source dir. We do it this way, cause there
1939
    dnl might be multiple version of Libgui, and we want the most recent one.
1940
    for i in `ls -dr $libguipath/libgui* 2>/dev/null ` ; do
1941
        if test -f $i/src/guitcl.h ; then
1942
          ac_cv_c_libguih=`(cd $i/src; pwd)`
1943
          break
1944
        fi
1945
    done
1946
fi
1947
 
1948
dnl see if one is installed
1949
if test x"${ac_cv_c_libguih}" = x ; then
1950
   AC_MSG_RESULT(none)
1951
   AC_CHECK_HEADER(guitcl.h, ac_cv_c_libguih=installed, ac_cv_c_libguih="")
1952
fi
1953
])
1954
LIBGUIHDIR=""
1955
if test x"${ac_cv_c_libguih}" = x ; then
1956
    AC_MSG_WARN([Can't find any Libgui headers])
1957
fi
1958
if test x"${ac_cv_c_libguih}" != x ; then
1959
    no_libgui=""
1960
    if test x"${ac_cv_c_libguih}" != x"installed" ; then
1961
        LIBGUIHDIR="-I${ac_cv_c_libguih}"
1962
    fi
1963
fi
1964
AC_MSG_RESULT(${ac_cv_c_libguih})
1965
AC_SUBST(LIBGUIHDIR)
1966
])
1967
 
1968
dnl ====================================================================
1969
dnl find the GUI library
1970
AC_DEFUN(CYG_AC_PATH_LIBGUILIB, [
1971
AC_MSG_CHECKING(for GUI library  in the build tree)
1972
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
1973
dnl look for the library
1974
AC_MSG_CHECKING(for GUI library)
1975
AC_CACHE_VAL(ac_cv_c_libguilib,[
1976
if test x"${ac_cv_c_libguilib}" = x ; then
1977
    for i in $dirlist; do
1978
      if test -f "$i/libgui/src/Makefile" ; then
1979
        ac_cv_c_libguilib=`(cd $i/libgui/src; pwd)`
1980
        break
1981
      fi
1982
    done
1983
fi
1984
])
1985
if test x"${ac_cv_c_libguilib}" != x ; then
1986
     GUILIB="${GUILIB} -L${ac_cv_c_libguilib}"
1987
     LIBGUILIB="-lgui"
1988
     AC_MSG_RESULT(${ac_cv_c_libguilib})
1989
else
1990
     AC_MSG_RESULT(none)
1991
fi
1992
 
1993
AC_SUBST(GUILIB)
1994
AC_SUBST(LIBGUILIB)
1995
])

powered by: WebSVN 2.1.0

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