~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to sys/win32/msdev/configure.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# configure.tcl --
 
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
 
9
#
 
10
# TODO:
 
11
#     string tolower
 
12
#
 
13
#     (more to come)
 
14
#
 
15
#     The script can be run via Tcl/Tk (see the README file
 
16
#     for details).
 
17
#
 
18
#     The textual user-interface allows you to set the
 
19
#     various options.
 
20
#
 
21
#     The chosen options are stored in a file "config.res"
 
22
#     for future use (if this file exists, it is read at
 
23
#     start-up).
 
24
#
 
25
 
 
26
# mainMenu --
 
27
#    Present the main menu
 
28
#
 
29
# Arguments:
 
30
#    None
 
31
# Result:
 
32
#    None
 
33
# Side effects:
 
34
#    New menus may be shown, option values set
 
35
#
 
36
proc mainMenu {} {
 
37
    global stdin
 
38
    global options
 
39
 
 
40
    while {1} {
 
41
        puts "
 
42
PLplot - main configuration menu
 
43
--------------------------------
 
44
 
 
45
Choices:
 
46
 
 
47
1. Precision for floating-point:   $options(float)
 
48
2. Installation directory:         $options(install)
 
49
3. Device drivers:
 
50
      $options(drivers)
 
51
4. Antialiasing:                   $options(antialiasing)
 
52
5. Interpolation libraries:
 
53
      $options(interpolation)
 
54
 
 
55
H. Explanations
 
56
 
 
57
E. Exit and configure
 
58
Q. Exit, do not configure
 
59
 
 
60
Your choice:"
 
61
 
 
62
 
 
63
        set choice [$stdin gets]
 
64
        switch -- $choice {
 
65
        1 - 2 - 3 - 4 - 5 {
 
66
            showMenu$choice
 
67
        }
 
68
        h - H {
 
69
            showHelp main
 
70
        }
 
71
        e - E {
 
72
            runConfiguration
 
73
            break
 
74
        }
 
75
        q - Q {
 
76
            puts "Choices not saved; no re-configuration"
 
77
            break
 
78
        }
 
79
        default {
 
80
            puts "Unknown choice ..."
 
81
        }
 
82
        }
 
83
    }
 
84
    exit
 
85
}
 
86
 
 
87
# showMenu1 --
 
88
#    Present the menu to select the precision
 
89
#
 
90
# Arguments:
 
91
#    None
 
92
# Result:
 
93
#    None
 
94
# Side effects:
 
95
#    Option float set
 
96
#
 
97
proc showMenu1 {} {
 
98
    global stdin
 
99
    global options
 
100
 
 
101
    while {1} {
 
102
        puts "
 
103
PLplot - floating-point precision
 
104
---------------------------------
 
105
 
 
106
Choices:
 
107
 
 
108
Currently: PLplot will use *** $options(float) *** precision
 
109
 
 
110
1. Use single precision
 
111
 
 
112
2. Use double precision
 
113
 
 
114
   Note:
 
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
 
119
   actually is.
 
120
 
 
121
R. Return
 
122
 
 
123
Your choice:"
 
124
 
 
125
        set choice [$stdin gets]
 
126
        switch -- $choice {
 
127
        1 {
 
128
            set options(float) "single"
 
129
        }
 
130
        2 {
 
131
            set options(float) "double"
 
132
        }
 
133
        r - R {
 
134
            break
 
135
        }
 
136
        default {
 
137
            puts "Unknown choice ..."
 
138
        }
 
139
        }
 
140
    }
 
141
}
 
142
 
 
143
# showMenu2 --
 
144
#    Present the menu to select the installation directory
 
145
#
 
146
# Arguments:
 
147
#    None
 
148
# Result:
 
149
#    None
 
150
# Side effects:
 
151
#    Option install set
 
152
#
 
