Subversion Repositories Vertical

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
#
2
# This file describes a "configure" script that is used to build
3
# makefiles for a particular platform.  Process this file using 
4
# Autoconf version 1.13 in order to generate that script.  All 
5
# lines of this file up to the AC_INIT macro are ignored.
6
#
7
# The build process allows for using a cross-compiler.  But the default
8
# action is to target the same platform that we are running on.  The
9
# configure script needs to discover the following properties of the 
10
# build and target systems:
11
#
12
#    srcdir
13
#
14
#        The is the name of the directory that contains the
15
#        "configure" shell script.  All source files are
16
#        located relative to this directory.
17
#
18
#    BUILD_CC
19
#
20
#        The name of a command that is used to convert C
21
#        source files into executables that run on the build
22
#        platform.
23
#
24
#    BUILD_CFLAGS
25
#
26
#        Switches that the build compiler needs in order to construct
27
#        command-line programs.
28
#
29
#    BUILD_LIBS
30
#
31
#        Libraries that the build compiler needs in order to construct
32
#        command-line programs.
33
#
34
#    BUILD_EXEEXT
35
#
36
#        The filename extension for executables on the build
37
#        platform.  "" for Unix and ".exe" for Windows.
38
#
39
#    BUILD_TCLSH
40
#
41
#        The name of a tclsh executable on the build platform.
42
#
43
#    TARGET_CC
44
#
45
#        The name of a command that runs on the build platform
46
#        and converts C source files into *.o files for the
47
#        target platform.  In other words, the cross-compiler.
48
#
49
#    TARGET_CFLAGS
50
#
51
#        Switches that the target compiler needs to turn C source files
52
#        into *.o files.  Do not include TARGET_TCL_INC, TARGET_X_INC
53
#        or TARGET_TK_INC in this list.  Makefiles might add
54
#        additional switches such as "-I.".
55
#
56
#    TARGET_TCL_INC
57
#    TARGET_X_INC
58
#    TARGET_TK_INC
59
#    TARGET_BLT_INC
60
#
61
#        These variables define the directories that contain header
62
#        files for Tcl, X11, Tk, and BLT respectively.  If the compiler
63
#        is able to find <tcl.h>, <X11/Xlib.h>, <tk.h> and <blt.h>
64
#        on its own, then these can be blank.
65
#
66
#    TARGET_LINK
67
#
68
#        The name of the linker that combines *.o files generated
69
#        by TARGET_CC into executables for the target platform.
70
#
71
#    TARGET_TCL_LIBS
72
#    TARGET_X_LIBS
73
#    TARGET_TK_LIBS
74
#    TARGET_BLT_LIBS
75
#
76
#        These are the library directives passed to the target linker
77
#        that cause the executable to link against Tcl, X11, Tk, and
78
#        BLT respectively.  They might be switches like "-ltcl8.0" or
79
#        pathnames of library files like "../../src/libtcl8.0.a".
80
#
81
#    TARGET_LIBS
82
#
83
#        Additional libraries or other switch that the target linker needs
84
#        to build an executable on the target.  Do not include
85
#        on this list any libraries in TARGET_TCL_LIBS, TARGET_X_LIBS,
86
#        TARGET_TK_LIBS, or TARGET_BLT_LIBS.
87
#
88
#    TARGET_EXEEXT
89
#
90
#        The filename extension for executables on the
91
#        target platform.  "" for Unix and ".exe" for windows.
92
#
93
#    TARGET_TCL_SCRIPT_DIR
94
#
95
#        A directory on the build platform that contains the
96
#        Tcl script libraries that are compatible with the
97
#        Tcl C libraries of the target platform.
98
#
99
#    TARGET_TK_SCRIPT_DIR
100
#
101
#        A directory on the build platform that contains the
102
#        Tk script libraries that are compatible with the
103
#        Tk C libraries of the target platform.
104
#
105
# The generated configure script will make an attempt to guess
106
# at all of the above parameters.  You can override any of
107
# the guesses by setting the environment variable named
108
# "config_AAAA" where "AAAA" is the name of the parameter
109
# described above.  (Exception: srcdir cannot be set this way.)
110
# If you have a file that sets one or more of these environment
111
# variables, you can invoke configure as follows:
112
#
113
#           configure --with-hints=FILE
114
#
115
# where FILE is the name of the file that sets the environment
116
# variables.  FILE should be an absolute pathname.
117
#
118
# If you have a Tcl/Tk/BLT source distribution available, then the
119
# files in that distribution will be used instead of any other
120
# Tcl/Tk/BLT files the script might discover if you tell the configure
121
# script about the source tree.  Use commandline options:
122
#
123
#         --with-tcl=PATH  --with-tk=PATH  --with-blt=PATH
124
#
125
# Or set environment variables config_WITH_TCL, config_WITH_TK, or
126
# config_WITH_BLT.
127
#
128
# This configure.in file is easy to reuse on other projects.  Just
129
# change the argument to AC_INIT().  And disable any features that
130
# you don't need (for example BLT) by erasing or commenting out
131
# the corresponding code.
132
#
133
AC_INIT(src/psdgui.c)
134
 
