forked from egallesio/STk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
614 lines (531 loc) · 13.7 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
dnl -*- ksh -*-
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during STk installation
dnl to configure the system for the local environment.
AC_INIT(README)
VERSION=4.0.1
echo "VERSION=$VERSION" > VERSION
echo "/* File generated. DO NOT EDIT */" > Src/stkvers.h
echo "#define STK_VERSION \"$VERSION\"" > Src/stkvers.h
# I have a lot of problems with cache. So ...
/bin/rm -f ./config.cache Src/config.cache Tcl/config.cache Tk/unix/config.cache
# determine the kind of the machine which is running this script
os=`uname -s`
version=`uname -r`
machine=`uname -m`
case $os in
Linux*)
case $version in
1.*) version=1.X;;
2.*) version=2.X;;
esac
case $machine in
i*86) machine=ix86;;
esac;;
FreeBSD*)
case $machine in
i*86) machine=ix86;;
esac;;
SunOS*)
case $version in
4.1.*) version=4.1.X;;
esac
case $machine in
sun4*) machine=sun4;;
esac;;
IRIX*)
case $version in
5.*) version=5.X;;
6.*) version=6.X;;
esac
case $machine in
IP*) machine=IPxx;;
esac;;
HP-UX*)
case $version in
A.09.*) version=9.X;;
A.10.*) version=10.X;;
esac
case $machine in
9000/7*) machine=9000s700;;
esac;;
CYGWIN32*)
machine=win32 ;;
esac
#
# General variables:
# DFLGS= the -Dxxx options
# EDFLGS= the -Dxxx options (which could be erased if dyn. loading is enabled)
# EOBJ= Some extra '.o' to build
# ETKOBJ= Some extra '.o' to build (when used with Tk)
# MACHINE= something which identifies the machine (hard/OS/machine)
DFLGS="-DSTk_CODE -DSCM_CODE"
EOBJ=""
ETKOBJ=""
EDFLGS=""
MACHINE=$os-$version-$machine
if test "$machine" = win32
then
FLAVOR=win
else
FLAVOR=unix
fi
AC_SUBST(DFLGS, DFLGS)
AC_SUBST(EOBJ, EOBJ)
AC_SUBST(ETKOBJ, ETKOBJ)
AC_SUBST(MACHINE,MACHINE)
AC_SUBST(VERSION,VERSION)
AC_SUBST(FLAVOR,FLAVOR)
####
#### Checks for various programs:
####
AC_PROG_RANLIB
STRIP=strip; AC_SUBST(STRIP)
####
#### Find the C compiler an compile flags
####
CC=${CC-gcc}
echo "Using '$CC' compiler"
AC_SUBST(CC)
STKCFLAGS=${CFLAGS-"-O2"}
AC_SUBST(STKCFLAGS, STKCFLAGS)
echo "Using '$STKCFLAGS' compilation options"
STKLDFLAGS=""
AC_SUBST(STKLDFLAGS)
####
#### Try to figure the system we have
####
case $MACHINE in
SunOS-4*) OS=SUNOS4;;
SunOS-5*) OS=SUNOS5;;
OSF1*) OS=OSF1;;
ULTRIX*) OS=ULTRIX;;
HP*) OS=HPUX; DFLGS="$DFLGS -Dhpux";;
Linux*) OS=LINUX;;
NetBSD-1*) OS=NETBSD1;;
FreeBSD*) OS=FREEBSD;;
IRIX-5*) OS=IRIX5;;
IRIX*-6*) OS=IRIX5;;
CYGWIN32*) OS=WIN32; FLAVOR=win; DFLGS="$DFLGS -DCYGWIN32";;
*) OS=unknown_system;;
esac
# Set the OS flag soon since it can be augmented with Linux
DFLGS="$DFLGS -D$OS"
echo "Assumming OS is $OS"
####
#### X11 stuff
####
AC_ISC_POSIX # to avoid a warning
AC_PATH_X
AC_PATH_XTRA
XINCLUDES=""; AC_SUBST(XINCLUDES)
XLIBSW=""; AC_SUBST(XLIBSW)
if test "$x_includes" != ""
then
XINCLUDES="-I$x_includes"
fi
if test "$x_libraries" != ""
then
XLIBSW="-L$x_libraries"
fi
XLIBSW="$XLIBSW $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
#--------------------------------------------------------------------
# Include sys/select.h if it exists and if it supplies things
# that appear to be useful and aren't already in sys/types.h.
# This appears to be true only on the RS/6000 under AIX. Some
# systems like OSF/1 have a sys/select.h that's of no use, and
# other systems like SCO UNIX have a sys/select.h that's
# pernicious. If "fd_set" isn't defined anywhere then set a
# special flag.
#--------------------------------------------------------------------
AC_MSG_CHECKING([fd_set and sys/select])
AC_TRY_COMPILE([#include <sys/types.h>],
[fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
if test $tk_ok = no; then
AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
if test $tk_ok = yes; then
AC_DEFINE(HAVE_SYS_SELECT_H)
fi
fi
AC_MSG_RESULT($tk_ok)
if test $tk_ok = no; then
AC_DEFINE(NO_FD_SET)
fi
####
#### Find the MP library to use
####
AC_ARG_WITH(fgmp,
[ --with-fgmp Use a free replacement of Gnu MP package],
MP=libfgmp,
MP=libgmp)
echo "Multiple precision library: $MP"
AC_SUBST(MP, MP)
####
#### Hash tables
####
AC_ARG_ENABLE(hash,
[ --enable-hash Enable hash table support],
hashtable="$enable_hash",
hashtable="yes")
if test "$hashtable" = "yes" ;
then
EOBJ="$EOBJ hash.o"; EDFLGS="$EDFLGS -DUSE_HASH"
fi
echo "Hash tables support: $hashtable"
####
#### Posix support
####
AC_ARG_ENABLE(posix,
[ --enable-posix Enable posix support],
posix="$enable_posix",
posix="yes")
if test "$posix" = "yes" ;
then
EOBJ="$EOBJ posix.o"; EDFLGS="$EDFLGS -DUSE_POSIX"
fi
echo "Posix support: $posix"
####
#### Use STklos support
####
AC_ARG_ENABLE(stklos,
[ --enable-stklos Provide support for STklos],
stklos="$enable_stklos",
stklos="yes")
if test "$stklos" = "yes" ;
then
if test "$hashtable" != "yes"
then
echo "*** Hash table support is required for STklos."
echo "*** Forcing hash table support building."
EOBJ="$EOBJ hash.o"; EDFLGS="$EDFLGS -DUSE_HASH"
fi
DFLGS="$DFLGS -DUSE_STKLOS"
fi
echo "STklos support: $stklos"
####
#### Use Socket support from David Tolpin ([email protected])
####
AC_ARG_ENABLE(socket,
[ --enable-socket Provide support for sockets],
socket="$enable_socket",
socket="yes")
if test "$socket" = "yes"
then
EOBJ="$EOBJ socket.o"; EDFLGS="$EDFLGS -DUSE_SOCKET"
fi
echo "Socket support: $socket"
####
#### Use Regexp support
####
AC_ARG_ENABLE(regexp,
[ --enable-regexp Provide support for regular expressions],
regexpr="$enable_regexpr",
regexpr="yes")
if test "$regexpr" = "yes"
then
EOBJ="$EOBJ sregexp.o"; EDFLGS="$EDFLGS -DUSE_REGEXP"
fi
echo "Regexp support: $regexpr"
####
#### Use Process support
####
AC_ARG_ENABLE(process,
[ --enable-process Provide support for Unix processes],
process="$enable_process",
process="yes")
if test "$process" = "yes"
then
EOBJ="$EOBJ process.o"; EDFLGS="$EDFLGS -DUSE_PROCESS"
fi
echo "Process support: $process"
####
#### Html support
####
AC_ARG_ENABLE(html,
[ --enable-html Enable html support],
html="$enable_html",
html="yes")
if test "$html" = "yes" ;
then
EOBJ="$EOBJ html.o"; EDFLGS="$EDFLGS -DUSE_HTML"
fi
echo "Html support: $html"
####
#### BASE64 support
####
AC_ARG_ENABLE(base64,
[ --enable-base64 Enable Base64 support],
base64="$enable_base64",
base64="yes")
if test "$base64" = "yes" ;
then
EOBJ="$EOBJ base64.o"; EDFLGS="$EDFLGS -DUSE_BASE64"
fi
echo "Base64 support: $base64"
####
#### LOCALE support
####
AC_ARG_ENABLE(locale,
[ --enable-locale Enable locale support],
locale="$enable_locale",
locale="yes")
if test "$locale" = "yes" ;
then
EOBJ="$EOBJ locale.o"; EDFLGS="$EDFLGS -DUSE_LOCALE"
fi
echo "Locale support: $locale"
####
#### Pixmap support
####
AC_ARG_ENABLE(pixmap,
[ --enable-pixmap Enable pixmap images support],
pixmapimages="$enable_pixmap",
pixmapimages="yes")
if test "$pixmapimages" = "yes" ;
then
ETKOBJ="$ETKOBJ pixmap.o"; EDFLGS="$EDFLGS -DUSE_PIXMAP"
fi
echo "Pixmap Images support: $pixmapimages"
####
#### JPEG support
####
AC_ARG_ENABLE(jpeg,
[ --enable-jpeg Enable JPEG images support],
jpegimages="$enable_jpeg",
jpegimages="yes")
if test "$jpegimages" = "yes" ;
then
ETKOBJ="$ETKOBJ jpeg.o"; EDFLGS="$EDFLGS -DUSE_JPEG"
fi
echo "JPEG Images support: $jpegimages"
##############################################################################
####
#### Dynamic loading
####
##############################################################################
DYNLOAD="" ; AC_SUBST(DYNLOAD)
EXTRA_OBJ="" ; AC_SUBST(EXTRA_OBJ)
LIB_DLD="" ; AC_SUBST(LIB_DLD)
HAVE_DYNLOAD=yes
case $OS in
unkn*) HAVE_DYNLOAD="no";;
ULTRIX) HAVE_DYNLOAD="no";;
LINUX) HAVE_DYNLOAD="no";
# Try to see if this system could be a ELF one
elf_hint="no"
for i in /lib/libc.so*
do
case $i in
/lib/libc.so.6*| libc-2.*) elf_hint="yes"; break;;
*) set `file $i`
if test "$2" = "ELF"
then
elf_hint="yes"
break
fi ;;
esac
done 2> /dev/null
AC_ARG_ENABLE(elf,
[ --enable-elf Enable Dynamic Loading using ELF (Linux only)],
dynload_elf="$enable_elf",
dynload_elf=$elf_hint)
AC_ARG_ENABLE(dld,
[ --enable-dld Enable Dynamic Loading using DLD (Linux only)],
dynload_dld="$enable_dld",
dynload_dld="no")
if test "$dynload_elf" = "yes"
then
if test "$dynload_dld" = "yes"
then
echo "**** You have set both DLD and ELF support. Rerun configure"
exit 1
fi
OS=LINUX_ELF
echo "Linux: Using ELF for dynamic loading"
HAVE_DYNLOAD="yes"
fi
if test "$dynload_dld" = "yes"
then
OS=LINUX_DLD
echo "Linux: Using DLD for dynamic loading"
HAVE_DYNLOAD="yes"
fi
# Set a compilation flag indicating the format used
DFLGS="$DFLGS -D$OS" ;;
*) AC_ARG_ENABLE(dynload,
[ --enable-dynload Enable Dynamic loading],
dynload="$enable_dynload",
dynload="yes")
if test "$dynload" = "no"
then
echo "======== Don't use dynamic loading =======";
HAVE_DYNLOAD="no";
fi;;
esac
SH_CCFLAGS=""; AC_SUBST(SH_CCFLAGS)
SH_LDFLAGS=""; AC_SUBST(SH_LDFLAGS)
SH_LOADER=":"; AC_SUBST(SH_LOADER)
SH_SUFFIX=""; AC_SUBST(SH_SUFFIX)
LIB_MALLOC=""; AC_SUBST(LIB_MALLOC)
echo "Determining options for dynamic loading for $OS"
case $OS in
SUNOS4)
SH_CCFLAGS="-pic"
SH_LDFLAGS="-assert pure-text -o"
SH_LOADER="ld"
SH_SUFFIX='so';;
SUNOS5)
SH_CCFLAGS="-K pic"
SH_LDFLAGS='-G -z text -h'
SH_LOADER="ld"
SH_SUFFIX='so';;
OSF1)
SH_CCFLAGS="-fpic"
SH_LDFLAGS="-shared -o"
SH_LOADER="ld"
SH_SUFFIX='so' ;;
NETBSD1)
SH_CCFLAGS="-fpic"
SH_LDFLAGS="-Bshareable -o"
SH_LOADER="ld"
SH_SUFFIX='so';;
HPUX)
SH_CCFLAGS="+Z"
SH_LDFLAGS="-b -o"
SH_LOADER="ld"
SH_SUFFIX='sl'
STKLDFLAGS="$STKLDFLAGS -Wl,-E"
LIB_DLD=-ldld;;
FREEBSD)
SH_CCFLAGS="-fpic"
SH_LDFLAGS="-shared -o"
SH_LOADER="ld"
LIB_MALLOC=""
STKLDFLAGS=-rdynamic
SH_SUFFIX='so';;
IRIX5)
if test "$CC" = "gcc"
then
SH_CCFLAGS="-fpic"
else
SH_CCFLAGS="-KPIC"
fi
SH_LDFLAGS="-shared -o"
SH_LOADER="$CC"
SH_SUFFIX='so' ;;
LINUX)
echo " Linux: no dynamic loading method chosen";;
LINUX_DLD)
SH_CCFLAGS=''
SH_LDFLAGS='-r -o'
SH_LOADER='ld'
SH_SUFFIX='so'
# Define STRIP to true to avoid executables striping when using DLD
STRIP=true
# Add the -ldld flag
LIB_DLD=-ldld;;
LINUX_ELF)
SH_CCFLAGS='-fpic'
SH_LDFLAGS='-shared -o'
SH_LOADER='ld'
SH_SUFFIX='so'
# Under ELF, use the -rdynamic option at ld phase
STKLDFLAGS=-rdynamic;;
*) echo " (I don't know how to make shared libraries for $OS)" ;;
esac
#
# Transform -pic in -fpic if using gcc
#
if test ! -z "SH_CCFLAGS" ; then
if test "$CC" = "gcc" -a "$SH_CCFLAGS" != "" ; then
SH_CCFLAGS="-fpic"
fi
fi
if test "$HAVE_DYNLOAD" = "yes"
then
for _i_ in $EOBJ $ETKOBJ
do
EXTRA_OBJ="$EXTRA_OBJ `basename $_i_ .o`.$SH_SUFFIX"
done
DYNLOAD=-DUSE_DYNLOAD
EOBJ=""
ETKOBJ=""
EDFLGS=""
fi
# Set final DFLGS
DFLGS="$DFLGS $EDFLGS"
####
#### Produce the Makefile
####
echo
AC_OUTPUT(Makefile Utils/STk.spec)
##############################################################################
####
#### Configuring Sub-directories
####
echo "**** Configuring Src directory";
(cd Src; CC=$CC MACH=$MACH /bin/sh ./configure)
echo "**** Configuring Extensions directory";
(cd Extensions; CC=$CC MACH=$MACH /bin/sh ./configure)
echo "**** Configuring Stack directory";
(cd Stack; CC=$CC /bin/sh ./configure)
echo "**** Configuring Tcl directory";
(cd Tcl; CC=$CC /bin/sh ./configure --prefix=$prefix)
echo "**** Configuring Tk directory";
if test "$x_includes" != "" -a "$x_libraries" != ""
then
(cd Tk/$FLAVOR; CC=$CC /bin/sh ./configure $FLAVOR --x-includes=$x_includes \
--x-libraries=$x_libraries --prefix=$prefix)
else
(cd Tk/$FLAVOR; CC=$CC /bin/sh ./configure $FLAVOR)
fi
###
### Some things to terminate
###
# FreeBsd seems to use an old syntax for inclusion in Makefile. Patch
# Makefiles acordingly
case $OS in
FREEBSD) for i in */Makefile
do
sed <$i > X$$X 's%include ../config.make%.include "../config.make"%'
mv X$$X $i
done;;
*) ;;
esac
# RPM 3.0 seems to need that symbolic links are not "dead". So we make
# the link from Snow/Makefile to STk/Makefile here instead of packing
# the file in the tarball
rm -f Snow/Makefile
(cd Snow; ln -s ../Src/Makefile .)
###
### SUMMARY
###
echo " "
echo " "
echo "SUMMARY"
echo "*******"
echo " Your system is " $OS
echo " C compiler is:" $CC
echo " Compilation options:" $STKCFLAGS
echo " Dynamic loading enabled:" $HAVE_DYNLOAD
echo " X11 libraries directory:" $x_libraries
echo " X11 headers directory:" $x_includes
echo " "
echo " You have chosen the following options"
echo " Multiple precision library: " $MP
echo " Hash tables support: " $hashtable
echo " Posix support: " $posix
echo " STklos support: " $stklos
echo " Socket support: " $socket
echo " Regexp support: " $regexpr
echo " Process support: " $process
echo " Html support: " $html
echo " Pixmap Images support: " $pixmapimages
echo " Jpeg Images support: " $jpegimages
echo " Base64 support: " $base64
echo " Locale support: " $locale
echo " "
echo "If this is correct, you can just type 'make' now at your shell prompt."
echo "Otherwise, rerun configure with proper options (see the README file for"
echo "a description of STk configure options.)"
echo " "