153
proc showMenu2 {} {
 
154
    global stdin
 
155
    global options
 
156
 
 
157
    while {1} {
 
158
        puts "
 
159
PLplot - installation directory
 
160
-------------------------------
 
161
 
 
162
Choices:
 
163
 
 
164
Currently: PLplot will use *** $options(install) ***
 
165
           to install the libraries
 
166
 
 
167
1. Set new directory
 
168
 
 
169
   Note:
 
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.
 
173
 
 
174
   Please note that the files will be stored in
 
175
   subdirectories (include, lib, ...) of the
 
176
   directory you give.
 
177
 
 
178
R. Return
 
179
 
 
180
Your choice:"
 
181
 
 
182
        set choice [$stdin gets]
 
183
        switch -- $choice {
 
184
        1 {
 
185
            puts "New directory: "
 
186
            set options(install) [$stdin gets]
 
187
        }
 
188
        r - R {
 
189
            break
 
190
        }
 
191
        default {
 
192
            puts "Unknown choice ..."
 
193
        }
 
194
        }
 
195
    }
 
196
}
 
197
 
 
198
# showMenu3 --
 
199
#    Present the menu to select the device drivers
 
200
#
 
201
# Arguments:
 
202
#    None
 
203
# Result:
 
204
#    None
 
205
# Side effects:
 
206
#    Option install set
 
207
#
 
208
proc showMenu3 {} {
 
209
    global stdin
 
210
    global options
 
211
 
 
212
    while {1} {
 
213
        puts "
 
214
PLplot - device drivers
 
215
-----------------------
 
216
 
 
217
Choices:
 
218
 
 
219
Currently: PLplot will use the following device drivers:
 
220
           *** $options(drivers) ***
 
221
 
 
222
1. Use a minimum set of drivers (win32 and PostScript only)
 
223
 
 
224
2. Use all standard drivers
 
225
 
 
226
3. Add the following drivers: JPEG and PNG
 
227
 
 
228
   Note:
 
229
   The additional drivers require the GD library to be
 
230
   present on the system.
 
231
 
 
232
R. Return
 
233
 
 
234
Your choice:"
 
235
 
 
236
        set choice [$stdin gets]
 
237
        switch -- $choice {
 
238
        1 {
 
239
            set options(drivers) [join $options(minimum_drivers) ", "]
 
240
        }
 
241
        2 {
 
242
            set options(drivers) [join $options(standard_drivers) ", "]
 
243
        }
 
244
        3 {
 
245
            puts "Not implemented yet!"
 
246
        }
 
247
        r - R {
 
248
            break
 
249
        }
 
250
        default {
 
251
            puts "Unknown choice ..."
 
252
        }
 
253
        }
 
254
    }
 
255
}
 
256
 
 
257
# showMenu4 --
 
258
#    Present the menu to select the antialiasing options
 
259
#
 
260
# Arguments:
 
261
#    None
 
262
# Result:
 
263
#    None
 
264
# Side effects:
 
265
#    Options related to antialiasing set
 
266
#
 
267
proc showMenu4 {} {
 
268
    global stdin
 
269
    global options
 
270
    puts $options
 
271
 
 
272
    while {1} {
 
273
        puts "
 
274
PLplot - antialiasing capabilities
 
275
----------------------------------
 
276
 
 
277
Choices:
 
278
 
 
279
NOT IMPLEMENTED YET
 
280
 
 
281
R. Return
 
282
 
 
283
Your choice:"
 
284
 
 
285
        set choice [$stdin gets]
 
286
        switch -- $choice {
 
287
        r - R {
 
288
            break
 
289
        }
 
290
        default {
 
291
            puts "Unknown choice ..."
 
292
        }
 
293
        }
 
294
    }
 
295
}
 
296
 
 
297
# showMenu5 --
 
298
#    Present the menu to select the interpolation libraries
 
299
#
 
300
# Arguments:
 
301
#    None
 
302
# Result:
 
303
#    None
 
304
# Side effects:
 