135
#########
136
# Check to see if the --with-hints=FILE option is used.
137
#
138
AC_ARG_WITH(hints,
139
  [  --with-hints=FILE       Read configuration options from FILE],
140
  . $withval)
141
 
142
#########
143
# Locate a compiler for the build machine.  This compiler should
144
# generate command-line programs that run on the build machine.
145
#
146
default_build_cflags="-g"
147
if test "$config_BUILD_CC" = ""; then
148
  AC_PROG_CC
149
  if test "$cross_compiling" = "yes"; then
150
    AC_MSG_ERROR([unable to find a compiler for building build tools])
151
  fi
152
  BUILD_CC=$CC
153
  default_build_cflags=$CFLAGS
154
else
155
  BUILD_CC=$config_BUILD_CC
156
  AC_MSG_CHECKING([host compiler])
157
  CC=$BUILD_CC
158
  AC_MSG_RESULT($BUILD_CC)
159
fi
160
AC_MSG_CHECKING([switches for the host compiler])
161
if test "$config_BUILD_CFLAGS" != ""; then
162
  CFLAGS=$config_BUILD_CFLAGS
163
  BUILD_CFLAGS=$config_BUILD_CFLAGS
164
else
165
  BUILD_CFLAGS=$default_build_cflags
166
fi
167
AC_MSG_RESULT($BUILD_CFLAGS)
168
if test "$config_BUILD_LIBS" != ""; then
169
  BUILD_LIBS=$config_BUILD_LIBS
170
fi
171
AC_SUBST(BUILD_CC)
172
AC_SUBST(BUILD_CFLAGS)
173
AC_SUBST(BUILD_LIBS)
174
 
175
##########
176
# Locate a compiler that converts C code into *.o files that run on
177
# the target machine.
178
#
179
AC_MSG_CHECKING([target compiler])
180
if test "$config_TARGET_CC" != ""; then
181
  TARGET_CC=$config_TARGET_CC
182
else
183
  TARGET_CC=$BUILD_CC
184
fi
185
AC_MSG_RESULT($TARGET_CC)
186
AC_MSG_CHECKING([switches on the target compiler])
187
if test "$config_TARGET_CFLAGS" != ""; then
188
  TARGET_CFLAGS=$config_TARGET_CFLAGS
189
else
190
  TARGET_CFLAGS=$BUILD_CFLAGS
191
fi
192
AC_MSG_RESULT($TARGET_CFLAGS)
193
AC_MSG_CHECKING([target linker])
194
if test "$config_TARGET_LINK" = ""; then
195
  TARGET_LINK=$TARGET_CC
196
else
197
  TARGET_LINK=$config_TARGET_LINK
198
fi
199
AC_MSG_RESULT($TARGET_LINK)
200
AC_MSG_CHECKING([switches on the target compiler])
201
if test "$config_TARGET_TFLAGS" != ""; then
202
  TARGET_TFLAGS=$config_TARGET_TFLAGS
203
else
204
  TARGET_TFLAGS=$BUILD_CFLAGS
205
fi
206
AC_MSG_RESULT($TARGET_TFLAGS)
207
AC_SUBST(TARGET_CC)
208
AC_SUBST(TARGET_CFLAGS)
209
AC_SUBST(TARGET_LINK)
210
AC_SUBST(TARGET_LFLAGS)
211
 
212
# Set the $cross variable if we are cross-compiling.  Make
213
# it 0 if we are not.
214
#
215
AC_MSG_CHECKING([if host and target compilers are the same])
216
if test "$BUILD_CC" = "$TARGET_CC"; then
217
  cross=0
218
  AC_MSG_RESULT(yes)
219
else
220
  cross=1
221
  AC_MSG_RESULT(no)
222
fi
223
 
224
###########
225
# Lots of things are different if we are compiling for Windows using
226
# the CYGWIN environment.  So check for that special case and handle
227
# things accordingly.
228
#
229
AC_MSG_CHECKING([if executables have the .exe suffix])
230
if test "$config_BUILD_EXEEXT" = ".exe"; then
231
  CYGWIN=yes
