-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure
executable file
·502 lines (434 loc) · 12 KB
/
configure
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
#! /bin/sh
# Spot o' Conf
# Copyright (c) 2017,2018 Stuart Cassoff <stwo@users.sourceforge.net>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
SPOTO_VER=0.7
SH=/bin/sh
e='printf %s\n'
ECHO=${e}
TR=tr
SED=sed
NAME=spot
TITLE='Tcl or Jim extension'
PKG_NAME=spot
PKG_VER=0.0
LIB=''
INIT=''
#FOR_WHAT=Tcl
#FOR_WHAT=Jim
if test X"${TCL}" = X""; then
TCL=8.6
fi
tcl="${TCL}"
tcl_nodots=`${e} "$tcl" | ${TR} -d '.'`
srcdir=`expr $0 : '\(.*\)/.*$'`
: ${srcdir:=.}
cwd=`pwd`
cd $srcdir
asrcdir=`pwd`
cd $cwd
prefix=/usr/local
appdir=''
#bindir='${prefix}/bin'
bindir=''
libdir='${prefix}/lib'
mandir='${prefix}/man/mann'
#docdir='${prefix}/share/doc'
docdir=''
#exadir='${prefix}/share/examples'
exadir=''
pkgdir=''
moddir=''
moddir_set=no
TCLSH_PROG='tclsh${tcl}'
WISH_PROG='wish${tcl}'
JIMSH_PROG=jimsh
BJE='/usr/local/share/examples/jim/build-jim-ext'
JIM_INC_DIR='${prefix}/include/jim'
JIM_LIB_DIR='${prefix}/lib'
JIM_LIB=jim
TCL_CONF_DIR='${prefix}/lib/tcl/tcl${tcl}'
PKGCONFIG=no
TCLLIBPATH='.'
JIMLIB='.'
DEBUG=no
THREADS=''
PKGINDEX=''
DOC=''
DOCBLD=dtplite
BIN=''
BINSRC=''
TESTENV=''
TEST='test-spot'
SHELL='shell-spot'
CLEAN='clean-spot'
DISTCLEAN='distclean-spot'
DIST='dist-ext'
EXT_BUILD=''
EXT_DEFS=''
EXT_INC_SPEC=''
EXT_LIB_SPEC=''
EXT_DEP_FILES=''
EXT_VPATH=''
EXT_CONF=''
EXT_MK=''
INSTALL_EXA=''
BLDSRC_FATAL=yes
VPATH='${srcdir}/generic:${srcdir}/unix:${srcdir}/library:${srcdir}/doc:${srcdir}/bin'
SUBST_VARS='NAME TITLE PKG_NAME PKG_VER LIB SHLIB SCLIB SCLIBSRC DOC DOCSRC DOCBLD DOCFMT INSTALL_DOC SCBIN SCBINSRC INSTALL_BIN INSTALL_EXA INSTALL_LIB LOAD_LIB INIT CC CFLAGS_CC CFLAGS_WARN CFLAGS_OPT CFLAGS_SH CFLAGS_TH LIBS_TH TH_DEFS OPT_DEFS LDFLAGS LDFLAGS_SH TDEFS JDEFS DEFS SPOTO_DEFS EXT_BUILD EXT_DEFS EXT_INC_SPEC EXT_LIB_SPEC EXT_DEP_FILES TCL_INC_SPEC JIM_INC_SPEC TCL_LIB_SPEC JIM_LIB_SPEC TCL_STUB_LIB_SPEC CC_INC_SPEC LD_LIB_SPEC LD_LIBRARY_PATH_VAR TCLLIBPATH JIMLIB TCLSH_PROG JIMSH_PROG BJE SH CFLAGS_DEBUG FOR_WHAT PKGINDEX CFG_PKGINDEX PKG_INSTALL_DIR DOC_INSTALL_DIR SHELL CLEAN DISTCLEAN DIST TEST TESTENV TESTFWK VPATH srcdir asrcdir cwd prefix appdir pkgdir moddir mandir docdir exadir bindir SPOTO_ARGS'
if test X"$1" != X"" && ! expr X"$1" : X'--..*$' > /dev/null; then
spoto_conf_file=$1
shift
else
spoto_conf_file=$srcdir/spoto.conf
fi
. "$spoto_conf_file"
ext_conf_file=''
if test X"$EXT_CONF" != X""; then
ext_conf_file=$srcdir/$EXT_CONF
. "$ext_conf_file"
fi
if test X"$TITLE" = X""; then
TITLE=$NAME
fi
if test X"$EXT_VPATH" != X""; then
VPATH="$VPATH:$EXT_VPATH"
fi
if test X"${tcl}" != X"${TCL}"; then
tcl="${TCL}"
fi
if test X"$FOR_WHAT" != X"Jim"; then
FOR_WHAT=Tcl
fi
if test X"$THREADS" = X""; then
if test $FOR_WHAT = Jim; then
THREADS=no
else
THREADS=yes
fi
fi
SHLIB=''
SCLIB=''
SCLIBSRC=''
LOAD_LIB=''
INSTALL_LIB=''
if expr "$LIB" : '..*[.]tcl$' > /dev/null; then
SCLIB="$LIB"
SCLIBSRC="$LIB"
LOAD_LIB='source'
INSTALL_LIB='install-script-lib'
fi
if test X"$LOAD_LIB" = X""; then
if expr "$LIB" : '..*[.]tm$' > /dev/null; then
LIBNAME=`expr "$LIB" : '\(..*\)[.]tm'`
if test $FOR_WHAT = Jim; then
SCLIB=$LIBNAME.tcl
LOAD_LIB='source'
else
SCLIB=$LIBNAME-$PKG_VER.tm
LOAD_LIB='tm'
fi
SCLIBSRC=$LIBNAME.tcl
INSTALL_LIB='install-script-lib'
LIB="$SCLIB"
fi
fi
if test X"$LOAD_LIB" = X"" && test X"$LIB" != X""; then
SHLIB="$LIB"
SCLIB=''
LOAD_LIB='load'
INSTALL_LIB='install-bin-lib'
fi
DOCFMT=''
if test X"$DOC" != X""; then
docext=`expr $DOC : '..*\.\(..*\)$'`
if test X"$docext" = X"n"; then
DOCFMT=nroff
fi
if test X"$docext" = X"html"; then
DOCFMT=html
fi
fi
SCBIN=''
SCBINSRC=''
INSTALL_BIN=''
if test X"$BINSRC" = X""; then
BINSRC="$BIN"
fi
if expr X"$BINSRC" : X'..*[.]tcl$' > /dev/null; then
SCBIN="$BIN"
SCBINSRC="$BINSRC"
INSTALL_BIN='install-script-bin'
fi
if test X"$appdir" = X""; then
appdir=`${e} "$NAME" | ${TR} '[:upper:]' '[:lower:]'`
fi
if test X"$pkgdir" = X""; then
if test $FOR_WHAT = Jim; then
pkgdir='${prefix}/lib/jim'
else
pkgdir='${prefix}/lib/tcl/${appdir}'
if test X"$LOAD_LIB" = X"tm"; then
moddir='${prefix}/lib/tcl/modules/${tcl_nodots}'
fi
fi
fi
if test X"$docdir" = X""; then
docdir='${prefix}/share/doc/${appdir}'
fi
if test X"$exadir" = X""; then
exadir='${prefix}/share/examples/${appdir}'
fi
if test X"$bindir" = X""; then
bindir='${prefix}/bin'
fi
if test $FOR_WHAT = Jim; then
t=:
j=${e}
else
t=${e}
j=:
fi
showhelpinfo=''
showhelp=''
showres=''
huh=''
for arg
do
name=`expr "$arg" : '\(.*\)=.*$'`
if test X"$name" != X""; then
value=`expr "$arg" : "$name=\(.*\)$"`
else
name=$arg
value=''
fi
case $name in
--appdir ) appdir=$value ;;
--prefix ) prefix=$value ;;
--bindir ) bindir=$value ;;
--libdir ) libdir=$value ;;
--pkgdir ) pkgdir=$value ;;
--moddir ) moddir=$value; moddir_set=yes ;;
--mandir ) mandir=$value ;;
--docdir ) docdir=$value ;;
--exadir ) exadir=$value ;;
--tcl ) tcl=$value ;;
--with-tcl ) TCL_CONF_DIR=$value ;;
--pkgconfig ) PKGCONFIG=$value ;;
--jimincdir ) JIM_INC_DIR=$value ;;
--jimlibdir ) JIM_LIB_DIR=$value ;;
--jimlib ) JIM_LIB_DIR=$value ;;
--tclsh ) TCLSH_PROG=$value ;;
--wish ) WISH_PROG=$value ;;
--jimsh ) JIMSH_PROG=$value ;;
--bje ) BJE=$value ;;
--docbld ) DOCBLD=$value ;;
--docfmt ) DOCFMT=$value ;;
--debug ) DEBUG=$value ;;
--threads ) THREADS=$value ;;
--quiet ) ECHO=: ;;
--result ) showres=yes ;;
-\?|--help ) showhelp=yes ;;
* ) huh="$huh $arg";showres='';break ;;
esac
done
if test X"$showres" = X"yes"; then
for i in $SUBST_VARS; do
printf '%-20s {@%s@}\n' $i $i
done | ${SED} -f spoto.sed | sort
exit
fi
${ECHO} "Spot o' Conf $SPOTO_VER configurator for: $TITLE $PKG_VER for $FOR_WHAT."
if test X"$huh" != X""; then
${ECHO} "Huh? $huh"
exit 1
fi
if test X"$showhelpinfo" = X"yes"; then
${e} "Use `expr $0 : '.*/\(.*\)$'` --help for help"
exit
fi
if test X"$showhelp" = X"yes"; then
${e} "Usage: `expr $0 : '.*/\(.*\)$'` [option=value ...]"
${e} 'Options:'
${t} " --tcl ver Tcl version to use [${tcl}]"
${e} " --appdir dir Usually the name of the thing [${appdir}]"
${e} " --prefix dir Prefix [${prefix}]"
${e} " --bindir dir Executable files dir [${bindir}]"
${e} " --libdir dir Library files dir [${libdir}]"
${e} " --pkgdir dir Package files dir [${pkgdir}]"
${t} " --moddir dir Module files dir [${moddir}]"
${e} " --mandir dir Man files dir [${mandir}]"
${e} " --docdir dir Documentation files dir [${docdir}]"
${e} " --exadir dir Example files dir [${exadir}]"
${e} " --pkgconfig key Key for pkg-config [${PKGCONFIG}]"
${t} " --with-tcl dir Where to find tclConfig.sh [${TCL_CONF_DIR}]"
${j} " --jimincdir dir Where to find Jim include files [${JIM_INC_DIR}]"
${j} " --jimlibdir dir Where to find Jim lib files [${JIM_LIB_DIR}]"
${j} " --jimlib dir Name of Jim lib file [${JIM_LIB}]"
${t} " --tclsh file Path to tclsh [${TCLSH_PROG}]"
${t} " --wish file Path to wish [${WISH_PROG}]"
${j} " --jimsh file Path to jimsh [${JIMSH_PROG}]"
${j} " --bje file Path to build-jim-ext [${BJE}]"
${e} " --docbld file Documentation builder [${DOCBLD}]"
${e} " --docfmt fmt Documentation format [${DOCFMT}]"
${e} " --debug bool Enable symbols and checks [${DEBUG}]"
${t} " --threads bool Enable threads [${THREADS}]"
${e} ' --quiet bool Do not display configure messages'
${e} ' --result Print the result of a configuration'
${e} ' --help, -? This information'
exit
fi
if test -f Makefile.in; then
${e} "Don't build in the toplevel source directory!"
if test X"$BLDSRC_FATAL" != X"no"; then exit 1; fi
fi
${ECHO} "Using config: $spoto_conf_file $ext_conf_file"
if test X"$DEBUG" = X"yes"; then
CFLAGS_DEBUG='-g'
else
CFLAGS_DEBUG='-DNDEBUG=1'
fi
LIBS_TH=''
if test X"$THREADS" = X"yes"; then
CFLAGS_TH='-pthread'
TH_DEFS='-DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1'
else
CFLAGS_TH=''
TH_DEFS=''
fi
if test X"$DOCFMT" != X"nroff" && test X"$DOCFMT" != X"html"; then
DOCFMT=''
fi
DOCSRC=''
if test X"$DOCFMT" != X"" && test X"$DOC" != X""; then
DOCNAME=`expr $DOC : '\(..*\)\..*$'`
DOCSRC=$DOCNAME.man
VPATH="$VPATH"':${srcdir}/doc'
if test X"$DOCFMT" = X"nroff"; then
DOC_INSTALL_DIR='${mandir}'
DOC=$DOCNAME.n
fi
if test X"$DOCFMT" = X"html"; then
DOC_INSTALL_DIR='${docdir}'
DOC=$DOCNAME.html
fi
INSTALL_DOC=install-doc
else
DOC=''
DOCBLD=''
DOC_INSTALL_DIR='${docdir}'
INSTALL_DOC=''
fi
TCLCONFIG=''
if test X"$PKGCONFIG" != X"no"; then
TCL_CONF_DIR=no
fi
if test X"$TCL_CONF_DIR" != X"no"; then
eval TCLCONFIG="\"$TCL_CONF_DIR\""/tclConfig.sh
fi
eval TCLSH_PROG="\"$TCLSH_PROG\""
tcl_nodots=`${e} "$tcl" | ${TR} -d '.'`
if test X"$LOAD_LIB" = X"tm"; then
if test X"$moddir_set" != X"yes"; then
moddir='${prefix}/lib/tcl/modules/'$tcl_nodots
fi
fi
if test $FOR_WHAT = Jim; then
PKGINDEX=''
DEFS='${JDEFS}'
SPOTO_DEFS='-DFOR_JIM=1'
CC_INC_SPEC='${JIM_INC_SPEC}'
LD_LIB_SPEC='${JIM_LIB_SPEC}'
PKG_INSTALL_DIR='${pkgdir}'
TESTFWK='testing.tcl'
else
DEFS='${TDEFS}'
SPOTO_DEFS='-DFOR_TCL=1'
CC_INC_SPEC='${TCL_INC_SPEC}'
#LD_LIB_SPEC='${TCL_LIB_SPEC}'
LD_LIB_SPEC='${TCL_STUB_LIB_SPEC}'
if test X"$LOAD_LIB" = X"tm"; then
PKG_INSTALL_DIR='${moddir}'
else
PKG_INSTALL_DIR='${pkgdir}'
fi
TESTFWK='all.tcl'
fi
OPT_DEFS='-DPACKAGE_NAME=\\"'"$PKG_NAME"'\\" -DPACKAGE_VERSION=\\"'"$PKG_VER"'\\"'
CC=${CC:=cc}
CFLAGS_CC='-pipe'
CFLAGS_WARN='-Wall'
CFLAGS_OPT='-O2'
CFLAGS_SH='-fpic'
LDFLAGS=''
LDFLAGS_SH='-shared'
TDEFS='-DUSE_TCL_STUBS=1'
JDEFS=''
LD_LIBRARY_PATH_VAR=LD_LIBRARY_PATH
TCL_INC_SPEC=''
TCL_LIB_SPEC=''
TCL_STUB_LIB_SPEC=''
eval JIM_INC_SPEC="-I\"$JIM_INC_DIR\""
eval JIM_LIB_SPEC="-L\"$JIM_LIB_DIR\"' '-l\"$JIM_LIB\""
if test $FOR_WHAT = Tcl; then
if test X"$TCLCONFIG" != X""; then
. "$TCLCONFIG"
else
if test X"$PKGCONFIG" != X"no"; then
if test X"$PKGCONFIG" = X"yes"; then
PKGCONFIG=tcl${tcl_nodots}
fi
TCL_INCLUDE_SPEC=`pkg-config --cflags $PKGCONFIG` || exit 1
TCL_LIB_SPEC=`pkg-config --libs $PKGCONFIG` || exit 1
fi
fi
TCL_INC_SPEC=${TCL_INCLUDE_SPEC-}
else
if test X"$PKGCONFIG" != X"no"; then
if test X"$PKGCONFIG" = X"yes"; then
PKGCONFIG=jimtcl
fi
JIM_INC_SPEC=`pkg-config --cflags $PKGCONFIG` || exit 1
JIM_LIB_SPEC=`pkg-config --libs $PKGCONFIG` || exit 1
fi
fi
SPOTO_ARGS="$@"
sfiles='Makefile.in'
if test X"$PKGINDEX" = X"pkgIndex.tcl.in"; then
sfiles="$sfiles $PKGINDEX"
CFG_PKGINDEX=cfg_`expr $PKGINDEX : '\(..*\)\.in$'`
PKGINDEX=''
else
CFG_PKGINDEX=''
fi
rm -f spoto.sed
if test X"$EXT_MK" != X"" ; then
for i in $EXT_MK; do
printf '%s\n\n%s\n' '/@EXT_MK@/a \' "/@EXT_MK@/r $srcdir/$i"
done
printf '%s\n' 's,@EXT_MK@,@TITLE@,'
else
printf '%s\n' '/@EXT_MK@/,/$/d'
fi >> spoto.sed
for i in $SUBST_VARS; do
eval q=`printf '$%s' "$i"`
printf 's\001@%s@\001%s\001g\n' $i "$q"
done >> spoto.sed
for ifile in $sfiles; do
ofile=`expr $ifile : '\(..*\)\.in$'`
INFILE=$srcdir/$ifile
OUTFILE=$ofile
${SED} -f spoto.sed < "$INFILE" > "$OUTFILE"
done
# EOF