305
#    Options related to interpolation set
 
306
#
 
307
proc showMenu5 {} {
 
308
    global stdin
 
309
    global options
 
310
    puts $options
 
311
 
 
312
    while {1} {
 
313
        puts "
 
314
PLplot - interpolation libraries
 
315
--------------------------------
 
316
 
 
317
Choices:
 
318
 
 
319
Currently: PLplot will use the following libraries:
 
320
           *** $options(interpolation) ***
 
321
 
 
322
1. Use the CSA library (cubic splines):     $options(usecsa)
 
323
 
 
324
2. Use the NN library (natural neighbours): $options(usenn)
 
325
 
 
326
   Note:
 
327
   The nearest neighbours (NN) library requires that you
 
328
   have the Qhull library too.
 
329
 
 
330
3. Location of Qhull library: $options(libqhull)
 
331
 
 
332
R. Return
 
333
 
 
334
Your choice:"
 
335
 
 
336
        set choice [$stdin gets]
 
337
        switch -- $choice {
 
338
        1 {
 
339
            yesNo usecsa
 
340
            set options(interpolation) [composeChoices csa nn]
 
341
        }
 
342
        2 {
 
343
            yesNo usenn
 
344
            set options(interpolation) [composeChoices csa nn]
 
345
        }
 
346
        3 {
 
347
            findLibrary qhull qhull.lib qhull.h
 
348
        }
 
349
        r - R {
 
350
            break
 
351
        }
 
352
        default {
 
353
            puts "Unknown choice ..."
 
354
        }
 
355
        }
 
356
    }
 
357
}
 
358
 
 
359
# showHelp --
 
360
#    Present some information
 
361
#
 
362
# Arguments:
 
363
#    name         Name of the chapter
 
364
# Result:
 
365
#    None
 
366
# Side effects:
 
367
#    None
 
368
#
 
369
proc showHelp {name} {
 
370
    global stdin
 
371
 
 
372
    while {1} {
 
373
        puts "
 
374
PLplot - information on the configuration options
 
375
-------------------------------------------------
 
376
 
 
377
Compile options:
 
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.
 
381
 
 
382
External libraries:
 
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.
 
387
 
 
388
More information in the README and INSTALL files
 
389
 
 
390
Press R to return ..."
 
391
 
 
392
        set choice [$stdin gets]
 
393
        switch -- $choice {
 
394
        r - R {
 
395
            break
 
396
        }
 
397
        default {
 
398
            puts "Unknown choice ..."
 
399
        }
 
400
        }
 
401
    }
 
402
}
 
403
 
 
404
# yesNo --
 
405
#    Toggle a choice
 
406
#
 
407
# Arguments:
 
408
#    name       Name of the option to toggle
 
409
# Result:
 
410
#    None
 
411
# Side effects:
 
412
#    Option toggled
 
413
#
 
414
proc yesNo {name} {
 
415
    global options
 
416
 
 
417
    if { [string equal $options($name) "No"] } {
 
418
        set options($name) "Yes"
 
419
    } else {
 
420
        set options($name) "No"
 
421
    }
 
422
}
 
423
 
 
424
# findLibrary --
 
425
#    Find a particular library (and its include files)
 
426
#
 
427
# Arguments:
 
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
 
431
# Result:
 
432
#    None
 
433
# Side effects:
 
434
#    Option indicated by keyword set
 
435
#
 
436
proc findLibrary {keyword libname incname} {
 
437
    global stdin
 
438
    global options
 
439
 
 
440
    set found 0
 
441
 
 
442
    foreach dir [concat [split [env LIB]] $options(lib$keyword)] {
 
443
        if { [file exists "$dir/$libname"] } {
 
444
            set options(lib$keyword) $dir
 
445
            set found 1
 
446
        }
 
447
    }
 
448
    foreach dir [concat [split [env LIB]] $options(inc$keyword)] {
 
449
        if { [file exists "$dir/$incname"] } {
 
450
            set options(inc$keyword) $dir
 
451
            incr found
 
452
        }
 
453
    }
 
454
    if { $found != 3 } {
 
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"
 
460
    }
 
461
}
 
