File: vms_make.com

package info (click to toggle)
gpdf 2.8.2-1.2sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,220 kB
  • ctags: 6,624
  • sloc: cpp: 61,071; ansic: 12,100; sh: 6,017; xml: 2,299; makefile: 589
file content (736 lines) | stat: -rw-r--r-- 19,944 bytes parent folder | download | duplicates (12)
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
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
$!========================================================================
$!
$! Main Xpdf compile script for VMS.
$!
$! Written by Patrick Moreau, Martin P.J. Zinser.
$!
$! Copyright 1996-2003 Glyph & Cog, LLC
$!
$!========================================================================
$!
$! This procedure takes up to three (optional) parameters:
$!
$! 1.) Configuration settings:
$!
$!     a4             - Use european A4 as the default paper size.
$!
$!     no_text_select - Disable text selection in Xpdf
$!
$!     opi_support    - Compile Xpdf with support for the Open Prepress 
$!                      Interface (OPI)
$!
$! 2.) Compiler detection:
$!
$!     In case you want to override the automatic compiler detection
$!     specify either DECC or GCC as the second paramter,
$!     e.g. @vms_make "" GCC 
$!
$! 3.) System Xpdf resource file
$!
$!     The default for this is decw$system_defaults:xpdfrc.dat, since this
$!     is the standard place for systemwide Xdefaults files on OpenVMS. You
$!     may provide a different file in p3.
$!
$! External libraries (like T1lib, Freetype, and XPM) are supported via the 
$! config file VMSLIB.DAT. Please check the sample file, which will be created
$! by this procedure upon first invocation, for the information you need to 
$! provide 
$!
$! Sample invocation of the script:
$!                 @vms_make a4,opi_support "" 
$!
$! In case of problems with the compile you may contact me at 
$! zinser@decus.de (preferred) or zinser@sysdev.deutsche-boerse.com (work). 
$!
$!========================================================================
$!
$ on error then goto err_exit
$!
$!
$! Just some general constants...
$!
$ true  = 1
$ false = 0
$ xpdf_link :== link
$ tmpnam = "temp_" + f$getjpi("","pid")
$ tc = tmpnam + ".c"
$!
$! Setup variables holding "config" information
$!
$ aconf_in_file = "aconf_h.in#aconf.h_in#aconf.h.in"
$ name        = "Xpdf"
$ version     = "?.?"
$ mydefs        = "#"
$ xlibs         = "xt#xmu#motif"
$ cxxdefs       = ""
$ libdefs       = "\"
$ libincs       = ""
$ float         = ""
$ compress_def  = false
$ ft2def        = false
$ x11_save      = ""
$ p2 = f$edit(p2,"upcase,trim")
$ if f$edit(p3,"trim") .eqs. "" 
$ then 
$   resfil = "decw$system_defaults:xpdfrc.dat"
$ else
$   resfil = "'p3'"
$ endif
$!
$ gosub proc_config
$ gosub check_version
$!
$! Start building the option file
$!
$ open/write optf xpdf.opt
$ open/write topt tmp.opt
$ write optf "Identification=""''name' ''version'"""
$ gosub check_create_vmslib
$ gosub check_xlib
$!
$ if (f$getsyi("HW_MODEL").ge.1024) .and. - 
     (f$locate("T1LIB",f$edit(libdefs,"UPCASE")) .lt. f$length(libdefs)) -
     then float  = "/float=ieee_float"
