2
# Simple configuration script for the Windows version of
3
# PLplot. It recognises the following options:
4
# --with-double Use double precision reals (default)
5
# --without-double Use single precision reals instead
6
# --with-single Use single precision reals instead
7
# --prefix=directory Directory to install PLplot in
8
# --installdir=directory Directory to install PLplot in
15
# The script can be run via Tcl/Tk (see the README file
18
# The textual user-interface allows you to set the
21
# The chosen options are stored in a file "config.res"
22
# for future use (if this file exists, it is read at
27
# Present the main menu
34
# New menus may be shown, option values set
42
PLplot - main configuration menu
43
--------------------------------
47
1. Precision for floating-point: $options(float)
48
2. Installation directory: $options(install)
51
4. Antialiasing: $options(antialiasing)
52
5. Interpolation libraries:
53
$options(interpolation)
58
Q. Exit, do not configure
63
set choice [$stdin gets]
76
puts "Choices not saved; no re-configuration"
80
puts "Unknown choice ..."
88
# Present the menu to select the precision
103
PLplot - floating-point precision
104
---------------------------------
108
Currently: PLplot will use *** $options(float) *** precision
110
1. Use single precision
112
2. Use double precision
115
This choice is important for interacting with
116
programs that do not explicitly use the PLFLT type
117
and for programming languages other than C or C++,
118
as they can not be told what the PLFLT type
125
set choice [$stdin gets]
128
set options(float) "single"
131
set options(float) "double"
137
puts "Unknown choice ..."
144
# Present the menu to select the installation directory
159
PLplot - installation directory
160
-------------------------------
164
Currently: PLplot will use *** $options(install) ***
165
to install the libraries
170
This choice is important for creating your own
171
software using PLplot and for finding all the
172
files that you need to distrbute.
174
Please note that the files will be stored in
175
subdirectories (include, lib, ...) of the
182
set choice [$stdin gets]
185
puts "New directory: "
186
set options(install) [$stdin gets]
192
puts "Unknown choice ..."
199
# Present the menu to select the device drivers
214
PLplot - device drivers
215
-----------------------
219
Currently: PLplot will use the following device drivers:
220
*** $options(drivers) ***
222
1. Use a minimum set of drivers (win32 and PostScript only)
224
2. Use all standard drivers
226
3. Add the following drivers: JPEG and PNG
229
The additional drivers require the GD library to be
230
present on the system.
236
set choice [$stdin gets]
239
set options(drivers) [join $options(minimum_drivers) ", "]
242
set options(drivers) [join $options(standard_drivers) ", "]
245
puts "Not implemented yet!"
251
puts "Unknown choice ..."
258
# Present the menu to select the antialiasing options
265
# Options related to antialiasing set
274
PLplot - antialiasing capabilities
275
----------------------------------
285
set choice [$stdin gets]
291
puts "Unknown choice ..."
298
# Present the menu to select the interpolation libraries
305
# Options related to interpolation set
314
PLplot - interpolation libraries
315
--------------------------------
319
Currently: PLplot will use the following libraries:
320
*** $options(interpolation) ***
322
1. Use the CSA library (cubic splines): $options(usecsa)
324
2. Use the NN library (natural neighbours): $options(usenn)
327
The nearest neighbours (NN) library requires that you
328
have the Qhull library too.
330
3. Location of Qhull library: $options(libqhull)
336
set choice [$stdin gets]
340
set options(interpolation) [composeChoices csa nn]
344
set options(interpolation) [composeChoices csa nn]
347
findLibrary qhull qhull.lib qhull.h
353
puts "Unknown choice ..."
360
# Present some information
363
# name Name of the chapter
369
proc showHelp {name} {
374
PLplot - information on the configuration options
375
-------------------------------------------------
378
PLplot has a single compile option, the precision
379
of floating-point numbers. This can be used to
380
comply better to the default of your programs.
383
PLplot can be configured to use various external
384
libraries to enhance its capabilities. As these
385
are maintained by others than the PLplot team,
386
you will need to get them yourself.
388
More information in the README and INSTALL files
390
Press R to return ..."
392
set choice [$stdin gets]
398
puts "Unknown choice ..."
408
# name Name of the option to toggle
417
if { [string equal $options($name) "No"] } {
418
set options($name) "Yes"
420
set options($name) "No"
425
# Find a particular library (and its include files)
428
# keyword Keyword to store the information in
429
# libname Name of the library to find
430
# incname Name of the include file to find
434
# Option indicated by keyword set
436
proc findLibrary {keyword libname incname} {
442
foreach dir [concat [split [env LIB]] $options(lib$keyword)] {
443
if { [file exists "$dir/$libname"] } {
444
set options(lib$keyword) $dir
448
foreach dir [concat [split [env LIB]] $options(inc$keyword)] {
449
if { [file exists "$dir/$incname"] } {
450
set options(inc$keyword) $dir
455
puts "File $libname or $incname not found!"
456
puts "Please enter the parent directory where they reside: "
457
set dir [$stdin gets]
458
set options(lib$keyword) "$dir\\lib"
459
set options(inc$keyword) "$dir\\include"
464
# Compose a list of choices (based on yes/no values)
467
# args List of names to examine (use$name and $name)
469
# "List" of chosen options or "None"
473
proc composeChoices {args} {
478
if { [info exists options($name)] &&
479
[info exists options(use$name)] } {
481
# Proceed - otherwise a programming error
483
#if { [string tolower $options(use$name)] == "yes" } {}
484
if { [string equal $options(use$name) "Yes" } {
485
lappend result $options($name)
488
puts "PROGRAMMING ERROR: options($name) or options(use$name) \
493
if { [string equal $result ""] } {
496
return [join $result ", "]
500
# saveConfiguration --
501
# Save the configuration data
508
# Options saved to file for future reference
510
proc saveConfiguration {} {
514
set outfile [aio.open $savefile w]
516
#puts $outfile "array set options [list [array get options]]"
517
foreach {key value} $options {
518
$outfile puts [list set options($key) $options($key)]
523
# runConfiguration --
524
# Save the configuration data
531
# Adjust the various files according to the options
533
proc runConfiguration {} {
541
# Adjust the makefile for installing the files
543
adjustFile "makefile.in" "makefile"
544
adjustFile "plplib/plplib.mak.in" "plplib/makefile"
547
# Adjust the Fortran examples
549
puts "Fortran examples not treated yet ..."
551
# cd ../../../examples/f77
553
# foreach f [glob *.fm4] {
554
# adjustFile $f "[file root $f].f"
559
# Put up a message ...
562
Configuration is complete.
563
Run the makefiles to create the actual
564
libraries and examples"
570
# Adjust the contents of the given file and copy it to a new file
573
# srcfile Name of the original file
574
# dstfile Name of the new file
578
# New file written with the new contents
580
proc adjustFile {srcfile dstfile} {
584
# Construct the set of old/new strings
591
if { $options(float) eq "single" } {
592
lappend replaces "~define_plflt~" "#undef PL_DOUBLE"
593
lappend replaces "real*8" "real*4"
595
lappend replaces ~define_plflt~ "#define PL_DOUBLE"
596
lappend replaces "real*4" "real*8"
600
# Installation directory and other stuff
602
lappend replaces "~installdir~" "$options(install)"
603
lappend replaces "~version~" "\"$options(version)\""
605
set device_drivers {}
606
foreach driver $options(drivers) {
607
set driver [string map {, ""} $driver]
608
append device_drivers \
609
"[string toupper $driver] = PLD_$driver\n"
611
lappend replaces "~devices~" $device_drivers
614
# Additional source files
617
if { [string tolower $options(usecsa)] eq "yes" } {
618
append selected_objs "\t\"\$(INTDIR)\\csa.c\" \\\n"
620
if { [string tolower $options(usenn)] eq "yes" } {
621
append selected_objs "\t\"\$(INTDIR)\\nn.c\" \\\n"
623
lappend replaces "~selected_objs~" $selected_objs
626
# Read the file, replace the strings and write the new one
628
set infile [aio.open $srcfile r]
629
set outfile [aio.open $dstfile w]
631
set contents [$infile read]
632
$outfile puts [string map $replaces $contents]
638
# handleCmdOptions --
639
# Interpret the command-line options - if any
642
# arglist List of command-line options
646
# Set the values in the options array
648
proc handleCmdOptions {arglist} {
653
"--with-double" { set options(float) "double" }
654
"--without-double" { set options(float) "single" }
655
"--with-single" { set options(float) "single" }
658
set dirname [lindex [split $a "="] 1]
659
set options(install) $dirname
663
# Nothing further at the moment
670
# Initialise all options and get the GUI started
675
set savefile "config.res"
676
set options(version) "5.6.0"
677
set options(float) "double"
678
set options(install) "c:\\plplot"
679
set options(drivers) "?"
680
set options(antialiasing) "No"
681
set options(interpolation) "None"
682
set options(csa) "Cubic splines"
683
set options(usenn) "No"
684
set options(usecsa) "No"
685
set options(nn) "Natural neighbours"
686
set options(usenn) "No"
687
set options(libqhull) "?"
688
set options(incqhull) "?"
689
set options(minimum_drivers) {win3 ps}
690
set options(standard_drivers) {win3 lj_hpgl null plmeta ps xfig}
691
set options(drivers) [join $options(standard_drivers) ", "]
695
set stdin [aio.open standard input]
698
# Compatibility command for jim
700
proc file {cmd args} {
704
set infile [aio.open [lindex $args 0]]
716
if { [file exists $savefile] } {
719
handleCmdOptions $argv