462
 
 
463
# composeChoices --
 
464
#    Compose a list of choices (based on yes/no values)
 
465
#
 
466
# Arguments:
 
467
#    args       List of names to examine (use$name and $name)
 
468
# Result:
 
469
#    "List" of chosen options or "None"
 
470
# Side effects:
 
471
#    None
 
472
#
 
473
proc composeChoices {args} {
 
474
    global options
 
475
 
 
476
    set result {}
 
477
    foreach name $args {
 
478
        if { [info exists options($name)] &&
 
479
             [info exists options(use$name)] } {
 
480
            #
 
481
            # Proceed - otherwise a programming error
 
482
            #
 
483
            #if { [string tolower $options(use$name)] == "yes" } {}
 
484
            if { [string equal $options(use$name) "Yes" } {
 
485
                lappend result $options($name)
 
486
            }
 
487
        } else {
 
488
            puts "PROGRAMMING ERROR: options($name) or options(use$name) \
 
489
does not exist!"
 
490
            exit
 
491
        }
 
492
    }
 
493
    if { [string equal $result ""] } {
 
494
        set result "None"
 
495
    }
 
496
    return [join $result ", "]
 
497
}
 
498
 
 
499
 
 
500
# saveConfiguration --
 
501
#    Save the configuration data
 
502
#
 
503
# Arguments:
 
504
#    None
 
505
# Result:
 
506
#    None
 
507
# Side effects:
 
508
#    Options saved to file for future reference
 
509
#
 
510
proc saveConfiguration {} {
 
511
    global savefile
 
512
    global options
 
513
 
 
514
    set outfile [aio.open $savefile w]
 
515
 
 
516
   #puts $outfile "array set options [list [array get options]]"
 
517
    foreach {key value} $options {
 
518
        $outfile puts [list set options($key) $options($key)]
 
519
    }
 
520
    $outfile close
 
521
}
 
522
 
 
523
# runConfiguration --
 
524
#    Save the configuration data
 
525
#
 
526
# Arguments:
 
527
#    None
 
528
# Result:
 
529
#    None
 
530
# Side effects:
 
531
#    Adjust the various files according to the options
 
532
#
 
533
proc runConfiguration {} {
 
534
 
 
535
    #
 
536
    # Save the options
 
537
    #
 
538
    saveConfiguration
 
539
 
 
540
    #
 
541
    # Adjust the makefile for installing the files
 
542
    #
 
543
    adjustFile "makefile.in" "makefile"
 
544
    adjustFile "plplib/plplib.mak.in" "plplib/makefile"
 
545
 
 
546
    #
 
547
    # Adjust the Fortran examples
 
548
    #
 
549
    puts "Fortran examples not treated yet ..."
 
550
#   set orgdir [pwd]
 
551
#   cd ../../../examples/f77
 
552
#
 
553
#    foreach f [glob *.fm4] {
 
554
#        adjustFile $f "[file root $f].f"
 
555
#    }
 
556
#   cd $orgdir
 
557
 
 
558
    #
 
559
    # Put up a message ...
 
560
    #
 
561
    puts "
 
562
Configuration is complete.
 
563
Run the makefiles to create the actual
 
564
libraries and examples"
 
565
 
 
566
    exit
 
567
}
 
568
 
 
569
# adjustFile --
 
570
#    Adjust the contents of the given file and copy it to a new file
 
571
#
 
572
# Arguments:
 
573
#    srcfile         Name of the original file
 
574
#    dstfile         Name of the new file
 
575
# Result:
 
576
#    None
 
577
# Side effects:
 
578
#    New file written with the new contents
 
579
#
 
580
proc adjustFile {srcfile dstfile} {
 
581
    global options
 
582
 
 
583
    #
 
584
    # Construct the set of old/new strings
 
585
    #
 
586
    set replaces {}
 
587
 
 
588
    #
 
589
    # Single-precision?
 
590
    #
 
591
    if { $options(float) eq "single" } {
 
592
        lappend replaces "~define_plflt~" "#undef PL_DOUBLE"
 
593
        lappend replaces "real*8"         "real*4"
 
594
    } else {
 
595
        lappend replaces ~define_plflt~ "#define PL_DOUBLE"
 
596
        lappend replaces "real*4"         "real*8"
 
597
    }
 
598
 
 
599
    #
 
600
    # Installation directory and other stuff
 
601
    #
 
602
    lappend replaces "~installdir~" "$options(install)"
 
603
    lappend replaces "~version~"    "\"$options(version)\""
 
604
 
 
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"
 
610
    }
 
611
    lappend replaces "~devices~" $device_drivers
 
612
 
 
613
    #
 
614
    # Additional source files
 
615
    #
 
616
    set selected_objs ""
 
617
    if { [string tolower $options(usecsa)] eq "yes" } {
 
618
        append selected_objs "\t\"\$(INTDIR)\\csa.c\" \\\n"
 
619
    }
 
620
    if { [string tolower $options(usenn)] eq "yes" } {
 
621
        append selected_objs "\t\"\$(INTDIR)\\nn.c\" \\\n"
 
622
    }
 
623
    lappend replaces "~selected_objs~" $selected_objs
 
624
 
 
625
    #
 
626
    # Read the file, replace the strings and write the new one
 
627
    #
 
628
    set infile  [aio.open $srcfile r]
 
629
    set outfile [aio.open $dstfile w]
 
630
 
 
631
    set contents  [$infile read]
 
632
    $outfile puts [string map $replaces $contents]
 
633
 
 
634
    $infile  close
 
635
    $outfile close
 
636
}
 