$ incs = "sys$library:,[-],[],[-.goo]''libincs'"     
$!
$ gosub check_compiler
$ close optf
$ close topt
$!
$! aconf.h.in might be mapped in different ways, so go figure
$!
$ i = 0
$FIND_ACONF:
$ fname = f$element(i,"#",aconf_in_file)
$ if fname .eqs. "#" then goto AMISS_ERR
$ if f$search(fname) .eqs. ""
$ then 
$   i = i + 1
$   goto find_aconf
$ endif
$ open/read/err=aconf_err aconf_in 'fname'
$ open/write aconf aconf.h
$ACONF_LOOP:
$ read/end_of_file=aconf_exit aconf_in line
$ work = f$edit(line, "compress,trim")
$ if f$extract(0,6,work) .nes. "#undef"
$ then
$   write aconf line
$ else
$   def = f$element(1," ",work)
$   if ((f$locate("\''def'\",f$edit(libdefs,"UPCASE")) .lt. f$length(libdefs)) -
        .or. (f$locate("#''def'#",f$edit(mydefs,"UPCASE")) .lt. f$length(mydefs))) 
$   then
$     write aconf "#define ", def, " 1"
$   else
$     gosub check_config
$   endif
$ endif
$!
$! Make sure old-style VMS is defined along with __VMS
$!
$ if f$locate("define ACONF_H",line) .lt. f$length(line) 
$ then
$    write aconf "#define VMS 1"
$ endif
$ goto aconf_loop
$ACONF_EXIT:
$ close aconf_in
$ close aconf
$ write sys$output "Compiling in [.GOO]"
$ set default [.goo]
$ @vms_make
$ write sys$output "Compiling in [.XPDF]"
$ set default [-.xpdf]
$ @vms_make
$ set default [-]
$ gosub reset_env
$ dele/noconf/nolog tmp.opt;*
$ exit
$ACONF_ERR:
$ write sys$output "Input file ''fname' could not be opened"
$ goto err_exit
$AMISS_ERR:
$ write sys$output "No source for aconf.h found."
$ write sys$output "Tried any of ''aconf_in_file'"
$CXX_ERR:
$ write sys$output "C++ compiler required to build Xpdf"
$ goto err_exit
$FT2_ERR:
$ write sys$output "Can not find [.internal] sub-dir in Freetype 2 tree"
$ goto err_exit
$ERR_EXIT:
$ set message/facil/ident/sever/text
$ gosub reset_env
$ close/nolog aconf_in
$ close/nolog aconf
$ close/nolog optf
$ close/nolog tmpc
$ close/nolop topt
$ write sys$output "Exiting..."  
$ exit 2
$!------------------------------------------------------------------------------
$!
$! Take care of driver file with information about external libraries
$!
$CHECK_CREATE_VMSLIB:
$!
$ if f$search("VMSLIB.DAT") .eqs. ""
$ then
$   type/out=vmslib.dat sys$input
!
! This is a simple driver file with information used by vms_make.com to
! check if external libraries (like t1lib and freetype) are available on
! the system.
!
! Layout of the file:
!
!    - Lines starting with ! are treated as comments
!    - Elements in a data line are separated by # signs
!    - The elements need to be listed in the following order
!      1.) Name of the Library (only used for informative messages 
!                               from vms_make.com)
!      2.) Location where the object library can be found
!      3.) Location where the include files for the library can be found
!      4.) Include file used to verify library location
!      5.) CPP define to pass to the build to indicate availability of 
!          the library
!
! Example: The following  lines show how definitions  
!          might look like. They are site specific and the locations of the 
!          library and include files need almost certainly to be changed.
! 
! Location: All of the libaries can be found at the following addresses
!
!   T1LIB:     http://www.decus.de:8080/www/vms/sw/t1lib.htmlx
!   FREETYPE:  http://www.decus.de:8080/www/vms/sw/freetype2.htmlx
!   XPM:       http://www.decus.de:8080/www/vms/sw/xpm.htmlx
!   LIBPAPER:  http://www.decus.de:8080/www/vms/sw/libpaper.htmlx
!
!T1LIB    # pubbin:t1shr.exe        # public$root:[xtools.libs.t1lib.lib.t1lib] # t1lib.h    # HAVE_T1LIB_H
!FREETYPE # pubbin:freetype2shr.exe # public$root:[xtools.libs.ft2.include.freetype],public$root:[xtools.libs.ft2.include] # freetype.h # HAVE_FREETYPE_H\FREETYPE2
!XPM      # pubbin:libxpm.olb       # X11:                                      # xpm.h      # HAVE_X11_XPM_H
!LIBPAPER # pubbin:libpapershr.exe  # public$root:[util.libs.paper.lib]         # paper.h    # HAVE_PAPER_H
$   write sys$output "New driver file vmslib.dat created."
$   write sys$output "Please customize libary locations for your site"
$   write sys$output "and afterwards re-execute vms_make.com"
$   write sys$output "Exiting..."
$   close/nolog optf
$   exit
$ endif
$!
$! Open data file with location of libraries
$!
$ open/read/end=end_lib/err=err_lib libdata VMSLIB.DAT
$LIB_LOOP:
$ read/end=end_lib libdata libline
$ libline = f$edit(libline, "UNCOMMENT,COLLAPSE")
$ if libline .eqs. "" then goto LIB_LOOP ! Comment line
$ libname = f$edit(f$element(0,"#",libline),"UPCASE")
$ write sys$output "Processing ''libname' setup ..."
$ libloc  = f$element(1,"#",libline)
$ libsrc  = f$element(2,"#",libline)
$ testinc = f$element(3,"#",libline)
$ cppdef  = f$element(4,"#",libline)
$ old_cpp = f$locate("=1",cppdef)
$ if old_cpp.lt.f$length(cppdef) then cppdef = f$extract(0,old_cpp,cppdef)
$ if f$search("''libloc'").eqs. ""
$ then
$   write sys$output "Can not find library ''libloc' - Skipping ''libname'"
$   goto LIB_LOOP
$ endif
$ libsrc_elem = 0
$ libsrc_found = false
$LIBSRC_LOOP:
$ libsrcdir = f$element(libsrc_elem,",",libsrc)
$ if (libsrcdir .eqs. ",") then goto END_LIBSRC
$ if f$search("''libsrcdir'''testinc'") .nes. "" then libsrc_found = true
$ libsrc_elem = libsrc_elem + 1
$ goto LIBSRC_LOOP
$END_LIBSRC:
$ if .not. libsrc_found
$ then
$   write sys$output "Can not find includes at ''libsrc' - Skipping ''libname'"
$   goto LIB_LOOP
$ endif
$ libdefs = libdefs +  cppdef + "\"
$ libincs = libincs + "," + libsrc
$ lqual = "/lib"
$ libtype = f$edit(f$parse(libloc,,,"TYPE"),"UPCASE")
$ if f$locate("EXE",libtype) .lt. f$length(libtype) then lqual = "/share"
$ write optf libloc , lqual
$ write topt libloc , lqual
$!
$! Nasty hack to get the freetype includes to work
$!
$ if ((libname .eqs. "FREETYPE") .and. -
      (f$locate("FREETYPE2",cppdef) .lt. f$length(cppdef)))