232
  AC_MSG_RESULT(yes)
233
else
234
  AC_MSG_RESULT(unknown)
235
fi
236
if test "$CYGWIN" != "yes"; then
237
  AC_CYGWIN
238
fi
239
if test "$CYGWIN" = "yes"; then
240
  BUILD_EXEEXT=.exe
241
else
242
  BUILD_EXEEXT=""
243
fi
244
if test "$cross" = "0"; then
245
  TARGET_EXEEXT=$BUILD_EXEEXT
246
else
247
  TARGET_EXEEXT=$config_TARGET_EXEEXT
248
fi
249
if test "$TARGET_EXEEXT" = ".exe"; then
250
  ACD_UNIX=0
251
  ACD_WIN=1
252
  tclsubdir=win
253
else
254
  ACD_UNIX=1
255
  ACD_WIN=0
256
  tclsubdir=unix
257
fi
258
TARGET_CFLAGS="$TARGET_CFLAGS -DACD_UNIX=$ACD_UNIX -DACD_WIN=$ACD_WIN"
259
 
260
AC_SUBST(BUILD_EXEEXT)
261
AC_SUBST(ACD_UNIX)
262
AC_SUBST(ACD_WIN)
263
AC_SUBST(TARGET_EXEEXT)
264
 
265
#########
266
# Locate a working copy of tclsh.  We have to have this program
267
# running on the build platform since the makefiles use it.
268
#
269
AC_ARG_WITH(tcl,
270
[  --with-tcl=DIR          Directory holding Tcl source tree for target])
271
if test "$config_WITH_TCL" != ""; then
272
  with_tcl=$config_WITH_TCL
273
fi
274
if test "$config_BUILD_TCLSH" != ""; then
275
  AC_MSG_CHECKING([for a working "tclsh"])
276
  BUILD_TCLSH=$config_BUILD_TCLSH
277
  AC_MSG_RESULT($BUILD_TCLSH)
278
else
279
  if test "$with_tcl" != ""; then
280
    if test -x "$with_tcl/$tclsubdir/tclsh"; then
281
      BUILD_TCLSH=$with_tcl/$tclsubdir/tclsh
282
    else
283
      if test -x "$with_tcl/$tclsubdir/tclsh8.0"; then
284
        BUILD_TCLSH=$with_tcl/$tclsubdir/tclsh8.0
285
      fi
286
    fi
287
  fi
288
  if test "$BUILD_TCLSH" = ""; then
289
    AC_CHECK_PROGS(BUILD_TCLSH, tclsh8.0 tclsh80 cygtclsh80 tclsh, "")
290
  fi
291
  if test "$BUILD_TCLSH" = ""; then
292
    AC_MSG_ERROR([no working "tclsh" could be found])
293
  fi
294
fi
295
AC_SUBST(BUILD_TCLSH)
296
 
297
#########
298
# Locate the directory that contains all of the Tcl initialization
299
# scripts for the target machine.
300
#
301
AC_MSG_CHECKING([Tcl script library])
302
if test "$config_TARGET_TCL_SCRIPT_DIR" != ""; then
303
  TARGET_TCL_SCRIPT_DIR=$config_TARGET_TCL_SCRIPT_DIR
304
else
305
  changequote(<<<,>>>)dnl
306
  cat > conftest.tcl <<\EOF