637
 
 
638
# handleCmdOptions --
 
639
#    Interpret the command-line options - if any
 
640
#
 
641
# Arguments:
 
642
#    arglist         List of command-line options
 
643
# Result:
 
644
#    None
 
645
# Side effects:
 
646
#    Set the values in the options array
 
647
#
 
648
proc handleCmdOptions {arglist} {
 
649
    global options
 
650
 
 
651
    foreach a $arglist {
 
652
        switch -glob -- $a {
 
653
            "--with-double"    { set options(float) "double" }
 
654
            "--without-double" { set options(float) "single" }
 
655
            "--with-single"    { set options(float) "single" }
 
656
            "--prefix=*"       -
 
657
            "--installdir=*"   {
 
658
               set dirname [lindex [split $a "="] 1]
 
659
               set options(install) $dirname
 
660
            }
 
661
 
 
662
            default {
 
663
                # Nothing further at the moment
 
664
            }
 
665
        }
 
666
    }
 
667
}
 
668
 
 
669
# main --
 
670
#     Initialise all options and get the GUI started
 
671
#
 
672
#
 
673
global savefile
 
674
global options
 
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) ", "]
 
692
 
 
693
load jim-aio
 
694
global stdin
 
695
set stdin [aio.open standard input]
 
696
 
 
697
# file --
 
698
#    Compatibility command for jim
 
699
#
 
700
proc file {cmd args} {
 
701
    switch -- $cmd {
 
702
    exists {
 
703
        if { [catch {
 
704
                 set infile [aio.open [lindex $args 0]]
 
705
              } msg] } {
 
706
            return 0
 
707
        } else {
 
708
            $infile close
 
709
            return 1
 
710
        }
 
711
    }
 
712
    }
 
713
}
 
714
 
 
715
 
 
716
if { [file exists $savefile] } {
 
717
    source $savefile
 
718
}
 
719
handleCmdOptions $argv
 
720
 
 
721
mainMenu