$ then
$   if ((f$search("freetype:freetype.h") .nes. "") .and. -
        (f$search("freetype:[internal]ftobjs.h") .nes. ""))
$   then
$     write sys$output "Will use local definition of freetype logical"
$     ft2def = false
$   else
$     ft2elem = 0 
$FT2_LOOP:
$     ft2srcdir = f$element(ft2elem,",",libsrc)
$     if f$search("''ft2srcdir'''testinc'") .nes. ""
$     then
$        if f$search("''ft2srcdir'internal.dir") .nes. ""
$        then
$          ft2dev  = f$parse("''ft2srcdir'",,,"device","no_conceal")
$          ft2dir  = f$parse("''ft2srcdir'",,,"directory","no_conceal")
$          ft2conc = f$locate("][",ft2dir)
$          ft2len  = f$length(ft2dir)
$          if ft2conc .lt. ft2len
$          then
$             ft2dir = f$extract(0,ft2conc,ft2dir) + -
                       f$extract(ft2conc+2,ft2len-2,ft2dir)
$          endif
$          ft2dir = ft2dir - "]" + ".]"
$          define freetype 'ft2dev''ft2dir','ft2srcdir'
$          ft2def = true
$        else
$          goto ft2_err
$        endif
$     else
$       ft2elem = ft2elem + 1
$       goto ft2_loop
$     endif
$   endif	 
$ endif
$!
$! Yet another special treatment for Xpm/X11
$!
$ if (libname .eqs. "XPM")
$ then
$   my_x11 = f$parse("''libsrc'xpm.h",,,"device") + - 
             f$parse("''libsrc'xpm.h",,,"directory")