307
    regsub {^([A-Za-z]):/} [info library] {//\1/} out
308
    puts -nonewline $out
309
    exit
310
EOF
311
  changequote([,])dnl
312
  tcllibdir=`$BUILD_TCLSH <conftest.tcl`
313
  rm -f conftest.tcl
314
  if test ! -r $tcllibdir/init.tcl; then
315
    AC_MSG_ERROR(not found)
316
  fi
317
  TARGET_TCL_SCRIPT_DIR=$tcllibdir
318
fi
319
AC_MSG_RESULT($TARGET_TCL_SCRIPT_DIR)
320
AC_SUBST(TARGET_TCL_SCRIPT_DIR)
321
 
322
#########
323
# Locate the directory that contains all of the Tk initialization
324
# scripts for the target machine.
325
#
326
AC_ARG_WITH(tk,
327
[  --with-tk=DIR           Directory holding Tk source tree for target])
328
if test "$config_WITH_TK" != ""; then
329
  with_tk=$config_WITH_TK
330
fi
331
AC_MSG_CHECKING([Tk script library])
332
if test "$config_TARGET_TK_SCRIPT_DIR" != ""; then
333
  TARGET_TK_SCRIPT_DIR=$config_TARGET_TK_SCRIPT_DIR
334
else
335
  if test "$with_tk" != ""; then
336
    tklibdir=$with_tk/library
337
  else
338
    changequote(<<<,>>>)dnl
339
    cat > conftest.tcl <<\EOF
340
      regsub {^([A-Za-z]):/} [info library] {//\1/} out
341
      regsub {/tcl7.6} $out {tk4.2} out
342
      regsub {/tcl([^/]*)} $out {/tk\1} out
343
      puts -nonewline $out
344
      exit
345
EOF
346
    changequote([,])dnl
347
    tklibdir=`$BUILD_TCLSH <conftest.tcl`
348
    rm -f conftest.tcl
349
  fi
350
  if test ! -r $tklibdir/tk.tcl; then
351
    AC_MSG_ERROR(not found)
352
  fi
353
  TARGET_TK_SCRIPT_DIR=$tklibdir
354
fi
355
AC_MSG_RESULT($TARGET_TK_SCRIPT_DIR)
356
AC_SUBST(TARGET_TK_SCRIPT_DIR)
357
 
358
##########
359
# Extract generic linker options from the environment.
360
#
361
if test "$config_TARGET_LIBS" != ""; then
362
  TARGET_LIBS=$config_TARGET_LIBS
363
else
364
  TARGET_LIBS=""
365
fi
366
AC_SUBST(TARGET_LIBS)
367
 
368
##########
369
# Figure out what C libraries are required to compile Tcl programs.
370
#
371
if test "$config_TARGET_TCL_LIBS" != ""; then
372
  TARGET_TCL_LIBS="$config_TARGET_TCL_LIBS"
373
else
374
  if test "$with_tcl" != ""; then
375
    extra=`echo $with_tcl/$tclsubdir/libtcl*.a`
376
  fi
377
  CC=$TARGET_CC
378
  AC_CHECK_FUNC(sin, LIBS="", LIBS="-lm")
379
  AC_CHECK_LIB(dl, dlopen)
380
  otherlibs=$LIBS
381
  if test "$extra" != ""; then
382
    LIBS=$extra
383
  else 
384
    LIBS=""
385
    AC_SEARCH_LIBS(Tcl_Init, tcl8.0 tcl80 tcl,,,$otherlibs)
386
  fi
387
  TARGET_TCL_LIBS="$LIBS $otherlibs"
388
fi
389
AC_SUBST(TARGET_TCL_LIBS)
390
 
391
##########
392
# Figure out where to get the TCL header files.
393
#
394
AC_MSG_CHECKING([TCL header files])
395
if test "$config_TARGET_TCL_INC" != ""; then
396
  TARGET_TCL_INC=$config_TARGET_TCL_INC
397
else
398
  if test "$with_tcl" != ""; then
399
    TARGET_TCL_INC="-I$with_tcl/generic -I$with_tcl/$tclsubdir"
400
  else
401
    TARGET_TCL_INC=""
402
  fi
403
fi
404
AC_MSG_RESULT($TARGET_TCLINC)
405
AC_SUBST(TARGET_TCL_INC)
406
 
407
###########
408
# Figure out what C libraries are required to compile X11 programs.
409
# If the target is windows, we assume the compiler is Cygwin20 and
410
# insert arguments that generate a windows GUI application.
411
#
412
if test "$config_TARGET_X_LIBS" != ""; then
413
  TARGET_X_LIBS=$config_TARGET_X_LIBS
414
  TARGET_X_INC=$config_TARGET_X_INC
415
else
416
  if test $ACD_UNIX = 1; then
417
    AC_PATH_XTRA
418
    if test "$X_CFLAGS" = "-DX_DISPLAY_MISSING"; then
419
      TARGET_X_LIBS=""
420
      TARGET_X_INC=""
421
    else
422
      xlibs="$X_LIBS $X_PRE_LIB -lX11 $X_EXTRA_LIBS"
423
      TARGET_X_LIBS=`echo $xlibs | sed -e 's/^  *//' -e 's/  //'g -e 's/ *$//'`
424
      if test "$x_includes" != ""; then
425
        TARGET_X_INC=`echo $x_includes | sed -e 's/^/-I/' -e 's/  */ -I/'`
426
      fi
427
    fi
428
  else
429
    TARGET_X_LIBS="-mwindows -e _mainCRTStartup"
430
    TARGET_X_INC=""
431
  fi
432
fi
433
AC_SUBST(TARGET_X_LIBS)
434
AC_SUBST(TARGET_X_INC)
435
 
436
 
437
##########
438
# Figure out what libraries are required to compile Tk programs.
439
#
440
if test "$config_TARGET_TK_LIBS" != ""; then
441
  TARGET_TK_LIBS="$config_TARGET_TK_LIBS"
442
else
443
  if test "$with_tk" != ""; then
444
    extra=`echo $with_tk/$tclsubdir/libtk*.a`
445
  else
446
    CC=$TARGET_CC
447
    otherlibs="$TARGET_X_LIBS $TARGET_TCL_LIBS"
448
    LIBS=""
449
    AC_SEARCH_LIBS(Tk_Init, tk8.0 tk80 tk,,,$otherlibs)
450
    TARGET_TK_LIBS=$LIBS
451
  fi
452
fi
453
AC_SUBST(TARGET_TK_LIBS)
454
 
455
###########
456
# Figure out where to get the TK header files.
457
#
458
AC_MSG_CHECKING([TK header files])
459
if test "$config_TARGET_TK_INC" != ""; then
460
  TARGET_TK_INC=$config_TARGET_TK_INC
461
else
462
  if test "$with_tk" != ""; then
463
    TARGET_TK_INC="-I$with_tk/generic -I$with_tk/$tclsubdir"
464
    if test "$tclsubdir" = "win"; then
465
      TARGET_TK_INC="$TARGET_TK_INC -I$with_tk/xlib"
466
    fi
467
  else
468
    TARGET_TK_INC=""
469
  fi
470
fi
471
AC_MSG_RESULT($TARGET_TK_INC)
472
AC_SUBST(TARGET_TK_INC)
473
 
474
############
475
# Figure out where to look for BLT header files <blt.h>.
476
#
477
AC_ARG_WITH(blt,
478
[  --with-blt=DIR          Directory holding BLT source tree for target])
479
if test "$config_WITH_BLT" != ""; then
480
  with_tk=$config_WITH_BLT
481
fi
482
AC_MSG_CHECKING([BLT header files])
483
if test "$config_TARGET_BLT_INC" != ""; then
484
  TARGET_BLT_INC=$config_TARGET_BLT_INC
485
else
486
  if test "$with_BLT" != ""; then
487
    TARGET_BLT_INC="-I$with_blt/src"
488
  else
489
    TARGET_BLT_INC=""
490
  fi
491
fi
492
AC_MSG_RESULT($TARGET_BLT_INC)
493
AC_SUBST(TARGET_BLT_INC)
494
 
495
##########
496
# Figure out what libraries are required to compile BLT programs.
497
#
498
if test "$config_TARGET_BLT_LIBS" != ""; then
499
  TARGET_BLT_LIBS="$config_TARGET_BLT_LIBS"
500
else
501
  if test "$with_blt" != ""; then
502
    TARGET_BLT_LIBS=`echo $with_blt/src/libBLT*.a`
503
  else
504
    CC=$TARGET_CC
505
    otherlibs="$TARGET_TK_LIBS $TARGET_X_LIBS $TARGET_TCL_LIBS"
506
    LIBS=""
507
    AC_SEARCH_LIBS(Blt_Init, BLT BLT2.4 BLT24,,,$otherlibs)
508
    TARGET_BLT_LIBS=$LIBS
509
  fi
510
fi
511
AC_SUBST(TARGET_BLT_LIBS)
512
 
513
###########
514
# Generate the Makefile.
515
#
516
exec 7>./Makefile
517
echo "\
518
# Top-level makefile.  This generates a second-tier makefile
519
# and invokes it.  See comments in the \"makemake.tcl.in\" or
520
# \"makemake.tcl\" files for additional information.
521
#
522
TCLSH  = $BUILD_TCLSH
523
" 1>&7
524
cat 1>&7 <<\EOF
525
 
526
all:	all.mk
527
	$(MAKE) -f all.mk all
528
 
529
all.mk:	makemake.tcl
530
	$(TCLSH) makemake.tcl >all.mk
531
 
532
debug:	all.mk
533
	$(MAKE) -f all.mk debug
534
 
535
doc:	all.mk
536
	$(MAKE) -f all.mk doc
537
 
538
install:	all.mk
539
	$(MAKE) -f all.mk install
540
 
541
clean:	all.mk
542
	$(MAKE) -f all.mk clean
543
 
544
distclean:	all.mk
545
	$(MAKE) -f all.mk distclean
546
	rm -f all.mk Makefile makemake.tcl config.*
547
EOF
548
 
549
#########
550
# Generate the output files.
551
#
552
AC_OUTPUT(makemake.tcl)