$! File: pyconfig_h.com $! $! This procedure attempts to figure out how to build a pyconfig.h file $! for the current project. $! $! It assumes that the CONFIGURE_THIS has been run to produce the $! the setup_'package'_com, and that procedure has been run. $! $! The CONFIGURE shell script will be examined for hints and a few symbols $! but most of the tests will not produce valid results on OpenVMS. Some $! will produce false positives and some will produce false negatives. $! $! It is easier to just read the pyconfig.h_in file and make up tests based $! on what is in it! $! $! This file will create an empty pyconfig_vms.h file if one does not exist. $! The pyconfig_vms.h is intended for manual edits to handle things that $! this procedure can not. $! $! The pyconfig_vms.h will be invoked by the resulting pyconfig.h file. $! $! This procedure knows about the DEC C RTL on the system it is on, and $! will also be able to detect and use the FRONTPORT library. $! Future versions may be handle the GNV, the OpenVMS porting library, $! and others. $! $! This procedure may not guess the options correctly for both architectures. $! $! P1 Indicates the porting libraries to be used. If not specified, this $! procedure will default to using FRONTPORT. $! $! If you specify a P1 parameter, then it must contain the names $! of all porting libraries in addition to the DECC RTL that should $! be used. $! $! FRONTPORT is currently the only name recognized. $! $! 15-Jan-2001 J. Malmberg Original $! 29-Apr-2001 J. Malmberg Also look for pyconfig.*in* in a [.include] $! subdirectory $! 30-Apr-2001 J. Malmberg Update for SAMBA checks $!============================================================================ $! $ss_normal = 1 $ss_abort = 44 $ss_control_y = 1556 $status = ss_normal $on control_y then goto control_y $on warning then goto general_error $! $! Some information for writing timestamps to created files $!---------------------------------------------------------- $my_proc = f$environment("PROCEDURE") $my_proc_file = f$parse(my_proc,,,"NAME") + f$parse(my_proc,,,"TYPE") $tab[0,8] = 9 $datetime = f$element(0,".",f$cvtime(,"ABSOLUTE","DATETIME")) $username = f$edit(f$getjpi("","USERNAME"),"TRIM") $! $pid = f$getjpi("","PID") $tfile1 = "SYS$SCRATCH:pyconfig_h_temp1_''pid'.TEMP" $dchfile = "SYS$SCRATCH:pyconfig_h_decc_''pid'.TEMP" $! $! $! Has the proper setup been run? $!------------------------------- $prj_setup_file = "PRJ_SRC:SETUP_*_BUILD.COM" $if f$trnlnm("PRJ_SRC") .eqs. "" $then $ file = f$search(prj_setup_file) $ if file .eqs. "" $ then $ write sys$output "Configure_this.com must be run before this procedure" $ status = ss_abort $ goto all_exit $ else $! $! Help the person out and run the setup procedure to create the $! logical names $!---------------------------------------------------------------------- $ @'file' $ endif $endif $prj_setup_file = f$search(prj_setup_file) $! $! Look for possible options of: $! "DECCRTL,FRONTPORT,POSIX,GNV,DIICOE,VMSPORT" $!--------------------------------------------- $! $! Note POSIX,GNV,DIICOE are more likely to try a real configure $!------------------------------------------------------------------- $! $! Should we use FRONTPORT? $!--------------------------- $use_frontport = 0 $if f$trnlnm("FRONTPORT__CRTL") .nes. "" $then $! $! Frontport library detected $!----------------------------- $ if p1 .nes. "" $ then $ x1 = "," + p1 $ if f$locate(",F",x1) .lt. f$length(x1) then use_frontport = 1 $ else $ use_frontport = 1 $ endif $endif $! $! Quick cheat to get the project name $!------------------------------------- $ proj_name = f$parse(prj_setup_file,,,"NAME") - "SETUP_" - "_BUILD" $! $! Does pyconfig_vms.h exist? $!------------------------- $update_pyconfig_vms = 0 $file = f$search("PRJ_SRC:pyconfig_vms.h") $if file .nes. "" $then $ write sys$output "Found existing custom file ''file'." $else $ update_pyconfig_vms = 1 $ write sys$output "Creating new PRJ_SRC:PYCONFIG_VMS.H for you." $ gosub write_pyconfig_vms $endif $! $! $! Write out the header $!---------------------- $gosub write_pyconfig_h_header $! $! $! $! pyconfig.h.in could have at least four different names depending $! on how it was transferred to OpenVMS $!------------------------------------------------------------------ $cfile = f$search("PRJ_SRC:pyconfig.h.in") $if cfile .eqs. "" $then $ cfile = F$SEARCH("PRJ_SRC:PYCONFIG.H_IN") $ if cfile .eqs. "" $ then $ cfile = f$search("PRJ_SRC:pyconfig__2eh.in") $ if cfile .eqs. "" $ then $ cfile = f$search("PRJ_SRC:pyconfig.h__2ein") $ endif $ endif $endif $if (cfile .eqs. "") .and. (f$trnlnm("PRJ_INCLUDE") .nes. "") $then $ cfile = f$search("PRJ_INCLUDE:pyconfig.h.in") $ if cfile .eqs. "" $ then $ cfile = f$search("PRJ_INCLUDE:pyconfig.h_in") $ if cfile .eqs. "" $ then $ cfile = f$search("PRJ_INCLUDE:pyconfig__2eh.in") $ if cfile .eqs. "" $ then $ cfile = f$search("PRJ_INCLUDE:pyconfig.h__2ein") $ endif $ endif $ endif $endif $if cfile .eqs. "" $then $ write sys$output "Can not find PRJ_SRC:pyconfig.h.in" $ write sys$output - "Looked for pyconfig.h.in, pyconfig.h_in, pyconfig__2eh.in, pyconfig.h__2ein" $ if f$trnlnm("PRJ_INCLUDE") .nes. "" $ then $ write sys$output "Also looked in PRJ_INCLUDE: for these files." $ endif $! $ write tf "" $ write tf - " /* Could not find PRJ_SRC:pyconfig.h.in */" $ write tf - " /* Looked also for pyconfig.h_in, pyconfig__2eh.in, pyconfig.h__2ein */ $ if f$trnlnm("PRJ_INCLUDE") .nes. "" $ then $ write tf - " /* Also looked in PRJ_INCLUDE: for these files. */" $ endif $ write tf - "/*--------------------------------------------------------------*/ $ write tf "" $ goto write_tail $endif $! $! $! Locate the DECC libraries in use $!----------------------------------- $decc_rtldef = f$parse("decc$rtldef","sys$library:.tlb;0") $decc_shr = f$parse("decc$shr","sys$share:.exe;0") $! $! Dump the DECC header names into a file $!---------------------------------------- $if f$search(dchfile) .nes. "" then delete 'dchfile';* $if f$search(tfile1) .nes. "" then delete 'tfile1';* $define/user sys$output 'tfile1' $library/list 'decc_rtldef' $open/read/error=rtldef_loop1_end tf1 'tfile1' $open/write/error=rtldef_loop1_end tf2 'dchfile' $rtldef_loop1: $ read/end=rtldef_loop1_end tf1 line_in $ line_in = f$edit(line_in,"TRIM,COMPRESS") $ key1 = f$element(0," ",line_in) $ key2 = f$element(1," ",line_in) $ if key1 .eqs. " " .or. key1 .eqs. "" then goto rtldef_loop1 $ if key2 .nes. " " .and. key2 .nes. "" then goto rtldef_loop1 $ write tf2 "|",key1,"|" $ goto rtldef_loop1 $rtldef_loop1_end: $if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1 $if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2 $if f$search(tfile1) .nes. "" then delete 'tfile1';* $! $! $! Now calculate what should be in the file from reading $! pyconfig.h.in and CONFIGURE. $!--------------------------------------------------------------- $open/read inf 'cfile' $do_comment = 0 $if_block = 0 $cfgh_in_loop1: $!set nover $ read/end=cfgh_in_loop1_end inf line_in $ xline = f$edit(line_in,"TRIM,COMPRESS") $! $! Blank line handling $!--------------------- $ if xline .eqs. "" $ then $ write tf "" $ goto cfgh_in_loop1 $ endif $ xlen = f$length(xline) $ key = f$extract(0,2,xline) $! $! deal with comments by copying exactly $!----------------------------------------- $ if (do_comment .eq. 1) .or. (key .eqs. "/*") $ then $ do_comment = 1 $ write tf line_in $ key = f$extract(xlen - 2, 2, xline) $ if key .eqs. "*/" then do_comment = 0 $ goto cfgh_in_loop1 $ endif $! $! Some quick parsing $!---------------------- $ keyif = f$extract(0,3,xline) $ key1 = f$element(0," ",xline) $ key2 = f$element(1," ",xline) $ key2a = f$element(0,"_",key2) $ key2b = f$element(1,"_",key2) $ key2_len = f$length(key2) $ key2_h = f$extract(key2_len - 2, 2, key2) $ key2_t = f$extract(key2_len - 5, 5, key2) $ if key2_t .eqs. "_TYPE" then key2_h = "_T" $ key64 = 0 $ if f$locate("64", xline) .lt. xlen then key64 = 1 $! $!write sys$output "xline = ''xline'" $! $! Comment out this section of the ifblock $!----------------------------------------- $ if if_block .ge. 3 $ then $ write tf "/* ", xline, " */" $ if keyif .eqs. "#en" then if_block = 0 $ goto cfgh_in_loop1 $ endif $! $! Handle the end of an ifblock $!------------------------------- $ if keyif .eqs. "#en" $ then $ write tf xline $ if_block = 0 $ goto cfgh_in_loop1 $ endif $! $ if key1 .eqs. "#ifndef" $ then $! Manual check for _ALL_SOURCE on AIX error $!----------------------------------------------- $ if key2 .eqs. "_ALL_SOURCE" $ then $ write tf "/* ", xline, " */" $! $! Ignore the rest of the block $!-------------------------------------- $ if_block = 3 $ goto cfgh_in_loop1 $ endif $ endif $! $! $! Default action for an #if/#else/#endif $!------------------------------------------ $ if keyif .eqs. "#if" .or. keyif .eqs. "#el" $ then $ if_block = 1 $ write tf xline $ goto cfgh_in_loop1 $ endif $! $! $! Process "normal?" stuff $!--------------------------- $ if key1 .eqs. "#undef" $ then $ key2c = f$element(2, "_", key2) $ if (key2c .eqs. "_") .or. (key2c .eqs. "H") then key2c = "" $ key2d = f$element(3, "_", key2) $ if (key2d .eqs. "_") .or. (key2d .eqs. "H") then key2d = "" $ if key2d .eqs. "T" $ then $ key2e = f$element(4, "_", key2) $ if key2e .eqs. "TYPE" $ then $ key2_h = "_T" $ key2d = "" $ endif $ endif $! $ double_under = 0 $ if key2a .eqs. "HAVE" .or. key2a .eqs. "STAT" $ then $! $! Process extra underscores $!------------------------------------ $ if f$locate("HAVE___", key2) .lt. key2_len $ then $ key2b = "__" + key2d $ key2d = "" $ double_under = 1 $ else $ if f$locate("HAVE__", key2) .lt. key2_len $ then $ key2b = "_" + key2c $ key2c = "" $ double_under = 1 $ endif $ endif $! $ if key2_h .eqs. "_H" $ then $! $! Looking for a header file $!--------------------------------------- $ headf = key2b $ if key2c .nes. "" then headf = headf + "_" + key2c $ if key2d .nes. "" then headf = headf + "_" + key2d $! $! (key2b .eqs. "READLINE") $! $! Some special parsing $!------------------------------------------ $ if (key2b .eqs. "SYS") .or. (key2b .eqs. "ARPA") .or. - (key2b .eqs. "NET") .or. (key2b .eqs. "NETINET") $ then $ if key2c .nes. "" $ then $ headf = key2c $ if key2d .nes. "" then headf = key2c + "_" + key2d $ endif $ endif $! $! And of course what's life with out some special cases $!-------------------------------------------------------------------- $ if key2b .eqs. "FILE" $ then $ write sys$output "" $ write sys$output - "%PYCONFIG_H-I-NONPORT, ''key2' being asked for!" $ write sys$output - "-PYCONFIG_H-I-FILE_OLD, file.h will not be configured as is obsolete!" $ write sys$output - "-PYCONFIG_H_I-FCNTL_NEW, "Expecting fcntl.h to be configured instead!" $ write sys$output - "-PYCONFIG_H_I-FCNTL_CHK, "Unable to verify at this time!" $ write sys$output - "-PYCONFIG_H-I-REVIEW, Manual Code review required!" $! $ if update_pyconfig_vms $ then $ open/append tfcv PRJ_SRC:PYCONFIG_VMS.H $ write tfcv "" $ write tfcv - "/* Check pyconfig.h for use of fcntl.h instead of file.h */" $ write tfcv "" $ close tfcv $ endif $ endif $! $! Now look it up in the DEC C RTL $!--------------------------------------------- $ define/user sys$output nl: $ define/user sys$error nl: $ search/output=nl: 'dchfile' |'headf'|/exact $ if '$severity' .eq. 1 $ then $ if key64 then write tf "#ifdef __ALPHA" $ write tf "#ifndef ''key2'" $ write tf "#define ''key2' 1" $if p2 .nes. "" then write sys$output "''dchfile' - #define ''key2' 1" $ write tf "#endif" $ if key64 then write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $! Try the FRONTPORT__DIR listings $!---------------------------------------------- $ if use_frontport .ne. 0 .and. double_under .eq. 0 $ then $ xx = f$search("FRONTPORT__DIR:''headf'.H") $ if xx .nes. "" $ then $ write tf " /* In header file supplied with FRONTPORT */" $ write tf "/*----------------------------------------*/" $ if key64 then write tf "#ifdef __ALPHA" $ write tf "#ifndef ''key2'" $ write tf "#define ''key2' 1" $if p2 .nes. "" $then $ write sys$output "FRONTPORT__DIR:''headf' #define ''key2' 1" $endif $ write tf "#endif" $ if key64 then write tf "#endif" $ goto cfgh_in_loop1 $ endif $ endif $ else $! $! Looking for a routine or a symbol $!------------------------------------------------ $ if key2c .eqs. "MACRO" $ then $ if (key2b .eqs. "FILE") .or. (key2b .eqs. "DATE") - .or. (key2b .eqs. "LINE") .or. (key2b .eqs. "TIME") $ then $ write tf "#ifndef HAVE_''key2b'" $ write tf "#define HAVE_''key2b' 1" $ write tf "#endif" $ endif $ goto cfgh_in_loop1 $ endif $! $! Special false tests $!------------------------------------- $ if double_under $ then $ if key2b .eqs. "_FCNTL" .or. key2b .eqs. "__FCNTL" $ then $ write tf "/* #undef HAVE_''key2b' */" $ goto cfgh_in_loop1 $ endif $! $ if key2b .eqs. "_STAT" .or. key2b .eqs. "__STAT" $ then $ write tf "/* #undef HAVE_''key2b' */" $ goto cfgh_in_loop1 $ endif $! $ if key2b .eqs. "_READ" .or. key2b .eqs. "__READ" $ then $ write tf "/* #undef HAVE_''key2b' */" $ goto cfgh_in_loop1 $ endif $ endif $! $ keysym = key2b $ if key2c .nes. "" then keysym = keysym + "_" + key2c $ if key2d .nes. "" then keysym = keysym + "_" + key2d $! $! Stat structure members $!------------------------------------- $ if key2b .eqs. "ST" $ then $ keysym = key2b + "_" + key2c $ keysym = f$edit(keysym,"LOWERCASE") $ endif $ if key2a .eqs. "STAT" $ then $ if (f$locate("STATVFS", key2b) .eq. 0) .and. key2c .eqs. "" $ then $ keysym = f$edit(key2b, "LOWERCASE") $ endif $!$ if (key2b .eqs. "STATVFS" .or. key2b .eqs. "STATFS2" - $! .or. key2b .eqs. "STATFS3") .and. key2c .nes. "" $! $ if (key2b .eqs. "STATVFS") .and. key2c .nes. "" $ then $! Should really verify that the structure $! named by key2b actually exists first. $!------------------------------------------------------------ $! $! Statvfs structure members $!------------------------------------------------- $ keysym = "f_" + f$edit(key2c,"LOWERCASE") $ endif $ endif $! $! UTMPX structure members $!-------------------------------------- $ if key2b .eqs. "UT" .and. key2c .eqs. "UT" $ then $ keysym = "ut_" + f$edit(key2d,"LOWERCASE") $ endif $! $ if f$locate("MMAP",key2) .lt. key2_len $ then $ write sys$output "" $ write sys$output - "%PYCONFIG_H-I-NONPORT, ''key2' being asked for!" $ write sys$output - "-PYCONFIG_H-I-MMAP, MMAP operations only work on STREAM and BINARY files!" $ write sys$output - "-PYCONFIG_H-I-REVIEW, Manual Code review required!" $ if update_pyconfig_vms $ then $ open/append tfcv PRJ_SRC:PYCONFIG_VMS.H $ write tfcv "" $ write tfcv - "/* Check pyconfig.h for use of ''key2' settings */" $ write tfcv "" $ close tfcv $ endif $ endif $! $! $ if keysym .eqs. "CRYPT" $ then $ write sys$output "" $ write sys$output - "%PYCONFIG_H-I-NONPORT, ''key2' being asked for!" $ write sys$output - "-PYCONFIG_H-I-CRYPT, CRYPT operations on the VMS SYSUAF may not work!" $ write sys$output - "-PYCONFIG_H_I-FPORT, FRONTPORT FPORT__VMS_CRYPT requires special conditions!" $ write sys$output - "-PYCONFIG_H-I-REVIEW, Manual Code review required!" $ if update_pyconfig_vms $ then $ open/append tfcv PRJ_SRC:PYCONFIG_VMS.H $ write tfcv "" $ write tfcv - "/* Check pyconfig.h for use of ''keysym' */" $ write tfcv "" $ close tfcv $ endif $ endif $! $! $ if keysym .eqs. "EXECL" $ then $ write sys$output "" $ write sys$output - "%PYCONFIG_H-I-NONPORT, ''key2' being asked for!" $ write sys$output - "-PYCONFIG_H-I-EXCEL, EXECL configured, Will probably not work." $ write sys$output - "-PYCONFIG_H-I-REVIEW, Manual Code review required!" $ if update_pyconfig_vms $ then $ open/append tfcv PRJ_SRC:PYCONFIG_VMS.H $ write tfcv "" $ write tfcv - "/* Check pyconfig.h for use of ''keysym' */" $ write tfcv "" $ close tfcv $ endif $ endif $! $ if keysym .eqs. "VOLATILE" $ then $ write tf "#ifndef HAVE_VOLATILE" $ write tf "#define HAVE_VOLATILE 1" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $ if keysym .eqs. "ERRNO_DECL" $ then $ write tf "#ifndef HAVE_ERRNO_DECL" $ write tf "#define HAVE_ERRNO_DECL 1" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $ if keysym .eqs. "LONGLONG" $ then $ write tf "#ifdef __ALPHA" $ write tf "#pragma message disable longlongtype" $ write tf "#ifndef HAVE_LONGLONG" $ write tf "#define HAVE_LONGLONG 1" $ write tf "#endif" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $ if keysym .eqs. "FCNTL_LOCK" .and. use_frontport .ne. 0 $ then $ write sys$output - "%PYCONFIG_H-I-NONPORT, ''key2' being asked for! $ write sys$output - "-PYCONFIG_H-I-FCNTL_LOCK, RMS locking from FRONTPORT library requires patches!" $ write sys$output - "-PYCONFIG_H-I-REVIEW, Manual Code review required!" $ write tf - " /* Routine found in the FRONTPORT shared image */" $ write tf - "/*---------------------------------------------*/" $ write tf "#ifndef HAVE_''keysym'" $ write tf "#define HAVE_''keysym' 1" $if p2 .nes. "" then write sys$output "FRONTPORT__CRTL #define ''keysym' 1" $ write tf "#endif" $ write tf "#ifndef HAVE_FCNTL_PATCH" $ write tf "#define HAVE_FCNTL_PATCH 1" $ write tf "#endif" $ if update_pyconfig_vms $ then $ open/append tfcv PRJ_SRC:PYCONFIG_VMS.H $ write tfcv "" $ write tfcv - "/* FCNTL_LOCK requested, requires source patch */" $ write tfcv "" $ close tfcv $ endif $ goto cfgh_in_loop1 $ endif $! $! Frontport has the TZ option in GETTIMEOFDAY $!---------------------------------------------------------- $ if keysym .eqs. "GETTIMEOFDAY_TZ" .and. use_frontport .ne. 0 $ then $ write tf - " /* Routine found in the FRONTPORT shared image */" $ write tf - "/*---------------------------------------------*/" $ write tf "#ifndef HAVE_GETTIMEOFDAY_TZ" $ write tf "#define HAVE_GETTIMEOFDAY_TZ 1" $if p2 .nes. "" then write sys$output "FRONTPORT__CRTL #define ''keysym' 1" $ write tf "#endif $ goto cfgh_in_loop1 $ endif $! $! Frontport provides READLINE simulation $!----------------------------------------------------- $ if keysym .eqs. "LIBREADLINE" .and. use_frontport .ne. 0 $ then $ write tf - " /* Library supplied in the FRONTPORT shared image */" $ write tf - "/*------------------------------------------------*/" $ write tf "#ifndef HAVE_LIBREADLINE" $ write tf "#define HAVE_LIBREADLINE 1" $if p2 .nes. "" then write sys$output "FRONTPORT__CRTL #define ''keysym' 1" $ write tf "#endif $ goto cfgh_in_loop1 $ endif $! $! These libraries are provided by the DEC C RTL $!------------------------------------------------------------- $ if keysym .eqs. "LIBINET" .or. keysym .eqs. "LIBSOCKET" $ then $ write tf "#ifndef HAVE_''keysym'" $ write tf "#define HAVE_''keysym' 1" $if p2 .nes. "" then write sys$output "''decc_shr' #define ''keysym' 1" $ write tf "#endif $ goto cfgh_in_loop1 $ endif $! $ if keysym .eqs. "FTRUNCATE_EXTEND" .and. use_frontport .ne. 0 $ then $ write sys$output - "%PYCONFIG_H-I-NONPORT, ''key2' being asked for! $ write sys$output - "-PYCONFIG_H-I-FTRNCT_EXT, FRONTPORT library FTRUNCATE_EXTEND has side effects!" $ write sys$output - "-PYCONFIG_H-I-REVIEW, Manual Code review required!" $ write tf - " /* Routine found in the FRONTPORT shared image */" $ write tf - "/*---------------------------------------------*/" $ write tf "#ifndef HAVE_FTRUNCATE_EXTEND" $ write tf "#define HAVE_FTRUNCATE_EXTEND 1" $if p2 .nes. "" then write sys$output "FRONTPORT__CRTL #define ''keysym' 1" $ write tf "#endif" $ if update_pyconfig_vms $ then $ open/append tfcv PRJ_SRC:PYCONFIG_VMS.H $ write tfcv "" $ write tfcv - "/* Check pyconfig.h use of HAVE_FTRUNCATE_EXTEND */" $ write tfcv "" $ close tfcv $ endif $ goto cfgh_in_loop1 $ endif $! $ if keysym .eqs. "HERRNO" then keysym = "h_errno" $ if keysym .eqs. "UTIMBUF" then keysym = "utimbuf" $ if key2c .eqs. "STRUCT" $ then $ keysym = f$edit(key2d,"LOWERCASE") $ else $ if key2_h .eqs. "_T" $ then $ if key2_t .eqs. "_TYPE" $ then $ keysym = f$extract(0, key2_len - 5, key2) - "HAVE_" $ endif $ keysym = f$edit(keysym,"LOWERCASE") $ endif $ endif $! $! Check the DEC C RTL shared image first $!------------------------------------------------------ $ if f$search(tfile1) .nes. "" then delete 'tfile1';* $ define/user sys$output nl: $ define/user sys$error nl: $ search/format=nonull/out='tfile1' 'decc_shr' 'keysym' $ if '$severity' .eq. 1 $ then $! $! Not documented, but from observation $!------------------------------------------------------ $ define/user sys$output nl: $ define/user sys$error nl: $ search/out=nl: 'tfile1' - "$''keysym'","$g''keysym'","$__utc_''keysym'",- "$__utctz_''keysym'","$__bsd44_''keysym'","$bsd_''keysym'" $ severity = '$severity' $! $! Of course the 64 bit stuff is different $!--------------------------------------------------------- $ if severity .ne. 1 .and. key64 $ then $ define/user sys$output nl: $ define/user sys$error nl: $ search/out=nl: 'tfile1' "$_''keysym'" $! search/out 'tfile1' "$_''keysym'" $ severity = '$severity' $ endif $! $! UNIX compatability routines $!--------------------------------------------- $ if severity .ne. 1 $ then $ define/user sys$output nl: $ define/user sys$error nl: $ search/out=nl: 'tfile1' - "$__unix_''keysym'","$__vms_''keysym'","$_posix_''keysym'" $ severity = '$severity' $ endif $! $! Show the result of the search $!------------------------------------------------ $ if 'severity' .eq. 1 $ then $ if key64 then write tf "#ifdef __ALPHA" $ write tf "#ifndef ''key2'" $ write tf "#define ''key2' 1" $if p2 .nes. "" then write sys$output "''decc_shr' #define ''key2' 1" $ write tf "#endif" $ if key64 then write tf "#endif" $ goto cfgh_in_loop1 $ endif $ endif $ if f$search(tfile1) .nes. "" then delete 'tfile1';* $! $! Check the DECC Header files next $!---------------------------------------------- $ define/user sys$output nl: $ define/user sys$error nl: $ search/out=nl: 'decc_rtldef' - "''keysym';", "''keysym'[", "struct ''keysym'"/exact $ severity = '$severity' $ if severity .eq. 1 $ then $ if key64 then write tf "#ifdef __ALPHA" $ write tf "#ifndef ''key2'" $ write tf "#define ''key2' 1" $if p2 .nes. "" then write sys$output "''decc_rtldef' #define ''key2' 1" $ write tf "#endif" $ if key64 then write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $! Check the FRONTPORT library next $!----------------------------------------------- $ if use_frontport .ne. 0 .and. double_under .eq. 0 - .and. keysym .nes. "ROOT" $ then $ define/user sys$output nl: $ define/user sys$error nl: $ search/format=nonull/out='tfile1' FRONTPORT__CRTL 'keysym' $ severity = '$severity' $ if severity .eq. 1 $ then $ define/user sys$output nl: $ define/user sys$error nl: $ search/out=nl: 'tfile1' "''keysym'" $ if '$severity' .eq. 1 $ then $ write tf - " /* Routine found in the FRONTPORT shared image */" $ write tf - "/*---------------------------------------------*/" $ if key64 then write tf "#ifdef __ALPHA" $ write tf "#ifndef ''key2'" $ write tf "#define ''key2' 1" $if p2 .nes. "" then write sys$output "FRONTPORT__CRTL #define ''key2' 1" $ write tf "#endif" $ if key64 then write tf "#endif" $ goto cfgh_in_loop1 $ endif $ endif $! $! Look for it in a supplimental header $!------------------------------------------------------------ $ define/user sys$output nl: $ define/user sys$error nl: $ search/out=nl: FRONTPORT__DIR:*.H - "''keysym';", "''keysym'[", "struct ''keysym'"/exact $ severity = '$severity' $ if severity .eq. 1 $ then $ write tf - " /* symbol found in the FRONTPORT header files */" $ write tf - "/*--------------------------------------------*/" $ if key64 then write tf "#ifdef __ALPHA" $ write tf "#ifndef ''key2'" $ write tf "#define ''key2' 1" $if p2 .nes. "" then write sys$output "FRONTPORT__DIR:*.H #define ''key2' 1" $ write tf "#endif" $ if key64 then write tf "#endif" $ goto cfgh_in_loop1 $ endif $ endif $ endif $ write tf "/* ", xline, " */" $ goto cfgh_in_loop1 $ endif $! $! $! Process SIZEOF directives found in SAMBA $!------------------------------------------------ $ if key2a .eqs. "SIZEOF" $ then $ if key2b .eqs. "INO" .and. key2_h .eqs. "_T" $ then $ write tf "#ifndef SIZEOF_INO_T" $ write tf "#define SIZEOF_INO_T (6)" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $ if key2b .eqs. "OFF" .and. key2_h .eqs. "_T" $ then $ write tf "#ifndef SIZEOF_OFF_T" $ write tf "#define SIZEOF_OFF_T (4)" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $ if key2b .eqs. "INT" $ then $ write tf "#ifndef SIZEOF_INT" $ write tf "#define SIZEOF_INT (4)" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $ if key2b .eqs. "LONG" $ then $ write tf "#ifndef SIZEOF_LONG" $ write tf "#define SIZEOF_LONG (4)" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $ if key2b .eqs. "SHORT" $ then $ write tf "#ifndef SIZEOF_SHORT" $ write tf "#define SIZEOF_SHORT (2)" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $ write tf "/* ", xline, " */" $ goto cfgh_in_loop1 $ endif $! $! Process NEED directives $!------------------------------- $ if key2a .eqs. "NEED" $ then $ if key2b .eqs. "STRINGS" .and. key2_h .eqs. "_H" $ then $ write tf "#ifndef NEED_STRINGS_H" $ write tf "#define NEED_STRINGS_H 1" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $ write tf "/* ", xline, " */" $ goto cfgh_in_loop1 $ endif $! $! Process ENABLE directives (Allow DCL OVERRIDE) $!---------------------------------------------------- $ if key2a .eqs. "ENABLE" $ then $ fnam = key2 - "ENABLE_" $ fflag = "with_" + f$edit(fnam,"LOWERCASE") + "=yes" $ tsym = "''proj_name'_''key2'" $ if f$type('tsym') .eqs. "STRING" $ then $ tsym_val = &'tsym' $ if tsym_val $ then $ write tf "#ifndef ''key2'" $ write tf "#define ''key2' 1" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $ endif $ define/user sys$output nl: $ define/user sys$error nl: $ search/out=nl: PRJ_SRC:configure. "''fflag'"/exact $ if '$severity' .eq. 1 $ then $ write tf "#ifndef ''key2'" $ write tf "#define ''key2' 1" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $ write tf "/* ", xline, " */" $ goto cfgh_in_loop1 $ endif $! $! Process STATFS directives $!------------------------------- $! if key2a .eqs. "STATFS" $! then $! write tf "/* ", xline, " */" $! goto cfgh_in_loop1 $! endif $! $! Process inline directive $!------------------------------ $ if key2 .eqs. "inline" $ then $ write tf "#ifndef inline" $ write tf "#define inline __inline" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $! Process RETSIGTYPE directive $!---------------------------------- $ if key2 .eqs. "RETSIGTYPE" $ then $ write tf "#ifndef RETSIGTYPE" $ write tf "#define RETSIGTYPE void" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $! Process STDC_HEADERS (SAMBA!) $!--------------------------- $ if key2 .eqs. "STDC_HEADERS" $ then $ write tf "#ifndef STDC_HEADERS" $ write tf "#define STDC_HEADERS 1" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $! Process PROTOTYPES directive $!------------------------------------- $ if key2 .eqs. "PROTOTYPES" $ then $ write tf "#ifndef PROTOTYPES" $ write tf "#define PROTOTYPES 1" $ write tf "#endif" $ goto cfgh_in_loop1 $ endif $! $! Special for SEEKDIR_RETURNS_VOID $!--------------------------------------- $ if key2 .eqs. "SEEKDIR_RETURNS_VOID" $ then $ write tf "#ifndef SEEKDIR_RETURNS_VOID" $ write tf "#define SEEKDIR_RETURNS_VOID 1" $ write tf "#endif" $ endif $! $! Unknown - See if CONFIGURE can give a clue for this $!---------------------------------------------------------- $ pflag = 0 $ set_flag = 0 $ gproj_name = proj_name - "_VMS" - "-VMS" $ if f$search(tfile1) .nes. "" then delete 'tfile1';* $ define/user sys$output nl: $ define/user sys$error nl: $ if f$locate("FILE", key2) .lt. key2_len then pflag = 1 $ if f$locate("DIR", key2) .eq. key2_len - 3 then pflag = 1 $ if f$locate("PATH", key2) .eq. key2_len - 4 then pflag = 1 $ search/out='tfile1' PRJ_SRC:configure. "''key2'="/exact $ search_sev = '$severity' $ if 'search_sev' .eq. 1 $ then $ open/read/err=unknown_cf_rd_error sf 'tfile1' $ read/end=unknown_cf_rd_err sf line_in $ skey1 = f$element(0,"=",line_in) $ if skey1 .eqs. key2 $ then $ skey2 = f$element(1,"=",line_in) $ skey2a = f$extract(0,2,skey2) $! $! Keep these two cases separate to make it easier to add $! more future intelligence to this routine $!---------------------------------------------------------------------- $ if skey2a .eqs. """`" $ then $ if pflag .eq. 1 $ then $ write tf "#ifndef ''key2'" $ write tf "#define ",key2," """,gproj_name,"_",key2,"""" $ write tf "#endif" $ else $! Ignore this for now $!------------------------------------------ $ write tf "/* ", xline, " */" $ endif $ set_flag = 1 $ goto found_in_configure $ endif $ if skey2a .eqs. """$" $ then $ if pflag .eq. 1 $ then $ write tf "#ifndef ''key2'" $ write tf "#define ",key2," """,gproj_name,"_",key2,"""" $ write tf "#endif" $ else $! Ignore this for now $!------------------------------------------- $ write tf "/* ", xline, " */" $ endif $ set_flag = 1 $ goto found_in_configure $ endif $ write tf "#ifndef ''key2'" $ write tf "#define ",key2," """,skey2,"""" $ write tf "#endif" $ set_flag = 1 $ else $ if pflag .eq. 1 $ then $ write tf "#ifndef ''key2'" $ write tf "#define ",key2," """,gproj_name,"_",key2,"""" $ write tf "#endif" $ set_flag = 1 $ endif $ endif $found_in_configure: $unknown_cf_rd_err: $ if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" $ then $ close sf $ endif $ if f$search(tfile1) .nes. "" then delete 'tfile1';* $ if set_flag .eq. 1 then goto cfgh_in_loop1 $ endif $ endif $! $! $! $! If it falls through everything else, comment it out $!----------------------------------------------------- $ write tf "/* ", xline, " */" $ goto cfgh_in_loop1 $cfgh_in_loop1_end: $close inf $! $! $! Write out the tail $!-------------------- $write_tail: $gosub write_pyconfig_h_tail $! $! Exit and clean up $!-------------------- $general_error: $status = '$status' $all_exit: $set noon $if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" then close sf $if f$trnlnm("tf","lnm$process",,"SUPERVISOR") .nes. "" then close tf $if f$trnlnm("inf","lnm$process",,"SUPERVISOR") .nes. "" then close inf $if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1 $if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2 $if f$trnlnm("tfcv","lnm$process",,"SUPERVISOR") .nes. "" then close tfcv $if f$type(tfile1) .eqs. "STRING" $then $ if f$search(tfile1) .nes. "" then delete 'tfile1';* $endif $if f$type(dchfile) .eqs. "STRING" $then $ if f$search(dchfile) .nes. "" then delete 'dchfile';* $endif $exit 'status' $! $! $control_y: $ status = ss_control_y $ goto all_exit $! $! $! $! Gosub to write a new pyconfig_vms.h $!----------------------------------- $write_pyconfig_vms: $outfile = "PRJ_SRC:PYCONFIG_VMS.H" $create 'outfile' $open/append tf 'outfile' $write tf "/* File: PYCONFIG_VMS.H" $write tf "**" $write tf "** This file contains the manual edits needed for porting" $write tf "** the ''proj_name' package to OpenVMS. $write tf "**" $write tf "** Edit this file as needed. The procedure that automatically" $write tf "** generated this header stub will not overwrite or make any" $write tf "** changes to this file." $write tf "**" $write tf - "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'" $write tf "**" $write tf - "**========================================================================*/" $write tf "" $if use_frontport .ne. 0 $then $write tf "" $write tf " /* Porting library defines wrappers for common functions */" $write tf "/*-------------------------------------------------------*/" $write tf "#ifndef FRONTPORT_HIDE_DECC" $write tf "#define FRONTPORT_HIDE_DECC" $write tf "#include ""frontport.h""" $write tf "#endif" $write tf "" $endif $close tf $return $! $! gosub to write out a documentation header for pyconfig.h $!---------------------------------------------------------------- $write_pyconfig_h_header: $outfile = "PRJ_SRC:PYCONFIG.H" $create 'outfile' $open/append tf 'outfile' $write tf "/* File: PYCONFIG.H" $write tf "**" $write tf - "** This file contains the options needed for porting ''proj_name' to" $write tf "** the ''proj_name' project on a VMS system." $write tf "**" $write tf "** Try not to make any edits to this file, as it is" $write tf "** automagically generated." $write tf "**" $write tf "** Manual edits should be made to the PYCONFIG_VMS.H file." $write tf "**" $write tf - "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'" $write tf "**" $write tf - "**========================================================================*/" $write tf "" $write tf " /* Allow compiler builtins */" $write tf "/*-------------------------*/" $write tf "#ifdef __DECC_VER" $write tf "#include " $write tf "#endif" $write tf "" $return $! $! gosub to write out the tail for pyconfig.h and close it $!--------------------------------------------------------- $write_pyconfig_h_tail: $write tf "" $write tf " /* Include the hand customized settings */" $write tf "/*--------------------------------------*/" $write tf "#include ""prj_src:pyconfig_vms.h""" $close tf $return $!