$   x11_save = f$trnlnm("X11")
$   define x11 'my_x11',decw$include   
$ endif 
$ goto LIB_LOOP
$END_LIB:
$ close libdata
$ return
$!------------------------------------------------------------------------------
$!
$! Take care of driver file with information about external libraries
$!
$CHECK_CONFIG:
$!
$ if (def .eqs. "SYSTEM_XPDFRC")
$ then
$   write aconf "#define SYSTEM_XPDFRC """, resfil, """" 
$ else
$   gosub check_cc_def
$ endif
$ return
$!------------------------------------------------------------------------------
$!
$! Check if this is a define relating to the properties of the C/C++
$! compiler
$!
$CHECK_CC_DEF:
$ if (def .eqs. "HAVE_DIRENT_H")
$ then
$   copy sys$input: 'tc
$   deck
#include <dirent.h>
int main(){
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_SYS_NDIR_H")
$ then
$   copy sys$input: 'tc
$   deck
#include <sys/ndir.h>
int main(){
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_SYS_DIR_H")
$ then
$   copy sys$input: 'tc
$   deck
#include <sys/dir.h>
int main(){
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_NDIR_H")
$ then
$   copy sys$input: 'tc
$   deck
#include <ndir.h>
int main(){
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_SYS_SELECT_H")
$ then
$   copy sys$input: 'tc
$   deck
#include <sys/select.h>
int main(){
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_SYS_BSDTYPES_H")
$ then
$   copy sys$input: 'tc
$   deck
#include <sys/bsdtypes.h>
int main(){
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_STRINGS_H")
$ then
$   copy sys$input: 'tc
$   deck
#include <strings.h>
int main(){
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_POPEN")
$ then
$   copy sys$input: 'tc
$   deck
#include <stdio.h>

int main(){
FILE *pipe;
 pipe = popen("DIR","r");
 pclose(pipe);
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_MKSTEMP")
$ then
$   copy sys$input: 'tc
$   deck
#include <stdlib.h>

int main(){
  mkstemp("tempXXXXXX");
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_FSEEKO")
$ then
$   copy sys$input: 'tc
$   deck
#define _LARGEFILE
#include <stdio.h>

int main(){
FILE *fp;
  fp = fopen("temp.txt","r");
  fseeko(fp,1,SEEK_SET);
  fclose(fp);
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "_LARGE_FILES")
$ then
$   copy sys$input: 'tc
$   deck
#define _LARGEFILE
#include <stdio.h>

int main(){
FILE *fp;
  fp = fopen("temp.txt","r");
  fseeko(fp,1,SEEK_SET);
  fclose(fp);
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ if (def .eqs. "HAVE_XTAPPSETEXITFLAG")
$ then
$   copy sys$input: 'tc
$   deck
#include <X11/Intrinsic.h>

int main(){
  XtAppContext  app_context;
  app_context = XtCreateApplicationContext();
  XtAppSetExitFlag(app_context);
  return 0;
}
$   eod
$   gosub cc_prop_check
$   return
$ endif
$ write aconf "/* ", line, " */" 
$ return
$!------------------------------------------------------------------------------
$!
$! Process config settings passed from the command line
$! (analog to Unix --enable-xxx)
$!
$PROC_CONFIG: 
$ if (p1.nes."")
$ then
$   i = 0
$   qual_list = f$edit(p1,"upcase")
$DEF_LOOP:
$   qual = f$element(i,",",qual_list)
$   if qual .eqs. "," then goto FINISH_DEF
$   i = i + 1
$   if (qual .eqs. "A4")
$   then 
$     mydefs = mydefs + "A4_PAPER#"
$     goto def_loop
$   endif
$   if (qual .eqs. "NO_TEXT_SELECT")
$   then
$     mydefs = mydefs + "NO_TEXT_SELECT#" 
$     goto def_loop
$   endif
$   if (qual .eqs. "OPI_SUPPORT")
$   then
$     mydefs = mydefs + "OPI_SUPPORT#" 
$     goto def_loop
$   endif
$   if (qual .eqs. "COMPRESS")
$   then
$     compress_def = true 
$     goto def_loop
$   endif
$   write sys$output "Qualifier ''qual' not recognized, will be ignored"
$   goto def_loop
$ endif
$FINISH_DEF:
$ return
$!
$!------------------------------------------------------------------------------
$!
$! Look for the compiler used 
$!
$CHECK_COMPILER:
$ its_decc = (f$search("SYS$SYSTEM:CXX$COMPILER.EXE") .nes. "")
$ its_gnuc = .not. its_decc .and. (f$trnlnm("gnu_cc") .nes. "")
$!
$! Exit if no compiler available
$!
$ if (.not. (its_decc .or. its_gnuc)) then goto CXX_ERR
$!
$! Override if requested from the commandline
$!
$ if (p2 .eqs. "DECC")
$ then
$   its_decc = true
$   its_gnuc = false 
$ endif
$ if (p1 .eqs. "GNUC")
$ then
$   its_decc = false
$   its_gnuc = true
$ endif
$!
$ if its_decc
$ then
$   ccomp :== "cc/decc/prefix=all ''float'"
$!
$! Take care of includes
$!
$   cc_user    = f$trnlnm("DECC$USER_INCLUDE")
$   cc_system  = f$trnlnm("DECC$SYSTEM_INCLUDE")
$   cxx_user   = f$trnlnm("CXX$USER_INCLUDE")
$   cxx_system = f$trnlnm("CXX$SYSTEM_INCLUDE")
$   define decc$system_include  'incs'
$   define decc$user_include    'incs'
$   define cxx$user_include     'incs'
$   define cxx$system_include   'incs'
$!
$! Check version of the C++ compiler
$! 
$   create vms_xpdf_cc_test.cc
$   cxx/lis=vms_xpdf_cc_test.lis/show=all vms_xpdf_cc_test.cc
$   open list vms_xpdf_cc_test.lis
$CXX_LIST:
$   read/end=close_cxx list line
$   start = f$locate("__DECCXX_VER",line)
$   if start .ne. f$length(line)
$   then
$     cxx_ver = f$extract(start+13,8,line)
$     if cxx_ver .gt. 60000000
$     then 
$       cxxdefs = "/warn=(disable=nosimpint)"
$       xpdf_link :== cxxlink
$     endif
$     goto close_cxx
$   endif
$   goto cxx_list
$CLOSE_CXX:
$   close list
$   delete/noconfirm vms_xpdf_cc_test.*;*
$   cxxcomp :== "cxx/prefix=all ''cxxdefs' ''float' /include=cxx$user_include"
$ endif
$!
$ if its_gnuc
$ then
$   ccomp   :== "gcc/nocase/include=(''incs')"
$   cxxcomp :== "gcc/plusplus/nocase/include=(''incs')"
$   write optf "gnu_cc:[000000]gcclib.olb/lib"
$   write optf "sys$share:vaxcrtl.exe/share"
$ endif
$ return
$-------------------------------------------------------------------------------
$RESET_ENV:
$ delete/sym/glob cxxcomp
$ delete/sym/glob ccomp
$ delete/sym/glob xpdf_link
$ if (ft2def) then deassign freetype
$ if its_decc
$ then
$  if cc_user .eqs. ""
$  then
$    deass decc$user_include
$  else
$    define decc$user_include 'cc_user'
$  endif
$  if cc_system .eqs. ""
$  then
$    deass decc$system_include
$  else
$    define decc$system_include 'cc_system'
$  endif
$  if cxx_user .eqs. ""
$  then
$    deass cxx$user_include
$  else
$    define cxx$user_include 'cxx_user'
$  endif
$  if cxx_system .eqs. ""
$  then
$    deass cxx$system_include
$  else
$    define cxx$system_include 'cxx_system'
$  endif
$ endif
$ if (x11_save .nes. "") then define x11 'x11_save'
$ return
$!
$!------------------------------------------------------------------------------
$!
$! Check for properties of C/C++ compiler
$!
$CC_PROP_CHECK:
$ cc_prop = true
$ set message/nofac/noident/nosever/notext
$ on error then continue
$ cc 'tmpnam'
$ if .not. ($status)  then cc_prop = false
$ on error then continue
$! The headers might lie about the capabilities of the RTL
$ link/opt=tmp.opt 'tmpnam'
$ if .not. ($status)  then cc_prop = false
$ set message/fac/ident/sever/text
$ on error then goto err_exit
$ delete/nolog 'tmpnam'.*;*
$ if cc_prop 
$ then
$   write sys$output "Checking for ''def'... yes"
$   write aconf "#define ''def' 1"
$   if (def .eqs. "HAVE_FSEEKO") .or. (def .eqs. "_LARGE_FILES") then - 
      write aconf "#define _LARGEFILE"
$ else 
$   write sys$output "Checking for ''def'... no"
$   write aconf line
$ endif
$ return
$!------------------------------------------------------------------------------
$!
$! Check Xlibs and write to options file
$!
$CHECK_XLIB:
$ If F$Type (xlibs) .nes. "STRING" Then xlibs = ""
$ need_xt = f$locate("XT",f$edit(xlibs,"upcase")) .lt. f$length(xlibs)
$ need_xmu = f$locate("XMU",f$edit(xlibs,"upcase")) .lt. f$length(xlibs)
$ need_xm  = f$locate("MOTIF",f$edit(xlibs,"upcase")) .lt. f$length(xlibs)
$ On Error Then GoTo XUI
$ @sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version
$ if f$extract(4,3,decw$version).eqs."1.0"
$ then
$   if need_xt .or. need_xmu .or. need_xm 
$   then 
$      write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share"
$      write topt "Sys$share:DECW$DWTLIBSHR.EXE/Share"
$   endif
$ endif
$ if f$extract(4,3,decw$version).eqs."1.1"
$ then
$   if need_xm  then write optf "sys$share:decw$xmlibshr.exe/share"
$   if need_xt  then write optf "sys$share:decw$xtshr.exe/share"
$   if nedd_xmu then write optf "sys$share:decw$xmulibshr.exe/share"
$   if need_xm  then write topt "sys$share:decw$xmlibshr.exe/share"
$   if need_xt  then write topt "sys$share:decw$xtshr.exe/share"
$   if nedd_xmu then write topt "sys$share:decw$xmulibshr.exe/share"
$ endif
$ if f$extract(4,3,decw$version).eqs."1.2"
$ then
$   if need_xm  then write optf "sys$share:decw$xmlibshr12.exe/share"
$   if need_xt  then write optf "sys$share:decw$xtlibshrr5.exe/share"
$   if need_xmu then write optf "sys$share:decw$xmulibshrr5.exe/share"
$   if need_xm  then write topt "sys$share:decw$xmlibshr12.exe/share"
$   if need_xt  then write topt "sys$share:decw$xtlibshrr5.exe/share"
$   if need_xmu then write topt "sys$share:decw$xmulibshrr5.exe/share"
$ endif
$ GoTo MAIN
$ XUI:
$!
$ if need_xt .or. need_xmu 
$ then 
$   write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share"
$   write topt "Sys$share:DECW$DWTLIBSHR.EXE/Share"
$ endif 
$ MAIN:
$ on error then goto err_exit
$ write optf "sys$share:decw$xlibshr.exe/share"
$ write topt "sys$share:decw$xlibshr.exe/share"
$ return
$!------------------------------------------------------------------------------
$!
$! Check version of Xpdf to build
$!
$CHECK_VERSION:
$ open/read in [.xpdf]config.h
$ check_string = "xpdfVersionNum"
$vloop:
$ read/end=vdone in rec
$ if (f$element(1," " ,rec) .nes. check_string) then goto vloop
$ start = f$locate(check_string,rec) + f$length(check_string)
$ len   = f$length(rec) - start 
$ version = f$edit(f$extract(start,len,rec),"COLLAPSE")
$vdone:
$ close in
$ return
$!------------------------------------------------------------------------------