Commit 877aad48 authored by simonmar's avatar simonmar
Browse files

[project @ 2000-06-13 16:07:20 by simonmar]

New Driver
==========

Most things work now, so I'm committing this for a shake down.
Doubtless there'll be some breakage but things should be back to
normal by the end of the week.

NOTE: GHC 4.06 won't work to build this driver at the moment, due to a
bug in its parser.  I'll commit a workaround shortly.

There are several improvements here:

	- the driver is written in Haskell, so is allegedly
	  more maintainable than the previous one.  It's a bit shorter,
	  at any rate.

	- the package system has been generalised, so that eg.
	  the RTS is a package, as is GMP and the prelude.  Packages
	  are now configured via a configuration file, package.conf.
	  Two versions of package.conf are automatically generated by
	  PackageSrc.hs, one for ghc-inplace and one for the installed ghc.

	- So that we only have to build the driver once, there's some
	  special hackery to deal with locations of utilities, and
	  other configuration stuff:

	  ghc now has a -B option, which is used in a similar way
	  to gcc's.  eg.

		ghc -B/home/blah/fptools

	  will run ghc in-place in the specified fptools tree, using
	  /home/blah/fptools/ghc/utils/mkdependHS to find mkdependHS
	  for example.  ghc-inplace is now a small shell script that
	  simply invokes the above.  Whereas

		ghc -B/usr/local/lib/ghc-4.07

	  also works, for an installed copy of ghc in
	  /usr/local/lib/ghc-4.07.

	- the mangler, object splitter and GC stats gatherer are separate
	  scripts in subdirectories of ghc/driver.  ghc-asm.lprl and
	  ghc-split.lprl have been copied in the CVS repository to maintain
	  the history (fingers crossed; I've never done this before)


Other notes:

	- Java support isn't there yet.  Andy: don't update for the time
	  being until I can sort this.

	- Windows support is also broken, but will be fixed in due course.
parent eab8ac17
This diff is collapsed.
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.31 2000/05/25 13:11:17 panne Exp $
# We create two driver scripts:
# - one to run in-place in the build tree for building libraries
# - one wired to the install locations for later installation
# $Id: Makefile,v 1.32 2000/06/13 16:07:20 simonmar Exp $
#
# the installation script is built first, and we invoke make recursively
# to build the in-place version.
TOP=..
CURRENT_DIR=ghc/driver
include $(TOP)/mk/boilerplate.mk
INSTALLING=1
DYN_LOADABLE_BITS = \
ghc-asm.prl \
ghc-consist.prl \
ghc-split.prl
INSTALLED_SCRIPT_PROG = ghc-$(ProjectVersion)
INPLACE_SCRIPT_PROG = ghc-inplace
ifeq "$(INSTALLING)" "1"
TOP_PWD := $(prefix)
SCRIPT_PROG = $(INSTALLED_SCRIPT_PROG)
SCRIPT_LINK = ghc
ifneq "$(GhcWithHscBuiltViaC)" "YES"
HC=$(WithGhcHc)
else
TOP_PWD := $(FPTOOLS_TOP_ABS)
SCRIPT_PROG = $(INPLACE_SCRIPT_PROG)
endif
SCRIPT_OBJS = ghc.prl
INTERP=perl
#
# The driver needs to know the options and names for
# all possible ways, so we magically generate the
# the make variable names for them here.
#
USER_WAY_NAMES = $(foreach way,$(USER_WAYS),WAY_$(way)_NAME)
USER_WAY_OPTS = $(foreach way,$(USER_WAYS),WAY_$(way)_REAL_OPTS)
SCRIPT_SUBST_VARS := \
INSTALLING \
ProjectName ProjectVersion ProjectVersionInt \
HscMajorVersion HscMinorVersion CcMajorVersion CcMinorVersion \
CURRENT_DIR HOSTPLATFORM TARGETPLATFORM \
GHC_LIB_DIR GHC_RUNTIME_DIR GHC_INCLUDE_DIR \
GHC_OPT_HILEV_ASM GhcWithNativeCodeGen LeadingUnderscore\
GHC_UNLIT GHC_HSCPP GHC_MKDEPENDHS GHC_HSC GHC_SYSMAN EnableWin32DLLs \
CP RM CONTEXT_DIFF LibGmp GhcWithRegisterised LibsReadline \
$(USER_WAY_NAMES) $(USER_WAY_OPTS)
#
# When creating a binary distribution, we prefix the driver script
# with a short msg about what variables need to be set to get the
# script going.
#
ifeq "$(BIN_DIST)" "1"
SCRIPT_PREFIX_FILES=prefix.txt
else
SCRIPT_SUBST_VARS += libdir includedir libexecdir datadir bindir TMPDIR TOP_PWD
endif
all :: $(DYN_LOADABLE_BITS)
# don't recurse on 'make install'
#
ifeq "$(INSTALLING)" "1"
all clean distclean mostlyclean maintainer-clean ::
$(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
HC=$(GHC_INPLACE)
endif
#
# Install setup:
# the driver goes in $(bindir), the perl script helpers
# in $(libdir)
#
# ToDo: allow different install name for driver?
#
INSTALL_SCRIPTS += $(SCRIPT_PROG)
INSTALL_LIBS += $(DYN_LOADABLE_BITS)
#
# depend setup: other directories need the driver script to compute
# their dependencies, so `depend' is simply an alias for `all' here.
depend :: all
#
# Clean up
#
CLEAN_FILES += $(SCRIPT_OBJS) $(SCRIPT_LINK) $(DYN_LOADABLE_BITS) ghc-[0-9].*
#
# Source distribution
#
SRC_DEST_FILES=$(patsubst %.prl,%.lprl,$(DYN_LOADABLE_BITS)) ghc.lprl ordering-passes test_mangler
SRC_HC_OPTS += -fglasgow-exts -cpp -syslib concurrent -syslib posix -syslib text
HS_PROG = ghc-$(ProjectVersion)
HS_SRCS = Config.hs Package.hs Main.hs
MKDEPENDHS_SRCS = Config.hs Main.hs PackageSrc.hs
LINK = ghc
SUBDIRS = mangler split stats
# -----------------------------------------------------------------------------
# Create driver configuration
boot :: Config.hs
Config.hs : $(FPTOOLS_TOP)/mk/config.mk Makefile
@$(RM) -f Config.hs
@echo -n "Creating Config.hs ... "
@echo "module Config where" >>Config.hs
@echo "_ProjectName = \"$(ProjectName)\"" >> Config.hs
@echo "_ProjectVersion = \"$(ProjectVersion)\"" >> Config.hs
@echo "_ProjectVersionInt = \"$(ProjectVersionInt)\"" >> Config.hs
@echo "_ProjectPatchLevel = \"$(ProjectPatchLevel)\"" >> Config.hs
@echo "_HOSTPLATFORM = \"$(HOSTPLATFORM)\"" >> Config.hs
@echo "_TARGETPLATFORM = \"$(TARGETPLATFORM)\"" >> Config.hs
@echo "_CURRENT_DIR = \"$(CURRENT_DIR)\"" >> Config.hs
@echo "_GHC_LIB_DIR = \"$(GHC_LIB_DIR)\"" >> Config.hs
@echo "_GHC_RUNTIME_DIR = \"$(GHC_RUNTIME_DIR)\"" >> Config.hs
@echo "_GHC_UTILS_DIR = \"$(GHC_UTILS_DIR)\"" >> Config.hs
@echo "_GHC_INCLUDE_DIR = \"$(GHC_INCLUDE_DIR)\"" >> Config.hs
@echo "_GHC_DRIVER_DIR = \"$(GHC_DRIVER_DIR)\"" >> Config.hs
@echo "_GCC = \"$(WhatGccIsCalled)\"" >> Config.hs
@echo "_GhcWithNativeCodeGen = \"$(GhcWithNativeCodeGen)\"" >> Config.hs
@echo "_LeadingUnderscore = \"$(LeadingUnderscore)\"" >> Config.hs
@echo "_GHC_MKDEPENDHS = \"$(GHC_MKDEPENDHS)\"" >> Config.hs
@echo "_GHC_UNLIT = \"$(GHC_UNLIT)\"" >> Config.hs
@echo "_GHC_HSCPP = \"$(GHC_HSCPP)\"" >> Config.hs
@echo "_GHC_HSC = \"$(GHC_HSC)\"" >> Config.hs
@echo "_GHC_MANGLER = \"$(GHC_MANGLER)\"" >> Config.hs
@echo "_GHC_SPLIT = \"$(GHC_SPLIT)\"" >> Config.hs
@echo "_GHC_STATS = \"$(GHC_STATS)\"" >> Config.hs
@echo "_GHC_SYSMAN = \"$(GHC_SYSMAN)\"" >> Config.hs
@echo "_EnableWin32DLLs = \"$(EnableWin32DLLs)\"" >> Config.hs
@echo "_CP = \"$(CP)\"" >> Config.hs
@echo "_RM = \"$(RM)\"" >> Config.hs
@echo "_CONTEXT_DIFF = \"$(CONTEXT_DIFF)\"" >> Config.hs
@echo "_HaveLibGmp = \"$(HaveLibGmp)\"" >> Config.hs
@echo "_GhcWithRegisterised = \"$(GhcWithRegisterised)\"" >> Config.hs
@echo "_USER_WAY_NAMES = \"$(USER_WAY_NAMES)\"" >> Config.hs
@echo "_USER_WAY_OPTS = \"$(USER_WAY_OPTS)\"" >> Config.hs
@echo "_libdir = \"$(libdir)\"" >> Config.hs
@echo "_libexecdir = \"$(libexecdir)\"" >> Config.hs
@echo "_datadir = \"$(datadir)\"" >> Config.hs
@echo "_bindir = \"$(bindir)\"" >> Config.hs
@echo "_TMPDIR = \"$(TMPDIR)\"" >> Config.hs
@echo "_FPTOOLS_TOP_ABS = \"$(FPTOOLS_TOP_ABS)\"" >> Config.hs
@echo done.
CLEAN_FILES += Config.hs
# -----------------------------------------------------------------------------
# Create link to from ghc-x.xx to ghc...
all :: $(LINK)
$(LINK) : $(HS_PROG)
@if ( $(PERL) -e '$$fn="$(LINK)"; exit ((! -f $$fn || -l $$fn) ? 0 : 1);' ); then \
echo "Creating a symbolic link from $(HS_PROG) to $(LINK)"; \
$(RM) $(LINK); \
$(LN_S) $(HS_PROG) $(LINK); \
else \
echo "Creating a symbolic link from $(HS_PROG) to $(LINK) failed: \`$(LINK)' already exists"; \
echo "Perhaps remove \`$(LINK)' manually?"; \
exit 1; \
fi;
# -----------------------------------------------------------------------------
# create ghc-inplace, a convenient way to run ghc from the build tree...
all :: ghc-inplace
ghc-inplace : ghc
@$(RM) $@
echo '#!/bin/sh' >>$@
echo exec $(FPTOOLS_TOP_ABS)/ghc/driver/ghc -B$(FPTOOLS_TOP_ABS) $$\* >>$@
chmod 755 $@
# -----------------------------------------------------------------------------
# package configuration files...
all :: package.conf package.conf.inplace
pkgconf : Config.o Package.o PackageSrc.o
$(HC) $(HC_OPTS) $(LD_OPTS) Config.o Package.o PackageSrc.o -o pkgconf
package.conf.inplace : pkgconf
./pkgconf in-place >$@
package.conf : pkgconf
./pkgconf install >$@
INSTALL_DATAS += package.conf
CLEAN_FILES += pkgconf package.conf.inplace package.conf
# -----------------------------------------------------------------------------
# installation...
INSTALL_PROGS = ghc
override datadir=$(libdir)
INSTALL_DATAS += ghc-usage.txt
# -----------------------------------------------------------------------------
include $(TOP)/mk/target.mk
ghc.prl : $(TOP)/mk/version.mk
#
# Another hack (hmm..I can see a pattern developing here :-)
# In ghc/driver, we create a symlink from ghc-<whatever-version> to
# ghc, but we don't want this included in a source distribution.
# We `solve' this by removing `ghc' from the dist tree here.
dist ::
@echo "Patching dist tree: removing $(SRC_DIST_DIR)/ghc symlink"
$(RM) $(SRC_DIST_DIR)/ghc
module Package where
import Pretty
data Package = Package {
import_dirs :: [String],
library_dirs :: [String],
libraries :: [String],
include_dir :: String,
c_include :: String,
package_deps :: [String],
extra_ghc_opts :: String,
extra_cc_opts :: String,
extra_ld_opts :: String
}
deriving (Read, Show)
pprPackage :: [(String,Package)] -> String
pprPackage pkgs = render (brackets (vcat (punctuate comma (map pprPkg pkgs))))
pprPkg (name, (Package
{ import_dirs = import_dirs
, library_dirs = library_dirs
, libraries = libraries
, include_dir = include_dir
, c_include = c_include
, package_deps = package_deps
, extra_ghc_opts = extra_ghc_opts
, extra_cc_opts = extra_cc_opts
, extra_ld_opts = extra_ld_opts }))
= parens (
text (show name) <> comma
<+> text "Package" <+> braces (
vcat [
text "import_dirs = " <> text (show import_dirs) <> comma,
text "library_dirs = " <> text (show library_dirs) <> comma,
text "libraries = " <> text (show libraries) <> comma,
text "include_dir = " <> text (show include_dir) <> comma,
text "c_include = " <> text (show c_include) <> comma,
text "package_deps = " <> text (show package_deps) <> comma,
text "extra_ghc_opts = " <> text (show extra_ghc_opts) <> comma,
text "extra_cc_opts = " <> text (show extra_cc_opts) <> comma,
text "extra_ld_opts = " <> text (show extra_ld_opts)
])
)
module Main (main) where
import IOExts
import IO
import System
import Config
import Package
main = do
args <- getArgs
case args of
[ "install" ] -> do { putStr (pprPackage (package_details True)) }
[ "in-place" ] -> do { putStr (pprPackage (package_details False)) }
_ -> do hPutStr stderr "usage: pkgconf (install | in-place)\n"
exitWith (ExitFailure 1)
package_details :: Bool -> [(String,Package)]
package_details installing =
[
( "gmp", -- GMP is at the bottom of the heap
Package {
import_dirs = [],
library_dirs = if _HaveLibGmp == "YES"
then []
else if installing
then [ _libdir ]
else [ ghc_src_dir _GHC_RUNTIME_DIR ++ "/gmp" ],
libraries = [ "gmp" ],
include_dir = "",
c_include = "",
package_deps = [],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = ""
}
),
( "rts", -- The RTS is just another package!
Package {
import_dirs = [],
library_dirs = [ if installing
then _libdir
else ghc_src_dir _GHC_RUNTIME_DIR ],
libraries = [ "HSrts" ],
include_dir = if installing
then ""
else ghc_src_dir _GHC_INCLUDE_DIR,
c_include = "Stg.h", -- ha!
package_deps = [ "gmp" ],
extra_ghc_opts = "",
extra_cc_opts = "",
-- the RTS forward-references to a bunch of stuff in the prelude,
-- so we force it to be included with special options to ld.
extra_ld_opts = unwords [
"-u PrelMain_mainIO_closure",
"-u PrelBase_Izh_static_info",
"-u PrelBase_Czh_static_info",
"-u PrelFloat_Fzh_static_info",
"-u PrelFloat_Dzh_static_info",
"-u PrelAddr_Azh_static_info",
"-u PrelAddr_Wzh_static_info",
"-u PrelAddr_I64zh_static_info",
"-u PrelAddr_W64zh_static_info",
"-u PrelStable_StablePtr_static_info",
"-u PrelBase_Izh_con_info",
"-u PrelBase_Czh_con_info",
"-u PrelFloat_Fzh_con_info",
"-u PrelFloat_Dzh_con_info",
"-u PrelAddr_Azh_con_info",
"-u PrelAddr_Wzh_con_info",
"-u PrelAddr_I64zh_con_info",
"-u PrelAddr_W64zh_con_info",
"-u PrelStable_StablePtr_con_info",
"-u PrelBase_False_closure",
"-u PrelBase_True_closure",
"-u PrelPack_unpackCString_closure",
"-u PrelException_stackOverflow_closure",
"-u PrelException_heapOverflow_closure",
"-u PrelException_NonTermination_closure",
"-u PrelException_PutFullMVar_closure",
"-u PrelException_BlockedOnDeadMVar_closure",
"-u PrelWeak_runFinalizzerBatch_closure",
"-u __init_Prelude",
"-u __init_PrelMain"
]
}
),
( "std", -- The Prelude & Standard Libraries
Package {
import_dirs = [ if installing
then _libdir ++ "/imports/std"
else ghc_src_dir _GHC_LIB_DIR ++ "/std" ],
library_dirs = if installing
then [ _libdir ]
else [ ghc_src_dir _GHC_LIB_DIR ++ "/std"
, ghc_src_dir _GHC_LIB_DIR ++ "/std/cbits" ],
libraries = [ "HSstd", "HSstd_cbits" ],
include_dir = if installing
then ""
else ghc_src_dir _GHC_LIB_DIR ++ "/std/cbits",
c_include = "HsStd.h",
package_deps = [ "rts" ],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = "-lm"
}
),
( "lang",
Package {
import_dirs = if installing
then [ _libdir ++ "/imports/lang" ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/lang"
, _FPTOOLS_TOP_ABS ++ "/hslibs/lang/monads"],
library_dirs = if installing
then [ _libdir ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/lang"
, _FPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
libraries = [ "HSlang", "HSlang_cbits" ],
include_dir = if installing
then ""
else _FPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits",
c_include = "HsLang.h",
package_deps = [],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = ""
}
),
( "concurrent",
Package {
import_dirs = [ if installing
then _libdir ++ "/imports/concurrent"
else _FPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
library_dirs = [ if installing
then _libdir
else _FPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
libraries = [ "HSconcurrent" ],
include_dir = if installing
then ""
else _FPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits",
c_include = "HsConcurrent.h",
package_deps = [ "lang" ],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = ""
}
),
( "data",
Package {
import_dirs = if installing
then [ _libdir ++ "/imports/data" ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/data"
, _FPTOOLS_TOP_ABS ++ "/hslibs/data/edison"
, _FPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Assoc"
, _FPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Coll"
, _FPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Seq" ],
library_dirs = if installing
then [_libdir ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/data" ],
libraries = [ "HSdata" ],
include_dir = if installing
then ""
else _FPTOOLS_TOP_ABS ++ "/hslibs/data/cbits",
c_include = "HsData.h",
package_deps = [ "lang" ],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = ""
}
),
( "net",
Package {
import_dirs = if installing
then [ _libdir ++ "/imports/net" ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/net" ],
library_dirs = if installing
then [ _libdir ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/net"
, _FPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
libraries = [ "HSnet", "HSnet_cbits" ],
include_dir = if installing
then ""
else _FPTOOLS_TOP_ABS ++ "/hslibs/net/cbits",
c_include = "HsNet.h",
package_deps = [ "lang", "text" ],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = if postfixMatch "solaris2" _TARGETPLATFORM
then "-lnsl -lsocket"
else ""
}
),
( "posix",
Package {
import_dirs = if installing
then [ _libdir ++ "/imports/posix" ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/posix" ],
library_dirs = if installing
then [ _libdir ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/posix"
, _FPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
libraries = [ "HSposix", "HSposix_cbits" ],
include_dir = if installing
then ""
else _FPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits",
c_include = "HsPosix.h",
package_deps = [ "lang" ],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = ""
}
),
( "text",
Package {
import_dirs = if installing
then [ _libdir ++ "/imports/text" ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/text"
, _FPTOOLS_TOP_ABS ++ "/hslibs/text/html"
, _FPTOOLS_TOP_ABS ++ "/hslibs/text/haxml/lib"
, _FPTOOLS_TOP_ABS ++ "/hslibs/text/parsec" ],
library_dirs = if installing
then [ _libdir ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/text"
, _FPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
libraries = [ "HStext", "HStext_cbits" ],
include_dir = if installing
then ""
else _FPTOOLS_TOP_ABS ++ "/hslibs/text/cbits",
c_include = "HsText.h",
package_deps = [ "lang", "data" ],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = ""
}
),
( "util",
Package {
import_dirs = if installing
then [ _libdir ++ "/imports/util" ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/util"
, _FPTOOLS_TOP_ABS ++ "/hslibs/util/check" ],
library_dirs = if installing
then [ _libdir ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/util"
, _FPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
libraries = [ "HSutil", "HSutil_cbits" ],
include_dir = if installing
then ""
else _FPTOOLS_TOP_ABS ++ "/hslibs/util/cbits",
c_include = "HsUtil.h",
package_deps = ["lang", "concurrent", "posix"],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = ""
}
),
( "win32",
Package {
import_dirs = if installing
then [ _libdir ++ "/imports/win32" ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/win32/src" ],
library_dirs = if installing
then [ _libdir ]
else [ _FPTOOLS_TOP_ABS ++ "/hslibs/win32/src" ],
libraries = [ "HSwin32" ],
include_dir = "",
c_include = "", -- ???
package_deps = ["lang"],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = "-luser32 -lgdi32"
}
),
( "com",
Package {
import_dirs = if installing
then [ _libdir ++ "/imports/com" ]
else [ _FPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
library_dirs = if installing
then [ _libdir ]
else [ _FPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
libraries = [ "HScom" ],
include_dir = "",
c_include = "", -- ???
package_deps = [ "lang" ],
extra_ghc_opts = "",
extra_cc_opts = "",
extra_ld_opts = "-luser32 -lole32 -loleaut32 -ladvapi32"
}
)
]
ghc_src_dir path = _FPTOOLS_TOP_ABS ++ '/':_CURRENT_DIR ++ '/':path
prefixMatch :: Eq a => [a] -> [a] -> Bool
prefixMatch [] str = True
prefixMatch pat [] = False
prefixMatch (p:ps) (s:ss) | p == s = prefixMatch ps ss
| otherwise = False
postfixMatch :: String -> String -> Bool
postfixMatch pat str = prefixMatch (reverse pat) (reverse str)
This diff is collapsed.
%************************************************************************
%* *
\section[Driver-consistency-chk]{@chk_consistency_info@: Check an executable for consistency}
%* *
%************************************************************************
\begin{code}
sub chk_consistency_info {
local($executable) = @_;
local($major_version, $minor_version);
local($phase, $infile, $opts);
# append .exe if it's not there under cygwin32
$executable = "${executable}.exe" if $TargetPlatform eq 'i386-unknown-cygwin32' &&
$executable !~ /\...*$/ ;
print STDERR "Checking consistency of: $executable\n" if $Verbose;
&tidy_up_and_die(1, "Panic: no such executable: $executable\n")
if ( ! -x $executable ) && ( ! -B $executable );
# perl apparently determines whether something is executable
# by looking at the file suffix under win32/cygwin32 !?!
# Hence, we try binary files if (! -x) fails.