Tcl Extension Architecture (TEA) Sample Extension

Check-in [4e4e6b55d3]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Branch which utilizes practcl as the make system and autosetup to replace autoconf.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | autosetup
Files: files | file ages | folders
SHA3-256: 4e4e6b55d37e2a8f90e85a74c3cb8ef3b74efef3d14b8c0b0ceeac29aeec6962
User & Date: seandeelywoods 2018-10-28 07:10:31
Context
2018-10-28
07:10
Branch which utilizes practcl as the make system and autosetup to replace autoconf. Leaf check-in: 4e4e6b55d3 user: seandeelywoods tags: autosetup
07:02
Adding local resident copy of practcl Leaf check-in: a2f82d04ff user: seandeelywoods tags: practcl
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ChangeLog.

            1  +2018-10-28  Sean Woods    <[email protected]>
            2  +
            3  +    * Implemented a Practcl build utilizing autosetup instead of autoconf
            4  +
     1      5   2018-01-19  Sean Woods    <[email protected]>
     2      6   
     3      7       * Rewrote build system to use practcl
     4      8   
     5      9   2015-08-28  Jan Nijtmans  <[email protected]>
     6     10   
     7     11   	* configure:          Rfe [00189c4afc]: Allow semi-static UCRT build on

Changes to Makefile.in.

     1      1   # Makefile.in --
     2      2   #
     3         -#	This file is a Makefile for Sample TEA Extension.  If it has the name
     4         -#	"Makefile.in" then it is a template for a Makefile;  to generate the
     5         -#	actual Makefile, run "./configure", which is a configuration script
     6         -#	generated by the "autoconf" program (constructs like "@[email protected]" will get
     7         -#	replaced in the actual Makefile.
     8         -#
     9         -# Copyright (c) 1999 Scriptics Corporation.
    10         -# Copyright (c) 2002-2005 ActiveState Corporation.
    11         -#
    12         -# See the file "license.terms" for information on usage and redistribution
    13         -# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    14         -
    15         -#========================================================================
    16         -# Add additional lines to handle any additional AC_SUBST cases that
    17         -# have been added in a customized configure script.
    18         -#========================================================================
    19         -
    20         -#SAMPLE_NEW_VAR	= @[email protected]
    21         -
    22         -#========================================================================
    23         -# Nothing of the variables below this line should need to be changed.
    24         -# Please check the TARGETS section below to make sure the make targets
    25         -# are correct.
    26         -#========================================================================
    27         -
    28         -#========================================================================
    29         -# The names of the source files is defined in the configure script.
    30         -# The object files are used for linking into the final library.
    31         -# This will be used when a dist target is added to the Makefile.
    32         -# It is not important to specify the directory, as long as it is the
    33         -# $(srcdir) or in the generic, win or unix subdirectory.
    34         -#========================================================================
    35         -
    36         -PKG_STUB_SOURCES = @[email protected]
    37         -PKG_STUB_OBJECTS = @[email protected]
    38         -
    39         -#========================================================================
    40         -# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with
    41         -# this package that need to be installed, if any.
    42         -#========================================================================
    43         -
    44         -PKG_TCL_SOURCES = @[email protected]
    45         -
    46         -#========================================================================
    47         -# This is a list of public header files to be installed, if any.
    48         -#========================================================================
    49         -
    50         -PKG_HEADERS	= @[email protected]
    51         -
    52         -#========================================================================
    53         -# "PKG_LIB_FILE" refers to the library (dynamic or static as per
    54         -# configuration options) composed of the named objects.
    55         -#========================================================================
    56         -
    57         -PKG_LIB_FILE	= @[email protected]
    58         -PKG_STUB_LIB_FILE = @[email protected]
    59         -
    60         -lib_BINARIES	= $(PKG_LIB_FILE)
    61         -BINARIES	= $(lib_BINARIES)
            3  +# A minimalist makefile to invoke functions in make.tcl
    62      4   
    63      5   SHELL		= @[email protected]
    64         -
            6  +TCLSH   = @[email protected]
    65      7   srcdir		= @[email protected]
    66         -prefix		= @[email protected]
    67         -exec_prefix	= @[email protected]
    68         -
    69         -bindir		= @[email protected]
    70         -libdir		= @[email protected]
    71         -includedir	= @[email protected]
    72         -datarootdir	= @[email protected]
    73         -datadir		= @[email protected]
    74         -mandir		= @[email protected]
    75         -
    76         -DESTDIR		=
    77         -
    78         -PKG_DIR		= $(PACKAGE_NAME)$(PACKAGE_VERSION)
    79         -pkgdatadir	= $(datadir)/$(PKG_DIR)
    80         -pkglibdir	= $(libdir)/$(PKG_DIR)
    81         -pkgincludedir	= $(includedir)/$(PKG_DIR)
    82         -
    83         -top_builddir	= @[email protected]
    84         -
    85         -INSTALL_OPTIONS	=
    86         -INSTALL		= @[email protected] $(INSTALL_OPTIONS)
    87         -INSTALL_DATA_DIR = ${INSTALL} -d -m 755
    88         -INSTALL_DATA	= @[email protected]
    89         -INSTALL_PROGRAM	= @[email protected]
    90         -INSTALL_SCRIPT	= @[email protected]
    91         -INSTALL_LIBRARY	= ${INSTALL_DATA}
    92         -
    93         -PACKAGE_NAME	= @[email protected]
    94         -PACKAGE_VERSION	= @[email protected]
    95         -CC		= @[email protected]
    96         -CFLAGS_DEFAULT	= @[email protected]
    97         -CFLAGS_WARNING	= @[email protected]
    98         -EXEEXT		= @[email protected]
    99         -LDFLAGS_DEFAULT	= @[email protected]
   100         -MAKE_LIB	= @[email protected]
   101         -MAKE_SHARED_LIB	= @[email protected]
   102         -MAKE_STATIC_LIB	= @[email protected]
   103         -MAKE_STUB_LIB	= @[email protected]
   104         -OBJEXT		= @[email protected]
   105         -RANLIB		= @[email protected]
   106         -RANLIB_STUB	= @[email protected]
   107         -SHLIB_CFLAGS	= @[email protected]
   108         -SHLIB_LD	= @[email protected]
   109         -SHLIB_LD_LIBS	= @[email protected]
   110         -STLIB_LD	= @[email protected]
   111         -#TCL_DEFS	= @[email protected]
   112         -TCL_BIN_DIR	= @[email protected]
   113         -TCL_SRC_DIR	= @[email protected]
   114         -#TK_BIN_DIR	= @[email protected]
   115         -#TK_SRC_DIR	= @[email protected]
   116         -
   117         -# Not used, but retained for reference of what libs Tcl required
   118         -#TCL_LIBS	= @[email protected]
   119         -
   120         -#========================================================================
   121         -# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our
   122         -# package without installing.  The other environment variables allow us
   123         -# to test against an uninstalled Tcl.  Add special env vars that you
   124         -# require for testing here (like TCLX_LIBRARY).
   125         -#========================================================================
   126         -
   127         -EXTRA_PATH	= $(top_builddir):$(TCL_BIN_DIR)
   128         -#EXTRA_PATH	= $(top_builddir):$(TCL_BIN_DIR):$(TK_BIN_DIR)
   129         -TCLLIBPATH	= $(top_builddir)
   130         -TCLSH_ENV	= TCL_LIBRARY=`@[email protected] $(TCL_SRC_DIR)/library`
   131         -PKG_ENV		= @[email protected]="$(EXTRA_PATH):$(@[email protected])" \
   132         -		  PATH="$(EXTRA_PATH):$(PATH)" \
   133         -		  TCLLIBPATH="$(TCLLIBPATH)"
   134         -
   135         -TCLSH_PROG	= @[email protected]
   136         -TCLSH		= $(TCLSH_ENV) $(PKG_ENV) $(TCLSH_PROG)
   137         -
   138         -#WISH_ENV	= TK_LIBRARY=`@[email protected] $(TK_SRC_DIR)/library`
   139         -#WISH_PROG	= @[email protected]
   140         -#WISH		= $(TCLSH_ENV) $(WISH_ENV) $(PKG_ENV) $(WISH_PROG)
   141         -
   142         -SHARED_BUILD	= @[email protected]
   143         -
   144         -INCLUDES	= @[email protected] @[email protected]
   145         -#INCLUDES	= @[email protected] @[email protected] @[email protected] @[email protected]
   146         -
   147         -PKG_CFLAGS	= @[email protected]
   148         -
   149         -# TCL_DEFS is not strictly need here, but if you remove it, then you
   150         -# must make sure that configure.ac checks for the necessary components
   151         -# that your library may use.  TCL_DEFS can actually be a problem if
   152         -# you do not compile with a similar machine setup as the Tcl core was
   153         -# compiled with.
   154         -#DEFS		= $(TCL_DEFS) @[email protected] $(PKG_CFLAGS)
   155         -DEFS		= @[email protected] $(PKG_CFLAGS)
   156         -
   157         -# Move pkgIndex.tcl to 'BINARIES' var if it is generated in the Makefile
   158         -CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
   159         -CLEANFILES	= @[email protected]
   160         -
   161         -CPPFLAGS	= @[email protected]
   162         -LIBS		= @[email protected] @[email protected]
   163         -AR		= @[email protected]
   164         -CFLAGS		= @[email protected]
   165         -COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) \
   166         -			  $(CFLAGS_DEFAULT) $(CFLAGS_WARNING) $(SHLIB_CFLAGS) $(CFLAGS)
   167         -
   168         -GDB		= gdb
   169         -VALGRIND	= valgrind
   170         -VALGRINDARGS	= --tool=memcheck --num-callers=8 --leak-resolution=high \
   171         -		  --leak-check=yes --show-reachable=yes -v
   172         -
   173         -.SUFFIXES: .c .$(OBJEXT)
   174      8   
   175      9   #========================================================================
   176     10   # Start of user-definable TARGETS section
   177     11   #========================================================================
   178     12   
   179         -#========================================================================
   180         -# TEA TARGETS.  Please note that the "libraries:" target refers to platform
   181         -# independent files, and the "binaries:" target includes executable programs and
   182         -# platform-dependent libraries.  Modify these targets so that they install
   183         -# the various pieces of your package.  The make and install rules
   184         -# for the BINARIES that you specified above have already been done.
   185         -#========================================================================
   186         -
   187         -all: binaries libraries doc
   188         -
   189         -#========================================================================
   190         -# The binaries target builds executable programs, Windows .dll's, unix
   191         -# shared/static libraries, and any other platform-dependent files.
   192         -# The list of targets to build for "binaries:" is specified at the top
   193         -# of the Makefile, in the "BINARIES" variable.
   194         -#========================================================================
           13  +all:
           14  +	$(TCLSH) ${srcdir}/make.tcl all
   195     15   
   196     16   binaries:
   197     17   	$(TCLSH) ${srcdir}/make.tcl binaries
   198         -	
           18  +
   199     19   libraries:
   200         -	$(TCLSH) ${srcdir}/make.tcl library
   201         -
   202         -#========================================================================
   203         -# Your doc target should differentiate from doc builds (by the developer)
   204         -# and doc installs (see install-doc), which just install the docs on the
   205         -# end user machine when building from source.
   206         -#========================================================================
           20  +	$(TCLSH) ${srcdir}/make.tcl all
   207     21   
   208     22   doc:
   209     23   	$(TCLSH) ${srcdir}/make.tcl doc
   210     24   
   211         -#========================================================================
   212         -# Performs a full install with documentation and headers
   213         -#========================================================================
           25  +test:
           26  +	$(TCLSH) ${srcdir}/make.tcl doc
           27  +
           28  +dist:
           29  +	$(TCLSH) ${srcdir}/make.tcl clean
           30  +
           31  +distclean:
           32  +	$(TCLSH) ${srcdir}/make.tcl clean
           33  +
           34  +clean:
           35  +	$(TCLSH) ${srcdir}/make.tcl clean
           36  +
   214     37   install:
   215     38   	$(TCLSH) ${srcdir}/make.tcl install $(DESTDIR)
   216     39   
   217         -#========================================================================
   218         -# Performs a minimum install of the dll and Tcl library files
   219         -#========================================================================
   220         -install-package:
   221         -	$(TCLSH) ${srcdir}/make.tcl install-package $(DESTDIR)
           40  +install-modules:
           41  +	$(TCLSH_PROG) $(srcdir)/scripts/install.tcl $(srcdir)/modules $(DESTDIR)$(pkglibdir)
   222     42   
   223         -test: binaries libraries
   224         -	$(TCLSH) `@[email protected] $(srcdir)/tests/all.tcl` $(TESTFLAGS) \
   225         -	    -load "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
   226         -		[list load `@[email protected] $(PKG_LIB_FILE)` $(PACKAGE_NAME)]"
   227         -
   228         -shell: binaries libraries
   229         -	@$(TCLSH) $(SCRIPT)
   230         -
   231         -gdb:
   232         -	$(TCLSH_ENV) $(PKG_ENV) $(GDB) $(TCLSH_PROG) $(SCRIPT)
   233         -
   234         -gdb-test: binaries libraries 
   235         -	$(TCLSH_ENV) $(PKG_ENV) $(GDB) \
   236         -	    --args $(TCLSH_PROG) `@[email protected] $(srcdir)/tests/all.tcl` \
   237         -	    $(TESTFLAGS) -singleproc 1 \
   238         -	    -load "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
   239         -		[list load `@[email protected] $(PKG_LIB_FILE)` $(PACKAGE_NAME)]"
   240         -
   241         -valgrind: binaries libraries
   242         -	$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) \
   243         -	    `@[email protected] $(srcdir)/tests/all.tcl` $(TESTFLAGS)
   244         -
   245         -valgrindshell: binaries libraries
   246         -	$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) $(SCRIPT)
   247         -
   248         -depend:
   249         -
   250         -#========================================================================
   251         -# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
   252         -# mentioned above.  That will ensure that this target is built when you
   253         -# run "make binaries".
   254         -#
   255         -# The $(PKG_OBJECTS) objects are created and linked into the final
   256         -# library.  In most cases these object files will correspond to the
   257         -# source files above.
   258         -#========================================================================
   259         -
   260         -$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS)
   261         -	-rm -f $(PKG_STUB_LIB_FILE)
   262         -	${MAKE_STUB_LIB}
   263         -	$(RANLIB_STUB) $(PKG_STUB_LIB_FILE)
   264         -
   265         -#========================================================================
   266         -# We need to enumerate the list of .c to .o lines here.
   267         -#
   268         -# In the following lines, $(srcdir) refers to the toplevel directory
   269         -# containing your extension.  If your sources are in a subdirectory,
   270         -# you will have to modify the paths to reflect this:
   271         -#
   272         -# sample.$(OBJEXT): $(srcdir)/generic/sample.c
   273         -# 	$(COMPILE) -c `@[email protected] $(srcdir)/generic/sample.c` -o [email protected]
   274         -#
   275         -# Setting the VPATH variable to a list of paths will cause the makefile
   276         -# to look into these paths when resolving .c to .obj dependencies.
   277         -# As necessary, add $(srcdir):$(srcdir)/compat:....
   278         -#========================================================================
   279         -
   280         -VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/macosx
   281         -
   282         -[email protected]@:
   283         -	$(COMPILE) -c `@[email protected] $<` -o [email protected]
   284         -
   285         -#========================================================================
   286         -# Distribution creation
   287         -# You may need to tweak this target to make it work correctly.
   288         -#========================================================================
   289         -
   290         -#COMPRESS	= tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
   291         -COMPRESS	= tar zcvf $(PKG_DIR).tar.gz $(PKG_DIR)
   292         -DIST_ROOT	= /tmp/dist
   293         -DIST_DIR	= $(DIST_ROOT)/$(PKG_DIR)
   294         -
   295         -DIST_INSTALL_DATA	= CPPROG='cp -p' $(INSTALL) -m 644
   296         -DIST_INSTALL_SCRIPT	= CPPROG='cp -p' $(INSTALL) -m 755
   297         -
   298         -dist-clean:
   299         -	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*
   300         -
   301         -dist: dist-clean
   302         -	$(INSTALL_DATA_DIR) $(DIST_DIR)
   303         -
   304         -	# TEA files
   305         -	$(DIST_INSTALL_DATA) $(srcdir)/Makefile.in \
   306         -	    $(srcdir)/aclocal.m4 $(srcdir)/configure.ac \
   307         -	    $(DIST_DIR)/
   308         -	$(DIST_INSTALL_SCRIPT) $(srcdir)/configure $(DIST_DIR)/
   309         -
   310         -	$(INSTALL_DATA_DIR) $(DIST_DIR)/tclconfig
   311         -	$(DIST_INSTALL_DATA) $(srcdir)/tclconfig/README.txt \
   312         -	    $(srcdir)/tclconfig/tcl.m4 $(srcdir)/tclconfig/install-sh \
   313         -	    $(DIST_DIR)/tclconfig/
   314         -
   315         -	# Extension files
   316         -	$(DIST_INSTALL_DATA) \
   317         -	    $(srcdir)/ChangeLog \
   318         -	    $(srcdir)/README.sha \
   319         -	    $(srcdir)/license.terms \
   320         -	    $(srcdir)/README \
   321         -	    $(srcdir)/pkgIndex.tcl.in \
   322         -	    $(DIST_DIR)/
   323         -
   324         -	list='demos doc generic library mac tests unix win'; \
   325         -	for p in $$list; do \
   326         -	    if test -d $(srcdir)/$$p ; then \
   327         -		$(INSTALL_DATA_DIR) $(DIST_DIR)/$$p; \
   328         -		$(DIST_INSTALL_DATA) $(srcdir)/$$p/* $(DIST_DIR)/$$p/; \
   329         -	    fi; \
   330         -	done
   331         -
   332         -	(cd $(DIST_ROOT); $(COMPRESS);)
   333         -
   334         -#========================================================================
   335         -# End of user-definable section
   336         -#========================================================================
   337         -
   338         -#========================================================================
   339         -# Don't modify the file to clean here.  Instead, set the "CLEANFILES"
   340         -# variable in configure.ac
   341         -#========================================================================
   342         -
   343         -clean:
   344         -	-test -z "$(BINARIES)" || rm -f $(BINARIES)
   345         -	-rm -f *.$(OBJEXT) core *.core
   346         -	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
   347         -
   348         -distclean: clean
   349         -	-rm -f *.tab.c
   350         -	-rm -f $(CONFIG_CLEAN_FILES)
   351         -	-rm -f config.cache config.log config.status
   352         -
   353         -#========================================================================
   354         -# Install binary object libraries.  On Windows this includes both .dll and
   355         -# .lib files.  Because the .lib files are not explicitly listed anywhere,
   356         -# we need to deduce their existence from the .dll file of the same name.
   357         -# Library files go into the lib directory.
   358         -# In addition, this will generate the pkgIndex.tcl
   359         -# file in the install location (assuming it can find a usable tclsh shell)
   360         -#
   361         -# You should not have to modify this target.
   362         -#========================================================================
   363         -
   364         -install-lib-binaries: binaries
   365         -	@$(INSTALL_DATA_DIR) $(DESTDIR)$(pkglibdir)
   366         -	@list='$(lib_BINARIES)'; for p in $$list; do \
   367         -	  if test -f $$p; then \
   368         -	    echo " $(INSTALL_LIBRARY) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
   369         -	    $(INSTALL_LIBRARY) $$p $(DESTDIR)$(pkglibdir)/$$p; \
   370         -	    ext=`echo $$p|sed -e "s/.*\.//"`; \
   371         -	    if test "x$$ext" = "xdll"; then \
   372         -		lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
   373         -		if test -f $$lib; then \
   374         -		    echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
   375         -	            $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \
   376         -		fi; \
   377         -	    fi; \
   378         -	  fi; \
   379         -	done
   380         -	@list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
   381         -	  if test -f $(srcdir)/$$p; then \
   382         -	    destp=`basename $$p`; \
   383         -	    echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
   384         -	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
   385         -	  fi; \
   386         -	done
   387         -	@if test "x$(SHARED_BUILD)" = "x1"; then \
   388         -	    echo " Install pkgIndex.tcl $(DESTDIR)$(pkglibdir)"; \
   389         -	    $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \
   390         -	fi
   391         -
   392         -#========================================================================
   393         -# Install binary executables (e.g. .exe files and dependent .dll files)
   394         -# This is for files that must go in the bin directory (located next to
   395         -# wish and tclsh), like dependent .dll files on Windows.
   396         -#
   397         -# You should not have to modify this target, except to define bin_BINARIES
   398         -# above if necessary.
   399         -#========================================================================
   400         -
   401         -install-bin-binaries: binaries
   402         -	@$(INSTALL_DATA_DIR) $(DESTDIR)$(bindir)
   403         -	@list='$(bin_BINARIES)'; for p in $$list; do \
   404         -	  if test -f $$p; then \
   405         -	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \
   406         -	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \
   407         -	  fi; \
   408         -	done
   409         -
   410         -Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
   411         -	cd $(top_builddir) \
   412         -	  && [email protected] CONFIG_HEADERS= $(SHELL) ./config.status
   413         -
   414         -uninstall-binaries:
   415         -	list='$(lib_BINARIES)'; for p in $$list; do \
   416         -	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
   417         -	done
   418         -	list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
   419         -	  p=`basename $$p`; \
   420         -	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
   421         -	done
   422         -	list='$(bin_BINARIES)'; for p in $$list; do \
   423         -	  rm -f $(DESTDIR)$(bindir)/$$p; \
   424         -	done
   425         -
   426         -.PHONY: all binaries clean depend distclean doc install libraries test
   427         -.PHONY: gdb gdb-test valgrind valgrindshell
           43  +.PHONY: all binaries libraries doc test dist distclean install install-modules clean
   428     44   
   429     45   # Tell versions [3.59,3.63) of GNU make to not export all variables.
   430     46   # Otherwise a system limit (for SysV at least) may be exceeded.
   431     47   .NOEXPORT:

Deleted aclocal.m4.

     1         -#
     2         -# Include the TEA standard macro set
     3         -#
     4         -
     5         -builtin(include,tclconfig/tcl.m4)
     6         -
     7         -#
     8         -# Add here whatever m4 macros you want to define for your package
     9         -#

Added auto.def.

            1  +# Initial auto.def created by 'autosetup --init=make'
            2  +puts "AUTO.DEF"
            3  +use cc cc-shared
            4  +
            5  +cc-check-tools ar ranlib strip
            6  +
            7  +define PACKAGE_NAME sample
            8  +define PACKAGE_VERSION 0.6
            9  +
           10  +define PACKAGE_DEFS {}
           11  +define PKG_LIBS {}
           12  +define PKG_CFLAGS {}
           13  +define TEA_TK_EXTENSION 0
           14  +define TEA_PRIVATE_TCL_HEADERS 0
           15  +define TEA_PRIVATE_TK_HEADERS 0
           16  +define VERSION [get-define PACKAGE_VERSION]
           17  +
           18  +# Add any user options here
           19  +options {
           20  +    with-tcl:path        => {Enable Tcl integration, with Tcl in the specified path}
           21  +    with-tcl-stubs=0     => {Enable Tcl integration via stubs library mechanism}
           22  +    with-tcl-private-stubs=1 => {Use Tcl private stubs}
           23  +    enable-shared=1 => {Perform a shared or static build}
           24  +}
           25  +
           26  +use pkg-config
           27  +pkg-config TCL
           28  +
           29  +# Find tclsh for the test suite and practcl
           30  +#
           31  +# We can't use jimsh for this: the test suite uses features of Tcl that
           32  +# Jim doesn't support, either statically or due to the way it's built by
           33  +# autosetup.  For example, Jim supports `file normalize`, but only if
           34  +# you build it with HAVE_REALPATH, which won't ever be defined in this
           35  +# context because autosetup doesn't try to discover platform-specific
           36  +# details like that before it decides to build jimsh0.  Besides which,
           37  +# autosetup won't build jimsh0 at all if it can find tclsh itself.
           38  +# Ironically, this means we may right now be running under either jimsh0
           39  +# or a version of tclsh that we find unsuitable below!
           40  +cc-check-progs tclsh
           41  +set mptd /opt/local
           42  +set hbtd /usr/local/Cellar/tcl-tk
           43  +if {[string equal false [get-define TCLSH]]} {
           44  +    msg-result "WARNING: 'make test' will not run here."
           45  +} else {
           46  +    set v [exec /bin/sh -c "echo 'puts \$tcl_version' | tclsh"]
           47  +    if {[expr $v >= 8.6]} {
           48  +        msg-result "Found Tclsh version $v in the PATH."
           49  +        define TCLSH tclsh
           50  +    } elseif {[file isdirectory $mptd]} {
           51  +        # This is a macOS system with the Macports version of Tcl/Tk
           52  +        # installed.  Select the newest version in /opt/local/bin
           53  +        foreach shver {tclsh8.6 tclsh8.7 tclsh9.0 tclsh8.5} {
           54  +          if {[file exists [file join $mptd bin $shver]]} {
           55  +            msg-result "Using Macports Tcl/Tk version $path."
           56  +            define TCLSH [file join $mptd bin $shver]
           57  +            break
           58  +          }
           59  +        }
           60  +    } elseif {[file isdirectory $hbtd]} {
           61  +        # This is a macOS system with the Homebrew version of Tcl/Tk
           62  +        # installed.  Select the newest version.  It won't normally be
           63  +        # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it
           64  +        # were in the PATH, it's bad practice to put /usr/local/bin (the
           65  +        # Homebrew default) ahead of /usr/bin, especially given that
           66  +        # it's user-writeable by default with Homebrew.  Thus, we can be
           67  +        # pretty sure the only way to call it is with an absolute path.
           68  +        set v [exec ls -tr $hbtd | tail -1]
           69  +        set path "$hbtd/$v/bin/tclsh"
           70  +        define TCLSH $path
           71  +        msg-result "Using Homebrew Tcl/Tk version $path."
           72  +    } else {
           73  +        msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'."
           74  +        define TCLSH false     ;# force "make test" failure via /usr/bin/false
           75  +    }
           76  +}
           77  +
           78  +if {[is_mingw]} {
           79  +    define-append EXTRA_CFLAGS -DBROKEN_MINGW_CMDLINE
           80  +    define-append LIBS -lkernel32 -lws2_32
           81  +}
           82  +
           83  +if {[string match *-solaris* [get-define host]]} {
           84  +    define-append EXTRA_CFLAGS {-D_XOPEN_SOURCE=500 -D__EXTENSIONS__}
           85  +}
           86  +
           87  +set tclpath [opt-val with-tcl]
           88  +if {$tclpath eq ""} {
           89  +  # Find Tcl
           90  +  foreach path {pkg/tcl ../tcl ~/tcl ~/.local /opt/local /usr/local /usr} {
           91  +    if {[file exists [file join $path tclConfig.sh]]} {
           92  +      set tclpath $path
           93  +      break
           94  +    }
           95  +    if {[file exists [file join $path unix tclConfig.sh]]} {
           96  +      set tclpath [file join $path unix]
           97  +      break
           98  +    }
           99  +    if {[file exists [file join $path win tclConfig.sh]]} {
          100  +      set tclpath [file join $path win]
          101  +      break
          102  +    }
          103  +    if {[file exists [file join $path lib tclConfig.sh]]} {
          104  +      set tclpath [file join $path lib]
          105  +      break
          106  +    }
          107  +  }
          108  +}
          109  +if {$tclpath eq ""} {
          110  +  error "Could not find Tcl"
          111  +}
          112  +
          113  +###
          114  +# Deposit the contents of tclconfig where TEA needs it
          115  +###
          116  +tea-generate $tclpath
          117  +
          118  +set NAME    [get-define PACKAGE_NAME]
          119  +set VERSION [get-define PACKAGE_VERSION]
          120  +if {[get-define TEA_PLATFORM] eq "windows"} {
          121  +  define PRACTCL_NAME_LIBRARY "%LIBRARY_PREFIX%%LIBRARY_NAME%%LIBRARY_VERSION_NODOTS%"
          122  +  define RANLIB :
          123  +  define RANLIB_STUB :
          124  +  if {[opt-bool enable-shared]} {
          125  +    define PKG_LIB_FILE [subst "[get-define PACKAGE_LIB_PREFIX][get-define PACKAGE_NAME][get-define SHARED_LIB_SUFFIX]"]
          126  +  } else {
          127  +    define PKG_LIB_FILE [subst "[get-define PACKAGE_LIB_PREFIX][get-define PACKAGE_NAME][get-define UNSHARED_LIB_SUFFIX]"]
          128  +  }
          129  +  define PKG_STUB_LIB_FILE [subst "[get-define PACKAGE_LIB_PREFIX][get-define PACKAGE_NAME]stub[get-define UNSHARED_LIB_SUFFIX]"]
          130  +} else {
          131  +  define PRACTCL_NAME_LIBRARY "lib%LIBRARY_PREFIX%%LIBRARY_NAME%%LIBRARY_VERSION%"
          132  +  if {[opt-bool enable-shared]} {
          133  +    define PKG_LIB_FILE [subst "lib[get-define PACKAGE_LIB_PREFIX][get-define PACKAGE_NAME][get-define SHARED_LIB_SUFFIX]"]
          134  +  } else {
          135  +    define PKG_LIB_FILE [subst "lib[get-define PACKAGE_LIB_PREFIX][get-define PACKAGE_NAME][get-define UNSHARED_LIB_SUFFIX]"]
          136  +  }
          137  +  define PKG_STUB_LIB_FILE [subst "lib[get-define PACKAGE_LIB_PREFIX][get-define PACKAGE_NAME]stub[get-define UNSHARED_LIB_SUFFIX]"]
          138  +}
          139  +
          140  +
          141  +
          142  +# Finally, append -ldl to make sure it's the last in the list.
          143  +# The library order matters in case of static linking.
          144  +if {[check-function-in-lib dlopen dl]} {
          145  +    # Some platforms (*BSD) have the dl functions already in libc and no libdl.
          146  +    # In such case we can link directly without -ldl.
          147  +    define-append LIBS [get-define lib_dlopen]
          148  +}
          149  +
          150  +
          151  +make-config-header autoconfig.h -auto {USE_* MIGRATE_*}
          152  +make-template config.tcl.in config.tcl
          153  +make-template Makefile.in Makefile
          154  +puts "/AUTO.DEF"

Added autosetup/LICENSE.

            1  +Unless explicitly stated, all files which form part of autosetup
            2  +are released under the following license:
            3  +
            4  +---------------------------------------------------------------------
            5  +autosetup - A build environment "autoconfigurator"
            6  +
            7  +Copyright (c) 2010-2011, WorkWare Systems <http://workware.net.au/>
            8  +
            9  +Redistribution and use in source and binary forms, with or without
           10  +modification, are permitted provided that the following conditions
           11  +are met:
           12  +
           13  +1. Redistributions of source code must retain the above copyright
           14  +   notice, this list of conditions and the following disclaimer.
           15  +2. Redistributions in binary form must reproduce the above
           16  +   copyright notice, this list of conditions and the following
           17  +   disclaimer in the documentation and/or other materials
           18  +   provided with the distribution.
           19  +
           20  +THIS SOFTWARE IS PROVIDED BY THE WORKWARE SYSTEMS ``AS IS'' AND ANY
           21  +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
           22  +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
           23  +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WORKWARE
           24  +SYSTEMS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
           25  +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
           26  +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
           27  +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
           28  +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
           29  +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
           30  +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
           31  +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
           32  +
           33  +The views and conclusions contained in the software and documentation
           34  +are those of the authors and should not be interpreted as representing
           35  +official policies, either expressed or implied, of WorkWare Systems.

Added autosetup/README.autosetup.

            1  +README.autosetup created by autosetup v0.6.9
            2  +
            3  +This is the autosetup directory for a local install of autosetup.
            4  +It contains autosetup, support files and loadable modules.
            5  +
            6  +*.tcl files in this directory are optional modules which
            7  +can be loaded with the 'use' directive.
            8  +
            9  +*.auto files in this directory are auto-loaded.
           10  +
           11  +For more information, see http://msteveb.github.com/autosetup/

Added autosetup/autosetup.

            1  +#!/bin/sh
            2  +# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
            3  +# All rights reserved
            4  +# vim:se syntax=tcl:
            5  +# \
            6  +dir=`dirname "$0"`; exec "`$dir/autosetup-find-tclsh`" "$0" "[email protected]"
            7  +
            8  +set autosetup(version) 0.6.9
            9  +
           10  +# Can be set to 1 to debug early-init problems
           11  +set autosetup(debug) [expr {"--debug" in $argv}]
           12  +
           13  +##################################################################
           14  +#
           15  +# Main flow of control, option handling
           16  +#
           17  +proc main {argv} {
           18  +	global autosetup define
           19  +
           20  +	# There are 3 potential directories involved:
           21  +	# 1. The directory containing autosetup (this script)
           22  +	# 2. The directory containing auto.def
           23  +	# 3. The current directory
           24  +
           25  +	# From this we need to determine:
           26  +	# a. The path to this script (and related support files)
           27  +	# b. The path to auto.def
           28  +	# c. The build directory, where output files are created
           29  +
           30  +	# This is also complicated by the fact that autosetup may
           31  +	# have been run via the configure wrapper ([getenv WRAPPER] is set)
           32  +
           33  +	# Here are the rules.
           34  +	# a. This script is $::argv0
           35  +	#    => dir, prog, exe, libdir
           36  +	# b. auto.def is in the directory containing the configure wrapper,
           37  +	#    otherwise it is in the current directory.
           38  +	#    => srcdir, autodef
           39  +	# c. The build directory is the current directory
           40  +	#    => builddir, [pwd]
           41  +
           42  +	# 'misc' is needed before we can do anything, so set a temporary libdir
           43  +	# in case this is the development version
           44  +	set autosetup(libdir) [file dirname $::argv0]/lib
           45  +	use misc
           46  +
           47  +	# (a)
           48  +	set autosetup(dir) [realdir [file dirname [realpath $::argv0]]]
           49  +	set autosetup(prog) [file join $autosetup(dir) [file tail $::argv0]]
           50  +	set autosetup(exe) [getenv WRAPPER $autosetup(prog)]
           51  +	if {$autosetup(installed)} {
           52  +		set autosetup(libdir) $autosetup(dir)
           53  +	} else {
           54  +		set autosetup(libdir) [file join $autosetup(dir) lib]
           55  +	}
           56  +	autosetup_add_dep $autosetup(prog)
           57  +
           58  +	# (b)
           59  +	if {[getenv WRAPPER ""] eq ""} {
           60  +		# Invoked directly
           61  +		set autosetup(srcdir) [pwd]
           62  +	} else {
           63  +		# Invoked via the configure wrapper
           64  +		set autosetup(srcdir) [file-normalize [file dirname $autosetup(exe)]]
           65  +	}
           66  +	set autosetup(autodef) [relative-path $autosetup(srcdir)/auto.def]
           67  +
           68  +	# (c)
           69  +	set autosetup(builddir) [pwd]
           70  +
           71  +	set autosetup(argv) $argv
           72  +	set autosetup(cmdline) {}
           73  +	# options is a list of known options
           74  +	set autosetup(options) {}
           75  +	# optset is a dictionary of option values set by the user based on getopt
           76  +	set autosetup(optset) {}
           77  +	# optdefault is a dictionary of default values
           78  +	set autosetup(optdefault) {}
           79  +	# options-defaults is a dictionary of overrides for default values for options
           80  +	set autosetup(options-defaults) {}
           81  +	set autosetup(optionhelp) {}
           82  +	set autosetup(showhelp) 0
           83  +
           84  +	use util
           85  +
           86  +	# Parse options
           87  +	use getopt
           88  +
           89  +	# At the is point we don't know what is a valid option
           90  +	# We simply parse anything that looks like an option
           91  +	set autosetup(getopt) [getopt argv]
           92  +
           93  +	#"=Core Options:"
           94  +	options-add {
           95  +		help:=local  => "display help and options. Optionally specify a module name, such as --help=system"
           96  +		licence license => "display the autosetup license"
           97  +		version      => "display the version of autosetup"
           98  +		ref:=text manual:=text
           99  +		reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'"
          100  +		debug        => "display debugging output as autosetup runs"
          101  +		install:=.   => "install autosetup to the current or given directory"
          102  +	}
          103  +	if {$autosetup(installed)} {
          104  +		# hidden options so we can produce a nice error
          105  +		options-add {
          106  +			sysinstall:path
          107  +		}
          108  +	} else {
          109  +		options-add {
          110  +			sysinstall:path  => "install standalone autosetup to the given directory (e.g.: /usr/local)"
          111  +		}
          112  +	}
          113  +	options-add {
          114  +		force init:=help   => "create initial auto.def, etc.  Use --init=help for known types"
          115  +		# Undocumented options
          116  +		option-checking=1
          117  +		nopager
          118  +		quiet
          119  +		timing
          120  +		conf:
          121  +	}
          122  +
          123  +	if {[opt-bool version]} {
          124  +		puts $autosetup(version)
          125  +		exit 0
          126  +	}
          127  +
          128  +	# autosetup --conf=alternate-auto.def
          129  +	if {[opt-str conf o]} {
          130  +		set autosetup(autodef) $o
          131  +	}
          132  +
          133  +	# Debugging output (set this early)
          134  +	incr autosetup(debug) [opt-bool debug]
          135  +	incr autosetup(force) [opt-bool force]
          136  +	incr autosetup(msg-quiet) [opt-bool quiet]
          137  +	incr autosetup(msg-timing) [opt-bool timing]
          138  +
          139  +	# If the local module exists, source it now to allow for
          140  +	# project-local customisations
          141  +	if {[file exists $autosetup(libdir)/local.tcl]} {
          142  +		use local
          143  +	}
          144  +
          145  +	# Now any auto-load modules
          146  +	autosetup_load_auto_modules
          147  +
          148  +	if {[opt-str help o]} {
          149  +		incr autosetup(showhelp)
          150  +		use help
          151  +		autosetup_help $o
          152  +	}
          153  +
          154  +	if {[opt-bool licence license]} {
          155  +		use help
          156  +		autosetup_show_license
          157  +		exit 0
          158  +	}
          159  +
          160  +	if {[opt-str {manual ref reference} o]} {
          161  +		use help
          162  +		autosetup_reference $o
          163  +	}
          164  +
          165  +	# Allow combining --install and --init
          166  +	set earlyexit 0
          167  +	if {[opt-str install o]} {
          168  +		use install
          169  +		autosetup_install $o
          170  +		incr earlyexit
          171  +	}
          172  +
          173  +	if {[opt-str init o]} {
          174  +		use init
          175  +		autosetup_init $o
          176  +		incr earlyexit
          177  +	}
          178  +
          179  +	if {$earlyexit} {
          180  +		exit 0
          181  +	}
          182  +	if {[opt-str sysinstall o]} {
          183  +		use install
          184  +		autosetup_install $o 1
          185  +		exit 0
          186  +	}
          187  +
          188  +	if {![file exists $autosetup(autodef)]} {
          189  +		# Check for invalid option first
          190  +		options {}
          191  +		user-error "No auto.def found in \"$autosetup(srcdir)\" (use [file tail $::autosetup(exe)] --init to create one)"
          192  +	}
          193  +
          194  +	# Parse extra arguments into autosetup(cmdline)
          195  +	foreach arg $argv {
          196  +		if {[regexp {([^=]*)=(.*)} $arg -> n v]} {
          197  +			dict set autosetup(cmdline) $n $v
          198  +			define $n $v
          199  +		} else {
          200  +			user-error "Unexpected parameter: $arg"
          201  +		}
          202  +	}
          203  +
          204  +	autosetup_add_dep $autosetup(autodef)
          205  +
          206  +	define CONFIGURE_OPTS ""
          207  +	foreach arg $autosetup(argv) {
          208  +		define-append CONFIGURE_OPTS [quote-if-needed $arg]
          209  +	}
          210  +	define AUTOREMAKE [file-normalize $autosetup(exe)]
          211  +	define-append AUTOREMAKE [get-define CONFIGURE_OPTS]
          212  +
          213  +
          214  +	# Log how we were invoked
          215  +	configlog "Invoked as: [getenv WRAPPER $::argv0] [quote-argv $autosetup(argv)]"
          216  +
          217  +	# Note that auto.def is *not* loaded in the global scope
          218  +	source $autosetup(autodef)
          219  +
          220  +	# Could warn here if options {} was not specified
          221  +
          222  +	show-notices
          223  +
          224  +	if {$autosetup(debug)} {
          225  +		msg-result "Writing all defines to config.log"
          226  +		configlog "================ defines ======================"
          227  +		foreach n [lsort [array names define]] {
          228  +			configlog "define $n $define($n)"
          229  +		}
          230  +	}
          231  +
          232  +	exit 0
          233  +}
          234  +
          235  +# @opt-bool ?-nodefault? option ...
          236  +#
          237  +# Check each of the named, boolean options and if any have been explicitly enabled
          238  +# or disabled by the user, return 1 or 0 accordingly.
          239  +#
          240  +# If the option was specified more than once, the last value wins.
          241  +# e.g. With '--enable-foo --disable-foo', '[opt-bool foo]' will return 0
          242  +#
          243  +# If no value was specified by the user, returns the default value for the
          244  +# first option. If '-nodefault' is given, this behaviour changes and
          245  +# -1 is returned instead.
          246  +#
          247  +proc opt-bool {args} {
          248  +	set nodefault 0
          249  +	if {[lindex $args 0] eq "-nodefault"} {
          250  +		set nodefault 1
          251  +		set args [lrange $args 1 end]
          252  +	}
          253  +	option-check-names {*}$args
          254  +
          255  +	foreach opt $args {
          256  +		if {[dict exists $::autosetup(optset) $opt]} {
          257  +			return [dict get $::autosetup(optset) $opt]
          258  +		}
          259  +	}
          260  +
          261  +	if {$nodefault} {
          262  +		return -1
          263  +	}
          264  +	# Default value is the default for the first option
          265  +	return [dict get $::autosetup(optdefault) [lindex $args 0]]
          266  +}
          267  +
          268  +# @opt-val optionlist ?default=""?
          269  +#
          270  +# Returns a list containing all the values given for the non-boolean options in '$optionlist'.
          271  +# There will be one entry in the list for each option given by the user, including if the
          272  +# same option was used multiple times.
          273  +#
          274  +# If no options were set, '$default' is returned (exactly, not as a list).
          275  +#
          276  +# Note: For most use cases, 'opt-str' should be preferred.
          277  +#
          278  +proc opt-val {names {default ""}} {
          279  +	option-check-names {*}$names
          280  +
          281  +	foreach opt $names {
          282  +		if {[dict exists $::autosetup(optset) $opt]} {
          283  +			lappend result {*}[dict get $::autosetup(optset) $opt]
          284  +		}
          285  +	}
          286  +	if {[info exists result]} {
          287  +		return $result
          288  +	}
          289  +	return $default
          290  +}
          291  +
          292  +# @opt-str optionlist varname ?default?
          293  +#
          294  +# Sets '$varname' in the callers scope to the value for one of the given options.
          295  +#
          296  +# For the list of options given in '$optionlist', if any value is set for any option,
          297  +# the option value is taken to be the *last* value of the last option (in the order given).
          298  +#
          299  +# If no option was given, and a default was specified with 'options-defaults',
          300  +# that value is used.
          301  +#
          302  +# If no 'options-defaults' value was given and '$default' was given, it is used.
          303  +#
          304  +# If none of the above provided a value, no value is set.
          305  +#
          306  +# The return value depends on whether '$default' was specified.
          307  +# If it was, the option value is returned.
          308  +# If it was not, 1 is returns if a value was set, or 0 if not.
          309  +#
          310  +# Typical usage is as follows:
          311  +#
          312  +## if {[opt-str {myopt altname} o]} {
          313  +##     do something with $o
          314  +## }
          315  +#
          316  +# Or:
          317  +## define myname [opt-str {myopt altname} o "/usr/local"]
          318  +#
          319  +proc opt-str {names varname args} {
          320  +	global autosetup
          321  +
          322  +	option-check-names {*}$names
          323  +	upvar $varname value
          324  +
          325  +	if {[llength $args]} {
          326  +		# A default was given, so always return the string value of the option
          327  +		set default [lindex $args 0]
          328  +		set retopt 1
          329  +	} else {
          330  +		# No default, so return 0 or 1 to indicate if a value was found
          331  +		set retopt 0
          332  +	}
          333  +
          334  +	foreach opt $names {
          335  +		if {[dict exists $::autosetup(optset) $opt]} {
          336  +			set result [lindex [dict get $::autosetup(optset) $opt] end]
          337  +		}
          338  +	}
          339  +
          340  +	if {![info exists result]} {
          341  +		# No user-specified value. Has options-defaults been set?
          342  +		foreach opt $names {
          343  +			if {[dict exists $::autosetup(options-defaults) $opt]} {
          344  +				set result [dict get $autosetup(options-defaults) $opt]
          345  +			}
          346  +		}
          347  +	}
          348  +
          349  +	if {[info exists result]} {
          350  +		set value $result
          351  +		if {$retopt} {
          352  +			return $value
          353  +		}
          354  +		return 1
          355  +	}
          356  +
          357  +	if {$retopt} {
          358  +		set value $default
          359  +		return $value
          360  +	}
          361  +
          362  +	return 0
          363  +}
          364  +
          365  +proc option-check-names {args} {
          366  +	foreach o $args {
          367  +		if {$o ni $::autosetup(options)} {
          368  +			autosetup-error "Request for undeclared option --$o"
          369  +		}
          370  +	}
          371  +}
          372  +
          373  +# Parse the option definition in $opts and update
          374  +# ::autosetup(setoptions) and ::autosetup(optionhelp) appropriately
          375  +#
          376  +proc options-add {opts {header ""}} {
          377  +	global autosetup
          378  +
          379  +	# First weed out comment lines
          380  +	set realopts {}
          381  +	foreach line [split $opts \n] {
          382  +		if {![string match "#*" [string trimleft $line]]} {
          383  +			append realopts $line \n
          384  +		}
          385  +	}
          386  +	set opts $realopts
          387  +
          388  +	for {set i 0} {$i < [llength $opts]} {incr i} {
          389  +		set opt [lindex $opts $i]
          390  +		if {[string match =* $opt]} {
          391  +			# This is a special heading
          392  +			lappend autosetup(optionhelp) $opt ""
          393  +			set header {}
          394  +			continue
          395  +		}
          396  +		unset -nocomplain defaultvalue equal value
          397  +
          398  +		#puts "i=$i, opt=$opt"
          399  +		regexp {^([^:=]*)(:)?(=)?(.*)$} $opt -> name colon equal value
          400  +		if {$name in $autosetup(options)} {
          401  +			autosetup-error "Option $name already specified"
          402  +		}
          403  +
          404  +		#puts "$opt => $name $colon $equal $value"
          405  +
          406  +		# Find the corresponding value in the user options
          407  +		# and set the default if necessary
          408  +		if {[string match "-*" $opt]} {
          409  +			# This is a documentation-only option, like "-C <dir>"
          410  +			set opthelp $opt
          411  +		} elseif {$colon eq ""} {
          412  +			# Boolean option
          413  +			lappend autosetup(options) $name
          414  +
          415  +			# Check for override
          416  +			if {[dict exists $autosetup(options-defaults) $name]} {
          417  +				# A default was specified with options-defaults, so use it
          418  +				set value [dict get $autosetup(options-defaults) $name]
          419  +			}
          420  +
          421  +			if {$value eq "1"} {
          422  +				set opthelp "--disable-$name"
          423  +			} else {
          424  +				set opthelp "--$name"
          425  +			}
          426  +
          427  +			# Set the default
          428  +			if {$value eq ""} {
          429  +				set value 0
          430  +			}
          431  +			set defaultvalue $value
          432  +			dict set autosetup(optdefault) $name $defaultvalue
          433  +
          434  +			if {[dict exists $autosetup(getopt) $name]} {
          435  +				# The option was specified by the user. Look at the last value.
          436  +				lassign [lindex [dict get $autosetup(getopt) $name] end] type setvalue
          437  +				if {$type eq "str"} {
          438  +					# Can we convert the value to a boolean?
          439  +					if {$setvalue in {1 enabled yes}} {
          440  +						set setvalue 1
          441  +					} elseif {$setvalue in {0 disabled no}} {
          442  +						set setvalue 0
          443  +					} else {
          444  +						user-error "Boolean option $name given as --$name=$setvalue"
          445  +					}
          446  +				}
          447  +				dict set autosetup(optset) $name $setvalue
          448  +				#puts "Found boolean option --$name=$setvalue"
          449  +			}
          450  +		} else {
          451  +			# String option.
          452  +			lappend autosetup(options) $name
          453  +
          454  +			if {$colon eq ":"} {
          455  +				# Was ":name=default" given?
          456  +				# If so, set $value to the display name and $defaultvalue to the default
          457  +				# (This is the preferred way to set a default value for a string option)
          458  +				if {[regexp {^([^=]+)=(.*)$} $value -> value defaultvalue]} {
          459  +					dict set autosetup(optdefault) $name $defaultvalue
          460  +				}
          461  +			}
          462  +
          463  +			# Maybe override the default value
          464  +			if {[dict exists $autosetup(options-defaults) $name]} {
          465  +				# A default was specified with options-defaults, so use it
          466  +				set defaultvalue [dict get $autosetup(options-defaults) $name]
          467  +				dict set autosetup(optdefault) $name $defaultvalue
          468  +			} elseif {![info exists defaultvalue]} {
          469  +				# For backward compatibility, if ":name" was given, use name as both
          470  +				# the display text and the default value, but only if the user
          471  +				# specified the option without the value
          472  +				set defaultvalue $value
          473  +			}
          474  +
          475  +			if {$equal eq "="} {
          476  +				# String option with optional value
          477  +				set opthelp "--$name?=$value?"
          478  +			} else {
          479  +				# String option with required value
          480  +				set opthelp "--$name=$value"
          481  +			}
          482  +
          483  +			# Get the values specified by the user
          484  +			if {[dict exists $autosetup(getopt) $name]} {
          485  +				set listvalue {}
          486  +
          487  +				foreach pair [dict get $autosetup(getopt) $name] {
          488  +					lassign $pair type setvalue
          489  +					if {$type eq "bool" && $setvalue} {
          490  +						if {$equal ne "="} {
          491  +							user-error "Option --$name requires a value"
          492  +						}
          493  +						# If given as a boolean, use the default value
          494  +						set setvalue $defaultvalue
          495  +					}
          496  +					lappend listvalue $setvalue
          497  +				}
          498  +
          499  +				#puts "Found string option --$name=$listvalue"
          500  +				dict set autosetup(optset) $name $listvalue
          501  +			}
          502  +		}
          503  +
          504  +		# Now create the help for this option if appropriate
          505  +		if {[lindex $opts $i+1] eq "=>"} {
          506  +			set desc [lindex $opts $i+2]
          507  +			if {[info exists defaultvalue]} {
          508  +				set desc [string map [list @[email protected] $defaultvalue] $desc]
          509  +			}
          510  +			#string match \n* $desc
          511  +			if {$header ne ""} {
          512  +				lappend autosetup(optionhelp) $header ""
          513  +				set header ""
          514  +			}
          515  +			# A multi-line description
          516  +			lappend autosetup(optionhelp) $opthelp $desc
          517  +			incr i 2
          518  +		}
          519  +	}
          520  +}
          521  +
          522  +# @module-options optionlist
          523  +#
          524  +# Like 'options', but used within a module.
          525  +proc module-options {opts} {
          526  +	set header ""
          527  +	if {$::autosetup(showhelp) > 1 && [llength $opts]} {
          528  +		set header "Module Options:"
          529  +	}
          530  +	options-add $opts $header
          531  +
          532  +	if {$::autosetup(showhelp)} {
          533  +		# Ensure that the module isn't executed on --help
          534  +		# We are running under eval or source, so use break
          535  +		# to prevent further execution
          536  +		#return -code break -level 2
          537  +		return -code break
          538  +	}
          539  +}
          540  +
          541  +proc max {a b} {
          542  +	expr {$a > $b ? $a : $b}
          543  +}
          544  +
          545  +proc options-wrap-desc {text length firstprefix nextprefix initial} {
          546  +	set len $initial
          547  +	set space $firstprefix
          548  +	foreach word [split $text] {
          549  +		set word [string trim $word]
          550  +		if {$word == ""} {
          551  +			continue
          552  +		}
          553  +		if {$len && [string length $space$word] + $len >= $length} {
          554  +			puts ""
          555  +			set len 0
          556  +			set space $nextprefix
          557  +		}
          558  +		incr len [string length $space$word]
          559  +		puts -nonewline $space$word
          560  +		set space " "
          561  +	}
          562  +	if {$len} {
          563  +		puts ""
          564  +	}
          565  +}
          566  +
          567  +proc options-show {} {
          568  +	# Determine the max option width
          569  +	set max 0
          570  +	foreach {opt desc} $::autosetup(optionhelp) {
          571  +		if {[string match =* $opt] || [string match \n* $desc]} {
          572  +			continue
          573  +		}
          574  +		set max [max $max [string length $opt]]
          575  +	}
          576  +	set indent [string repeat " " [expr $max+4]]
          577  +	set cols [getenv COLUMNS 80]
          578  +	catch {
          579  +		lassign [exec stty size] rows cols
          580  +	}
          581  +	incr cols -1
          582  +	# Now output
          583  +	foreach {opt desc} $::autosetup(optionhelp) {
          584  +		if {[string match =* $opt]} {
          585  +			puts [string range $opt 1 end]
          586  +			continue
          587  +		}
          588  +		puts -nonewline "  [format %-${max}s $opt]"
          589  +		if {[string match \n* $desc]} {
          590  +			puts $desc
          591  +		} else {
          592  +			options-wrap-desc [string trim $desc] $cols "  " $indent [expr $max + 2]
          593  +		}
          594  +	}
          595  +}
          596  +
          597  +# @options optionspec
          598  +#
          599  +# Specifies configuration-time options which may be selected by the user
          600  +# and checked with 'opt-str' and 'opt-bool'. '$optionspec' contains a series
          601  +# of options specifications separated by newlines, as follows:
          602  +#
          603  +# A boolean option is of the form:
          604  +#
          605  +## name[=0|1]  => "Description of this boolean option"
          606  +#
          607  +# The default is 'name=0', meaning that the option is disabled by default.
          608  +# If 'name=1' is used to make the option enabled by default, the description should reflect
          609  +# that with text like "Disable support for ...".
          610  +#
          611  +# An argument option (one which takes a parameter) is of the form:
          612  +#
          613  +## name:[=]value  => "Description of this option"
          614  +#
          615  +# If the 'name:value' form is used, the value must be provided with the option (as '--name=myvalue').
          616  +# If the 'name:=value' form is used, the value is optional and the given value is used as the default
          617  +# if it is not provided.
          618  +#
          619  +# The description may contain '@[email protected]', in which case it will be replaced with the default
          620  +# value for the option (taking into account defaults specified with 'options-defaults'.
          621  +#
          622  +# Undocumented options are also supported by omitting the '=> description'.
          623  +# These options are not displayed with '--help' and can be useful for internal options or as aliases.
          624  +#
          625  +# For example, '--disable-lfs' is an alias for '--disable=largefile':
          626  +#
          627  +## lfs=1 largefile=1 => "Disable large file support"
          628  +#
          629  +proc options {optlist} {
          630  +	# Allow options as a list or args
          631  +	options-add $optlist "Local Options:"
          632  +
          633  +	if {$::autosetup(showhelp)} {
          634  +		options-show
          635  +		exit 0
          636  +	}
          637  +
          638  +	# Check for invalid options
          639  +	if {[opt-bool option-checking]} {
          640  +		foreach o [dict keys $::autosetup(getopt)] {
          641  +			if {$o ni $::autosetup(options)} {
          642  +				user-error "Unknown option --$o"
          643  +			}
          644  +		}
          645  +	}
          646  +}
          647  +
          648  +# @options-defaults dictionary
          649  +#
          650  +# Specifies a dictionary of options and a new default value for each of those options.
          651  +# Use before any 'use' statements in 'auto.def' to change the defaults for
          652  +# subsequently included modules.
          653  +proc options-defaults {dict} {
          654  +	foreach {n v} $dict {
          655  +		dict set ::autosetup(options-defaults) $n $v
          656  +	}
          657  +}
          658  +
          659  +proc config_guess {} {
          660  +	if {[file-isexec $::autosetup(dir)/autosetup-config.guess]} {
          661  +		if {[catch {exec-with-stderr sh $::autosetup(dir)/autosetup-config.guess} alias]} {
          662  +			user-error $alias
          663  +		}
          664  +		return $alias
          665  +	} else {
          666  +		configlog "No autosetup-config.guess, so using uname"
          667  +		string tolower [exec uname -p]-unknown-[exec uname -s][exec uname -r]
          668  +	}
          669  +}
          670  +
          671  +proc config_sub {alias} {
          672  +	if {[file-isexec $::autosetup(dir)/autosetup-config.sub]} {
          673  +		if {[catch {exec-with-stderr sh $::autosetup(dir)/autosetup-config.sub $alias} alias]} {
          674  +			user-error $alias
          675  +		}
          676  +	}
          677  +	return $alias
          678  +}
          679  +
          680  +# @define name ?value=1?
          681  +#
          682  +# Defines the named variable to the given value.
          683  +# These (name, value) pairs represent the results of the configuration check
          684  +# and are available to be subsequently checked, modified and substituted.
          685  +#
          686  +proc define {name {value 1}} {
          687  +	set ::define($name) $value
          688  +	#dputs "$name <= $value"
          689  +}
          690  +
          691  +# @undefine name
          692  +#
          693  +# Undefine the named variable.
          694  +#
          695  +proc undefine {name} {
          696  +	unset -nocomplain ::define($name)
          697  +	#dputs "$name <= <undef>"
          698  +}
          699  +
          700  +# @define-append name value ...
          701  +#
          702  +# Appends the given value(s) to the given "defined" variable.
          703  +# If the variable is not defined or empty, it is set to '$value'.
          704  +# Otherwise the value is appended, separated by a space.
          705  +# Any extra values are similarly appended.
          706  +# If any value is already contained in the variable (as a substring) it is omitted.
          707  +#
          708  +proc define-append {name args} {
          709  +	if {[get-define $name ""] ne ""} {
          710  +		# Avoid duplicates
          711  +		foreach arg $args {
          712  +			if {$arg eq ""} {
          713  +				continue
          714  +			}
          715  +			set found 0
          716  +			foreach str [split $::define($name) " "] {
          717  +				if {$str eq $arg} {
          718  +					incr found
          719  +				}
          720  +			}
          721  +			if {!$found} {
          722  +				append ::define($name) " " $arg
          723  +			}
          724  +		}
          725  +	} else {
          726  +		set ::define($name) [join $args]
          727  +	}
          728  +	#dputs "$name += [join $args] => $::define($name)"
          729  +}
          730  +
          731  +# @get-define name ?default=0?
          732  +#
          733  +# Returns the current value of the "defined" variable, or '$default'
          734  +# if not set.
          735  +#
          736  +proc get-define {name {default 0}} {
          737  +	if {[info exists ::define($name)]} {
          738  +		#dputs "$name => $::define($name)"
          739  +		return $::define($name)
          740  +	}
          741  +	#dputs "$name => $default"
          742  +	return $default
          743  +}
          744  +
          745  +# @is-defined name
          746  +#
          747  +# Returns 1 if the given variable is defined.
          748  +#
          749  +proc is-defined {name} {
          750  +	info exists ::define($name)
          751  +}
          752  +
          753  +# @is-define-set name
          754  +#
          755  +# Returns 1 if the given variable is defined and is set
          756  +# to a value other than "" or 0
          757  +#
          758  +proc is-define-set {name} {
          759  +	if {[get-define $name] in {0 ""}} {
          760  +		return 0
          761  +	}
          762  +	return 1
          763  +}
          764  +
          765  +# @all-defines
          766  +#
          767  +# Returns a dictionary (name, value list) of all defined variables.
          768  +#
          769  +# This is suitable for use with 'dict', 'array set' or 'foreach'
          770  +# and allows for arbitrary processing of the defined variables.
          771  +#
          772  +proc all-defines {} {
          773  +	array get ::define
          774  +}
          775  +
          776  +
          777  +# @get-env name default
          778  +#
          779  +# If '$name' was specified on the command line, return it.
          780  +# Otherwise if '$name' was set in the environment, return it.
          781  +# Otherwise return '$default'.
          782  +#
          783  +proc get-env {name default} {
          784  +	if {[dict exists $::autosetup(cmdline) $name]} {
          785  +		return [dict get $::autosetup(cmdline) $name]
          786  +	}
          787  +	getenv $name $default
          788  +}
          789  +
          790  +# @env-is-set name
          791  +#
          792  +# Returns 1 if '$name' was specified on the command line or in the environment.
          793  +# Note that an empty environment variable is not considered to be set.
          794  +#
          795  +proc env-is-set {name} {
          796  +	if {[dict exists $::autosetup(cmdline) $name]} {
          797  +		return 1
          798  +	}
          799  +	if {[getenv $name ""] ne ""} {
          800  +		return 1
          801  +	}
          802  +	return 0
          803  +}
          804  +
          805  +# @readfile filename ?default=""?
          806  +#
          807  +# Return the contents of the file, without the trailing newline.
          808  +# If the file doesn't exist or can't be read, returns '$default'.
          809  +#
          810  +proc readfile {filename {default_value ""}} {
          811  +	set result $default_value
          812  +	catch {
          813  +		set f [open $filename]
          814  +		set result [read -nonewline $f]
          815  +		close $f
          816  +	}
          817  +	return $result
          818  +}
          819  +
          820  +# @writefile filename value
          821  +#
          822  +# Creates the given file containing '$value'.
          823  +# Does not add an extra newline.
          824  +#
          825  +proc writefile {filename value} {
          826  +	set f [open $filename w]
          827  +	puts -nonewline $f $value
          828  +	close $f
          829  +}
          830  +
          831  +proc quote-if-needed {str} {
          832  +	if {[string match {*[\" ]*} $str]} {
          833  +		return \"[string map [list \" \\" \\ \\\\] $str]\"
          834  +	}
          835  +	return $str
          836  +}
          837  +
          838  +proc quote-argv {argv} {
          839  +	set args {}
          840  +	foreach arg $argv {
          841  +		lappend args [quote-if-needed $arg]
          842  +	}
          843  +	join $args
          844  +}
          845  +
          846  +# @list-non-empty list
          847  +#
          848  +# Returns a copy of the given list with empty elements removed
          849  +proc list-non-empty {list} {
          850  +	set result {}
          851  +	foreach p $list {
          852  +		if {$p ne ""} {
          853  +			lappend result $p
          854  +		}
          855  +	}
          856  +	return $result
          857  +}
          858  +
          859  +# @find-executable-path name
          860  +#
          861  +# Searches the path for an executable with the given name.
          862  +# Note that the name may include some parameters, e.g. 'cc -mbig-endian',
          863  +# in which case the parameters are ignored.
          864  +# The full path to the executable if found, or "" if not found.
          865  +# Returns 1 if found, or 0 if not.
          866  +#
          867  +proc find-executable-path {name} {
          868  +	# Ignore any parameters
          869  +	set name [lindex $name 0]
          870  +	# The empty string is never a valid executable
          871  +	if {$name ne ""} {
          872  +		foreach p [split-path] {
          873  +			dputs "Looking for $name in $p"
          874  +			set exec [file join $p $name]
          875  +			if {[file-isexec $exec]} {
          876  +				dputs "Found $name -> $exec"
          877  +				return $exec
          878  +			}
          879  +		}
          880  +	}
          881  +	return {}
          882  +}
          883  +
          884  +# @find-executable name
          885  +#
          886  +# Searches the path for an executable with the given name.
          887  +# Note that the name may include some parameters, e.g. 'cc -mbig-endian',
          888  +# in which case the parameters are ignored.
          889  +# Returns 1 if found, or 0 if not.
          890  +#
          891  +proc find-executable {name} {
          892  +	if {[find-executable-path $name] eq {}} {
          893  +		return 0
          894  +	}
          895  +	return 1
          896  +}
          897  +
          898  +# @find-an-executable ?-required? name ...
          899  +#
          900  +# Given a list of possible executable names,
          901  +# searches for one of these on the path.
          902  +#
          903  +# Returns the name found, or "" if none found.
          904  +# If the first parameter is '-required', an error is generated
          905  +# if no executable is found.
          906  +#
          907  +proc find-an-executable {args} {
          908  +	set required 0
          909  +	if {[lindex $args 0] eq "-required"} {
          910  +		set args [lrange $args 1 end]
          911  +		incr required
          912  +	}
          913  +	foreach name $args {
          914  +		if {[find-executable $name]} {
          915  +			return $name
          916  +		}
          917  +	}
          918  +	if {$required} {
          919  +		if {[llength $args] == 1} {
          920  +			user-error "failed to find: [join $args]"
          921  +		} else {
          922  +			user-error "failed to find one of: [join $args]"
          923  +		}
          924  +	}
          925  +	return ""
          926  +}
          927  +
          928  +# @configlog msg
          929  +#
          930  +# Writes the given message to the configuration log, 'config.log'.
          931  +#
          932  +proc configlog {msg} {
          933  +	if {![info exists ::autosetup(logfh)]} {
          934  +		set ::autosetup(logfh) [open config.log w]
          935  +	}
          936  +	puts $::autosetup(logfh) $msg
          937  +}
          938  +
          939  +# @msg-checking msg
          940  +#
          941  +# Writes the message with no newline to stdout.
          942  +#
          943  +proc msg-checking {msg} {
          944  +	if {$::autosetup(msg-quiet) == 0} {
          945  +		maybe-show-timestamp
          946  +		puts -nonewline $msg
          947  +		set ::autosetup(msg-checking) 1
          948  +	}
          949  +}
          950  +
          951  +# @msg-result msg
          952  +#
          953  +# Writes the message to stdout.
          954  +#
          955  +proc msg-result {msg} {
          956  +	if {$::autosetup(msg-quiet) == 0} {
          957  +		maybe-show-timestamp
          958  +		puts $msg
          959  +		set ::autosetup(msg-checking) 0
          960  +		show-notices
          961  +	}
          962  +}
          963  +
          964  +# @msg-quiet command ...
          965  +#
          966  +# 'msg-quiet' evaluates it's arguments as a command with output
          967  +# from 'msg-checking' and 'msg-result' suppressed.
          968  +#
          969  +# This is useful if a check needs to run a subcheck which isn't
          970  +# of interest to the user.
          971  +proc msg-quiet {args} {
          972  +	incr ::autosetup(msg-quiet)
          973  +	set rc [uplevel 1 $args]
          974  +	incr ::autosetup(msg-quiet) -1
          975  +	return $rc
          976  +}
          977  +
          978  +# Will be overridden by 'use misc'
          979  +proc error-stacktrace {msg} {
          980  +	return $msg
          981  +}
          982  +
          983  +proc error-location {msg} {
          984  +	return $msg
          985  +}
          986  +
          987  +##################################################################
          988  +#
          989  +# Debugging output
          990  +#
          991  +proc dputs {msg} {
          992  +	if {$::autosetup(debug)} {
          993  +		puts $msg
          994  +	}
          995  +}
          996  +
          997  +##################################################################
          998  +#
          999  +# User and system warnings and errors
         1000  +#
         1001  +# Usage errors such as wrong command line options
         1002  +
         1003  +# @user-error msg
         1004  +#
         1005  +# Indicate incorrect usage to the user, including if required components
         1006  +# or features are not found.
         1007  +# 'autosetup' exits with a non-zero return code.
         1008  +#
         1009  +proc user-error {msg} {
         1010  +	show-notices
         1011  +	puts stderr "Error: $msg"
         1012  +	puts stderr "Try: '[file tail $::autosetup(exe)] --help' for options"
         1013  +	exit 1
         1014  +}
         1015  +
         1016  +# @user-notice msg
         1017  +#
         1018  +# Output the given message to stderr.
         1019  +#
         1020  +proc user-notice {msg} {
         1021  +	lappend ::autosetup(notices) $msg
         1022  +}
         1023  +
         1024  +# Incorrect usage in the auto.def file. Identify the location.
         1025  +proc autosetup-error {msg} {
         1026  +	autosetup-full-error [error-location $msg]
         1027  +}
         1028  +
         1029  +# Like autosetup-error, except $msg is the full error message.
         1030  +proc autosetup-full-error {msg} {
         1031  +	show-notices
         1032  +	puts stderr $msg
         1033  +	exit 1
         1034  +}
         1035  +
         1036  +proc show-notices {} {
         1037  +	if {$::autosetup(msg-checking)} {
         1038  +		puts ""
         1039  +		set ::autosetup(msg-checking) 0
         1040  +	}
         1041  +	flush stdout
         1042  +	if {[info exists ::autosetup(notices)]} {
         1043  +		puts stderr [join $::autosetup(notices) \n]
         1044  +		unset ::autosetup(notices)
         1045  +	}
         1046  +}
         1047  +
         1048  +proc maybe-show-timestamp {} {
         1049  +	if {$::autosetup(msg-timing) && $::autosetup(msg-checking) == 0} {
         1050  +		puts -nonewline [format {[%6.2f] } [expr {([clock millis] - $::autosetup(start)) % 10000 / 1000.0}]]
         1051  +	}
         1052  +}
         1053  +
         1054  +# @autosetup-require-version required
         1055  +#
         1056  +# Checks the current version of 'autosetup' against '$required'.
         1057  +# A fatal error is generated if the current version is less than that required.
         1058  +#
         1059  +proc autosetup-require-version {required} {
         1060  +	if {[compare-versions $::autosetup(version) $required] < 0} {
         1061  +		user-error "autosetup version $required is required, but this is $::autosetup(version)"
         1062  +	}
         1063  +}
         1064  +
         1065  +proc autosetup_version {} {
         1066  +	return "autosetup v$::autosetup(version)"
         1067  +}
         1068  +
         1069  +##################################################################
         1070  +#
         1071  +# Directory/path handling
         1072  +#
         1073  +
         1074  +proc realdir {dir} {
         1075  +	set oldpwd [pwd]
         1076  +	cd $dir
         1077  +	set pwd [pwd]
         1078  +	cd $oldpwd
         1079  +	return $pwd
         1080  +}
         1081  +
         1082  +# Follow symlinks until we get to something which is not a symlink
         1083  +proc realpath {path} {
         1084  +	while {1} {
         1085  +		if {[catch {
         1086  +			set path [file readlink $path]
         1087  +		}]} {
         1088  +			# Not a link
         1089  +			break
         1090  +		}
         1091  +	}
         1092  +	return $path
         1093  +}
         1094  +
         1095  +# Convert absolute path, $path into a path relative
         1096  +# to the given directory (or the current dir, if not given).
         1097  +#
         1098  +proc relative-path {path {pwd {}}} {
         1099  +	set diff 0
         1100  +	set same 0
         1101  +	set newf {}
         1102  +	set prefix {}
         1103  +	set path [file-normalize $path]
         1104  +	if {$pwd eq ""} {
         1105  +		set pwd [pwd]
         1106  +	} else {
         1107  +		set pwd [file-normalize $pwd]
         1108  +	}
         1109  +
         1110  +	if {$path eq $pwd} {
         1111  +		return .
         1112  +	}
         1113  +
         1114  +	# Try to make the filename relative to the current dir
         1115  +	foreach p [split $pwd /] f [split $path /] {
         1116  +		if {$p ne $f} {
         1117  +			incr diff
         1118  +		} elseif {!$diff} {
         1119  +			incr same
         1120  +		}
         1121  +		if {$diff} {
         1122  +			if {$p ne ""} {
         1123  +				# Add .. for sibling or parent dir
         1124  +				lappend prefix ..
         1125  +			}
         1126  +			if {$f ne ""} {
         1127  +				lappend newf $f
         1128  +			}
         1129  +		}
         1130  +	}
         1131  +	if {$same == 1 || [llength $prefix] > 3} {
         1132  +		return $path
         1133  +	}
         1134  +
         1135  +	file join [join $prefix /] [join $newf /]
         1136  +}
         1137  +
         1138  +# Add filename as a dependency to rerun autosetup
         1139  +# The name will be normalised (converted to a full path)
         1140  +#
         1141  +proc autosetup_add_dep {filename} {
         1142  +	lappend ::autosetup(deps) [file-normalize $filename]
         1143  +}
         1144  +
         1145  +##################################################################
         1146  +#
         1147  +# Library module support
         1148  +#
         1149  +
         1150  +# @use module ...
         1151  +#
         1152  +# Load the given library modules.
         1153  +# e.g. 'use cc cc-shared'
         1154  +#
         1155  +# Note that module 'X' is implemented in either 'autosetup/X.tcl'
         1156  +# or 'autosetup/X/init.tcl'
         1157  +#
         1158  +# The latter form is useful for a complex module which requires additional
         1159  +# support file. In this form, '$::usedir' is set to the module directory
         1160  +# when it is loaded.
         1161  +#
         1162  +proc use {args} {
         1163  +	global autosetup libmodule modsource
         1164  +
         1165  +	set dirs [list $autosetup(libdir)]
         1166  +	if {[info exists autosetup(srcdir)]} {
         1167  +		lappend dirs $autosetup(srcdir)/autosetup
         1168  +	}
         1169  +	foreach m $args {
         1170  +		if {[info exists libmodule($m)]} {
         1171  +			continue
         1172  +		}
         1173  +		set libmodule($m) 1
         1174  +		if {[info exists modsource(${m}.tcl)]} {
         1175  +			automf_load eval $modsource(${m}.tcl)
         1176  +		} else {
         1177  +			set locs [list ${m}.tcl ${m}/init.tcl]
         1178  +			set found 0
         1179  +			foreach dir $dirs {
         1180  +				foreach loc $locs {
         1181  +					set source $dir/$loc
         1182  +					if {[file exists $source]} {
         1183  +						incr found
         1184  +						break
         1185  +					}
         1186  +				}
         1187  +				if {$found} {
         1188  +					break
         1189  +				}
         1190  +			}
         1191  +			if {$found} {
         1192  +				# For the convenience of the "use" source, point to the directory
         1193  +				# it is being loaded from
         1194  +				set ::usedir [file dirname $source]
         1195  +				automf_load source $source
         1196  +				autosetup_add_dep $source
         1197  +			} else {
         1198  +				autosetup-error "use: No such module: $m"
         1199  +			}
         1200  +		}
         1201  +	}
         1202  +}
         1203  +
         1204  +proc autosetup_load_auto_modules {} {
         1205  +	global autosetup modsource
         1206  +	# First load any embedded auto modules
         1207  +	foreach mod [array names modsource *.auto] {
         1208  +		automf_load eval $modsource($mod)
         1209  +	}
         1210  +	# Now any external auto modules
         1211  +	foreach file [glob -nocomplain $autosetup(libdir)/*.auto $autosetup(libdir)/*/*.auto] {
         1212  +		automf_load source $file
         1213  +	}
         1214  +}
         1215  +
         1216  +# Load module source in the global scope by executing the given command
         1217  +proc automf_load {args} {
         1218  +	if {[catch [list uplevel #0 $args] msg opts] ni {0 2 3}} {
         1219  +		autosetup-full-error [error-dump $msg $opts $::autosetup(debug)]
         1220  +	}
         1221  +}
         1222  +
         1223  +# Initial settings
         1224  +set autosetup(exe) $::argv0
         1225  +set autosetup(istcl) 1
         1226  +set autosetup(start) [clock millis]
         1227  +set autosetup(installed) 0
         1228  +set autosetup(sysinstall) 0
         1229  +set autosetup(msg-checking) 0
         1230  +set autosetup(msg-quiet) 0
         1231  +set autosetup(inittypes) {}
         1232  +
         1233  +# Embedded modules are inserted below here
         1234  +set autosetup(installed) 1
         1235  +set autosetup(sysinstall) 0
         1236  +# ----- @module asciidoc-formatting.tcl -----
         1237  +
         1238  +set modsource(asciidoc-formatting.tcl) {
         1239  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
         1240  +# All rights reserved
         1241  +
         1242  +# Module which provides text formatting
         1243  +# asciidoc format
         1244  +
         1245  +use formatting
         1246  +
         1247  +proc para {text} {
         1248  +    regsub -all "\[ \t\n\]+" [string trim $text] " "
         1249  +}
         1250  +proc title {text} {
         1251  +    underline [para $text] =
         1252  +    nl
         1253  +}
         1254  +proc p {text} {
         1255  +    puts [para $text]
         1256  +    nl
         1257  +}
         1258  +proc code {text} {
         1259  +    foreach line [parse_code_block $text] {
         1260  +        puts "    $line"
         1261  +    }
         1262  +    nl
         1263  +}
         1264  +proc codelines {lines} {
         1265  +    foreach line $lines {
         1266  +        puts "    $line"
         1267  +    }
         1268  +    nl
         1269  +}
         1270  +proc nl {} {
         1271  +    puts ""
         1272  +}
         1273  +proc underline {text char} {
         1274  +    regexp "^(\[ \t\]*)(.*)" $text -> indent words
         1275  +    puts $text
         1276  +    puts $indent[string repeat $char [string length $words]]
         1277  +}
         1278  +proc section {text} {
         1279  +    underline "[para $text]" -
         1280  +    nl
         1281  +}
         1282  +proc subsection {text} {
         1283  +    underline "$text" ~
         1284  +    nl
         1285  +}
         1286  +proc bullet {text} {
         1287  +    puts "* [para $text]"
         1288  +}
         1289  +proc indent {text} {
         1290  +    puts " :: "
         1291  +    puts [para $text]
         1292  +}
         1293  +proc defn {first args} {
         1294  +    set sep ""
         1295  +    if {$first ne ""} {
         1296  +        puts "${first}::"
         1297  +    } else {
         1298  +        puts " :: "
         1299  +    }
         1300  +    set defn [string trim [join $args \n]]
         1301  +    regsub -all "\n\n" $defn "\n ::\n" defn
         1302  +    puts $defn
         1303  +}
         1304  +}
         1305  +
         1306  +# ----- @module formatting.tcl -----
         1307  +
         1308  +set modsource(formatting.tcl) {
         1309  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
         1310  +# All rights reserved
         1311  +
         1312  +# Module which provides common text formatting
         1313  +
         1314  +# This is designed for documenation which looks like:
         1315  +# code {...}
         1316  +# or
         1317  +# code {
         1318  +#    ...
         1319  +#    ...
         1320  +# }
         1321  +# In the second case, we need to work out the indenting
         1322  +# and strip it from all lines but preserve the remaining indenting.
         1323  +# Note that all lines need to be indented with the same initial
         1324  +# spaces/tabs.
         1325  +#
         1326  +# Returns a list of lines with the indenting removed.
         1327  +#
         1328  +proc parse_code_block {text} {
         1329  +    # If the text begins with newline, take the following text,
         1330  +    # otherwise just return the original
         1331  +    if {![regexp "^\n(.*)" $text -> text]} {
         1332  +        return [list [string trim $text]]
         1333  +    }
         1334  +
         1335  +    # And trip spaces off the end
         1336  +    set text [string trimright $text]
         1337  +
         1338  +    set min 100
         1339  +    # Examine each line to determine the minimum indent
         1340  +    foreach line [split $text \n] {
         1341  +        if {$line eq ""} {
         1342  +            # Ignore empty lines for the indent calculation
         1343  +            continue
         1344  +        }
         1345  +        regexp "^(\[ \t\]*)" $line -> indent
         1346  +        set len [string length $indent]
         1347  +        if {$len < $min} {
         1348  +            set min $len
         1349  +        }
         1350  +    }
         1351  +
         1352  +    # Now make a list of lines with this indent removed
         1353  +    set lines {}
         1354  +    foreach line [split $text \n] {
         1355  +        lappend lines [string range $line $min end]
         1356  +    }
         1357  +
         1358  +    # Return the result
         1359  +    return $lines
         1360  +}
         1361  +}
         1362  +
         1363  +# ----- @module getopt.tcl -----
         1364  +
         1365  +set modsource(getopt.tcl) {
         1366  +# Copyright (c) 2006 WorkWare Systems http://www.workware.net.au/
         1367  +# All rights reserved
         1368  +
         1369  +# Simple getopt module
         1370  +
         1371  +# Parse everything out of the argv list which looks like an option
         1372  +# Everything which doesn't look like an option, or is after --, is left unchanged
         1373  +# Understands --enable-xxx as a synonym for --xxx to enable the boolean option xxx.
         1374  +# Understands --disable-xxx to disable the boolean option xxx.
         1375  +#
         1376  +# The returned value is a dictionary keyed by option name
         1377  +# Each value is a list of {type value} ... where type is "bool" or "str".
         1378  +# The value for a boolean option is 0 or 1. The value of a string option is the value given.
         1379  +proc getopt {argvname} {
         1380  +	upvar $argvname argv
         1381  +	set nargv {}
         1382  +
         1383  +	set opts {}
         1384  +
         1385  +	for {set i 0} {$i < [llength $argv]} {incr i} {
         1386  +		set arg [lindex $argv $i]
         1387  +
         1388  +		#dputs arg=$arg
         1389  +
         1390  +		if {$arg eq "--"} {
         1391  +			# End of options
         1392  +			incr i
         1393  +			lappend nargv {*}[lrange $argv $i end]
         1394  +			break
         1395  +		}
         1396  +
         1397  +		if {[regexp {^--([^=][^=]+)=(.*)$} $arg -> name value]} {
         1398  +			# --name=value
         1399  +			dict lappend opts $name [list str $value]
         1400  +		} elseif {[regexp {^--(enable-|disable-)?([^=]*)$} $arg -> prefix name]} {
         1401  +			if {$prefix in {enable- ""}} {
         1402  +				set value 1
         1403  +			} else {
         1404  +				set value 0
         1405  +			}
         1406  +			dict lappend opts $name [list bool $value]
         1407  +		} else {
         1408  +			lappend nargv $arg
         1409  +		}
         1410  +	}
         1411  +
         1412  +	#puts "getopt: argv=[join $argv] => [join $nargv]"
         1413  +	#array set getopt $opts
         1414  +	#parray getopt
         1415  +
         1416  +	set argv $nargv
         1417  +
         1418  +	return $opts
         1419  +}
         1420  +}
         1421  +
         1422  +# ----- @module help.tcl -----
         1423  +
         1424  +set modsource(help.tcl) {
         1425  +# Copyright (c) 2010 WorkWare Systems http://workware.net.au/
         1426  +# All rights reserved
         1427  +
         1428  +# Module which provides usage, help and the command reference
         1429  +
         1430  +proc autosetup_help {what} {
         1431  +    use_pager
         1432  +
         1433  +    puts "Usage: [file tail $::autosetup(exe)] \[options\] \[settings\]\n"
         1434  +    puts "This is [autosetup_version], a build environment \"autoconfigurator\""
         1435  +    puts "See the documentation online at http://msteveb.github.com/autosetup/\n"
         1436  +
         1437  +    if {$what eq "local"} {
         1438  +        if {[file exists $::autosetup(autodef)]} {
         1439  +            # This relies on auto.def having a call to 'options'
         1440  +            # which will display options and quit
         1441  +            source $::autosetup(autodef)
         1442  +        } else {
         1443  +            options-show
         1444  +        }
         1445  +    } else {
         1446  +        incr ::autosetup(showhelp)
         1447  +        if {[catch {use $what}]} {
         1448  +            user-error "Unknown module: $what"
         1449  +        } else {
         1450  +            options-show
         1451  +        }
         1452  +    }
         1453  +    exit 0
         1454  +}
         1455  +
         1456  +proc autosetup_show_license {} {
         1457  +    global modsource autosetup
         1458  +    use_pager
         1459  +
         1460  +    if {[info exists modsource(LICENSE)]} {
         1461  +        puts $modsource(LICENSE)
         1462  +        return
         1463  +    }
         1464  +    foreach dir [list $autosetup(libdir) $autosetup(srcdir)] {
         1465  +        set path [file join $dir LICENSE]
         1466  +        if {[file exists $path]} {
         1467  +            puts [readfile $path]
         1468  +            return
         1469  +        }
         1470  +    }
         1471  +    puts "LICENSE not found"
         1472  +}
         1473  +
         1474  +# If not already paged and stdout is a tty, pipe the output through the pager
         1475  +# This is done by reinvoking autosetup with --nopager added
         1476  +proc use_pager {} {
         1477  +    if {![opt-bool nopager] && [getenv PAGER ""] ne "" && [isatty? stdin] && [isatty? stdout]} {
         1478  +        if {[catch {
         1479  +            exec [info nameofexecutable] $::argv0 --nopager {*}$::argv |& {*}[getenv PAGER] >@stdout <@stdin 2>@stderr
         1480  +        } msg opts] == 1} {
         1481  +            if {[dict get $opts -errorcode] eq "NONE"} {
         1482  +                # an internal/exec error
         1483  +                puts stderr $msg
         1484  +                exit 1
         1485  +            }
         1486  +        }
         1487  +        exit 0
         1488  +    }
         1489  +}
         1490  +
         1491  +# Outputs the autosetup references in one of several formats
         1492  +proc autosetup_reference {{type text}} {
         1493  +
         1494  +    use_pager
         1495  +
         1496  +    switch -glob -- $type {
         1497  +        wiki {use wiki-formatting}
         1498  +        ascii* {use asciidoc-formatting}
         1499  +        md - markdown {use markdown-formatting}
         1500  +        default {use text-formatting}
         1501  +    }
         1502  +
         1503  +    title "[autosetup_version] -- Command Reference"
         1504  +
         1505  +    section {Introduction}
         1506  +
         1507  +    p {
         1508  +        See http://msteveb.github.com/autosetup/ for the online documentation for 'autosetup'
         1509  +    }
         1510  +
         1511  +    p {
         1512  +        'autosetup' provides a number of built-in commands which
         1513  +        are documented below. These may be used from 'auto.def' to test
         1514  +        for features, define variables, create files from templates and
         1515  +        other similar actions.
         1516  +    }
         1517  +
         1518  +    automf_command_reference
         1519  +
         1520  +    exit 0
         1521  +}
         1522  +
         1523  +proc autosetup_output_block {type lines} {
         1524  +    if {[llength $lines]} {
         1525  +        switch $type {
         1526  +            section {
         1527  +                section $lines
         1528  +            }
         1529  +            subsection {
         1530  +                subsection $lines
         1531  +            }
         1532  +            code {
         1533  +                codelines $lines
         1534  +            }
         1535  +            p {
         1536  +                p [join $lines]
         1537  +            }
         1538  +            list {
         1539  +                foreach line $lines {
         1540  +                    bullet $line
         1541  +                }
         1542  +                nl
         1543  +            }
         1544  +        }
         1545  +    }
         1546  +}
         1547  +
         1548  +# Generate a command reference from inline documentation
         1549  +proc automf_command_reference {} {
         1550  +    lappend files $::autosetup(prog)
         1551  +    lappend files {*}[lsort [glob -nocomplain $::autosetup(libdir)/*.tcl]]
         1552  +
         1553  +    # We want to process all non-module files before module files
         1554  +    # and then modules in alphabetical order.
         1555  +    # So examine all files and extract docs into doc($modulename) and doc(_core_)
         1556  +    #
         1557  +    # Each entry is a list of {type data} where $type is one of: section, subsection, code, list, p
         1558  +    # and $data is a string for section, subsection or a list of text lines for other types.
         1559  +
         1560  +    # XXX: Should commands be in alphabetical order too? Currently they are in file order.
         1561  +
         1562  +    set doc(_core_) {}
         1563  +    lappend doc(_core_) [list section "Core Commands"]
         1564  +
         1565  +    foreach file $files {
         1566  +        set modulename [file rootname [file tail $file]]
         1567  +        set current _core_
         1568  +        set f [open $file]
         1569  +        while {![eof $f]} {
         1570  +            set line [gets $f]
         1571  +
         1572  +            # Find embedded module names
         1573  +            if {[regexp {^#.*@module ([^ ]*)} $line -> modulename]} {
         1574  +                continue
         1575  +            }
         1576  +
         1577  +            # Find lines starting with "# @*" and continuing through the remaining comment lines
         1578  +            if {![regexp {^# @(.*)} $line -> cmd]} {
         1579  +                continue
         1580  +            }
         1581  +
         1582  +            # Synopsis or command?
         1583  +            if {$cmd eq "synopsis:"} {
         1584  +                set current $modulename
         1585  +                lappend doc($current) [list section "Module: $modulename"]
         1586  +            } else {
         1587  +                lappend doc($current) [list subsection $cmd]
         1588  +            }
         1589  +
         1590  +            set lines {}
         1591  +            set type p
         1592  +
         1593  +            # Now the description
         1594  +            while {![eof $f]} {
         1595  +                set line [gets $f]
         1596  +
         1597  +                if {![regexp {^#(#)? ?(.*)} $line -> hash cmd]} {
         1598  +                    break
         1599  +                }
         1600  +                if {$hash eq "#"} {
         1601  +                    set t code
         1602  +                } elseif {[regexp {^- (.*)} $cmd -> cmd]} {
         1603  +                    set t list
         1604  +                } else {
         1605  +                    set t p
         1606  +                }
         1607  +
         1608  +                #puts "hash=$hash, oldhash=$oldhash, lines=[llength $lines], cmd=$cmd"
         1609  +
         1610  +                if {$t ne $type || $cmd eq ""} {
         1611  +                    # Finish the current block
         1612  +                    lappend doc($current) [list $type $lines]
         1613  +                    set lines {}
         1614  +                    set type $t
         1615  +                }
         1616  +                if {$cmd ne ""} {
         1617  +                    lappend lines $cmd
         1618  +                }
         1619  +            }
         1620  +
         1621  +            lappend doc($current) [list $type $lines]
         1622  +        }
         1623  +        close $f
         1624  +    }
         1625  +
         1626  +    # Now format and output the results
         1627  +
         1628  +    # _core_ will sort first
         1629  +    foreach module [lsort [array names doc]] {
         1630  +        foreach item $doc($module) {
         1631  +            autosetup_output_block {*}$item
         1632  +        }
         1633  +    }
         1634  +}
         1635  +}
         1636  +
         1637  +# ----- @module init.tcl -----
         1638  +
         1639  +set modsource(init.tcl) {
         1640  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
         1641  +# All rights reserved
         1642  +
         1643  +# Module to help create auto.def and configure
         1644  +
         1645  +proc autosetup_init {type} {
         1646  +	set help 0
         1647  +	if {$type in {? help}} {
         1648  +		incr help
         1649  +	} elseif {![dict exists $::autosetup(inittypes) $type]} {
         1650  +		puts "Unknown type, --init=$type"
         1651  +		incr help
         1652  +	}
         1653  +	if {$help} {
         1654  +		puts "Use one of the following types (e.g. --init=make)\n"
         1655  +		foreach type [lsort [dict keys $::autosetup(inittypes)]] {
         1656  +			lassign [dict get $::autosetup(inittypes) $type] desc
         1657  +			# XXX: Use the options-show code to wrap the description
         1658  +			puts [format "%-10s %s" $type $desc]
         1659  +		}
         1660  +		return
         1661  +	}
         1662  +	lassign [dict get $::autosetup(inittypes) $type] desc script
         1663  +
         1664  +	puts "Initialising $type: $desc\n"
         1665  +
         1666  +	# All initialisations happens in the top level srcdir
         1667  +	cd $::autosetup(srcdir)
         1668  +
         1669  +	uplevel #0 $script
         1670  +}
         1671  +
         1672  +proc autosetup_add_init_type {type desc script} {
         1673  +	dict set ::autosetup(inittypes) $type [list $desc $script]
         1674  +}
         1675  +
         1676  +# This is for in creating build-system init scripts
         1677  +#
         1678  +# If the file doesn't exist, create it containing $contents
         1679  +# If the file does exist, only overwrite if --force is specified.
         1680  +#
         1681  +proc autosetup_check_create {filename contents} {
         1682  +	if {[file exists $filename]} {
         1683  +		if {!$::autosetup(force)} {
         1684  +			puts "I see $filename already exists."
         1685  +			return
         1686  +		} else {
         1687  +			puts "I will overwrite the existing $filename because you used --force."
         1688  +		}
         1689  +	} else {
         1690  +		puts "I don't see $filename, so I will create it."
         1691  +	}
         1692  +	writefile $filename $contents
         1693  +}
         1694  +}
         1695  +
         1696  +# ----- @module install.tcl -----
         1697  +
         1698  +set modsource(install.tcl) {
         1699  +# Copyright (c) 2006-2010 WorkWare Systems http://www.workware.net.au/
         1700  +# All rights reserved
         1701  +
         1702  +# Module which can install autosetup
         1703  +
         1704  +# autosetup(installed)=1 means that autosetup is not running from source
         1705  +# autosetup(sysinstall)=1 means that autosetup is running from a sysinstall verion
         1706  +# shared=1 means that we are trying to do a sysinstall. This is only possible from the development source.
         1707  +
         1708  +proc autosetup_install {dir {shared 0}} {
         1709  +	global autosetup
         1710  +	if {$shared} {
         1711  +		if {$autosetup(installed) || $autosetup(sysinstall)} {
         1712  +			user-error "Can only --sysinstall from development sources"
         1713  +		}
         1714  +	} elseif {$autosetup(installed) && !$autosetup(sysinstall)} {
         1715  +		user-error "Can't --install from project install"
         1716  +	}
         1717  +
         1718  +	if {$autosetup(sysinstall)} {
         1719  +		# This is the sysinstall version, so install just uses references
         1720  +		cd $dir
         1721  +
         1722  +		puts "[autosetup_version] creating configure to use system-installed autosetup"
         1723  +		autosetup_create_configure 1
         1724  +		puts "Creating autosetup/README.autosetup"
         1725  +		file mkdir autosetup
         1726  +		autosetup_install_readme autosetup/README.autosetup 1
         1727  +		return
         1728  +	}
         1729  +
         1730  +	if {[catch {
         1731  +		if {$shared} {
         1732  +			set target $dir/bin/autosetup
         1733  +			set installedas $target
         1734  +		} else {
         1735  +			if {$dir eq "."} {
         1736  +				set installedas autosetup
         1737  +			} else {
         1738  +				set installedas $dir/autosetup
         1739  +			}
         1740  +			cd $dir
         1741  +			file mkdir autosetup
         1742  +			set target autosetup/autosetup
         1743  +		}
         1744  +		set targetdir [file dirname $target]
         1745  +		file mkdir $targetdir
         1746  +
         1747  +		set f [open $target w]
         1748  +
         1749  +		set publicmodules {}
         1750  +
         1751  +		# First the main script, but only up until "CUT HERE"
         1752  +		set in [open $autosetup(dir)/autosetup]
         1753  +		while {[gets $in buf] >= 0} {
         1754  +			if {$buf ne "##-- CUT HERE --##"} {
         1755  +				puts $f $buf
         1756  +				continue
         1757  +			}
         1758  +
         1759  +			# Insert the static modules here
         1760  +			# i.e. those which don't contain @synopsis:
         1761  +			# All modules are inserted if $shared is set
         1762  +			puts $f "set autosetup(installed) 1"
         1763  +			puts $f "set autosetup(sysinstall) $shared"
         1764  +			foreach file [lsort [glob $autosetup(libdir)/*.{tcl,auto}]] {
         1765  +				set modname [file tail $file]
         1766  +				set ext [file ext $modname]
         1767  +				set buf [readfile $file]
         1768  +				if {!$shared} {
         1769  +					if {$ext eq ".auto" || [string match "*\n# @synopsis:*" $buf]} {
         1770  +						lappend publicmodules $file
         1771  +						continue
         1772  +					}
         1773  +				}
         1774  +				dputs "install: importing lib/[file tail $file]"
         1775  +				puts $f "# ----- @module $modname -----"
         1776  +				puts $f "\nset modsource($modname) \{"
         1777  +				puts $f $buf
         1778  +				puts $f "\}\n"
         1779  +			}
         1780  +			if {$shared} {
         1781  +				foreach {srcname destname} [list $autosetup(libdir)/README.autosetup-lib README.autosetup \
         1782  +						$autosetup(srcdir)/LICENSE LICENSE] {
         1783  +					dputs "install: importing $srcname as $destname"
         1784  +					puts $f "\nset modsource($destname) \\\n[list [readfile $srcname]\n]\n"
         1785  +				}
         1786  +			}
         1787  +		}
         1788  +		close $in
         1789  +		close $f
         1790  +		catch {exec chmod 755 $target}
         1791  +
         1792  +		set installfiles {autosetup-config.guess autosetup-config.sub autosetup-test-tclsh}
         1793  +		set removefiles {}
         1794  +
         1795  +		if {!$shared} {
         1796  +			autosetup_install_readme $targetdir/README.autosetup 0
         1797  +
         1798  +			# Install public modules
         1799  +			foreach file $publicmodules {
         1800  +				set tail [file tail $file]
         1801  +				autosetup_install_file $file $targetdir/$tail
         1802  +			}
         1803  +			lappend installfiles jimsh0.c autosetup-find-tclsh LICENSE
         1804  +			lappend removefiles config.guess config.sub test-tclsh find-tclsh
         1805  +		} else {
         1806  +			lappend installfiles {sys-find-tclsh autosetup-find-tclsh}
         1807  +		}
         1808  +
         1809  +		# Install support files
         1810  +		foreach fileinfo $installfiles {
         1811  +			if {[llength $fileinfo] == 2} {
         1812  +				lassign $fileinfo source dest
         1813  +			} else {
         1814  +				lassign $fileinfo source
         1815  +				set dest $source
         1816  +			}
         1817  +			autosetup_install_file $autosetup(dir)/$source $targetdir/$dest
         1818  +		}
         1819  +
         1820  +		# Remove obsolete files
         1821  +		foreach file $removefiles {
         1822  +			if {[file exists $targetdir/$file]} {
         1823  +				file delete $targetdir/$file
         1824  +			}
         1825  +		}
         1826  +	} error]} {
         1827  +		user-error "Failed to install autosetup: $error"
         1828  +	}
         1829  +	if {$shared} {
         1830  +		set type "system"
         1831  +	} else {
         1832  +		set type "local"
         1833  +	}
         1834  +	puts "Installed $type [autosetup_version] to $installedas"
         1835  +
         1836  +	if {!$shared} {
         1837  +		# Now create 'configure' if necessary
         1838  +		autosetup_create_configure 0
         1839  +	}
         1840  +}
         1841  +
         1842  +proc autosetup_create_configure {shared} {
         1843  +	if {[file exists configure]} {
         1844  +		if {!$::autosetup(force)} {
         1845  +			# Could this be an autosetup configure?
         1846  +			if {![string match "*\nWRAPPER=*" [readfile configure]]} {
         1847  +				puts "I see configure, but not created by autosetup, so I won't overwrite it."
         1848  +				puts "Remove it or use --force to overwrite."
         1849  +				return
         1850  +			}
         1851  +		} else {
         1852  +			puts "I will overwrite the existing configure because you used --force."
         1853  +		}
         1854  +	} else {
         1855  +		puts "I don't see configure, so I will create it."
         1856  +	}
         1857  +	if {$shared} {
         1858  +		writefile configure \
         1859  +{#!/bin/sh
         1860  +WRAPPER="$0"; export WRAPPER; "autosetup" "[email protected]"
         1861  +}
         1862  +	} else {
         1863  +		writefile configure \
         1864  +{#!/bin/sh
         1865  +dir="`dirname "$0"`/autosetup"
         1866  +WRAPPER="$0"; export WRAPPER; exec "`$dir/autosetup-find-tclsh`" "$dir/autosetup" "[email protected]"
         1867  +}
         1868  +	}
         1869  +	catch {exec chmod 755 configure}
         1870  +}
         1871  +
         1872  +# Append the contents of $file to filehandle $f
         1873  +proc autosetup_install_append {f file} {
         1874  +	dputs "install: include $file"
         1875  +	set in [open $file]
         1876  +	puts $f [read $in]
         1877  +	close $in
         1878  +}
         1879  +
         1880  +proc autosetup_install_file {source target} {
         1881  +	dputs "install: $source => $target"
         1882  +	if {![file exists $source]} {
         1883  +		error "Missing installation file '$source'"
         1884  +	}
         1885  +	writefile $target [readfile $source]\n
         1886  +	# If possible, copy the file mode
         1887  +	file stat $source stat
         1888  +	set mode [format %o [expr {$stat(mode) & 0x1ff}]]
         1889  +	catch {exec chmod $mode $target}
         1890  +}
         1891  +
         1892  +proc autosetup_install_readme {target sysinstall} {
         1893  +	set readme "README.autosetup created by [autosetup_version]\n\n"
         1894  +	if {$sysinstall} {
         1895  +		append readme \
         1896  +{This is the autosetup directory for a system install of autosetup.
         1897  +Loadable modules can be added here.
         1898  +}
         1899  +	} else {
         1900  +		append readme \
         1901  +{This is the autosetup directory for a local install of autosetup.
         1902  +It contains autosetup, support files and loadable modules.
         1903  +}
         1904  +}
         1905  +
         1906  +	append readme {
         1907  +*.tcl files in this directory are optional modules which
         1908  +can be loaded with the 'use' directive.
         1909  +
         1910  +*.auto files in this directory are auto-loaded.
         1911  +
         1912  +For more information, see http://msteveb.github.com/autosetup/
         1913  +}
         1914  +	dputs "install: autosetup/README.autosetup"
         1915  +	writefile $target $readme
         1916  +}
         1917  +}
         1918  +
         1919  +# ----- @module markdown-formatting.tcl -----
         1920  +
         1921  +set modsource(markdown-formatting.tcl) {
         1922  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
         1923  +# All rights reserved
         1924  +
         1925  +# Module which provides text formatting
         1926  +# markdown format (kramdown syntax)
         1927  +
         1928  +use formatting
         1929  +
         1930  +proc para {text} {
         1931  +    regsub -all "\[ \t\n\]+" [string trim $text] " " text
         1932  +    regsub -all {([^a-zA-Z])'([^']*)'} $text {\1**`\2`**} text
         1933  +    regsub -all {^'([^']*)'} $text {**`\1`**} text
         1934  +    regsub -all {(http[^ \t\n]*)} $text {[\1](\1)} text
         1935  +    return $text
         1936  +}
         1937  +proc title {text} {
         1938  +    underline [para $text] =
         1939  +    nl
         1940  +}
         1941  +proc p {text} {
         1942  +    puts [para $text]
         1943  +    nl
         1944  +}
         1945  +proc codelines {lines} {
         1946  +    puts "~~~~~~~~~~~~"
         1947  +    foreach line $lines {
         1948  +        puts $line
         1949  +    }
         1950  +    puts "~~~~~~~~~~~~"
         1951  +    nl
         1952  +}
         1953  +proc code {text} {
         1954  +    puts "~~~~~~~~~~~~"
         1955  +    foreach line [parse_code_block $text] {
         1956  +        puts $line
         1957  +    }
         1958  +    puts "~~~~~~~~~~~~"
         1959  +    nl
         1960  +}
         1961  +proc nl {} {
         1962  +    puts ""
         1963  +}
         1964  +proc underline {text char} {
         1965  +    regexp "^(\[ \t\]*)(.*)" $text -> indent words
         1966  +    puts $text
         1967  +    puts $indent[string repeat $char [string length $words]]
         1968  +}
         1969  +proc section {text} {
         1970  +    underline "[para $text]" -
         1971  +    nl
         1972  +}
         1973  +proc subsection {text} {
         1974  +    puts "### `$text`"
         1975  +    nl
         1976  +}
         1977  +proc bullet {text} {
         1978  +    puts "* [para $text]"
         1979  +}
         1980  +proc defn {first args} {
         1981  +    puts "^"
         1982  +    set defn [string trim [join $args \n]]
         1983  +    if {$first ne ""} {
         1984  +        puts "**${first}**"
         1985  +        puts -nonewline ": "
         1986  +        regsub -all "\n\n" $defn "\n: " defn
         1987  +    }
         1988  +    puts "$defn"
         1989  +}
         1990  +}
         1991  +
         1992  +# ----- @module misc.tcl -----
         1993  +
         1994  +set modsource(misc.tcl) {
         1995  +# Copyright (c) 2007-2010 WorkWare Systems http://www.workware.net.au/
         1996  +# All rights reserved
         1997  +
         1998  +# Module containing misc procs useful to modules
         1999  +# Largely for platform compatibility
         2000  +
         2001  +set autosetup(istcl) [info exists ::tcl_library]
         2002  +set autosetup(iswin) [string equal windows $tcl_platform(platform)]
         2003  +
         2004  +if {$autosetup(iswin)} {
         2005  +	# mingw/windows separates $PATH with semicolons
         2006  +	# and doesn't have an executable bit
         2007  +	proc split-path {} {
         2008  +		split [getenv PATH .] {;}
         2009  +	}
         2010  +	proc file-isexec {exec} {
         2011  +		# Basic test for windows. We ignore .bat
         2012  +		if {[file isfile $exec] || [file isfile $exec.exe]} {
         2013  +			return 1
         2014  +		}
         2015  +		return 0
         2016  +	}
         2017  +} else {
         2018  +	# unix separates $PATH with colons and has and executable bit
         2019  +	proc split-path {} {
         2020  +		split [getenv PATH .] :
         2021  +	}
         2022  +	proc file-isexec {exec} {
         2023  +		file executable $exec
         2024  +	}
         2025  +}
         2026  +
         2027  +# Assume that exec can return stdout and stderr
         2028  +proc exec-with-stderr {args} {
         2029  +	exec {*}$args 2>@1
         2030  +}
         2031  +
         2032  +if {$autosetup(istcl)} {
         2033  +	# Tcl doesn't have the env command
         2034  +	proc getenv {name args} {
         2035  +		if {[info exists ::env($name)]} {
         2036  +			return $::env($name)
         2037  +		}
         2038  +		if {[llength $args]} {
         2039  +			return [lindex $args 0]
         2040  +		}
         2041  +		return -code error "environment variable \"$name\" does not exist"
         2042  +	}
         2043  +	proc isatty? {channel} {
         2044  +		dict exists [fconfigure $channel] -xchar
         2045  +	}
         2046  +} else {
         2047  +	if {$autosetup(iswin)} {
         2048  +		# On Windows, backslash convert all environment variables
         2049  +		# (Assume that Tcl does this for us)
         2050  +		proc getenv {name args} {
         2051  +			string map {\\ /} [env $name {*}$args]
         2052  +		}
         2053  +	} else {
         2054  +		# Jim on unix is simple
         2055  +		alias getenv env
         2056  +	}
         2057  +	proc isatty? {channel} {
         2058  +		set tty 0
         2059  +		catch {
         2060  +			# isatty is a recent addition to Jim Tcl
         2061  +			set tty [$channel isatty]
         2062  +		}
         2063  +		return $tty
         2064  +	}
         2065  +}
         2066  +
         2067  +# In case 'file normalize' doesn't exist
         2068  +#
         2069  +proc file-normalize {path} {
         2070  +	if {[catch {file normalize $path} result]} {
         2071  +		if {$path eq ""} {
         2072  +			return ""
         2073  +		}
         2074  +		set oldpwd [pwd]
         2075  +		if {[file isdir $path]} {
         2076  +			cd $path
         2077  +			set result [pwd]
         2078  +		} else {
         2079  +			cd [file dirname $path]
         2080  +			set result [file join [pwd] [file tail $path]]
         2081  +		}
         2082  +		cd $oldpwd
         2083  +	}
         2084  +	return $result
         2085  +}
         2086  +
         2087  +# If everything is working properly, the only errors which occur
         2088  +# should be generated in user code (e.g. auto.def).
         2089  +# By default, we only want to show the error location in user code.
         2090  +# We use [info frame] to achieve this, but it works differently on Tcl and Jim.
         2091  +#
         2092  +# This is designed to be called for incorrect usage in auto.def, via autosetup-error
         2093  +#
         2094  +proc error-location {msg} {
         2095  +	if {$::autosetup(debug)} {
         2096  +		return -code error $msg
         2097  +	}
         2098  +	# Search back through the stack trace for the first error in a .def file
         2099  +	for {set i 1} {$i < [info level]} {incr i} {
         2100  +		if {$::autosetup(istcl)} {
         2101  +			array set info [info frame -$i]
         2102  +		} else {
         2103  +			lassign [info frame -$i] info(caller) info(file) info(line)
         2104  +		}
         2105  +		if {[string match *.def $info(file)]} {
         2106  +			return "[relative-path $info(file)]:$info(line): Error: $msg"
         2107  +		}
         2108  +		#puts "Skipping $info(file):$info(line)"
         2109  +	}
         2110  +	return $msg
         2111  +}
         2112  +
         2113  +# If everything is working properly, the only errors which occur
         2114  +# should be generated in user code (e.g. auto.def).
         2115  +# By default, we only want to show the error location in user code.
         2116  +# We use [info frame] to achieve this, but it works differently on Tcl and Jim.
         2117  +#
         2118  +# This is designed to be called for incorrect usage in auto.def, via autosetup-error
         2119  +#
         2120  +proc error-stacktrace {msg} {
         2121  +	if {$::autosetup(debug)} {
         2122  +		return -code error $msg
         2123  +	}
         2124  +	# Search back through the stack trace for the first error in a .def file
         2125  +	for {set i 1} {$i < [info level]} {incr i} {
         2126  +		if {$::autosetup(istcl)} {
         2127  +			array set info [info frame -$i]
         2128  +		} else {
         2129  +			lassign [info frame -$i] info(caller) info(file) info(line)
         2130  +		}
         2131  +		if {[string match *.def $info(file)]} {
         2132  +			return "[relative-path $info(file)]:$info(line): Error: $msg"
         2133  +		}
         2134  +		#puts "Skipping $info(file):$info(line)"
         2135  +	}
         2136  +	return $msg
         2137  +}
         2138  +
         2139  +# Given the return from [catch {...} msg opts], returns an appropriate
         2140  +# error message. A nice one for Jim and a less-nice one for Tcl.
         2141  +# If 'fulltrace' is set, a full stack trace is provided.
         2142  +# Otherwise a simple message is provided.
         2143  +#
         2144  +# This is designed for developer errors, e.g. in module code or auto.def code
         2145  +#
         2146  +#
         2147  +proc error-dump {msg opts fulltrace} {
         2148  +	if {$::autosetup(istcl)} {
         2149  +		if {$fulltrace} {
         2150  +			return "Error: [dict get $opts -errorinfo]"
         2151  +		} else {
         2152  +			return "Error: $msg"
         2153  +		}
         2154  +	} else {
         2155  +		lassign $opts(-errorinfo) p f l
         2156  +		if {$f ne ""} {
         2157  +			set result "$f:$l: Error: "
         2158  +		}
         2159  +		append result "$msg\n"
         2160  +		if {$fulltrace} {
         2161  +			append result [stackdump $opts(-errorinfo)]
         2162  +		}
         2163  +
         2164  +		# Remove the trailing newline
         2165  +		string trim $result
         2166  +	}
         2167  +}
         2168  +}
         2169  +
         2170  +# ----- @module text-formatting.tcl -----
         2171  +
         2172  +set modsource(text-formatting.tcl) {
         2173  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
         2174  +# All rights reserved
         2175  +
         2176  +# Module which provides text formatting
         2177  +
         2178  +use formatting
         2179  +
         2180  +proc wordwrap {text length {firstprefix ""} {nextprefix ""}} {
         2181  +	set len 0
         2182  +	set space $firstprefix
         2183  +
         2184  +	foreach word [split $text] {
         2185  +		set word [string trim $word]
         2186  +		if {$word eq ""} {
         2187  +			continue
         2188  +		}
         2189  +		if {[info exists partial]} {
         2190  +			append partial " " $word
         2191  +			if {[string first $quote $word] < 0} {
         2192  +				# Haven't found end of quoted word
         2193  +				continue
         2194  +			}
         2195  +			# Finished quoted word
         2196  +			set word $partial
         2197  +			unset partial
         2198  +			unset quote
         2199  +		} else {
         2200  +			set quote [string index $word 0]
         2201  +			if {$quote in {' *}} {
         2202  +				if {[string first $quote $word 1] < 0} {
         2203  +					# Haven't found end of quoted word
         2204  +					# Not a whole word.
         2205  +					set first [string index $word 0]
         2206  +					# Start of quoted word
         2207  +					set partial $word
         2208  +					continue
         2209  +				}
         2210  +			}
         2211  +		}
         2212  +
         2213  +		if {$len && [string length $space$word] + $len >= $length} {
         2214  +			puts ""
         2215  +			set len 0
         2216  +			set space $nextprefix
         2217  +		}
         2218  +		incr len [string length $space$word]
         2219  +
         2220  +		# Use man-page conventions for highlighting 'quoted' and *quoted*
         2221  +		# single words.
         2222  +		# Use x^Hx for *bold* and _^Hx for 'underline'.
         2223  +		#
         2224  +		# less and more will both understand this.
         2225  +		# Pipe through 'col -b' to remove them.
         2226  +		if {[regexp {^'(.*)'(.*)} $word -> quoted after]} {
         2227  +			set quoted [string map {~ " "} $quoted]
         2228  +			regsub -all . $quoted "&\b&" quoted
         2229  +			set word $quoted$after
         2230  +		} elseif {[regexp {^[*](.*)[*](.*)} $word -> quoted after]} {
         2231  +			set quoted [string map {~ " "} $quoted]
         2232  +			regsub -all . $quoted "_\b&" quoted
         2233  +			set word $quoted$after
         2234  +		}
         2235  +		puts -nonewline $space$word
         2236  +		set space " "
         2237  +	}
         2238  +	if {[info exists partial]} {
         2239  +		# Missing end of quote
         2240  +		puts -nonewline $space$partial
         2241  +	}
         2242  +	if {$len} {
         2243  +		puts ""
         2244  +	}
         2245  +}
         2246  +proc title {text} {
         2247  +	underline [string trim $text] =
         2248  +	nl
         2249  +}
         2250  +proc p {text} {
         2251  +	wordwrap $text 80
         2252  +	nl
         2253  +}
         2254  +proc codelines {lines} {
         2255  +	foreach line $lines {
         2256  +		puts "	  $line"
         2257  +	}
         2258  +	nl
         2259  +}
         2260  +proc nl {} {
         2261  +	puts ""
         2262  +}
         2263  +proc underline {text char} {
         2264  +	regexp "^(\[ \t\]*)(.*)" $text -> indent words
         2265  +	puts $text
         2266  +	puts $indent[string repeat $char [string length $words]]
         2267  +}
         2268  +proc section {text} {
         2269  +	underline "[string trim $text]" -
         2270  +	nl
         2271  +}
         2272  +proc subsection {text} {
         2273  +	underline "$text" ~
         2274  +	nl
         2275  +}
         2276  +proc bullet {text} {
         2277  +	wordwrap $text 76 "	 * " "	  "
         2278  +}
         2279  +proc indent {text} {
         2280  +	wordwrap $text 76 "	   " "	  "
         2281  +}
         2282  +proc defn {first args} {
         2283  +	if {$first ne ""} {
         2284  +		underline "	   $first" ~
         2285  +	}
         2286  +	foreach p $args {
         2287  +		if {$p ne ""} {
         2288  +			indent $p
         2289  +		}
         2290  +	}
         2291  +}
         2292  +}
         2293  +
         2294  +# ----- @module util.tcl -----
         2295  +
         2296  +set modsource(util.tcl) {
         2297  +# Copyright (c) 2012 WorkWare Systems http://www.workware.net.au/
         2298  +# All rights reserved
         2299  +
         2300  +# Module which contains miscellaneous utility functions
         2301  +
         2302  +# @compare-versions version1 version2
         2303  +#
         2304  +# Versions are of the form 'a.b.c' (may be any number of numeric components)
         2305  +#
         2306  +# Compares the two versions and returns:
         2307  +## -1 if v1 < v2
         2308  +##  0 if v1 == v2
         2309  +##  1 if v1 > v2
         2310  +#
         2311  +# If one version has fewer components than the other, 0 is substituted to the right. e.g.
         2312  +## 0.2   <  0.3
         2313  +## 0.2.5 >  0.2
         2314  +## 1.1   == 1.1.0
         2315  +#
         2316  +proc compare-versions {v1 v2} {
         2317  +	foreach c1 [split $v1 .] c2 [split $v2 .] {
         2318  +		if {$c1 eq ""} {
         2319  +			set c1 0
         2320  +		}
         2321  +		if {$c2 eq ""} {
         2322  +			set c2 0
         2323  +		}
         2324  +		if {$c1 < $c2} {
         2325  +			return -1
         2326  +		}
         2327  +		if {$c1 > $c2} {
         2328  +			return 1
         2329  +		}
         2330  +	}
         2331  +	return 0
         2332  +}
         2333  +
         2334  +# @suffix suf list
         2335  +#
         2336  +# Takes a list and returns a new list with '$suf' appended
         2337  +# to each element
         2338  +#
         2339  +## suffix .c {a b c} => {a.c b.c c.c}
         2340  +#
         2341  +proc suffix {suf list} {
         2342  +	set result {}
         2343  +	foreach p $list {
         2344  +		lappend result $p$suf
         2345  +	}
         2346  +	return $result
         2347  +}
         2348  +
         2349  +# @prefix pre list
         2350  +#
         2351  +# Takes a list and returns a new list with '$pre' prepended
         2352  +# to each element
         2353  +#
         2354  +## prefix jim- {a.c b.c} => {jim-a.c jim-b.c}
         2355  +#
         2356  +proc prefix {pre list} {
         2357  +	set result {}
         2358  +	foreach p $list {
         2359  +		lappend result $pre$p
         2360  +	}
         2361  +	return $result
         2362  +}
         2363  +
         2364  +# @lpop list
         2365  +#
         2366  +# Removes the last entry from the given list and returns it.
         2367  +proc lpop {listname} {
         2368  +	upvar $listname list
         2369  +	set val [lindex $list end]
         2370  +	set list [lrange $list 0 end-1]
         2371  +	return $val
         2372  +}
         2373  +}
         2374  +
         2375  +# ----- @module wiki-formatting.tcl -----
         2376  +
         2377  +set modsource(wiki-formatting.tcl) {
         2378  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
         2379  +# All rights reserved
         2380  +
         2381  +# Module which provides text formatting
         2382  +# wiki.tcl.tk format output
         2383  +
         2384  +use formatting
         2385  +
         2386  +proc joinlines {text} {
         2387  +    set lines {}
         2388  +    foreach l [split [string trim $text] \n] {
         2389  +        lappend lines [string trim $l]
         2390  +    }
         2391  +    join $lines
         2392  +}
         2393  +proc p {text} {
         2394  +    puts [joinlines $text]
         2395  +    puts ""
         2396  +}
         2397  +proc title {text} {
         2398  +    puts "*** [joinlines $text] ***"
         2399  +    puts ""
         2400  +}
         2401  +proc codelines {lines} {
         2402  +    puts "======"
         2403  +    foreach line $lines {
         2404  +        puts "    $line"
         2405  +    }
         2406  +    puts "======"
         2407  +}
         2408  +proc code {text} {
         2409  +    puts "======"
         2410  +    foreach line [parse_code_block $text] {
         2411  +        puts "    $line"
         2412  +    }
         2413  +    puts "======"
         2414  +}
         2415  +proc nl {} {
         2416  +}
         2417  +proc section {text} {
         2418  +    puts "'''$text'''"
         2419  +    puts ""
         2420  +}
         2421  +proc subsection {text} {
         2422  +    puts "''$text''"
         2423  +    puts ""
         2424  +}
         2425  +proc bullet {text} {
         2426  +    puts "   * [joinlines $text]"
         2427  +}
         2428  +proc indent {text} {
         2429  +    puts "    :    [joinlines $text]"
         2430  +}
         2431  +proc defn {first args} {
         2432  +    if {$first ne ""} {
         2433  +        indent '''$first'''
         2434  +    }
         2435  +
         2436  +    foreach p $args {
         2437  +        p $p
         2438  +    }
         2439  +}
         2440  +}
         2441  +
         2442  +
         2443  +##################################################################
         2444  +#
         2445  +# Entry/Exit
         2446  +#
         2447  +if {$autosetup(debug)} {
         2448  +	main $argv
         2449  +}
         2450  +if {[catch {main $argv} msg opts] == 1} {
         2451  +	show-notices
         2452  +	autosetup-full-error [error-dump $msg $opts $autosetup(debug)]
         2453  +	if {!$autosetup(debug)} {
         2454  +		puts stderr "Try: '[file tail $autosetup(exe)] --debug' for a full stack trace"
         2455  +	}
         2456  +	exit 1
         2457  +}

Added autosetup/autosetup-config.guess.

            1  +#! /bin/sh
            2  +# Attempt to guess a canonical system name.
            3  +#   Copyright 1992-2018 Free Software Foundation, Inc.
            4  +
            5  +timestamp='2018-03-08'
            6  +
            7  +# This file is free software; you can redistribute it and/or modify it
            8  +# under the terms of the GNU General Public License as published by
            9  +# the Free Software Foundation; either version 3 of the License, or
           10  +# (at your option) any later version.
           11  +#
           12  +# This program is distributed in the hope that it will be useful, but
           13  +# WITHOUT ANY WARRANTY; without even the implied warranty of
           14  +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
           15  +# General Public License for more details.
           16  +#
           17  +# You should have received a copy of the GNU General Public License
           18  +# along with this program; if not, see <https://www.gnu.org/licenses/>.
           19  +#
           20  +# As a special exception to the GNU General Public License, if you
           21  +# distribute this file as part of a program that contains a
           22  +# configuration script generated by Autoconf, you may include it under
           23  +# the same distribution terms that you use for the rest of that
           24  +# program.  This Exception is an additional permission under section 7
           25  +# of the GNU General Public License, version 3 ("GPLv3").
           26  +#
           27  +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
           28  +#
           29  +# You can get the latest version of this script from:
           30  +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
           31  +#
           32  +# Please send patches to <[email protected]>.
           33  +
           34  +
           35  +me=`echo "$0" | sed -e 's,.*/,,'`
           36  +
           37  +usage="\
           38  +Usage: $0 [OPTION]
           39  +
           40  +Output the configuration name of the system \`$me' is run on.
           41  +
           42  +Options:
           43  +  -h, --help         print this help, then exit
           44  +  -t, --time-stamp   print date of last modification, then exit
           45  +  -v, --version      print version number, then exit
           46  +
           47  +Report bugs and patches to <[email protected]>."
           48  +
           49  +version="\
           50  +GNU config.guess ($timestamp)
           51  +
           52  +Originally written by Per Bothner.
           53  +Copyright 1992-2018 Free Software Foundation, Inc.
           54  +
           55  +This is free software; see the source for copying conditions.  There is NO
           56  +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
           57  +
           58  +help="
           59  +Try \`$me --help' for more information."
           60  +
           61  +# Parse command line
           62  +while test $# -gt 0 ; do
           63  +  case $1 in
           64  +    --time-stamp | --time* | -t )
           65  +       echo "$timestamp" ; exit ;;
           66  +    --version | -v )
           67  +       echo "$version" ; exit ;;
           68  +    --help | --h* | -h )
           69  +       echo "$usage"; exit ;;
           70  +    -- )     # Stop option processing
           71  +       shift; break ;;
           72  +    - )	# Use stdin as input.
           73  +       break ;;
           74  +    -* )
           75  +       echo "$me: invalid option $1$help" >&2
           76  +       exit 1 ;;
           77  +    * )
           78  +       break ;;
           79  +  esac
           80  +done
           81  +
           82  +if test $# != 0; then
           83  +  echo "$me: too many arguments$help" >&2
           84  +  exit 1
           85  +fi
           86  +
           87  +trap 'exit 1' 1 2 15
           88  +
           89  +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
           90  +# compiler to aid in system detection is discouraged as it requires
           91  +# temporary files to be created and, as you can see below, it is a
           92  +# headache to deal with in a portable fashion.
           93  +
           94  +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
           95  +# use `HOST_CC' if defined, but it is deprecated.
           96  +
           97  +# Portable tmp directory creation inspired by the Autoconf team.
           98  +
           99  +set_cc_for_build='
          100  +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
          101  +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
          102  +: ${TMPDIR=/tmp} ;
          103  + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
          104  + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
          105  + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
          106  + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
          107  +dummy=$tmp/dummy ;
          108  +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
          109  +case $CC_FOR_BUILD,$HOST_CC,$CC in
          110  + ,,)    echo "int x;" > "$dummy.c" ;
          111  +	for c in cc gcc c89 c99 ; do
          112  +	  if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
          113  +	     CC_FOR_BUILD="$c"; break ;
          114  +	  fi ;
          115  +	done ;
          116  +	if test x"$CC_FOR_BUILD" = x ; then
          117  +	  CC_FOR_BUILD=no_compiler_found ;
          118  +	fi
          119  +	;;
          120  + ,,*)   CC_FOR_BUILD=$CC ;;
          121  + ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
          122  +esac ; set_cc_for_build= ;'
          123  +
          124  +# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
          125  +# ([email protected] 1994-08-24)
          126  +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
          127  +	PATH=$PATH:/.attbin ; export PATH
          128  +fi
          129  +
          130  +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
          131  +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
          132  +UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
          133  +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
          134  +
          135  +case "$UNAME_SYSTEM" in
          136  +Linux|GNU|GNU/*)
          137  +	# If the system lacks a compiler, then just pick glibc.
          138  +	# We could probably try harder.
          139  +	LIBC=gnu
          140  +
          141  +	eval "$set_cc_for_build"
          142  +	cat <<-EOF > "$dummy.c"
          143  +	#include <features.h>
          144  +	#if defined(__UCLIBC__)
          145  +	LIBC=uclibc
          146  +	#elif defined(__dietlibc__)
          147  +	LIBC=dietlibc
          148  +	#else
          149  +	LIBC=gnu
          150  +	#endif
          151  +	EOF
          152  +	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
          153  +
          154  +	# If ldd exists, use it to detect musl libc.
          155  +	if command -v ldd >/dev/null && \
          156  +		ldd --version 2>&1 | grep -q ^musl
          157  +	then
          158  +	    LIBC=musl
          159  +	fi
          160  +	;;
          161  +esac
          162  +
          163  +# Note: order is significant - the case branches are not exclusive.
          164  +
          165  +case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
          166  +    *:NetBSD:*:*)
          167  +	# NetBSD (nbsd) targets should (where applicable) match one or
          168  +	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
          169  +	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
          170  +	# switched to ELF, *-*-netbsd* would select the old
          171  +	# object file format.  This provides both forward
          172  +	# compatibility and a consistent mechanism for selecting the
          173  +	# object file format.
          174  +	#
          175  +	# Note: NetBSD doesn't particularly care about the vendor
          176  +	# portion of the name.  We always set it to "unknown".
          177  +	sysctl="sysctl -n hw.machine_arch"
          178  +	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
          179  +	    "/sbin/$sysctl" 2>/dev/null || \
          180  +	    "/usr/sbin/$sysctl" 2>/dev/null || \
          181  +	    echo unknown)`
          182  +	case "$UNAME_MACHINE_ARCH" in
          183  +	    armeb) machine=armeb-unknown ;;
          184  +	    arm*) machine=arm-unknown ;;
          185  +	    sh3el) machine=shl-unknown ;;
          186  +	    sh3eb) machine=sh-unknown ;;
          187  +	    sh5el) machine=sh5le-unknown ;;
          188  +	    earmv*)
          189  +		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
          190  +		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
          191  +		machine="${arch}${endian}"-unknown
          192  +		;;
          193  +	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
          194  +	esac
          195  +	# The Operating System including object format, if it has switched
          196  +	# to ELF recently (or will in the future) and ABI.
          197  +	case "$UNAME_MACHINE_ARCH" in
          198  +	    earm*)
          199  +		os=netbsdelf
          200  +		;;
          201  +	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
          202  +		eval "$set_cc_for_build"
          203  +		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
          204  +			| grep -q __ELF__
          205  +		then
          206  +		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
          207  +		    # Return netbsd for either.  FIX?
          208  +		    os=netbsd
          209  +		else
          210  +		    os=netbsdelf
          211  +		fi
          212  +		;;
          213  +	    *)
          214  +		os=netbsd
          215  +		;;
          216  +	esac
          217  +	# Determine ABI tags.
          218  +	case "$UNAME_MACHINE_ARCH" in
          219  +	    earm*)
          220  +		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
          221  +		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
          222  +		;;
          223  +	esac
          224  +	# The OS release
          225  +	# Debian GNU/NetBSD machines have a different userland, and
          226  +	# thus, need a distinct triplet. However, they do not need
          227  +	# kernel version information, so it can be replaced with a
          228  +	# suitable tag, in the style of linux-gnu.
          229  +	case "$UNAME_VERSION" in
          230  +	    Debian*)
          231  +		release='-gnu'
          232  +		;;
          233  +	    *)
          234  +		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
          235  +		;;
          236  +	esac
          237  +	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
          238  +	# contains redundant information, the shorter form:
          239  +	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
          240  +	echo "$machine-${os}${release}${abi}"
          241  +	exit ;;
          242  +    *:Bitrig:*:*)
          243  +	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
          244  +	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
          245  +	exit ;;
          246  +    *:OpenBSD:*:*)
          247  +	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
          248  +	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
          249  +	exit ;;
          250  +    *:LibertyBSD:*:*)
          251  +	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
          252  +	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
          253  +	exit ;;
          254  +    *:MidnightBSD:*:*)
          255  +	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
          256  +	exit ;;
          257  +    *:ekkoBSD:*:*)
          258  +	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
          259  +	exit ;;
          260  +    *:SolidBSD:*:*)
          261  +	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
          262  +	exit ;;
          263  +    macppc:MirBSD:*:*)
          264  +	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
          265  +	exit ;;
          266  +    *:MirBSD:*:*)
          267  +	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
          268  +	exit ;;
          269  +    *:Sortix:*:*)
          270  +	echo "$UNAME_MACHINE"-unknown-sortix
          271  +	exit ;;
          272  +    *:Redox:*:*)
          273  +	echo "$UNAME_MACHINE"-unknown-redox
          274  +	exit ;;
          275  +    mips:OSF1:*.*)
          276  +        echo mips-dec-osf1
          277  +        exit ;;
          278  +    alpha:OSF1:*:*)
          279  +	case $UNAME_RELEASE in
          280  +	*4.0)
          281  +		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
          282  +		;;
          283  +	*5.*)
          284  +		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
          285  +		;;
          286  +	esac
          287  +	# According to Compaq, /usr/sbin/psrinfo has been available on
          288  +	# OSF/1 and Tru64 systems produced since 1995.  I hope that
          289  +	# covers most systems running today.  This code pipes the CPU
          290  +	# types through head -n 1, so we only detect the type of CPU 0.
          291  +	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
          292  +	case "$ALPHA_CPU_TYPE" in
          293  +	    "EV4 (21064)")
          294  +		UNAME_MACHINE=alpha ;;
          295  +	    "EV4.5 (21064)")
          296  +		UNAME_MACHINE=alpha ;;
          297  +	    "LCA4 (21066/21068)")
          298  +		UNAME_MACHINE=alpha ;;
          299  +	    "EV5 (21164)")
          300  +		UNAME_MACHINE=alphaev5 ;;
          301  +	    "EV5.6 (21164A)")
          302  +		UNAME_MACHINE=alphaev56 ;;
          303  +	    "EV5.6 (21164PC)")
          304  +		UNAME_MACHINE=alphapca56 ;;
          305  +	    "EV5.7 (21164PC)")
          306  +		UNAME_MACHINE=alphapca57 ;;
          307  +	    "EV6 (21264)")
          308  +		UNAME_MACHINE=alphaev6 ;;
          309  +	    "EV6.7 (21264A)")
          310  +		UNAME_MACHINE=alphaev67 ;;
          311  +	    "EV6.8CB (21264C)")
          312  +		UNAME_MACHINE=alphaev68 ;;
          313  +	    "EV6.8AL (21264B)")
          314  +		UNAME_MACHINE=alphaev68 ;;
          315  +	    "EV6.8CX (21264D)")
          316  +		UNAME_MACHINE=alphaev68 ;;
          317  +	    "EV6.9A (21264/EV69A)")
          318  +		UNAME_MACHINE=alphaev69 ;;
          319  +	    "EV7 (21364)")
          320  +		UNAME_MACHINE=alphaev7 ;;
          321  +	    "EV7.9 (21364A)")
          322  +		UNAME_MACHINE=alphaev79 ;;
          323  +	esac
          324  +	# A Pn.n version is a patched version.
          325  +	# A Vn.n version is a released version.
          326  +	# A Tn.n version is a released field test version.
          327  +	# A Xn.n version is an unreleased experimental baselevel.
          328  +	# 1.2 uses "1.2" for uname -r.
          329  +	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
          330  +	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
          331  +	exitcode=$?
          332  +	trap '' 0
          333  +	exit $exitcode ;;
          334  +    Amiga*:UNIX_System_V:4.0:*)
          335  +	echo m68k-unknown-sysv4
          336  +	exit ;;
          337  +    *:[Aa]miga[Oo][Ss]:*:*)
          338  +	echo "$UNAME_MACHINE"-unknown-amigaos
          339  +	exit ;;
          340  +    *:[Mm]orph[Oo][Ss]:*:*)
          341  +	echo "$UNAME_MACHINE"-unknown-morphos
          342  +	exit ;;
          343  +    *:OS/390:*:*)
          344  +	echo i370-ibm-openedition
          345  +	exit ;;
          346  +    *:z/VM:*:*)
          347  +	echo s390-ibm-zvmoe
          348  +	exit ;;
          349  +    *:OS400:*:*)
          350  +	echo powerpc-ibm-os400
          351  +	exit ;;
          352  +    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
          353  +	echo arm-acorn-riscix"$UNAME_RELEASE"
          354  +	exit ;;
          355  +    arm*:riscos:*:*|arm*:RISCOS:*:*)
          356  +	echo arm-unknown-riscos
          357  +	exit ;;
          358  +    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
          359  +	echo hppa1.1-hitachi-hiuxmpp
          360  +	exit ;;
          361  +    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
          362  +	# [email protected] (Earle F. Ake) contributed MIS and NILE.
          363  +	if test "`(/bin/universe) 2>/dev/null`" = att ; then
          364  +		echo pyramid-pyramid-sysv3
          365  +	else
          366  +		echo pyramid-pyramid-bsd
          367  +	fi
          368  +	exit ;;
          369  +    NILE*:*:*:dcosx)
          370  +	echo pyramid-pyramid-svr4
          371  +	exit ;;
          372  +    DRS?6000:unix:4.0:6*)
          373  +	echo sparc-icl-nx6
          374  +	exit ;;
          375  +    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
          376  +	case `/usr/bin/uname -p` in
          377  +	    sparc) echo sparc-icl-nx7; exit ;;
          378  +	esac ;;
          379  +    s390x:SunOS:*:*)
          380  +	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
          381  +	exit ;;
          382  +    sun4H:SunOS:5.*:*)
          383  +	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
          384  +	exit ;;
          385  +    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
          386  +	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
          387  +	exit ;;
          388  +    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
          389  +	echo i386-pc-auroraux"$UNAME_RELEASE"
          390  +	exit ;;
          391  +    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
          392  +	eval "$set_cc_for_build"
          393  +	SUN_ARCH=i386
          394  +	# If there is a compiler, see if it is configured for 64-bit objects.
          395  +	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
          396  +	# This test works for both compilers.
          397  +	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
          398  +	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
          399  +		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
          400  +		grep IS_64BIT_ARCH >/dev/null
          401  +	    then
          402  +		SUN_ARCH=x86_64
          403  +	    fi
          404  +	fi
          405  +	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
          406  +	exit ;;
          407  +    sun4*:SunOS:6*:*)
          408  +	# According to config.sub, this is the proper way to canonicalize
          409  +	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
          410  +	# it's likely to be more like Solaris than SunOS4.
          411  +	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
          412  +	exit ;;
          413  +    sun4*:SunOS:*:*)
          414  +	case "`/usr/bin/arch -k`" in
          415  +	    Series*|S4*)
          416  +		UNAME_RELEASE=`uname -v`
          417  +		;;
          418  +	esac
          419  +	# Japanese Language versions have a version number like `4.1.3-JL'.
          420  +	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
          421  +	exit ;;
          422  +    sun3*:SunOS:*:*)
          423  +	echo m68k-sun-sunos"$UNAME_RELEASE"
          424  +	exit ;;
          425  +    sun*:*:4.2BSD:*)
          426  +	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
          427  +	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
          428  +	case "`/bin/arch`" in
          429  +	    sun3)
          430  +		echo m68k-sun-sunos"$UNAME_RELEASE"
          431  +		;;
          432  +	    sun4)
          433  +		echo sparc-sun-sunos"$UNAME_RELEASE"
          434  +		;;
          435  +	esac
          436  +	exit ;;
          437  +    aushp:SunOS:*:*)
          438  +	echo sparc-auspex-sunos"$UNAME_RELEASE"
          439  +	exit ;;
          440  +    # The situation for MiNT is a little confusing.  The machine name
          441  +    # can be virtually everything (everything which is not
          442  +    # "atarist" or "atariste" at least should have a processor
          443  +    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
          444  +    # to the lowercase version "mint" (or "freemint").  Finally
          445  +    # the system name "TOS" denotes a system which is actually not
          446  +    # MiNT.  But MiNT is downward compatible to TOS, so this should
          447  +    # be no problem.
          448  +    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
          449  +	echo m68k-atari-mint"$UNAME_RELEASE"
          450  +	exit ;;
          451  +    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
          452  +	echo m68k-atari-mint"$UNAME_RELEASE"
          453  +	exit ;;
          454  +    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
          455  +	echo m68k-atari-mint"$UNAME_RELEASE"
          456  +	exit ;;
          457  +    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
          458  +	echo m68k-milan-mint"$UNAME_RELEASE"
          459  +	exit ;;
          460  +    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
          461  +	echo m68k-hades-mint"$UNAME_RELEASE"
          462  +	exit ;;
          463  +    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
          464  +	echo m68k-unknown-mint"$UNAME_RELEASE"
          465  +	exit ;;
          466  +    m68k:machten:*:*)
          467  +	echo m68k-apple-machten"$UNAME_RELEASE"
          468  +	exit ;;
          469  +    powerpc:machten:*:*)
          470  +	echo powerpc-apple-machten"$UNAME_RELEASE"
          471  +	exit ;;
          472  +    RISC*:Mach:*:*)
          473  +	echo mips-dec-mach_bsd4.3
          474  +	exit ;;
          475  +    RISC*:ULTRIX:*:*)
          476  +	echo mips-dec-ultrix"$UNAME_RELEASE"
          477  +	exit ;;
          478  +    VAX*:ULTRIX*:*:*)
          479  +	echo vax-dec-ultrix"$UNAME_RELEASE"
          480  +	exit ;;
          481  +    2020:CLIX:*:* | 2430:CLIX:*:*)
          482  +	echo clipper-intergraph-clix"$UNAME_RELEASE"
          483  +	exit ;;
          484  +    mips:*:*:UMIPS | mips:*:*:RISCos)
          485  +	eval "$set_cc_for_build"
          486  +	sed 's/^	//' << EOF > "$dummy.c"
          487  +#ifdef __cplusplus
          488  +#include <stdio.h>  /* for printf() prototype */
          489  +	int main (int argc, char *argv[]) {
          490  +#else
          491  +	int main (argc, argv) int argc; char *argv[]; {
          492  +#endif
          493  +	#if defined (host_mips) && defined (MIPSEB)
          494  +	#if defined (SYSTYPE_SYSV)
          495  +	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
          496  +	#endif
          497  +	#if defined (SYSTYPE_SVR4)
          498  +	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
          499  +	#endif
          500  +	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
          501  +	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
          502  +	#endif
          503  +	#endif
          504  +	  exit (-1);
          505  +	}
          506  +EOF
          507  +	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
          508  +	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
          509  +	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
          510  +	    { echo "$SYSTEM_NAME"; exit; }
          511  +	echo mips-mips-riscos"$UNAME_RELEASE"
          512  +	exit ;;
          513  +    Motorola:PowerMAX_OS:*:*)
          514  +	echo powerpc-motorola-powermax
          515  +	exit ;;
          516  +    Motorola:*:4.3:PL8-*)
          517  +	echo powerpc-harris-powermax
          518  +	exit ;;
          519  +    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
          520  +	echo powerpc-harris-powermax
          521  +	exit ;;
          522  +    Night_Hawk:Power_UNIX:*:*)
          523  +	echo powerpc-harris-powerunix
          524  +	exit ;;
          525  +    m88k:CX/UX:7*:*)
          526  +	echo m88k-harris-cxux7
          527  +	exit ;;
          528  +    m88k:*:4*:R4*)
          529  +	echo m88k-motorola-sysv4
          530  +	exit ;;
          531  +    m88k:*:3*:R3*)
          532  +	echo m88k-motorola-sysv3
          533  +	exit ;;
          534  +    AViiON:dgux:*:*)
          535  +	# DG/UX returns AViiON for all architectures
          536  +	UNAME_PROCESSOR=`/usr/bin/uname -p`
          537  +	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
          538  +	then
          539  +	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
          540  +	       [ "$TARGET_BINARY_INTERFACE"x = x ]
          541  +	    then
          542  +		echo m88k-dg-dgux"$UNAME_RELEASE"
          543  +	    else
          544  +		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
          545  +	    fi
          546  +	else
          547  +	    echo i586-dg-dgux"$UNAME_RELEASE"
          548  +	fi
          549  +	exit ;;
          550  +    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
          551  +	echo m88k-dolphin-sysv3
          552  +	exit ;;
          553  +    M88*:*:R3*:*)
          554  +	# Delta 88k system running SVR3
          555  +	echo m88k-motorola-sysv3
          556  +	exit ;;
          557  +    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
          558  +	echo m88k-tektronix-sysv3
          559  +	exit ;;
          560  +    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
          561  +	echo m68k-tektronix-bsd
          562  +	exit ;;
          563  +    *:IRIX*:*:*)
          564  +	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
          565  +	exit ;;
          566  +    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
          567  +	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
          568  +	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
          569  +    i*86:AIX:*:*)
          570  +	echo i386-ibm-aix
          571  +	exit ;;
          572  +    ia64:AIX:*:*)
          573  +	if [ -x /usr/bin/oslevel ] ; then
          574  +		IBM_REV=`/usr/bin/oslevel`
          575  +	else
          576  +		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
          577  +	fi
          578  +	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
          579  +	exit ;;
          580  +    *:AIX:2:3)
          581  +	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
          582  +		eval "$set_cc_for_build"
          583  +		sed 's/^		//' << EOF > "$dummy.c"
          584  +		#include <sys/systemcfg.h>
          585  +
          586  +		main()
          587  +			{
          588  +			if (!__power_pc())
          589  +				exit(1);
          590  +			puts("powerpc-ibm-aix3.2.5");
          591  +			exit(0);
          592  +			}
          593  +EOF
          594  +		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
          595  +		then
          596  +			echo "$SYSTEM_NAME"
          597  +		else
          598  +			echo rs6000-ibm-aix3.2.5
          599  +		fi
          600  +	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
          601  +		echo rs6000-ibm-aix3.2.4
          602  +	else
          603  +		echo rs6000-ibm-aix3.2
          604  +	fi
          605  +	exit ;;
          606  +    *:AIX:*:[4567])
          607  +	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
          608  +	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
          609  +		IBM_ARCH=rs6000
          610  +	else
          611  +		IBM_ARCH=powerpc
          612  +	fi
          613  +	if [ -x /usr/bin/lslpp ] ; then
          614  +		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
          615  +			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
          616  +	else
          617  +		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
          618  +	fi
          619  +	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
          620  +	exit ;;
          621  +    *:AIX:*:*)
          622  +	echo rs6000-ibm-aix
          623  +	exit ;;
          624  +    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
          625  +	echo romp-ibm-bsd4.4
          626  +	exit ;;
          627  +    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
          628  +	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
          629  +	exit ;;                             # report: romp-ibm BSD 4.3
          630  +    *:BOSX:*:*)
          631  +	echo rs6000-bull-bosx
          632  +	exit ;;
          633  +    DPX/2?00:B.O.S.:*:*)
          634  +	echo m68k-bull-sysv3
          635  +	exit ;;
          636  +    9000/[34]??:4.3bsd:1.*:*)
          637  +	echo m68k-hp-bsd
          638  +	exit ;;
          639  +    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
          640  +	echo m68k-hp-bsd4.4
          641  +	exit ;;
          642  +    9000/[34678]??:HP-UX:*:*)
          643  +	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
          644  +	case "$UNAME_MACHINE" in
          645  +	    9000/31?)            HP_ARCH=m68000 ;;
          646  +	    9000/[34]??)         HP_ARCH=m68k ;;
          647  +	    9000/[678][0-9][0-9])
          648  +		if [ -x /usr/bin/getconf ]; then
          649  +		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
          650  +		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
          651  +		    case "$sc_cpu_version" in
          652  +		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
          653  +		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
          654  +		      532)                      # CPU_PA_RISC2_0
          655  +			case "$sc_kernel_bits" in
          656  +			  32) HP_ARCH=hppa2.0n ;;
          657  +			  64) HP_ARCH=hppa2.0w ;;
          658  +			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
          659  +			esac ;;
          660  +		    esac
          661  +		fi
          662  +		if [ "$HP_ARCH" = "" ]; then
          663  +		    eval "$set_cc_for_build"
          664  +		    sed 's/^		//' << EOF > "$dummy.c"
          665  +
          666  +		#define _HPUX_SOURCE
          667  +		#include <stdlib.h>
          668  +		#include <unistd.h>
          669  +
          670  +		int main ()
          671  +		{
          672  +		#if defined(_SC_KERNEL_BITS)
          673  +		    long bits = sysconf(_SC_KERNEL_BITS);
          674  +		#endif
          675  +		    long cpu  = sysconf (_SC_CPU_VERSION);
          676  +
          677  +		    switch (cpu)
          678  +			{
          679  +			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
          680  +			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
          681  +			case CPU_PA_RISC2_0:
          682  +		#if defined(_SC_KERNEL_BITS)
          683  +			    switch (bits)
          684  +				{
          685  +				case 64: puts ("hppa2.0w"); break;
          686  +				case 32: puts ("hppa2.0n"); break;
          687  +				default: puts ("hppa2.0"); break;
          688  +				} break;
          689  +		#else  /* !defined(_SC_KERNEL_BITS) */
          690  +			    puts ("hppa2.0"); break;
          691  +		#endif
          692  +			default: puts ("hppa1.0"); break;
          693  +			}
          694  +		    exit (0);
          695  +		}
          696  +EOF
          697  +		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
          698  +		    test -z "$HP_ARCH" && HP_ARCH=hppa
          699  +		fi ;;
          700  +	esac
          701  +	if [ "$HP_ARCH" = hppa2.0w ]
          702  +	then
          703  +	    eval "$set_cc_for_build"
          704  +
          705  +	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
          706  +	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
          707  +	    # generating 64-bit code.  GNU and HP use different nomenclature:
          708  +	    #
          709  +	    # $ CC_FOR_BUILD=cc ./config.guess
          710  +	    # => hppa2.0w-hp-hpux11.23
          711  +	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
          712  +	    # => hppa64-hp-hpux11.23
          713  +
          714  +	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
          715  +		grep -q __LP64__
          716  +	    then
          717  +		HP_ARCH=hppa2.0w
          718  +	    else
          719  +		HP_ARCH=hppa64
          720  +	    fi
          721  +	fi
          722  +	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
          723  +	exit ;;
          724  +    ia64:HP-UX:*:*)
          725  +	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
          726  +	echo ia64-hp-hpux"$HPUX_REV"
          727  +	exit ;;
          728  +    3050*:HI-UX:*:*)
          729  +	eval "$set_cc_for_build"
          730  +	sed 's/^	//' << EOF > "$dummy.c"
          731  +	#include <unistd.h>
          732  +	int
          733  +	main ()
          734  +	{
          735  +	  long cpu = sysconf (_SC_CPU_VERSION);
          736  +	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
          737  +	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
          738  +	     results, however.  */
          739  +	  if (CPU_IS_PA_RISC (cpu))
          740  +	    {
          741  +	      switch (cpu)
          742  +		{
          743  +		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
          744  +		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
          745  +		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
          746  +		  default: puts ("hppa-hitachi-hiuxwe2"); break;
          747  +		}
          748  +	    }
          749  +	  else if (CPU_IS_HP_MC68K (cpu))
          750  +	    puts ("m68k-hitachi-hiuxwe2");
          751  +	  else puts ("unknown-hitachi-hiuxwe2");
          752  +	  exit (0);
          753  +	}
          754  +EOF
          755  +	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
          756  +		{ echo "$SYSTEM_NAME"; exit; }
          757  +	echo unknown-hitachi-hiuxwe2
          758  +	exit ;;
          759  +    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
          760  +	echo hppa1.1-hp-bsd
          761  +	exit ;;
          762  +    9000/8??:4.3bsd:*:*)
          763  +	echo hppa1.0-hp-bsd
          764  +	exit ;;
          765  +    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
          766  +	echo hppa1.0-hp-mpeix
          767  +	exit ;;
          768  +    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
          769  +	echo hppa1.1-hp-osf
          770  +	exit ;;
          771  +    hp8??:OSF1:*:*)
          772  +	echo hppa1.0-hp-osf
          773  +	exit ;;
          774  +    i*86:OSF1:*:*)
          775  +	if [ -x /usr/sbin/sysversion ] ; then
          776  +	    echo "$UNAME_MACHINE"-unknown-osf1mk
          777  +	else
          778  +	    echo "$UNAME_MACHINE"-unknown-osf1
          779  +	fi
          780  +	exit ;;
          781  +    parisc*:Lites*:*:*)
          782  +	echo hppa1.1-hp-lites
          783  +	exit ;;
          784  +    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
          785  +	echo c1-convex-bsd
          786  +	exit ;;
          787  +    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
          788  +	if getsysinfo -f scalar_acc
          789  +	then echo c32-convex-bsd
          790  +	else echo c2-convex-bsd
          791  +	fi
          792  +	exit ;;
          793  +    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
          794  +	echo c34-convex-bsd
          795  +	exit ;;
          796  +    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
          797  +	echo c38-convex-bsd
          798  +	exit ;;
          799  +    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
          800  +	echo c4-convex-bsd
          801  +	exit ;;
          802  +    CRAY*Y-MP:*:*:*)
          803  +	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
          804  +	exit ;;
          805  +    CRAY*[A-Z]90:*:*:*)
          806  +	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
          807  +	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
          808  +	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
          809  +	      -e 's/\.[^.]*$/.X/'
          810  +	exit ;;
          811  +    CRAY*TS:*:*:*)
          812  +	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
          813  +	exit ;;
          814  +    CRAY*T3E:*:*:*)
          815  +	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
          816  +	exit ;;
          817  +    CRAY*SV1:*:*:*)
          818  +	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
          819  +	exit ;;
          820  +    *:UNICOS/mp:*:*)
          821  +	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
          822  +	exit ;;
          823  +    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
          824  +	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
          825  +	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
          826  +	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
          827  +	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
          828  +	exit ;;
          829  +    5000:UNIX_System_V:4.*:*)
          830  +	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
          831  +	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
          832  +	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
          833  +	exit ;;
          834  +    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
          835  +	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
          836  +	exit ;;
          837  +    sparc*:BSD/OS:*:*)
          838  +	echo sparc-unknown-bsdi"$UNAME_RELEASE"
          839  +	exit ;;
          840  +    *:BSD/OS:*:*)
          841  +	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
          842  +	exit ;;
          843  +    *:FreeBSD:*:*)
          844  +	UNAME_PROCESSOR=`/usr/bin/uname -p`
          845  +	case "$UNAME_PROCESSOR" in
          846  +	    amd64)
          847  +		UNAME_PROCESSOR=x86_64 ;;
          848  +	    i386)
          849  +		UNAME_PROCESSOR=i586 ;;
          850  +	esac
          851  +	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
          852  +	exit ;;
          853  +    i*:CYGWIN*:*)
          854  +	echo "$UNAME_MACHINE"-pc-cygwin
          855  +	exit ;;
          856  +    *:MINGW64*:*)
          857  +	echo "$UNAME_MACHINE"-pc-mingw64
          858  +	exit ;;
          859  +    *:MINGW*:*)
          860  +	echo "$UNAME_MACHINE"-pc-mingw32
          861  +	exit ;;
          862  +    *:MSYS*:*)
          863  +	echo "$UNAME_MACHINE"-pc-msys
          864  +	exit ;;
          865  +    i*:PW*:*)
          866  +	echo "$UNAME_MACHINE"-pc-pw32
          867  +	exit ;;
          868  +    *:Interix*:*)
          869  +	case "$UNAME_MACHINE" in
          870  +	    x86)
          871  +		echo i586-pc-interix"$UNAME_RELEASE"
          872  +		exit ;;
          873  +	    authenticamd | genuineintel | EM64T)
          874  +		echo x86_64-unknown-interix"$UNAME_RELEASE"
          875  +		exit ;;
          876  +	    IA64)
          877  +		echo ia64-unknown-interix"$UNAME_RELEASE"
          878  +		exit ;;
          879  +	esac ;;
          880  +    i*:UWIN*:*)
          881  +	echo "$UNAME_MACHINE"-pc-uwin
          882  +	exit ;;
          883  +    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
          884  +	echo x86_64-unknown-cygwin
          885  +	exit ;;
          886  +    prep*:SunOS:5.*:*)
          887  +	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
          888  +	exit ;;
          889  +    *:GNU:*:*)
          890  +	# the GNU system
          891  +	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
          892  +	exit ;;
          893  +    *:GNU/*:*:*)
          894  +	# other systems with GNU libc and userland
          895  +	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
          896  +	exit ;;
          897  +    i*86:Minix:*:*)
          898  +	echo "$UNAME_MACHINE"-pc-minix
          899  +	exit ;;
          900  +    aarch64:Linux:*:*)
          901  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          902  +	exit ;;
          903  +    aarch64_be:Linux:*:*)
          904  +	UNAME_MACHINE=aarch64_be
          905  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          906  +	exit ;;
          907  +    alpha:Linux:*:*)
          908  +	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
          909  +	  EV5)   UNAME_MACHINE=alphaev5 ;;
          910  +	  EV56)  UNAME_MACHINE=alphaev56 ;;
          911  +	  PCA56) UNAME_MACHINE=alphapca56 ;;
          912  +	  PCA57) UNAME_MACHINE=alphapca56 ;;
          913  +	  EV6)   UNAME_MACHINE=alphaev6 ;;
          914  +	  EV67)  UNAME_MACHINE=alphaev67 ;;
          915  +	  EV68*) UNAME_MACHINE=alphaev68 ;;
          916  +	esac
          917  +	objdump --private-headers /bin/sh | grep -q ld.so.1
          918  +	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
          919  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          920  +	exit ;;
          921  +    arc:Linux:*:* | arceb:Linux:*:*)
          922  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          923  +	exit ;;
          924  +    arm*:Linux:*:*)
          925  +	eval "$set_cc_for_build"
          926  +	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
          927  +	    | grep -q __ARM_EABI__
          928  +	then
          929  +	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          930  +	else
          931  +	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
          932  +		| grep -q __ARM_PCS_VFP
          933  +	    then
          934  +		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
          935  +	    else
          936  +		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
          937  +	    fi
          938  +	fi
          939  +	exit ;;
          940  +    avr32*:Linux:*:*)
          941  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          942  +	exit ;;
          943  +    cris:Linux:*:*)
          944  +	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
          945  +	exit ;;
          946  +    crisv32:Linux:*:*)
          947  +	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
          948  +	exit ;;
          949  +    e2k:Linux:*:*)
          950  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          951  +	exit ;;
          952  +    frv:Linux:*:*)
          953  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          954  +	exit ;;
          955  +    hexagon:Linux:*:*)
          956  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          957  +	exit ;;
          958  +    i*86:Linux:*:*)
          959  +	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
          960  +	exit ;;
          961  +    ia64:Linux:*:*)
          962  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          963  +	exit ;;
          964  +    k1om:Linux:*:*)
          965  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          966  +	exit ;;
          967  +    m32r*:Linux:*:*)
          968  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          969  +	exit ;;
          970  +    m68*:Linux:*:*)
          971  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          972  +	exit ;;
          973  +    mips:Linux:*:* | mips64:Linux:*:*)
          974  +	eval "$set_cc_for_build"
          975  +	sed 's/^	//' << EOF > "$dummy.c"
          976  +	#undef CPU
          977  +	#undef ${UNAME_MACHINE}
          978  +	#undef ${UNAME_MACHINE}el
          979  +	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
          980  +	CPU=${UNAME_MACHINE}el
          981  +	#else
          982  +	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
          983  +	CPU=${UNAME_MACHINE}
          984  +	#else
          985  +	CPU=
          986  +	#endif
          987  +	#endif
          988  +EOF
          989  +	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
          990  +	test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
          991  +	;;
          992  +    mips64el:Linux:*:*)
          993  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
          994  +	exit ;;
          995  +    openrisc*:Linux:*:*)
          996  +	echo or1k-unknown-linux-"$LIBC"
          997  +	exit ;;
          998  +    or32:Linux:*:* | or1k*:Linux:*:*)
          999  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
         1000  +	exit ;;
         1001  +    padre:Linux:*:*)
         1002  +	echo sparc-unknown-linux-"$LIBC"
         1003  +	exit ;;
         1004  +    parisc64:Linux:*:* | hppa64:Linux:*:*)
         1005  +	echo hppa64-unknown-linux-"$LIBC"
         1006  +	exit ;;
         1007  +    parisc:Linux:*:* | hppa:Linux:*:*)
         1008  +	# Look for CPU level
         1009  +	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
         1010  +	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
         1011  +	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
         1012  +	  *)    echo hppa-unknown-linux-"$LIBC" ;;
         1013  +	esac
         1014  +	exit ;;
         1015  +    ppc64:Linux:*:*)
         1016  +	echo powerpc64-unknown-linux-"$LIBC"
         1017  +	exit ;;
         1018  +    ppc:Linux:*:*)
         1019  +	echo powerpc-unknown-linux-"$LIBC"
         1020  +	exit ;;
         1021  +    ppc64le:Linux:*:*)
         1022  +	echo powerpc64le-unknown-linux-"$LIBC"
         1023  +	exit ;;
         1024  +    ppcle:Linux:*:*)
         1025  +	echo powerpcle-unknown-linux-"$LIBC"
         1026  +	exit ;;
         1027  +    riscv32:Linux:*:* | riscv64:Linux:*:*)
         1028  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
         1029  +	exit ;;
         1030  +    s390:Linux:*:* | s390x:Linux:*:*)
         1031  +	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
         1032  +	exit ;;
         1033  +    sh64*:Linux:*:*)
         1034  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
         1035  +	exit ;;
         1036  +    sh*:Linux:*:*)
         1037  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
         1038  +	exit ;;
         1039  +    sparc:Linux:*:* | sparc64:Linux:*:*)
         1040  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
         1041  +	exit ;;
         1042  +    tile*:Linux:*:*)
         1043  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
         1044  +	exit ;;
         1045  +    vax:Linux:*:*)
         1046  +	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
         1047  +	exit ;;
         1048  +    x86_64:Linux:*:*)
         1049  +	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
         1050  +	exit ;;
         1051  +    xtensa*:Linux:*:*)
         1052  +	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
         1053  +	exit ;;
         1054  +    i*86:DYNIX/ptx:4*:*)
         1055  +	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
         1056  +	# earlier versions are messed up and put the nodename in both
         1057  +	# sysname and nodename.
         1058  +	echo i386-sequent-sysv4
         1059  +	exit ;;
         1060  +    i*86:UNIX_SV:4.2MP:2.*)
         1061  +	# Unixware is an offshoot of SVR4, but it has its own version
         1062  +	# number series starting with 2...
         1063  +	# I am not positive that other SVR4 systems won't match this,
         1064  +	# I just have to hope.  -- rms.
         1065  +	# Use sysv4.2uw... so that sysv4* matches it.
         1066  +	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
         1067  +	exit ;;
         1068  +    i*86:OS/2:*:*)
         1069  +	# If we were able to find `uname', then EMX Unix compatibility
         1070  +	# is probably installed.
         1071  +	echo "$UNAME_MACHINE"-pc-os2-emx
         1072  +	exit ;;
         1073  +    i*86:XTS-300:*:STOP)
         1074  +	echo "$UNAME_MACHINE"-unknown-stop
         1075  +	exit ;;
         1076  +    i*86:atheos:*:*)
         1077  +	echo "$UNAME_MACHINE"-unknown-atheos
         1078  +	exit ;;
         1079  +    i*86:syllable:*:*)
         1080  +	echo "$UNAME_MACHINE"-pc-syllable
         1081  +	exit ;;
         1082  +    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
         1083  +	echo i386-unknown-lynxos"$UNAME_RELEASE"
         1084  +	exit ;;
         1085  +    i*86:*DOS:*:*)
         1086  +	echo "$UNAME_MACHINE"-pc-msdosdjgpp
         1087  +	exit ;;
         1088  +    i*86:*:4.*:*)
         1089  +	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
         1090  +	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
         1091  +		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
         1092  +	else
         1093  +		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
         1094  +	fi
         1095  +	exit ;;
         1096  +    i*86:*:5:[678]*)
         1097  +	# UnixWare 7.x, OpenUNIX and OpenServer 6.
         1098  +	case `/bin/uname -X | grep "^Machine"` in
         1099  +	    *486*)	     UNAME_MACHINE=i486 ;;
         1100  +	    *Pentium)	     UNAME_MACHINE=i586 ;;
         1101  +	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
         1102  +	esac
         1103  +	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
         1104  +	exit ;;
         1105  +    i*86:*:3.2:*)
         1106  +	if test -f /usr/options/cb.name; then
         1107  +		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
         1108  +		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
         1109  +	elif /bin/uname -X 2>/dev/null >/dev/null ; then
         1110  +		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
         1111  +		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
         1112  +		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
         1113  +			&& UNAME_MACHINE=i586
         1114  +		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
         1115  +			&& UNAME_MACHINE=i686
         1116  +		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
         1117  +			&& UNAME_MACHINE=i686
         1118  +		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
         1119  +	else
         1120  +		echo "$UNAME_MACHINE"-pc-sysv32
         1121  +	fi
         1122  +	exit ;;
         1123  +    pc:*:*:*)
         1124  +	# Left here for compatibility:
         1125  +	# uname -m prints for DJGPP always 'pc', but it prints nothing about
         1126  +	# the processor, so we play safe by assuming i586.
         1127  +	# Note: whatever this is, it MUST be the same as what config.sub
         1128  +	# prints for the "djgpp" host, or else GDB configure will decide that
         1129  +	# this is a cross-build.
         1130  +	echo i586-pc-msdosdjgpp
         1131  +	exit ;;
         1132  +    Intel:Mach:3*:*)
         1133  +	echo i386-pc-mach3
         1134  +	exit ;;
         1135  +    paragon:*:*:*)
         1136  +	echo i860-intel-osf1
         1137  +	exit ;;
         1138  +    i860:*:4.*:*) # i860-SVR4
         1139  +	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
         1140  +	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
         1141  +	else # Add other i860-SVR4 vendors below as they are discovered.
         1142  +	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
         1143  +	fi
         1144  +	exit ;;
         1145  +    mini*:CTIX:SYS*5:*)
         1146  +	# "miniframe"
         1147  +	echo m68010-convergent-sysv
         1148  +	exit ;;
         1149  +    mc68k:UNIX:SYSTEM5:3.51m)
         1150  +	echo m68k-convergent-sysv
         1151  +	exit ;;
         1152  +    M680?0:D-NIX:5.3:*)
         1153  +	echo m68k-diab-dnix
         1154  +	exit ;;
         1155  +    M68*:*:R3V[5678]*:*)
         1156  +	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
         1157  +    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
         1158  +	OS_REL=''
         1159  +	test -r /etc/.relid \
         1160  +	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
         1161  +	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
         1162  +	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
         1163  +	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
         1164  +	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
         1165  +    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         1166  +	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
         1167  +	  && { echo i486-ncr-sysv4; exit; } ;;
         1168  +    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
         1169  +	OS_REL='.3'
         1170  +	test -r /etc/.relid \
         1171  +	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
         1172  +	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
         1173  +	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
         1174  +	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
         1175  +	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
         1176  +	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
         1177  +	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
         1178  +    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
         1179  +	echo m68k-unknown-lynxos"$UNAME_RELEASE"
         1180  +	exit ;;
         1181  +    mc68030:UNIX_System_V:4.*:*)
         1182  +	echo m68k-atari-sysv4
         1183  +	exit ;;
         1184  +    TSUNAMI:LynxOS:2.*:*)
         1185  +	echo sparc-unknown-lynxos"$UNAME_RELEASE"
         1186  +	exit ;;
         1187  +    rs6000:LynxOS:2.*:*)
         1188  +	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
         1189  +	exit ;;
         1190  +    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
         1191  +	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
         1192  +	exit ;;
         1193  +    SM[BE]S:UNIX_SV:*:*)
         1194  +	echo mips-dde-sysv"$UNAME_RELEASE"
         1195  +	exit ;;
         1196  +    RM*:ReliantUNIX-*:*:*)
         1197  +	echo mips-sni-sysv4
         1198  +	exit ;;
         1199  +    RM*:SINIX-*:*:*)
         1200  +	echo mips-sni-sysv4
         1201  +	exit ;;
         1202  +    *:SINIX-*:*:*)
         1203  +	if uname -p 2>/dev/null >/dev/null ; then
         1204  +		UNAME_MACHINE=`(uname -p) 2>/dev/null`
         1205  +		echo "$UNAME_MACHINE"-sni-sysv4
         1206  +	else
         1207  +		echo ns32k-sni-sysv
         1208  +	fi
         1209  +	exit ;;
         1210  +    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
         1211  +			# says <[email protected]>
         1212  +	echo i586-unisys-sysv4
         1213  +	exit ;;
         1214  +    *:UNIX_System_V:4*:FTX*)
         1215  +	# From Gerald Hewes <[email protected]>.
         1216  +	# How about differentiating between stratus architectures? -djm
         1217  +	echo hppa1.1-stratus-sysv4
         1218  +	exit ;;
         1219  +    *:*:*:FTX*)
         1220  +	# From [email protected]
         1221  +	echo i860-stratus-sysv4
         1222  +	exit ;;
         1223  +    i*86:VOS:*:*)
         1224  +	# From [email protected]
         1225  +	echo "$UNAME_MACHINE"-stratus-vos
         1226  +	exit ;;
         1227  +    *:VOS:*:*)
         1228  +	# From [email protected]
         1229  +	echo hppa1.1-stratus-vos
         1230  +	exit ;;
         1231  +    mc68*:A/UX:*:*)
         1232  +	echo m68k-apple-aux"$UNAME_RELEASE"
         1233  +	exit ;;
         1234  +    news*:NEWS-OS:6*:*)
         1235  +	echo mips-sony-newsos6
         1236  +	exit ;;
         1237  +    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
         1238  +	if [ -d /usr/nec ]; then
         1239  +		echo mips-nec-sysv"$UNAME_RELEASE"
         1240  +	else
         1241  +		echo mips-unknown-sysv"$UNAME_RELEASE"
         1242  +	fi
         1243  +	exit ;;
         1244  +    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
         1245  +	echo powerpc-be-beos
         1246  +	exit ;;
         1247  +    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
         1248  +	echo powerpc-apple-beos
         1249  +	exit ;;
         1250  +    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
         1251  +	echo i586-pc-beos
         1252  +	exit ;;
         1253  +    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
         1254  +	echo i586-pc-haiku
         1255  +	exit ;;
         1256  +    x86_64:Haiku:*:*)
         1257  +	echo x86_64-unknown-haiku
         1258  +	exit ;;
         1259  +    SX-4:SUPER-UX:*:*)
         1260  +	echo sx4-nec-superux"$UNAME_RELEASE"
         1261  +	exit ;;
         1262  +    SX-5:SUPER-UX:*:*)
         1263  +	echo sx5-nec-superux"$UNAME_RELEASE"
         1264  +	exit ;;
         1265  +    SX-6:SUPER-UX:*:*)
         1266  +	echo sx6-nec-superux"$UNAME_RELEASE"
         1267  +	exit ;;
         1268  +    SX-7:SUPER-UX:*:*)
         1269  +	echo sx7-nec-superux"$UNAME_RELEASE"
         1270  +	exit ;;
         1271  +    SX-8:SUPER-UX:*:*)
         1272  +	echo sx8-nec-superux"$UNAME_RELEASE"
         1273  +	exit ;;
         1274  +    SX-8R:SUPER-UX:*:*)
         1275  +	echo sx8r-nec-superux"$UNAME_RELEASE"
         1276  +	exit ;;
         1277  +    SX-ACE:SUPER-UX:*:*)
         1278  +	echo sxace-nec-superux"$UNAME_RELEASE"
         1279  +	exit ;;
         1280  +    Power*:Rhapsody:*:*)
         1281  +	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
         1282  +	exit ;;
         1283  +    *:Rhapsody:*:*)
         1284  +	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
         1285  +	exit ;;
         1286  +    *:Darwin:*:*)
         1287  +	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
         1288  +	eval "$set_cc_for_build"
         1289  +	if test "$UNAME_PROCESSOR" = unknown ; then
         1290  +	    UNAME_PROCESSOR=powerpc
         1291  +	fi
         1292  +	if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
         1293  +	    if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
         1294  +		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
         1295  +		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
         1296  +		       grep IS_64BIT_ARCH >/dev/null
         1297  +		then
         1298  +		    case $UNAME_PROCESSOR in
         1299  +			i386) UNAME_PROCESSOR=x86_64 ;;
         1300  +			powerpc) UNAME_PROCESSOR=powerpc64 ;;
         1301  +		    esac
         1302  +		fi
         1303  +		# On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
         1304  +		if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
         1305  +		       (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
         1306  +		       grep IS_PPC >/dev/null
         1307  +		then
         1308  +		    UNAME_PROCESSOR=powerpc
         1309  +		fi
         1310  +	    fi
         1311  +	elif test "$UNAME_PROCESSOR" = i386 ; then
         1312  +	    # Avoid executing cc on OS X 10.9, as it ships with a stub
         1313  +	    # that puts up a graphical alert prompting to install
         1314  +	    # developer tools.  Any system running Mac OS X 10.7 or
         1315  +	    # later (Darwin 11 and later) is required to have a 64-bit
         1316  +	    # processor. This is not true of the ARM version of Darwin
         1317  +	    # that Apple uses in portable devices.
         1318  +	    UNAME_PROCESSOR=x86_64
         1319  +	fi
         1320  +	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
         1321  +	exit ;;
         1322  +    *:procnto*:*:* | *:QNX:[0123456789]*:*)
         1323  +	UNAME_PROCESSOR=`uname -p`
         1324  +	if test "$UNAME_PROCESSOR" = x86; then
         1325  +		UNAME_PROCESSOR=i386
         1326  +		UNAME_MACHINE=pc
         1327  +	fi
         1328  +	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
         1329  +	exit ;;
         1330  +    *:QNX:*:4*)
         1331  +	echo i386-pc-qnx
         1332  +	exit ;;
         1333  +    NEO-*:NONSTOP_KERNEL:*:*)
         1334  +	echo neo-tandem-nsk"$UNAME_RELEASE"
         1335  +	exit ;;
         1336  +    NSE-*:NONSTOP_KERNEL:*:*)
         1337  +	echo nse-tandem-nsk"$UNAME_RELEASE"
         1338  +	exit ;;
         1339  +    NSR-*:NONSTOP_KERNEL:*:*)
         1340  +	echo nsr-tandem-nsk"$UNAME_RELEASE"
         1341  +	exit ;;
         1342  +    NSV-*:NONSTOP_KERNEL:*:*)
         1343  +	echo nsv-tandem-nsk"$UNAME_RELEASE"
         1344  +	exit ;;
         1345  +    NSX-*:NONSTOP_KERNEL:*:*)
         1346  +	echo nsx-tandem-nsk"$UNAME_RELEASE"
         1347  +	exit ;;
         1348  +    *:NonStop-UX:*:*)
         1349  +	echo mips-compaq-nonstopux
         1350  +	exit ;;
         1351  +    BS2000:POSIX*:*:*)
         1352  +	echo bs2000-siemens-sysv
         1353  +	exit ;;
         1354  +    DS/*:UNIX_System_V:*:*)
         1355  +	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
         1356  +	exit ;;
         1357  +    *:Plan9:*:*)
         1358  +	# "uname -m" is not consistent, so use $cputype instead. 386
         1359  +	# is converted to i386 for consistency with other x86
         1360  +	# operating systems.
         1361  +	if test "$cputype" = 386; then
         1362  +	    UNAME_MACHINE=i386
         1363  +	else
         1364  +	    UNAME_MACHINE="$cputype"
         1365  +	fi
         1366  +	echo "$UNAME_MACHINE"-unknown-plan9
         1367  +	exit ;;
         1368  +    *:TOPS-10:*:*)
         1369  +	echo pdp10-unknown-tops10
         1370  +	exit ;;
         1371  +    *:TENEX:*:*)
         1372  +	echo pdp10-unknown-tenex
         1373  +	exit ;;
         1374  +    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
         1375  +	echo pdp10-dec-tops20
         1376  +	exit ;;
         1377  +    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
         1378  +	echo pdp10-xkl-tops20
         1379  +	exit ;;
         1380  +    *:TOPS-20:*:*)
         1381  +	echo pdp10-unknown-tops20
         1382  +	exit ;;
         1383  +    *:ITS:*:*)
         1384  +	echo pdp10-unknown-its
         1385  +	exit ;;
         1386  +    SEI:*:*:SEIUX)
         1387  +	echo mips-sei-seiux"$UNAME_RELEASE"
         1388  +	exit ;;
         1389  +    *:DragonFly:*:*)
         1390  +	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
         1391  +	exit ;;
         1392  +    *:*VMS:*:*)
         1393  +	UNAME_MACHINE=`(uname -p) 2>/dev/null`
         1394  +	case "$UNAME_MACHINE" in
         1395  +	    A*) echo alpha-dec-vms ; exit ;;
         1396  +	    I*) echo ia64-dec-vms ; exit ;;
         1397  +	    V*) echo vax-dec-vms ; exit ;;
         1398  +	esac ;;
         1399  +    *:XENIX:*:SysV)
         1400  +	echo i386-pc-xenix
         1401  +	exit ;;
         1402  +    i*86:skyos:*:*)
         1403  +	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
         1404  +	exit ;;
         1405  +    i*86:rdos:*:*)
         1406  +	echo "$UNAME_MACHINE"-pc-rdos
         1407  +	exit ;;
         1408  +    i*86:AROS:*:*)
         1409  +	echo "$UNAME_MACHINE"-pc-aros
         1410  +	exit ;;
         1411  +    x86_64:VMkernel:*:*)
         1412  +	echo "$UNAME_MACHINE"-unknown-esx
         1413  +	exit ;;
         1414  +    amd64:Isilon\ OneFS:*:*)
         1415  +	echo x86_64-unknown-onefs
         1416  +	exit ;;
         1417  +esac
         1418  +
         1419  +echo "$0: unable to guess system type" >&2
         1420  +
         1421  +case "$UNAME_MACHINE:$UNAME_SYSTEM" in
         1422  +    mips:Linux | mips64:Linux)
         1423  +	# If we got here on MIPS GNU/Linux, output extra information.
         1424  +	cat >&2 <<EOF
         1425  +
         1426  +NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
         1427  +the system type. Please install a C compiler and try again.
         1428  +EOF
         1429  +	;;
         1430  +esac
         1431  +
         1432  +cat >&2 <<EOF
         1433  +
         1434  +This script (version $timestamp), has failed to recognize the
         1435  +operating system you are using. If your script is old, overwrite *all*
         1436  +copies of config.guess and config.sub with the latest versions from:
         1437  +
         1438  +  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
         1439  +and
         1440  +  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
         1441  +
         1442  +If $0 has already been updated, send the following data and any
         1443  +information you think might be pertinent to [email protected] to
         1444  +provide the necessary information to handle your system.
         1445  +
         1446  +config.guess timestamp = $timestamp
         1447  +
         1448  +uname -m = `(uname -m) 2>/dev/null || echo unknown`
         1449  +uname -r = `(uname -r) 2>/dev/null || echo unknown`
         1450  +uname -s = `(uname -s) 2>/dev/null || echo unknown`
         1451  +uname -v = `(uname -v) 2>/dev/null || echo unknown`
         1452  +
         1453  +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
         1454  +/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
         1455  +
         1456  +hostinfo               = `(hostinfo) 2>/dev/null`
         1457  +/bin/universe          = `(/bin/universe) 2>/dev/null`
         1458  +/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
         1459  +/bin/arch              = `(/bin/arch) 2>/dev/null`
         1460  +/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
         1461  +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
         1462  +
         1463  +UNAME_MACHINE = "$UNAME_MACHINE"
         1464  +UNAME_RELEASE = "$UNAME_RELEASE"
         1465  +UNAME_SYSTEM  = "$UNAME_SYSTEM"
         1466  +UNAME_VERSION = "$UNAME_VERSION"
         1467  +EOF
         1468  +
         1469  +exit 1
         1470  +
         1471  +# Local variables:
         1472  +# eval: (add-hook 'before-save-hook 'time-stamp)
         1473  +# time-stamp-start: "timestamp='"
         1474  +# time-stamp-format: "%:y-%02m-%02d"
         1475  +# time-stamp-end: "'"
         1476  +# End:

Added autosetup/autosetup-config.sub.

            1  +#! /bin/sh
            2  +# Configuration validation subroutine script.
            3  +#   Copyright 1992-2018 Free Software Foundation, Inc.
            4  +
            5  +timestamp='2018-03-08'
            6  +
            7  +# This file is free software; you can redistribute it and/or modify it
            8  +# under the terms of the GNU General Public License as published by
            9  +# the Free Software Foundation; either version 3 of the License, or
           10  +# (at your option) any later version.
           11  +#
           12  +# This program is distributed in the hope that it will be useful, but
           13  +# WITHOUT ANY WARRANTY; without even the implied warranty of
           14  +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
           15  +# General Public License for more details.
           16  +#
           17  +# You should have received a copy of the GNU General Public License
           18  +# along with this program; if not, see <https://www.gnu.org/licenses/>.
           19  +#
           20  +# As a special exception to the GNU General Public License, if you
           21  +# distribute this file as part of a program that contains a
           22  +# configuration script generated by Autoconf, you may include it under
           23  +# the same distribution terms that you use for the rest of that
           24  +# program.  This Exception is an additional permission under section 7
           25  +# of the GNU General Public License, version 3 ("GPLv3").
           26  +
           27  +
           28  +# Please send patches to <[email protected]>.
           29  +#
           30  +# Configuration subroutine to validate and canonicalize a configuration type.
           31  +# Supply the specified configuration type as an argument.
           32  +# If it is invalid, we print an error message on stderr and exit with code 1.
           33  +# Otherwise, we print the canonical config type on stdout and succeed.
           34  +
           35  +# You can get the latest version of this script from:
           36  +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
           37  +
           38  +# This file is supposed to be the same for all GNU packages
           39  +# and recognize all the CPU types, system types and aliases
           40  +# that are meaningful with *any* GNU software.
           41  +# Each package is responsible for reporting which valid configurations
           42  +# it does not support.  The user should be able to distinguish
           43  +# a failure to support a valid configuration from a meaningless
           44  +# configuration.
           45  +
           46  +# The goal of this file is to map all the various variations of a given
           47  +# machine specification into a single specification in the form:
           48  +#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
           49  +# or in some cases, the newer four-part form:
           50  +#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
           51  +# It is wrong to echo any other type of specification.
           52  +
           53  +me=`echo "$0" | sed -e 's,.*/,,'`
           54  +
           55  +usage="\
           56  +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
           57  +
           58  +Canonicalize a configuration name.
           59  +
           60  +Options:
           61  +  -h, --help         print this help, then exit
           62  +  -t, --time-stamp   print date of last modification, then exit
           63  +  -v, --version      print version number, then exit
           64  +
           65  +Report bugs and patches to <[email protected]>."
           66  +
           67  +version="\
           68  +GNU config.sub ($timestamp)
           69  +
           70  +Copyright 1992-2018 Free Software Foundation, Inc.
           71  +
           72  +This is free software; see the source for copying conditions.  There is NO
           73  +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
           74  +
           75  +help="
           76  +Try \`$me --help' for more information."
           77  +
           78  +# Parse command line
           79  +while test $# -gt 0 ; do
           80  +  case $1 in
           81  +    --time-stamp | --time* | -t )
           82  +       echo "$timestamp" ; exit ;;
           83  +    --version | -v )
           84  +       echo "$version" ; exit ;;
           85  +    --help | --h* | -h )
           86  +       echo "$usage"; exit ;;
           87  +    -- )     # Stop option processing
           88  +       shift; break ;;
           89  +    - )	# Use stdin as input.
           90  +       break ;;
           91  +    -* )
           92  +       echo "$me: invalid option $1$help"
           93  +       exit 1 ;;
           94  +
           95  +    *local*)
           96  +       # First pass through any local machine types.
           97  +       echo "$1"
           98  +       exit ;;
           99  +
          100  +    * )
          101  +       break ;;
          102  +  esac
          103  +done
          104  +
          105  +case $# in
          106  + 0) echo "$me: missing argument$help" >&2
          107  +    exit 1;;
          108  + 1) ;;
          109  + *) echo "$me: too many arguments$help" >&2
          110  +    exit 1;;
          111  +esac
          112  +
          113  +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
          114  +# Here we must recognize all the valid KERNEL-OS combinations.
          115  +maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
          116  +case $maybe_os in
          117  +  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
          118  +  linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
          119  +  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
          120  +  kopensolaris*-gnu* | cloudabi*-eabi* | \
          121  +  storm-chaos* | os2-emx* | rtmk-nova*)
          122  +    os=-$maybe_os
          123  +    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
          124  +    ;;
          125  +  android-linux)
          126  +    os=-linux-android
          127  +    basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
          128  +    ;;
          129  +  *)
          130  +    basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
          131  +    if [ "$basic_machine" != "$1" ]
          132  +    then os=`echo "$1" | sed 's/.*-/-/'`
          133  +    else os=; fi
          134  +    ;;
          135  +esac
          136  +
          137  +### Let's recognize common machines as not being operating systems so
          138  +### that things like config.sub decstation-3100 work.  We also
          139  +### recognize some manufacturers as not being operating systems, so we
          140  +### can provide default operating systems below.
          141  +case $os in
          142  +	-sun*os*)
          143  +		# Prevent following clause from handling this invalid input.
          144  +		;;
          145  +	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
          146  +	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
          147  +	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
          148  +	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
          149  +	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
          150  +	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
          151  +	-apple | -axis | -knuth | -cray | -microblaze*)
          152  +		os=
          153  +		basic_machine=$1
          154  +		;;
          155  +	-bluegene*)
          156  +		os=-cnk
          157  +		;;
          158  +	-sim | -cisco | -oki | -wec | -winbond)
          159  +		os=
          160  +		basic_machine=$1
          161  +		;;
          162  +	-scout)
          163  +		;;
          164  +	-wrs)
          165  +		os=-vxworks
          166  +		basic_machine=$1
          167  +		;;
          168  +	-chorusos*)
          169  +		os=-chorusos
          170  +		basic_machine=$1
          171  +		;;
          172  +	-chorusrdb)
          173  +		os=-chorusrdb
          174  +		basic_machine=$1
          175  +		;;
          176  +	-hiux*)
          177  +		os=-hiuxwe2
          178  +		;;
          179  +	-sco6)
          180  +		os=-sco5v6
          181  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          182  +		;;
          183  +	-sco5)
          184  +		os=-sco3.2v5
          185  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          186  +		;;
          187  +	-sco4)
          188  +		os=-sco3.2v4
          189  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          190  +		;;
          191  +	-sco3.2.[4-9]*)
          192  +		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
          193  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          194  +		;;
          195  +	-sco3.2v[4-9]*)
          196  +		# Don't forget version if it is 3.2v4 or newer.
          197  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          198  +		;;
          199  +	-sco5v6*)
          200  +		# Don't forget version if it is 3.2v4 or newer.
          201  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          202  +		;;
          203  +	-sco*)
          204  +		os=-sco3.2v2
          205  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          206  +		;;
          207  +	-udk*)
          208  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          209  +		;;
          210  +	-isc)
          211  +		os=-isc2.2
          212  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          213  +		;;
          214  +	-clix*)
          215  +		basic_machine=clipper-intergraph
          216  +		;;
          217  +	-isc*)
          218  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
          219  +		;;
          220  +	-lynx*178)
          221  +		os=-lynxos178
          222  +		;;
          223  +	-lynx*5)
          224  +		os=-lynxos5
          225  +		;;
          226  +	-lynx*)
          227  +		os=-lynxos
          228  +		;;
          229  +	-ptx*)
          230  +		basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
          231  +		;;
          232  +	-psos*)
          233  +		os=-psos
          234  +		;;
          235  +	-mint | -mint[0-9]*)
          236  +		basic_machine=m68k-atari
          237  +		os=-mint
          238  +		;;
          239  +esac
          240  +
          241  +# Decode aliases for certain CPU-COMPANY combinations.
          242  +case $basic_machine in
          243  +	# Recognize the basic CPU types without company name.
          244  +	# Some are omitted here because they have special meanings below.
          245  +	1750a | 580 \
          246  +	| a29k \
          247  +	| aarch64 | aarch64_be \
          248  +	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
          249  +	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
          250  +	| am33_2.0 \
          251  +	| arc | arceb \
          252  +	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
          253  +	| avr | avr32 \
          254  +	| ba \
          255  +	| be32 | be64 \
          256  +	| bfin \
          257  +	| c4x | c8051 | clipper \
          258  +	| d10v | d30v | dlx | dsp16xx \
          259  +	| e2k | epiphany \
          260  +	| fido | fr30 | frv | ft32 \
          261  +	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
          262  +	| hexagon \
          263  +	| i370 | i860 | i960 | ia16 | ia64 \
          264  +	| ip2k | iq2000 \
          265  +	| k1om \
          266  +	| le32 | le64 \
          267  +	| lm32 \
          268  +	| m32c | m32r | m32rle | m68000 | m68k | m88k \
          269  +	| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
          270  +	| mips | mipsbe | mipseb | mipsel | mipsle \
          271  +	| mips16 \
          272  +	| mips64 | mips64el \
          273  +	| mips64octeon | mips64octeonel \
          274  +	| mips64orion | mips64orionel \
          275  +	| mips64r5900 | mips64r5900el \
          276  +	| mips64vr | mips64vrel \
          277  +	| mips64vr4100 | mips64vr4100el \
          278  +	| mips64vr4300 | mips64vr4300el \
          279  +	| mips64vr5000 | mips64vr5000el \
          280  +	| mips64vr5900 | mips64vr5900el \
          281  +	| mipsisa32 | mipsisa32el \
          282  +	| mipsisa32r2 | mipsisa32r2el \
          283  +	| mipsisa32r6 | mipsisa32r6el \
          284  +	| mipsisa64 | mipsisa64el \
          285  +	| mipsisa64r2 | mipsisa64r2el \
          286  +	| mipsisa64r6 | mipsisa64r6el \
          287  +	| mipsisa64sb1 | mipsisa64sb1el \
          288  +	| mipsisa64sr71k | mipsisa64sr71kel \
          289  +	| mipsr5900 | mipsr5900el \
          290  +	| mipstx39 | mipstx39el \
          291  +	| mn10200 | mn10300 \
          292  +	| moxie \
          293  +	| mt \
          294  +	| msp430 \
          295  +	| nds32 | nds32le | nds32be \
          296  +	| nios | nios2 | nios2eb | nios2el \
          297  +	| ns16k | ns32k \
          298  +	| open8 | or1k | or1knd | or32 \
          299  +	| pdp10 | pj | pjl \
          300  +	| powerpc | powerpc64 | powerpc64le | powerpcle \
          301  +	| pru \
          302  +	| pyramid \
          303  +	| riscv32 | riscv64 \
          304  +	| rl78 | rx \
          305  +	| score \
          306  +	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
          307  +	| sh64 | sh64le \
          308  +	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
          309  +	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
          310  +	| spu \
          311  +	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
          312  +	| ubicom32 \
          313  +	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
          314  +	| visium \
          315  +	| wasm32 \
          316  +	| x86 | xc16x | xstormy16 | xtensa \
          317  +	| z8k | z80)
          318  +		basic_machine=$basic_machine-unknown
          319  +		;;
          320  +	c54x)
          321  +		basic_machine=tic54x-unknown
          322  +		;;
          323  +	c55x)
          324  +		basic_machine=tic55x-unknown
          325  +		;;
          326  +	c6x)
          327  +		basic_machine=tic6x-unknown
          328  +		;;
          329  +	leon|leon[3-9])
          330  +		basic_machine=sparc-$basic_machine
          331  +		;;
          332  +	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
          333  +		basic_machine=$basic_machine-unknown
          334  +		os=-none
          335  +		;;
          336  +	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
          337  +		;;
          338  +	ms1)
          339  +		basic_machine=mt-unknown
          340  +		;;
          341  +
          342  +	strongarm | thumb | xscale)
          343  +		basic_machine=arm-unknown
          344  +		;;
          345  +	xgate)
          346  +		basic_machine=$basic_machine-unknown
          347  +		os=-none
          348  +		;;
          349  +	xscaleeb)
          350  +		basic_machine=armeb-unknown
          351  +		;;
          352  +
          353  +	xscaleel)
          354  +		basic_machine=armel-unknown
          355  +		;;
          356  +
          357  +	# We use `pc' rather than `unknown'
          358  +	# because (1) that's what they normally are, and
          359  +	# (2) the word "unknown" tends to confuse beginning users.
          360  +	i*86 | x86_64)
          361  +	  basic_machine=$basic_machine-pc
          362  +	  ;;
          363  +	# Object if more than one company name word.
          364  +	*-*-*)
          365  +		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
          366  +		exit 1
          367  +		;;
          368  +	# Recognize the basic CPU types with company name.
          369  +	580-* \
          370  +	| a29k-* \
          371  +	| aarch64-* | aarch64_be-* \
          372  +	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
          373  +	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
          374  +	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
          375  +	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
          376  +	| avr-* | avr32-* \
          377  +	| ba-* \
          378  +	| be32-* | be64-* \
          379  +	| bfin-* | bs2000-* \
          380  +	| c[123]* | c30-* | [cjt]90-* | c4x-* \
          381  +	| c8051-* | clipper-* | craynv-* | cydra-* \
          382  +	| d10v-* | d30v-* | dlx-* \
          383  +	| e2k-* | elxsi-* \
          384  +	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
          385  +	| h8300-* | h8500-* \
          386  +	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
          387  +	| hexagon-* \
          388  +	| i*86-* | i860-* | i960-* | ia16-* | ia64-* \
          389  +	| ip2k-* | iq2000-* \
          390  +	| k1om-* \
          391  +	| le32-* | le64-* \
          392  +	| lm32-* \
          393  +	| m32c-* | m32r-* | m32rle-* \
          394  +	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
          395  +	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
          396  +	| microblaze-* | microblazeel-* \
          397  +	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
          398  +	| mips16-* \
          399  +	| mips64-* | mips64el-* \
          400  +	| mips64octeon-* | mips64octeonel-* \
          401  +	| mips64orion-* | mips64orionel-* \
          402  +	| mips64r5900-* | mips64r5900el-* \
          403  +	| mips64vr-* | mips64vrel-* \
          404  +	| mips64vr4100-* | mips64vr4100el-* \
          405  +	| mips64vr4300-* | mips64vr4300el-* \
          406  +	| mips64vr5000-* | mips64vr5000el-* \
          407  +	| mips64vr5900-* | mips64vr5900el-* \
          408  +	| mipsisa32-* | mipsisa32el-* \
          409  +	| mipsisa32r2-* | mipsisa32r2el-* \
          410  +	| mipsisa32r6-* | mipsisa32r6el-* \
          411  +	| mipsisa64-* | mipsisa64el-* \
          412  +	| mipsisa64r2-* | mipsisa64r2el-* \
          413  +	| mipsisa64r6-* | mipsisa64r6el-* \
          414  +	| mipsisa64sb1-* | mipsisa64sb1el-* \
          415  +	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
          416  +	| mipsr5900-* | mipsr5900el-* \
          417  +	| mipstx39-* | mipstx39el-* \
          418  +	| mmix-* \
          419  +	| mt-* \
          420  +	| msp430-* \
          421  +	| nds32-* | nds32le-* | nds32be-* \
          422  +	| nios-* | nios2-* | nios2eb-* | nios2el-* \
          423  +	| none-* | np1-* | ns16k-* | ns32k-* \
          424  +	| open8-* \
          425  +	| or1k*-* \
          426  +	| orion-* \
          427  +	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
          428  +	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
          429  +	| pru-* \
          430  +	| pyramid-* \
          431  +	| riscv32-* | riscv64-* \
          432  +	| rl78-* | romp-* | rs6000-* | rx-* \
          433  +	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
          434  +	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
          435  +	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
          436  +	| sparclite-* \
          437  +	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
          438  +	| tahoe-* \
          439  +	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
          440  +	| tile*-* \
          441  +	| tron-* \
          442  +	| ubicom32-* \
          443  +	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
          444  +	| vax-* \
          445  +	| visium-* \
          446  +	| wasm32-* \
          447  +	| we32k-* \
          448  +	| x86-* | x86_64-* | xc16x-* | xps100-* \
          449  +	| xstormy16-* | xtensa*-* \
          450  +	| ymp-* \
          451  +	| z8k-* | z80-*)
          452  +		;;
          453  +	# Recognize the basic CPU types without company name, with glob match.
          454  +	xtensa*)
          455  +		basic_machine=$basic_machine-unknown
          456  +		;;
          457  +	# Recognize the various machine names and aliases which stand
          458  +	# for a CPU type and a company and sometimes even an OS.
          459  +	386bsd)
          460  +		basic_machine=i386-pc
          461  +		os=-bsd
          462  +		;;
          463  +	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
          464  +		basic_machine=m68000-att
          465  +		;;
          466  +	3b*)
          467  +		basic_machine=we32k-att
          468  +		;;
          469  +	a29khif)
          470  +		basic_machine=a29k-amd
          471  +		os=-udi
          472  +		;;
          473  +	abacus)
          474  +		basic_machine=abacus-unknown
          475  +		;;
          476  +	adobe68k)
          477  +		basic_machine=m68010-adobe
          478  +		os=-scout
          479  +		;;
          480  +	alliant | fx80)
          481  +		basic_machine=fx80-alliant
          482  +		;;
          483  +	altos | altos3068)
          484  +		basic_machine=m68k-altos
          485  +		;;
          486  +	am29k)
          487  +		basic_machine=a29k-none
          488  +		os=-bsd
          489  +		;;
          490  +	amd64)
          491  +		basic_machine=x86_64-pc
          492  +		;;
          493  +	amd64-*)
          494  +		basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          495  +		;;
          496  +	amdahl)
          497  +		basic_machine=580-amdahl
          498  +		os=-sysv
          499  +		;;
          500  +	amiga | amiga-*)
          501  +		basic_machine=m68k-unknown
          502  +		;;
          503  +	amigaos | amigados)
          504  +		basic_machine=m68k-unknown
          505  +		os=-amigaos
          506  +		;;
          507  +	amigaunix | amix)
          508  +		basic_machine=m68k-unknown
          509  +		os=-sysv4
          510  +		;;
          511  +	apollo68)
          512  +		basic_machine=m68k-apollo
          513  +		os=-sysv
          514  +		;;
          515  +	apollo68bsd)
          516  +		basic_machine=m68k-apollo
          517  +		os=-bsd
          518  +		;;
          519  +	aros)
          520  +		basic_machine=i386-pc
          521  +		os=-aros
          522  +		;;
          523  +	asmjs)
          524  +		basic_machine=asmjs-unknown
          525  +		;;
          526  +	aux)
          527  +		basic_machine=m68k-apple
          528  +		os=-aux
          529  +		;;
          530  +	balance)
          531  +		basic_machine=ns32k-sequent
          532  +		os=-dynix
          533  +		;;
          534  +	blackfin)
          535  +		basic_machine=bfin-unknown
          536  +		os=-linux
          537  +		;;
          538  +	blackfin-*)
          539  +		basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          540  +		os=-linux
          541  +		;;
          542  +	bluegene*)
          543  +		basic_machine=powerpc-ibm
          544  +		os=-cnk
          545  +		;;
          546  +	c54x-*)
          547  +		basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          548  +		;;
          549  +	c55x-*)
          550  +		basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          551  +		;;
          552  +	c6x-*)
          553  +		basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          554  +		;;
          555  +	c90)
          556  +		basic_machine=c90-cray
          557  +		os=-unicos
          558  +		;;
          559  +	cegcc)
          560  +		basic_machine=arm-unknown
          561  +		os=-cegcc
          562  +		;;
          563  +	convex-c1)
          564  +		basic_machine=c1-convex
          565  +		os=-bsd
          566  +		;;
          567  +	convex-c2)
          568  +		basic_machine=c2-convex
          569  +		os=-bsd
          570  +		;;
          571  +	convex-c32)
          572  +		basic_machine=c32-convex
          573  +		os=-bsd
          574  +		;;
          575  +	convex-c34)
          576  +		basic_machine=c34-convex
          577  +		os=-bsd
          578  +		;;
          579  +	convex-c38)
          580  +		basic_machine=c38-convex
          581  +		os=-bsd
          582  +		;;
          583  +	cray | j90)
          584  +		basic_machine=j90-cray
          585  +		os=-unicos
          586  +		;;
          587  +	craynv)
          588  +		basic_machine=craynv-cray
          589  +		os=-unicosmp
          590  +		;;
          591  +	cr16 | cr16-*)
          592  +		basic_machine=cr16-unknown
          593  +		os=-elf
          594  +		;;
          595  +	crds | unos)
          596  +		basic_machine=m68k-crds
          597  +		;;
          598  +	crisv32 | crisv32-* | etraxfs*)
          599  +		basic_machine=crisv32-axis
          600  +		;;
          601  +	cris | cris-* | etrax*)
          602  +		basic_machine=cris-axis
          603  +		;;
          604  +	crx)
          605  +		basic_machine=crx-unknown
          606  +		os=-elf
          607  +		;;
          608  +	da30 | da30-*)
          609  +		basic_machine=m68k-da30
          610  +		;;
          611  +	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
          612  +		basic_machine=mips-dec
          613  +		;;
          614  +	decsystem10* | dec10*)
          615  +		basic_machine=pdp10-dec
          616  +		os=-tops10
          617  +		;;
          618  +	decsystem20* | dec20*)
          619  +		basic_machine=pdp10-dec
          620  +		os=-tops20
          621  +		;;
          622  +	delta | 3300 | motorola-3300 | motorola-delta \
          623  +	      | 3300-motorola | delta-motorola)
          624  +		basic_machine=m68k-motorola
          625  +		;;
          626  +	delta88)
          627  +		basic_machine=m88k-motorola
          628  +		os=-sysv3
          629  +		;;
          630  +	dicos)
          631  +		basic_machine=i686-pc
          632  +		os=-dicos
          633  +		;;
          634  +	djgpp)
          635  +		basic_machine=i586-pc
          636  +		os=-msdosdjgpp
          637  +		;;
          638  +	dpx20 | dpx20-*)
          639  +		basic_machine=rs6000-bull
          640  +		os=-bosx
          641  +		;;
          642  +	dpx2*)
          643  +		basic_machine=m68k-bull
          644  +		os=-sysv3
          645  +		;;
          646  +	e500v[12])
          647  +		basic_machine=powerpc-unknown
          648  +		os=$os"spe"
          649  +		;;
          650  +	e500v[12]-*)
          651  +		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          652  +		os=$os"spe"
          653  +		;;
          654  +	ebmon29k)
          655  +		basic_machine=a29k-amd
          656  +		os=-ebmon
          657  +		;;
          658  +	elxsi)
          659  +		basic_machine=elxsi-elxsi
          660  +		os=-bsd
          661  +		;;
          662  +	encore | umax | mmax)
          663  +		basic_machine=ns32k-encore
          664  +		;;
          665  +	es1800 | OSE68k | ose68k | ose | OSE)
          666  +		basic_machine=m68k-ericsson
          667  +		os=-ose
          668  +		;;
          669  +	fx2800)
          670  +		basic_machine=i860-alliant
          671  +		;;
          672  +	genix)
          673  +		basic_machine=ns32k-ns
          674  +		;;
          675  +	gmicro)
          676  +		basic_machine=tron-gmicro
          677  +		os=-sysv
          678  +		;;
          679  +	go32)
          680  +		basic_machine=i386-pc
          681  +		os=-go32
          682  +		;;
          683  +	h3050r* | hiux*)
          684  +		basic_machine=hppa1.1-hitachi
          685  +		os=-hiuxwe2
          686  +		;;
          687  +	h8300hms)
          688  +		basic_machine=h8300-hitachi
          689  +		os=-hms
          690  +		;;
          691  +	h8300xray)
          692  +		basic_machine=h8300-hitachi
          693  +		os=-xray
          694  +		;;
          695  +	h8500hms)
          696  +		basic_machine=h8500-hitachi
          697  +		os=-hms
          698  +		;;
          699  +	harris)
          700  +		basic_machine=m88k-harris
          701  +		os=-sysv3
          702  +		;;
          703  +	hp300-*)
          704  +		basic_machine=m68k-hp
          705  +		;;
          706  +	hp300bsd)
          707  +		basic_machine=m68k-hp
          708  +		os=-bsd
          709  +		;;
          710  +	hp300hpux)
          711  +		basic_machine=m68k-hp
          712  +		os=-hpux
          713  +		;;
          714  +	hp3k9[0-9][0-9] | hp9[0-9][0-9])
          715  +		basic_machine=hppa1.0-hp
          716  +		;;
          717  +	hp9k2[0-9][0-9] | hp9k31[0-9])
          718  +		basic_machine=m68000-hp
          719  +		;;
          720  +	hp9k3[2-9][0-9])
          721  +		basic_machine=m68k-hp
          722  +		;;
          723  +	hp9k6[0-9][0-9] | hp6[0-9][0-9])
          724  +		basic_machine=hppa1.0-hp
          725  +		;;
          726  +	hp9k7[0-79][0-9] | hp7[0-79][0-9])
          727  +		basic_machine=hppa1.1-hp
          728  +		;;
          729  +	hp9k78[0-9] | hp78[0-9])
          730  +		# FIXME: really hppa2.0-hp
          731  +		basic_machine=hppa1.1-hp
          732  +		;;
          733  +	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
          734  +		# FIXME: really hppa2.0-hp
          735  +		basic_machine=hppa1.1-hp
          736  +		;;
          737  +	hp9k8[0-9][13679] | hp8[0-9][13679])
          738  +		basic_machine=hppa1.1-hp
          739  +		;;
          740  +	hp9k8[0-9][0-9] | hp8[0-9][0-9])
          741  +		basic_machine=hppa1.0-hp
          742  +		;;
          743  +	hppaosf)
          744  +		basic_machine=hppa1.1-hp
          745  +		os=-osf
          746  +		;;
          747  +	hppro)
          748  +		basic_machine=hppa1.1-hp
          749  +		os=-proelf
          750  +		;;
          751  +	i370-ibm* | ibm*)
          752  +		basic_machine=i370-ibm
          753  +		;;
          754  +	i*86v32)
          755  +		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
          756  +		os=-sysv32
          757  +		;;
          758  +	i*86v4*)
          759  +		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
          760  +		os=-sysv4
          761  +		;;
          762  +	i*86v)
          763  +		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
          764  +		os=-sysv
          765  +		;;
          766  +	i*86sol2)
          767  +		basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
          768  +		os=-solaris2
          769  +		;;
          770  +	i386mach)
          771  +		basic_machine=i386-mach
          772  +		os=-mach
          773  +		;;
          774  +	vsta)
          775  +		basic_machine=i386-unknown
          776  +		os=-vsta
          777  +		;;
          778  +	iris | iris4d)
          779  +		basic_machine=mips-sgi
          780  +		case $os in
          781  +		    -irix*)
          782  +			;;
          783  +		    *)
          784  +			os=-irix4
          785  +			;;
          786  +		esac
          787  +		;;
          788  +	isi68 | isi)
          789  +		basic_machine=m68k-isi
          790  +		os=-sysv
          791  +		;;
          792  +	leon-*|leon[3-9]-*)
          793  +		basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
          794  +		;;
          795  +	m68knommu)
          796  +		basic_machine=m68k-unknown
          797  +		os=-linux
          798  +		;;
          799  +	m68knommu-*)
          800  +		basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          801  +		os=-linux
          802  +		;;
          803  +	magnum | m3230)
          804  +		basic_machine=mips-mips
          805  +		os=-sysv
          806  +		;;
          807  +	merlin)
          808  +		basic_machine=ns32k-utek
          809  +		os=-sysv
          810  +		;;
          811  +	microblaze*)
          812  +		basic_machine=microblaze-xilinx
          813  +		;;
          814  +	mingw64)
          815  +		basic_machine=x86_64-pc
          816  +		os=-mingw64
          817  +		;;
          818  +	mingw32)
          819  +		basic_machine=i686-pc
          820  +		os=-mingw32
          821  +		;;
          822  +	mingw32ce)
          823  +		basic_machine=arm-unknown
          824  +		os=-mingw32ce
          825  +		;;
          826  +	miniframe)
          827  +		basic_machine=m68000-convergent
          828  +		;;
          829  +	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
          830  +		basic_machine=m68k-atari
          831  +		os=-mint
          832  +		;;
          833  +	mips3*-*)
          834  +		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
          835  +		;;
          836  +	mips3*)
          837  +		basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
          838  +		;;
          839  +	monitor)
          840  +		basic_machine=m68k-rom68k
          841  +		os=-coff
          842  +		;;
          843  +	morphos)
          844  +		basic_machine=powerpc-unknown
          845  +		os=-morphos
          846  +		;;
          847  +	moxiebox)
          848  +		basic_machine=moxie-unknown
          849  +		os=-moxiebox
          850  +		;;
          851  +	msdos)
          852  +		basic_machine=i386-pc
          853  +		os=-msdos
          854  +		;;
          855  +	ms1-*)
          856  +		basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
          857  +		;;
          858  +	msys)
          859  +		basic_machine=i686-pc
          860  +		os=-msys
          861  +		;;
          862  +	mvs)
          863  +		basic_machine=i370-ibm
          864  +		os=-mvs
          865  +		;;
          866  +	nacl)
          867  +		basic_machine=le32-unknown
          868  +		os=-nacl
          869  +		;;
          870  +	ncr3000)
          871  +		basic_machine=i486-ncr
          872  +		os=-sysv4
          873  +		;;
          874  +	netbsd386)
          875  +		basic_machine=i386-unknown
          876  +		os=-netbsd
          877  +		;;
          878  +	netwinder)
          879  +		basic_machine=armv4l-rebel
          880  +		os=-linux
          881  +		;;
          882  +	news | news700 | news800 | news900)
          883  +		basic_machine=m68k-sony
          884  +		os=-newsos
          885  +		;;
          886  +	news1000)
          887  +		basic_machine=m68030-sony
          888  +		os=-newsos
          889  +		;;
          890  +	news-3600 | risc-news)
          891  +		basic_machine=mips-sony
          892  +		os=-newsos
          893  +		;;
          894  +	necv70)
          895  +		basic_machine=v70-nec
          896  +		os=-sysv
          897  +		;;
          898  +	next | m*-next)
          899  +		basic_machine=m68k-next
          900  +		case $os in
          901  +		    -nextstep* )
          902  +			;;
          903  +		    -ns2*)
          904  +		      os=-nextstep2
          905  +			;;
          906  +		    *)
          907  +		      os=-nextstep3
          908  +			;;
          909  +		esac
          910  +		;;
          911  +	nh3000)
          912  +		basic_machine=m68k-harris
          913  +		os=-cxux
          914  +		;;
          915  +	nh[45]000)
          916  +		basic_machine=m88k-harris
          917  +		os=-cxux
          918  +		;;
          919  +	nindy960)
          920  +		basic_machine=i960-intel
          921  +		os=-nindy
          922  +		;;
          923  +	mon960)
          924  +		basic_machine=i960-intel
          925  +		os=-mon960
          926  +		;;
          927  +	nonstopux)
          928  +		basic_machine=mips-compaq
          929  +		os=-nonstopux
          930  +		;;
          931  +	np1)
          932  +		basic_machine=np1-gould
          933  +		;;
          934  +	neo-tandem)
          935  +		basic_machine=neo-tandem
          936  +		;;
          937  +	nse-tandem)
          938  +		basic_machine=nse-tandem
          939  +		;;
          940  +	nsr-tandem)
          941  +		basic_machine=nsr-tandem
          942  +		;;
          943  +	nsv-tandem)
          944  +		basic_machine=nsv-tandem
          945  +		;;
          946  +	nsx-tandem)
          947  +		basic_machine=nsx-tandem
          948  +		;;
          949  +	op50n-* | op60c-*)
          950  +		basic_machine=hppa1.1-oki
          951  +		os=-proelf
          952  +		;;
          953  +	openrisc | openrisc-*)
          954  +		basic_machine=or32-unknown
          955  +		;;
          956  +	os400)
          957  +		basic_machine=powerpc-ibm
          958  +		os=-os400
          959  +		;;
          960  +	OSE68000 | ose68000)
          961  +		basic_machine=m68000-ericsson
          962  +		os=-ose
          963  +		;;
          964  +	os68k)
          965  +		basic_machine=m68k-none
          966  +		os=-os68k
          967  +		;;
          968  +	pa-hitachi)
          969  +		basic_machine=hppa1.1-hitachi
          970  +		os=-hiuxwe2
          971  +		;;
          972  +	paragon)
          973  +		basic_machine=i860-intel
          974  +		os=-osf
          975  +		;;
          976  +	parisc)
          977  +		basic_machine=hppa-unknown
          978  +		os=-linux
          979  +		;;
          980  +	parisc-*)
          981  +		basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          982  +		os=-linux
          983  +		;;
          984  +	pbd)
          985  +		basic_machine=sparc-tti
          986  +		;;
          987  +	pbb)
          988  +		basic_machine=m68k-tti
          989  +		;;
          990  +	pc532 | pc532-*)
          991  +		basic_machine=ns32k-pc532
          992  +		;;
          993  +	pc98)
          994  +		basic_machine=i386-pc
          995  +		;;
          996  +	pc98-*)
          997  +		basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
          998  +		;;
          999  +	pentium | p5 | k5 | k6 | nexgen | viac3)
         1000  +		basic_machine=i586-pc
         1001  +		;;
         1002  +	pentiumpro | p6 | 6x86 | athlon | athlon_*)
         1003  +		basic_machine=i686-pc
         1004  +		;;
         1005  +	pentiumii | pentium2 | pentiumiii | pentium3)
         1006  +		basic_machine=i686-pc
         1007  +		;;
         1008  +	pentium4)
         1009  +		basic_machine=i786-pc
         1010  +		;;
         1011  +	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
         1012  +		basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1013  +		;;
         1014  +	pentiumpro-* | p6-* | 6x86-* | athlon-*)
         1015  +		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1016  +		;;
         1017  +	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
         1018  +		basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1019  +		;;
         1020  +	pentium4-*)
         1021  +		basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1022  +		;;
         1023  +	pn)
         1024  +		basic_machine=pn-gould
         1025  +		;;
         1026  +	power)	basic_machine=power-ibm
         1027  +		;;
         1028  +	ppc | ppcbe)	basic_machine=powerpc-unknown
         1029  +		;;
         1030  +	ppc-* | ppcbe-*)
         1031  +		basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1032  +		;;
         1033  +	ppcle | powerpclittle)
         1034  +		basic_machine=powerpcle-unknown
         1035  +		;;
         1036  +	ppcle-* | powerpclittle-*)
         1037  +		basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1038  +		;;
         1039  +	ppc64)	basic_machine=powerpc64-unknown
         1040  +		;;
         1041  +	ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1042  +		;;
         1043  +	ppc64le | powerpc64little)
         1044  +		basic_machine=powerpc64le-unknown
         1045  +		;;
         1046  +	ppc64le-* | powerpc64little-*)
         1047  +		basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1048  +		;;
         1049  +	ps2)
         1050  +		basic_machine=i386-ibm
         1051  +		;;
         1052  +	pw32)
         1053  +		basic_machine=i586-unknown
         1054  +		os=-pw32
         1055  +		;;
         1056  +	rdos | rdos64)
         1057  +		basic_machine=x86_64-pc
         1058  +		os=-rdos
         1059  +		;;
         1060  +	rdos32)
         1061  +		basic_machine=i386-pc
         1062  +		os=-rdos
         1063  +		;;
         1064  +	rom68k)
         1065  +		basic_machine=m68k-rom68k
         1066  +		os=-coff
         1067  +		;;
         1068  +	rm[46]00)
         1069  +		basic_machine=mips-siemens
         1070  +		;;
         1071  +	rtpc | rtpc-*)
         1072  +		basic_machine=romp-ibm
         1073  +		;;
         1074  +	s390 | s390-*)
         1075  +		basic_machine=s390-ibm
         1076  +		;;
         1077  +	s390x | s390x-*)
         1078  +		basic_machine=s390x-ibm
         1079  +		;;
         1080  +	sa29200)
         1081  +		basic_machine=a29k-amd
         1082  +		os=-udi
         1083  +		;;
         1084  +	sb1)
         1085  +		basic_machine=mipsisa64sb1-unknown
         1086  +		;;
         1087  +	sb1el)
         1088  +		basic_machine=mipsisa64sb1el-unknown
         1089  +		;;
         1090  +	sde)
         1091  +		basic_machine=mipsisa32-sde
         1092  +		os=-elf
         1093  +		;;
         1094  +	sei)
         1095  +		basic_machine=mips-sei
         1096  +		os=-seiux
         1097  +		;;
         1098  +	sequent)
         1099  +		basic_machine=i386-sequent
         1100  +		;;
         1101  +	sh5el)
         1102  +		basic_machine=sh5le-unknown
         1103  +		;;
         1104  +	simso-wrs)
         1105  +		basic_machine=sparclite-wrs
         1106  +		os=-vxworks
         1107  +		;;
         1108  +	sps7)
         1109  +		basic_machine=m68k-bull
         1110  +		os=-sysv2
         1111  +		;;
         1112  +	spur)
         1113  +		basic_machine=spur-unknown
         1114  +		;;
         1115  +	st2000)
         1116  +		basic_machine=m68k-tandem
         1117  +		;;
         1118  +	stratus)
         1119  +		basic_machine=i860-stratus
         1120  +		os=-sysv4
         1121  +		;;
         1122  +	strongarm-* | thumb-*)
         1123  +		basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
         1124  +		;;
         1125  +	sun2)
         1126  +		basic_machine=m68000-sun
         1127  +		;;
         1128  +	sun2os3)
         1129  +		basic_machine=m68000-sun
         1130  +		os=-sunos3
         1131  +		;;
         1132  +	sun2os4)
         1133  +		basic_machine=m68000-sun
         1134  +		os=-sunos4
         1135  +		;;
         1136  +	sun3os3)
         1137  +		basic_machine=m68k-sun
         1138  +		os=-sunos3
         1139  +		;;
         1140  +	sun3os4)
         1141  +		basic_machine=m68k-sun
         1142  +		os=-sunos4
         1143  +		;;
         1144  +	sun4os3)
         1145  +		basic_machine=sparc-sun
         1146  +		os=-sunos3
         1147  +		;;
         1148  +	sun4os4)
         1149  +		basic_machine=sparc-sun
         1150  +		os=-sunos4
         1151  +		;;
         1152  +	sun4sol2)
         1153  +		basic_machine=sparc-sun
         1154  +		os=-solaris2
         1155  +		;;
         1156  +	sun3 | sun3-*)
         1157  +		basic_machine=m68k-sun
         1158  +		;;
         1159  +	sun4)
         1160  +		basic_machine=sparc-sun
         1161  +		;;
         1162  +	sun386 | sun386i | roadrunner)
         1163  +		basic_machine=i386-sun
         1164  +		;;
         1165  +	sv1)
         1166  +		basic_machine=sv1-cray
         1167  +		os=-unicos
         1168  +		;;
         1169  +	symmetry)
         1170  +		basic_machine=i386-sequent
         1171  +		os=-dynix
         1172  +		;;
         1173  +	t3e)
         1174  +		basic_machine=alphaev5-cray
         1175  +		os=-unicos
         1176  +		;;
         1177  +	t90)
         1178  +		basic_machine=t90-cray
         1179  +		os=-unicos
         1180  +		;;
         1181  +	tile*)
         1182  +		basic_machine=$basic_machine-unknown
         1183  +		os=-linux-gnu
         1184  +		;;
         1185  +	tx39)
         1186  +		basic_machine=mipstx39-unknown
         1187  +		;;
         1188  +	tx39el)
         1189  +		basic_machine=mipstx39el-unknown
         1190  +		;;
         1191  +	toad1)
         1192  +		basic_machine=pdp10-xkl
         1193  +		os=-tops20
         1194  +		;;
         1195  +	tower | tower-32)
         1196  +		basic_machine=m68k-ncr
         1197  +		;;
         1198  +	tpf)
         1199  +		basic_machine=s390x-ibm
         1200  +		os=-tpf
         1201  +		;;
         1202  +	udi29k)
         1203  +		basic_machine=a29k-amd
         1204  +		os=-udi
         1205  +		;;
         1206  +	ultra3)
         1207  +		basic_machine=a29k-nyu
         1208  +		os=-sym1
         1209  +		;;
         1210  +	v810 | necv810)
         1211  +		basic_machine=v810-nec
         1212  +		os=-none
         1213  +		;;
         1214  +	vaxv)
         1215  +		basic_machine=vax-dec
         1216  +		os=-sysv
         1217  +		;;
         1218  +	vms)
         1219  +		basic_machine=vax-dec
         1220  +		os=-vms
         1221  +		;;
         1222  +	vpp*|vx|vx-*)
         1223  +		basic_machine=f301-fujitsu
         1224  +		;;
         1225  +	vxworks960)
         1226  +		basic_machine=i960-wrs
         1227  +		os=-vxworks
         1228  +		;;
         1229  +	vxworks68)
         1230  +		basic_machine=m68k-wrs
         1231  +		os=-vxworks
         1232  +		;;
         1233  +	vxworks29k)
         1234  +		basic_machine=a29k-wrs
         1235  +		os=-vxworks
         1236  +		;;
         1237  +	w65*)
         1238  +		basic_machine=w65-wdc
         1239  +		os=-none
         1240  +		;;
         1241  +	w89k-*)
         1242  +		basic_machine=hppa1.1-winbond
         1243  +		os=-proelf
         1244  +		;;
         1245  +	x64)
         1246  +		basic_machine=x86_64-pc
         1247  +		;;
         1248  +	xbox)
         1249  +		basic_machine=i686-pc
         1250  +		os=-mingw32
         1251  +		;;
         1252  +	xps | xps100)
         1253  +		basic_machine=xps100-honeywell
         1254  +		;;
         1255  +	xscale-* | xscalee[bl]-*)
         1256  +		basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
         1257  +		;;
         1258  +	ymp)
         1259  +		basic_machine=ymp-cray
         1260  +		os=-unicos
         1261  +		;;
         1262  +	none)
         1263  +		basic_machine=none-none
         1264  +		os=-none
         1265  +		;;
         1266  +
         1267  +# Here we handle the default manufacturer of certain CPU types.  It is in
         1268  +# some cases the only manufacturer, in others, it is the most popular.
         1269  +	w89k)
         1270  +		basic_machine=hppa1.1-winbond
         1271  +		;;
         1272  +	op50n)
         1273  +		basic_machine=hppa1.1-oki
         1274  +		;;
         1275  +	op60c)
         1276  +		basic_machine=hppa1.1-oki
         1277  +		;;
         1278  +	romp)
         1279  +		basic_machine=romp-ibm
         1280  +		;;
         1281  +	mmix)
         1282  +		basic_machine=mmix-knuth
         1283  +		;;
         1284  +	rs6000)
         1285  +		basic_machine=rs6000-ibm
         1286  +		;;
         1287  +	vax)
         1288  +		basic_machine=vax-dec
         1289  +		;;
         1290  +	pdp11)
         1291  +		basic_machine=pdp11-dec
         1292  +		;;
         1293  +	we32k)
         1294  +		basic_machine=we32k-att
         1295  +		;;
         1296  +	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
         1297  +		basic_machine=sh-unknown
         1298  +		;;
         1299  +	cydra)
         1300  +		basic_machine=cydra-cydrome
         1301  +		;;
         1302  +	orion)
         1303  +		basic_machine=orion-highlevel
         1304  +		;;
         1305  +	orion105)
         1306  +		basic_machine=clipper-highlevel
         1307  +		;;
         1308  +	mac | mpw | mac-mpw)
         1309  +		basic_machine=m68k-apple
         1310  +		;;
         1311  +	pmac | pmac-mpw)
         1312  +		basic_machine=powerpc-apple
         1313  +		;;
         1314  +	*-unknown)
         1315  +		# Make sure to match an already-canonicalized machine name.
         1316  +		;;
         1317  +	*)
         1318  +		echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
         1319  +		exit 1
         1320  +		;;
         1321  +esac
         1322  +
         1323  +# Here we canonicalize certain aliases for manufacturers.
         1324  +case $basic_machine in
         1325  +	*-digital*)
         1326  +		basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
         1327  +		;;
         1328  +	*-commodore*)
         1329  +		basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
         1330  +		;;
         1331  +	*)
         1332  +		;;
         1333  +esac
         1334  +
         1335  +# Decode manufacturer-specific aliases for certain operating systems.
         1336  +
         1337  +if [ x"$os" != x"" ]
         1338  +then
         1339  +case $os in
         1340  +	# First match some system type aliases that might get confused
         1341  +	# with valid system types.
         1342  +	# -solaris* is a basic system type, with this one exception.
         1343  +	-auroraux)
         1344  +		os=-auroraux
         1345  +		;;
         1346  +	-solaris1 | -solaris1.*)
         1347  +		os=`echo $os | sed -e 's|solaris1|sunos4|'`
         1348  +		;;
         1349  +	-solaris)
         1350  +		os=-solaris2
         1351  +		;;
         1352  +	-unixware*)
         1353  +		os=-sysv4.2uw
         1354  +		;;
         1355  +	-gnu/linux*)
         1356  +		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
         1357  +		;;
         1358  +	# es1800 is here to avoid being matched by es* (a different OS)
         1359  +	-es1800*)
         1360  +		os=-ose
         1361  +		;;
         1362  +	# Now accept the basic system types.
         1363  +	# The portable systems comes first.
         1364  +	# Each alternative MUST end in a * to match a version number.
         1365  +	# -sysv* is not here because it comes later, after sysvr4.
         1366  +	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
         1367  +	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
         1368  +	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
         1369  +	      | -sym* | -kopensolaris* | -plan9* \
         1370  +	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
         1371  +	      | -aos* | -aros* | -cloudabi* | -sortix* \
         1372  +	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
         1373  +	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
         1374  +	      | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
         1375  +	      | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
         1376  +	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
         1377  +	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
         1378  +	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
         1379  +	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \
         1380  +	      | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
         1381  +	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
         1382  +	      | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
         1383  +	      | -linux-newlib* | -linux-musl* | -linux-uclibc* \
         1384  +	      | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
         1385  +	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
         1386  +	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
         1387  +	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
         1388  +	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
         1389  +	      | -morphos* | -superux* | -rtmk* | -windiss* \
         1390  +	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
         1391  +	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
         1392  +	      | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
         1393  +	      | -midnightbsd*)
         1394  +	# Remember, each alternative MUST END IN *, to match a version number.
         1395  +		;;
         1396  +	-qnx*)
         1397  +		case $basic_machine in
         1398  +		    x86-* | i*86-*)
         1399  +			;;
         1400  +		    *)
         1401  +			os=-nto$os
         1402  +			;;
         1403  +		esac
         1404  +		;;
         1405  +	-nto-qnx*)
         1406  +		;;
         1407  +	-nto*)
         1408  +		os=`echo $os | sed -e 's|nto|nto-qnx|'`
         1409  +		;;
         1410  +	-sim | -xray | -os68k* | -v88r* \
         1411  +	      | -windows* | -osx | -abug | -netware* | -os9* \
         1412  +	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
         1413  +		;;
         1414  +	-mac*)
         1415  +		os=`echo "$os" | sed -e 's|mac|macos|'`
         1416  +		;;
         1417  +	-linux-dietlibc)
         1418  +		os=-linux-dietlibc
         1419  +		;;
         1420  +	-linux*)
         1421  +		os=`echo $os | sed -e 's|linux|linux-gnu|'`
         1422  +		;;
         1423  +	-sunos5*)
         1424  +		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
         1425  +		;;
         1426  +	-sunos6*)
         1427  +		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
         1428  +		;;
         1429  +	-opened*)
         1430  +		os=-openedition
         1431  +		;;
         1432  +	-os400*)
         1433  +		os=-os400
         1434  +		;;
         1435  +	-wince*)
         1436  +		os=-wince
         1437  +		;;
         1438  +	-utek*)
         1439  +		os=-bsd
         1440  +		;;
         1441  +	-dynix*)
         1442  +		os=-bsd
         1443  +		;;
         1444  +	-acis*)
         1445  +		os=-aos
         1446  +		;;
         1447  +	-atheos*)
         1448  +		os=-atheos
         1449  +		;;
         1450  +	-syllable*)
         1451  +		os=-syllable
         1452  +		;;
         1453  +	-386bsd)
         1454  +		os=-bsd
         1455  +		;;
         1456  +	-ctix* | -uts*)
         1457  +		os=-sysv
         1458  +		;;
         1459  +	-nova*)
         1460  +		os=-rtmk-nova
         1461  +		;;
         1462  +	-ns2)
         1463  +		os=-nextstep2
         1464  +		;;
         1465  +	-nsk*)
         1466  +		os=-nsk
         1467  +		;;
         1468  +	# Preserve the version number of sinix5.
         1469  +	-sinix5.*)
         1470  +		os=`echo $os | sed -e 's|sinix|sysv|'`
         1471  +		;;
         1472  +	-sinix*)
         1473  +		os=-sysv4
         1474  +		;;
         1475  +	-tpf*)
         1476  +		os=-tpf
         1477  +		;;
         1478  +	-triton*)
         1479  +		os=-sysv3
         1480  +		;;
         1481  +	-oss*)
         1482  +		os=-sysv3
         1483  +		;;
         1484  +	-svr4*)
         1485  +		os=-sysv4
         1486  +		;;
         1487  +	-svr3)
         1488  +		os=-sysv3
         1489  +		;;
         1490  +	-sysvr4)
         1491  +		os=-sysv4
         1492  +		;;
         1493  +	# This must come after -sysvr4.
         1494  +	-sysv*)
         1495  +		;;
         1496  +	-ose*)
         1497  +		os=-ose
         1498  +		;;
         1499  +	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
         1500  +		os=-mint
         1501  +		;;
         1502  +	-zvmoe)
         1503  +		os=-zvmoe
         1504  +		;;
         1505  +	-dicos*)
         1506  +		os=-dicos
         1507  +		;;
         1508  +	-pikeos*)
         1509  +		# Until real need of OS specific support for
         1510  +		# particular features comes up, bare metal
         1511  +		# configurations are quite functional.
         1512  +		case $basic_machine in
         1513  +		    arm*)
         1514  +			os=-eabi
         1515  +			;;
         1516  +		    *)
         1517  +			os=-elf
         1518  +			;;
         1519  +		esac
         1520  +		;;
         1521  +	-nacl*)
         1522  +		;;
         1523  +	-ios)
         1524  +		;;
         1525  +	-none)
         1526  +		;;
         1527  +	*)
         1528  +		# Get rid of the `-' at the beginning of $os.
         1529  +		os=`echo $os | sed 's/[^-]*-//'`
         1530  +		echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
         1531  +		exit 1
         1532  +		;;
         1533  +esac
         1534  +else
         1535  +
         1536  +# Here we handle the default operating systems that come with various machines.
         1537  +# The value should be what the vendor currently ships out the door with their
         1538  +# machine or put another way, the most popular os provided with the machine.
         1539  +
         1540  +# Note that if you're going to try to match "-MANUFACTURER" here (say,
         1541  +# "-sun"), then you have to tell the case statement up towards the top
         1542  +# that MANUFACTURER isn't an operating system.  Otherwise, code above
         1543  +# will signal an error saying that MANUFACTURER isn't an operating
         1544  +# system, and we'll never get to this point.
         1545  +
         1546  +case $basic_machine in
         1547  +	score-*)
         1548  +		os=-elf
         1549  +		;;
         1550  +	spu-*)
         1551  +		os=-elf
         1552  +		;;
         1553  +	*-acorn)
         1554  +		os=-riscix1.2
         1555  +		;;
         1556  +	arm*-rebel)
         1557  +		os=-linux
         1558  +		;;
         1559  +	arm*-semi)
         1560  +		os=-aout
         1561  +		;;
         1562  +	c4x-* | tic4x-*)
         1563  +		os=-coff
         1564  +		;;
         1565  +	c8051-*)
         1566  +		os=-elf
         1567  +		;;
         1568  +	hexagon-*)
         1569  +		os=-elf
         1570  +		;;
         1571  +	tic54x-*)
         1572  +		os=-coff
         1573  +		;;
         1574  +	tic55x-*)
         1575  +		os=-coff
         1576  +		;;
         1577  +	tic6x-*)
         1578  +		os=-coff
         1579  +		;;
         1580  +	# This must come before the *-dec entry.
         1581  +	pdp10-*)
         1582  +		os=-tops20
         1583  +		;;
         1584  +	pdp11-*)
         1585  +		os=-none
         1586  +		;;
         1587  +	*-dec | vax-*)
         1588  +		os=-ultrix4.2
         1589  +		;;
         1590  +	m68*-apollo)
         1591  +		os=-domain
         1592  +		;;
         1593  +	i386-sun)
         1594  +		os=-sunos4.0.2
         1595  +		;;
         1596  +	m68000-sun)
         1597  +		os=-sunos3
         1598  +		;;
         1599  +	m68*-cisco)
         1600  +		os=-aout
         1601  +		;;
         1602  +	mep-*)
         1603  +		os=-elf
         1604  +		;;
         1605  +	mips*-cisco)
         1606  +		os=-elf
         1607  +		;;
         1608  +	mips*-*)
         1609  +		os=-elf
         1610  +		;;
         1611  +	or32-*)
         1612  +		os=-coff
         1613  +		;;
         1614  +	*-tti)	# must be before sparc entry or we get the wrong os.
         1615  +		os=-sysv3
         1616  +		;;
         1617  +	sparc-* | *-sun)
         1618  +		os=-sunos4.1.1
         1619  +		;;
         1620  +	pru-*)
         1621  +		os=-elf
         1622  +		;;
         1623  +	*-be)
         1624  +		os=-beos
         1625  +		;;
         1626  +	*-ibm)
         1627  +		os=-aix
         1628  +		;;
         1629  +	*-knuth)
         1630  +		os=-mmixware
         1631  +		;;
         1632  +	*-wec)
         1633  +		os=-proelf
         1634  +		;;
         1635  +	*-winbond)
         1636  +		os=-proelf
         1637  +		;;
         1638  +	*-oki)
         1639  +		os=-proelf
         1640  +		;;
         1641  +	*-hp)
         1642  +		os=-hpux
         1643  +		;;
         1644  +	*-hitachi)
         1645  +		os=-hiux
         1646  +		;;
         1647  +	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
         1648  +		os=-sysv
         1649  +		;;
         1650  +	*-cbm)
         1651  +		os=-amigaos
         1652  +		;;
         1653  +	*-dg)
         1654  +		os=-dgux
         1655  +		;;
         1656  +	*-dolphin)
         1657  +		os=-sysv3
         1658  +		;;
         1659  +	m68k-ccur)
         1660  +		os=-rtu
         1661  +		;;
         1662  +	m88k-omron*)
         1663  +		os=-luna
         1664  +		;;
         1665  +	*-next)
         1666  +		os=-nextstep
         1667  +		;;
         1668  +	*-sequent)
         1669  +		os=-ptx
         1670  +		;;
         1671  +	*-crds)
         1672  +		os=-unos
         1673  +		;;
         1674  +	*-ns)
         1675  +		os=-genix
         1676  +		;;
         1677  +	i370-*)
         1678  +		os=-mvs
         1679  +		;;
         1680  +	*-gould)
         1681  +		os=-sysv
         1682  +		;;
         1683  +	*-highlevel)
         1684  +		os=-bsd
         1685  +		;;
         1686  +	*-encore)
         1687  +		os=-bsd
         1688  +		;;
         1689  +	*-sgi)
         1690  +		os=-irix
         1691  +		;;
         1692  +	*-siemens)
         1693  +		os=-sysv4
         1694  +		;;
         1695  +	*-masscomp)
         1696  +		os=-rtu
         1697  +		;;
         1698  +	f30[01]-fujitsu | f700-fujitsu)
         1699  +		os=-uxpv
         1700  +		;;
         1701  +	*-rom68k)
         1702  +		os=-coff
         1703  +		;;
         1704  +	*-*bug)
         1705  +		os=-coff
         1706  +		;;
         1707  +	*-apple)
         1708  +		os=-macos
         1709  +		;;
         1710  +	*-atari*)
         1711  +		os=-mint
         1712  +		;;
         1713  +	*)
         1714  +		os=-none
         1715  +		;;
         1716  +esac
         1717  +fi
         1718  +
         1719  +# Here we handle the case where we know the os, and the CPU type, but not the
         1720  +# manufacturer.  We pick the logical manufacturer.
         1721  +vendor=unknown
         1722  +case $basic_machine in
         1723  +	*-unknown)
         1724  +		case $os in
         1725  +			-riscix*)
         1726  +				vendor=acorn
         1727  +				;;
         1728  +			-sunos*)
         1729  +				vendor=sun
         1730  +				;;
         1731  +			-cnk*|-aix*)
         1732  +				vendor=ibm
         1733  +				;;
         1734  +			-beos*)
         1735  +				vendor=be
         1736  +				;;
         1737  +			-hpux*)
         1738  +				vendor=hp
         1739  +				;;
         1740  +			-mpeix*)
         1741  +				vendor=hp
         1742  +				;;
         1743  +			-hiux*)
         1744  +				vendor=hitachi
         1745  +				;;
         1746  +			-unos*)
         1747  +				vendor=crds
         1748  +				;;
         1749  +			-dgux*)
         1750  +				vendor=dg
         1751  +				;;
         1752  +			-luna*)
         1753  +				vendor=omron
         1754  +				;;
         1755  +			-genix*)
         1756  +				vendor=ns
         1757  +				;;
         1758  +			-mvs* | -opened*)
         1759  +				vendor=ibm
         1760  +				;;
         1761  +			-os400*)
         1762  +				vendor=ibm
         1763  +				;;
         1764  +			-ptx*)
         1765  +				vendor=sequent
         1766  +				;;
         1767  +			-tpf*)
         1768  +				vendor=ibm
         1769  +				;;
         1770  +			-vxsim* | -vxworks* | -windiss*)
         1771  +				vendor=wrs
         1772  +				;;
         1773  +			-aux*)
         1774  +				vendor=apple
         1775  +				;;
         1776  +			-hms*)
         1777  +				vendor=hitachi
         1778  +				;;
         1779  +			-mpw* | -macos*)
         1780  +				vendor=apple
         1781  +				;;
         1782  +			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
         1783  +				vendor=atari
         1784  +				;;
         1785  +			-vos*)
         1786  +				vendor=stratus
         1787  +				;;
         1788  +		esac
         1789  +		basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
         1790  +		;;
         1791  +esac
         1792  +
         1793  +echo "$basic_machine$os"
         1794  +exit
         1795  +
         1796  +# Local variables:
         1797  +# eval: (add-hook 'before-save-hook 'time-stamp)
         1798  +# time-stamp-start: "timestamp='"
         1799  +# time-stamp-format: "%:y-%02m-%02d"
         1800  +# time-stamp-end: "'"
         1801  +# End:

Added autosetup/autosetup-find-tclsh.

            1  +#!/bin/sh
            2  +# Looks for a suitable tclsh or jimsh in the PATH
            3  +# If not found, builds a bootstrap jimsh from source
            4  +# Prefer $autosetup_tclsh if is set in the environment
            5  +d=`dirname "$0"`
            6  +{ "$d/jimsh0" "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
            7  +PATH="$PATH:$d"; export PATH
            8  +for tclsh in $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6; do
            9  +	{ $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
           10  +done
           11  +echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
           12  +for cc in ${CC_FOR_BUILD:-cc} gcc; do
           13  +	{ $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
           14  +	"$d/jimsh0" "$d/autosetup-test-tclsh" && exit 0
           15  +done
           16  +echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
           17  +echo false

Added autosetup/autosetup-test-tclsh.

            1  +# A small Tcl script to verify that the chosen
            2  +# interpreter works. Sometimes we might e.g. pick up
            3  +# an interpreter for a different arch.
            4  +# Outputs the full path to the interpreter
            5  +
            6  +if {[catch {info version} version] == 0} {
            7  +	# This is Jim Tcl
            8  +	if {$version >= 0.72} {
            9  +		# Ensure that regexp works
           10  +		regexp (a.*?) a
           11  +		puts [info nameofexecutable]
           12  +		exit 0
           13  +	}
           14  +} elseif {[catch {info tclversion} version] == 0} {
           15  +	if {$version >= 8.5 && ![string match 8.5a* [info patchlevel]]} {
           16  +		puts [info nameofexecutable]
           17  +		exit 0
           18  +	}
           19  +}
           20  +exit 1

Added autosetup/cc-db.tcl.

            1  +# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# @synopsis:
            5  +#
            6  +# The 'cc-db' module provides a knowledge-base of system idiosyncrasies.
            7  +# In general, this module can always be included.
            8  +
            9  +use cc
           10  +
           11  +module-options {}
           12  +
           13  +# openbsd needs sys/types.h to detect some system headers
           14  +cc-include-needs sys/socket.h sys/types.h
           15  +cc-include-needs netinet/in.h sys/types.h

Added autosetup/cc-lib.tcl.

            1  +# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# @synopsis:
            5  +#
            6  +# Provides a library of common tests on top of the 'cc' module.
            7  +
            8  +use cc
            9  +
           10  +module-options {}
           11  +
           12  +# @cc-check-lfs
           13  +#
           14  +# The equivalent of the 'AC_SYS_LARGEFILE' macro.
           15  +#
           16  +# defines 'HAVE_LFS' if LFS is available,
           17  +# and defines '_FILE_OFFSET_BITS=64' if necessary
           18  +#
           19  +# Returns 1 if 'LFS' is available or 0 otherwise
           20  +#
           21  +proc cc-check-lfs {} {
           22  +	cc-check-includes sys/types.h
           23  +	msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..."
           24  +	set lfs 1
           25  +	if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} {
           26  +		msg-result no
           27  +	} elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} {
           28  +		define _FILE_OFFSET_BITS 64
           29  +		msg-result yes
           30  +	} else {
           31  +		set lfs 0
           32  +		msg-result none
           33  +	}
           34  +	define-feature lfs $lfs
           35  +	return $lfs
           36  +}
           37  +
           38  +# @cc-check-endian
           39  +#
           40  +# The equivalent of the 'AC_C_BIGENDIAN' macro.
           41  +#
           42  +# defines 'HAVE_BIG_ENDIAN' if endian is known to be big,
           43  +# or 'HAVE_LITTLE_ENDIAN' if endian is known to be little.
           44  +#
           45  +# Returns 1 if determined, or 0 if not.
           46  +#
           47  +proc cc-check-endian {} {
           48  +	cc-check-includes sys/types.h sys/param.h
           49  +	set rc 0
           50  +	msg-checking "Checking endian..."
           51  +	cc-with {-includes {sys/types.h sys/param.h}} {
           52  +		if {[cctest -code {
           53  +			#if !defined(BIG_ENDIAN) || !defined(BYTE_ORDER)
           54  +				#error unknown
           55  +			#elif BYTE_ORDER != BIG_ENDIAN
           56  +				#error little
           57  +			#endif
           58  +		}]} {
           59  +			define-feature big-endian
           60  +			msg-result "big"
           61  +			set rc 1
           62  +		} elseif {[cctest -code {
           63  +			#if !defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER)
           64  +				#error unknown
           65  +			#elif BYTE_ORDER != LITTLE_ENDIAN
           66  +				#error big
           67  +			#endif
           68  +		}]} {
           69  +			define-feature little-endian
           70  +			msg-result "little"
           71  +			set rc 1
           72  +		} else {
           73  +			msg-result "unknown"
           74  +		}
           75  +	}
           76  +	return $rc
           77  +}
           78  +
           79  +# @cc-check-flags flag ?...?
           80  +#
           81  +# Checks whether the given C/C++ compiler flags can be used. Defines feature
           82  +# names prefixed with 'HAVE_CFLAG' and 'HAVE_CXXFLAG' respectively, and
           83  +# appends working flags to '-cflags' and 'CFLAGS' or 'CXXFLAGS'.
           84  +proc cc-check-flags {args} {
           85  +	set result 1
           86  +	array set opts [cc-get-settings]
           87  +	switch -exact -- $opts(-lang) {
           88  +		c++ {
           89  +			set lang C++
           90  +			set prefix CXXFLAG
           91  +		}
           92  +		c {
           93  +			set lang C
           94  +			set prefix CFLAG
           95  +		}
           96  +		default {
           97  +			autosetup-error "cc-check-flags failed with unknown language: $opts(-lang)"
           98  +		}
           99  +	}
          100  +	foreach flag $args {
          101  +		msg-checking "Checking whether the $lang compiler accepts $flag..."
          102  +		if {[cctest -cflags $flag]} {
          103  +			msg-result yes
          104  +			define-feature $prefix$flag
          105  +			cc-with [list -cflags [list $flag]]
          106  +			define-append ${prefix}S $flag
          107  +		} else {
          108  +			msg-result no
          109  +			set result 0
          110  +		}
          111  +	}
          112  +	return $result
          113  +}
          114  +
          115  +# @cc-check-standards ver ?...?
          116  +#
          117  +# Checks whether the C/C++ compiler accepts one of the specified '-std=$ver'
          118  +# options, and appends the first working one to '-cflags' and 'CFLAGS' or
          119  +# 'CXXFLAGS'.
          120  +proc cc-check-standards {args} {
          121  +	array set opts [cc-get-settings]
          122  +	foreach std $args {
          123  +		if {[cc-check-flags -std=$std]} {
          124  +			return $std
          125  +		}
          126  +	}
          127  +	return ""
          128  +}
          129  +
          130  +# Checks whether $keyword is usable as alignof
          131  +proc cctest_alignof {keyword} {
          132  +	msg-checking "Checking for $keyword..."
          133  +	if {[cctest -code "int x = ${keyword}(char), y = ${keyword}('x');"]} then {
          134  +		msg-result ok
          135  +		define-feature $keyword
          136  +	} else {
          137  +		msg-result "not found"
          138  +	}
          139  +}
          140  +
          141  +# @cc-check-c11
          142  +#
          143  +# Checks for several C11/C++11 extensions and their alternatives. Currently
          144  +# checks for '_Static_assert', '_Alignof', '__alignof__', '__alignof'.
          145  +proc cc-check-c11 {} {
          146  +	msg-checking "Checking for _Static_assert..."
          147  +	if {[cctest -code {
          148  +		_Static_assert(1, "static assertions are available");
          149  +	}]} then {
          150  +		msg-result ok
          151  +		define-feature _Static_assert
          152  +	} else {
          153  +		msg-result "not found"
          154  +	}
          155  +
          156  +	cctest_alignof _Alignof
          157  +	cctest_alignof __alignof__
          158  +	cctest_alignof __alignof
          159  +}
          160  +
          161  +# @cc-check-alloca
          162  +#
          163  +# The equivalent of the 'AC_FUNC_ALLOCA' macro.
          164  +#
          165  +# Checks for the existence of 'alloca'
          166  +# defines 'HAVE_ALLOCA' and returns 1 if it exists.
          167  +proc cc-check-alloca {} {
          168  +	cc-check-some-feature alloca {
          169  +		cctest -includes alloca.h -code { alloca (2 * sizeof (int)); }
          170  +	}
          171  +}
          172  +
          173  +# @cc-signal-return-type
          174  +#
          175  +# The equivalent of the 'AC_TYPE_SIGNAL' macro.
          176  +#
          177  +# defines 'RETSIGTYPE' to 'int' or 'void'.
          178  +proc cc-signal-return-type {} {
          179  +	msg-checking "Checking return type of signal handlers..."
          180  +	cc-with {-includes {sys/types.h signal.h}} {
          181  +		if {[cctest -code {return *(signal (0, 0)) (0) == 1;}]} {
          182  +				set type int
          183  +		} else {
          184  +				set type void
          185  +		}
          186  +		define RETSIGTYPE $type
          187  +		msg-result $type
          188  +	}
          189  +}

Added autosetup/cc-shared.tcl.

            1  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# @synopsis:
            5  +#
            6  +# The 'cc-shared' module provides support for shared libraries and shared objects.
            7  +# It defines the following variables:
            8  +#
            9  +## SH_CFLAGS         Flags to use compiling sources destined for a shared library
           10  +## SH_LDFLAGS        Flags to use linking (creating) a shared library
           11  +## SH_SOPREFIX       Prefix to use to set the soname when creating a shared library
           12  +## SH_SOFULLPATH     Set to 1 if the shared library soname should include the full install path
           13  +## SH_SOEXT          Extension for shared libs
           14  +## SH_SOEXTVER       Format for versioned shared libs - %s = version
           15  +## SHOBJ_CFLAGS      Flags to use compiling sources destined for a shared object
           16  +## SHOBJ_LDFLAGS     Flags to use linking a shared object, undefined symbols allowed
           17  +## SHOBJ_LDFLAGS_R   - as above, but all symbols must be resolved
           18  +## SH_LINKRPATH      Format for setting the rpath when linking an executable, %s = path
           19  +## SH_LINKFLAGS      Flags to use linking an executable which will load shared objects
           20  +## LD_LIBRARY_PATH   Environment variable which specifies path to shared libraries
           21  +## STRIPLIBFLAGS     Arguments to strip a dynamic library
           22  +
           23  +module-options {}
           24  +
           25  +# Defaults: gcc on unix
           26  +define SHOBJ_CFLAGS -fPIC
           27  +define SHOBJ_LDFLAGS -shared
           28  +define SH_CFLAGS -fPIC
           29  +define SH_LDFLAGS -shared
           30  +define SH_LINKFLAGS -rdynamic
           31  +define SH_LINKRPATH "-Wl,-rpath -Wl,%s"
           32  +define SH_SOEXT .so
           33  +define SH_SOEXTVER .so.%s
           34  +define SH_SOPREFIX -Wl,-soname,
           35  +define LD_LIBRARY_PATH LD_LIBRARY_PATH
           36  +define STRIPLIBFLAGS --strip-unneeded
           37  +
           38  +# Note: This is a helpful reference for identifying the toolchain
           39  +#       http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers
           40  +
           41  +switch -glob -- [get-define host] {
           42  +	*-*-darwin* {
           43  +		define SHOBJ_CFLAGS "-dynamic -fno-common"
           44  +		define SHOBJ_LDFLAGS "-bundle -undefined dynamic_lookup"
           45  +		define SHOBJ_LDFLAGS_R -bundle
           46  +		define SH_CFLAGS -dynamic
           47  +		define SH_LDFLAGS -dynamiclib
           48  +		define SH_LINKFLAGS ""
           49  +		define SH_SOEXT .dylib
           50  +		define SH_SOEXTVER .%s.dylib
           51  +		define SH_SOPREFIX -Wl,-install_name,
           52  +		define SH_SOFULLPATH
           53  +		define LD_LIBRARY_PATH DYLD_LIBRARY_PATH
           54  +		define STRIPLIBFLAGS -x
           55  +	}
           56  +	*-*-ming* - *-*-cygwin - *-*-msys {
           57  +		define SHOBJ_CFLAGS ""
           58  +		define SHOBJ_LDFLAGS -shared
           59  +		define SH_CFLAGS ""
           60  +		define SH_LDFLAGS -shared
           61  +		define SH_LINKRPATH ""
           62  +		define SH_LINKFLAGS ""
           63  +		define SH_SOEXT .dll
           64  +		define SH_SOEXTVER .dll
           65  +		define SH_SOPREFIX ""
           66  +		define LD_LIBRARY_PATH PATH
           67  +	}
           68  +	sparc* {
           69  +		if {[msg-quiet cc-check-decls __SUNPRO_C]} {
           70  +			msg-result "Found sun stdio compiler"
           71  +			# sun stdio compiler
           72  +			# XXX: These haven't been fully tested.
           73  +			define SHOBJ_CFLAGS -KPIC
           74  +			define SHOBJ_LDFLAGS "-G"
           75  +			define SH_CFLAGS -KPIC
           76  +			define SH_LINKFLAGS -Wl,-export-dynamic
           77  +			define SH_SOPREFIX -Wl,-h,
           78  +		}
           79  +	}
           80  +	*-*-solaris* {
           81  +		if {[msg-quiet cc-check-decls __SUNPRO_C]} {
           82  +			msg-result "Found sun stdio compiler"
           83  +			# sun stdio compiler
           84  +			# XXX: These haven't been fully tested.
           85  +			define SHOBJ_CFLAGS -KPIC
           86  +			define SHOBJ_LDFLAGS "-G"
           87  +			define SH_CFLAGS -KPIC
           88  +			define SH_LINKFLAGS -Wl,-export-dynamic
           89  +			define SH_SOPREFIX -Wl,-h,
           90  +		}
           91  +	}
           92  +	*-*-hpux {
           93  +		# XXX: These haven't been tested
           94  +		define SHOBJ_CFLAGS "+O3 +z"
           95  +		define SHOBJ_LDFLAGS -b
           96  +		define SH_CFLAGS +z
           97  +		define SH_LINKFLAGS -Wl,+s
           98  +		define LD_LIBRARY_PATH SHLIB_PATH
           99  +	}
          100  +	*-*-haiku {
          101  +		define SHOBJ_CFLAGS ""
          102  +		define SHOBJ_LDFLAGS -shared
          103  +		define SH_CFLAGS ""
          104  +		define SH_LDFLAGS -shared
          105  +		define SH_LINKFLAGS ""
          106  +		define SH_SOPREFIX ""
          107  +		define LD_LIBRARY_PATH LIBRARY_PATH
          108  +	}
          109  +}
          110  +
          111  +if {![is-defined SHOBJ_LDFLAGS_R]} {
          112  +	define SHOBJ_LDFLAGS_R [get-define SHOBJ_LDFLAGS]
          113  +}

Added autosetup/cc.tcl.

            1  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# @synopsis:
            5  +#
            6  +# The 'cc' module supports checking various 'features' of the C or C++
            7  +# compiler/linker environment. Common commands are 'cc-check-includes',
            8  +# 'cc-check-types', 'cc-check-functions', 'cc-with', 'make-config-header' and 'make-template'.
            9  +#
           10  +# The following environment variables are used if set:
           11  +#
           12  +## CC       - C compiler
           13  +## CXX      - C++ compiler
           14  +## CCACHE   - Set to "none" to disable automatic use of ccache
           15  +## CFLAGS   - Additional C compiler flags
           16  +## CXXFLAGS - Additional C++ compiler flags
           17  +## LDFLAGS  - Additional compiler flags during linking
           18  +## LIBS     - Additional libraries to use (for all tests)
           19  +## CROSS    - Tool prefix for cross compilation
           20  +#
           21  +# The following variables are defined from the corresponding
           22  +# environment variables if set.
           23  +#
           24  +## CPPFLAGS
           25  +## LINKFLAGS
           26  +## CC_FOR_BUILD
           27  +## LD
           28  +
           29  +use system
           30  +
           31  +module-options {}
           32  +
           33  +# Checks for the existence of the given function by linking
           34  +#
           35  +proc cctest_function {function} {
           36  +	cctest -link 1 -declare "extern void $function\(void);" -code "$function\();"
           37  +}
           38  +
           39  +# Checks for the existence of the given type by compiling
           40  +proc cctest_type {type} {
           41  +	cctest -code "$type _x;"
           42  +}
           43  +
           44  +# Checks for the existence of the given type/structure member.
           45  +# e.g. "struct stat.st_mtime"
           46  +proc cctest_member {struct_member} {
           47  +	# split at the first dot
           48  +	regexp {^([^.]+)[.](.*)$} $struct_member -> struct member
           49  +	cctest -code "static $struct _s; return sizeof(_s.$member);"
           50  +}
           51  +
           52  +# Checks for the existence of the given define by compiling
           53  +#
           54  +proc cctest_define {name} {
           55  +	cctest -code "#ifndef $name\n#error not defined\n#endif"
           56  +}
           57  +
           58  +# Checks for the existence of the given name either as
           59  +# a macro (#define) or an rvalue (such as an enum)
           60  +#
           61  +proc cctest_decl {name} {
           62  +	cctest -code "#ifndef $name\n(void)$name;\n#endif"
           63  +}
           64  +
           65  +# @cc-check-sizeof type ...
           66  +#
           67  +# Checks the size of the given types (between 1 and 32, inclusive).
           68  +# Defines a variable with the size determined, or 'unknown' otherwise.
           69  +# e.g. for type 'long long', defines 'SIZEOF_LONG_LONG'.
           70  +# Returns the size of the last type.
           71  +#
           72  +proc cc-check-sizeof {args} {
           73  +	foreach type $args {
           74  +		msg-checking "Checking for sizeof $type..."
           75  +		set size unknown
           76  +		# Try the most common sizes first
           77  +		foreach i {4 8 1 2 16 32} {
           78  +			if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
           79  +				set size $i
           80  +				break
           81  +			}
           82  +		}
           83  +		msg-result $size
           84  +		set define [feature-define-name $type SIZEOF_]
           85  +		define $define $size
           86  +	}
           87  +	# Return the last result
           88  +	get-define $define
           89  +}
           90  +
           91  +# Checks for each feature in $list by using the given script.
           92  +#
           93  +# When the script is evaluated, $each is set to the feature
           94  +# being checked, and $extra is set to any additional cctest args.
           95  +#
           96  +# Returns 1 if all features were found, or 0 otherwise.
           97  +proc cc-check-some-feature {list script} {
           98  +	set ret 1
           99  +	foreach each $list {
          100  +		if {![check-feature $each $script]} {
          101  +			set ret 0
          102  +		}
          103  +	}
          104  +	return $ret
          105  +}
          106  +
          107  +# @cc-check-includes includes ...
          108  +#
          109  +# Checks that the given include files can be used.
          110  +proc cc-check-includes {args} {
          111  +	cc-check-some-feature $args {
          112  +		set with {}
          113  +		if {[dict exists $::autosetup(cc-include-deps) $each]} {
          114  +			set deps [dict keys [dict get $::autosetup(cc-include-deps) $each]]
          115  +			msg-quiet cc-check-includes {*}$deps
          116  +			foreach i $deps {
          117  +				if {[have-feature $i]} {
          118  +					lappend with $i
          119  +				}
          120  +			}
          121  +		}
          122  +		if {[llength $with]} {
          123  +			cc-with [list -includes $with] {
          124  +				cctest -includes $each
          125  +			}
          126  +		} else {
          127  +			cctest -includes $each
          128  +		}
          129  +	}
          130  +}
          131  +
          132  +# @cc-include-needs include required ...
          133  +#
          134  +# Ensures that when checking for '$include', a check is first
          135  +# made for each '$required' file, and if found, it is included with '#include'.
          136  +proc cc-include-needs {file args} {
          137  +	foreach depfile $args {
          138  +		dict set ::autosetup(cc-include-deps) $file $depfile 1
          139  +	}
          140  +}
          141  +
          142  +# @cc-check-types type ...
          143  +#
          144  +# Checks that the types exist.
          145  +proc cc-check-types {args} {
          146  +	cc-check-some-feature $args {
          147  +		cctest_type $each
          148  +	}
          149  +}
          150  +
          151  +# @cc-check-defines define ...
          152  +#
          153  +# Checks that the given preprocessor symbols are defined.
          154  +proc cc-check-defines {args} {
          155  +	cc-check-some-feature $args {
          156  +		cctest_define $each
          157  +	}
          158  +}
          159  +
          160  +# @cc-check-decls name ...
          161  +#
          162  +# Checks that each given name is either a preprocessor symbol or rvalue
          163  +# such as an enum. Note that the define used is 'HAVE_DECL_xxx'
          164  +# rather than 'HAVE_xxx'.
          165  +proc cc-check-decls {args} {
          166  +	set ret 1
          167  +	foreach name $args {
          168  +		msg-checking "Checking for $name..."
          169  +		set r [cctest_decl $name]
          170  +		define-feature "decl $name" $r
          171  +		if {$r} {
          172  +			msg-result "ok"
          173  +		} else {
          174  +			msg-result "not found"
          175  +			set ret 0
          176  +		}
          177  +	}
          178  +	return $ret
          179  +}
          180  +
          181  +# @cc-check-functions function ...
          182  +#
          183  +# Checks that the given functions exist (can be linked).
          184  +proc cc-check-functions {args} {
          185  +	cc-check-some-feature $args {
          186  +		cctest_function $each
          187  +	}
          188  +}
          189  +
          190  +# @cc-check-members type.member ...
          191  +#
          192  +# Checks that the given type/structure members exist.
          193  +# A structure member is of the form 'struct stat.st_mtime'.
          194  +proc cc-check-members {args} {
          195  +	cc-check-some-feature $args {
          196  +		cctest_member $each
          197  +	}
          198  +}
          199  +
          200  +# @cc-check-function-in-lib function libs ?otherlibs?
          201  +#
          202  +# Checks that the given function can be found in one of the libs.
          203  +#
          204  +# First checks for no library required, then checks each of the libraries
          205  +# in turn.
          206  +#
          207  +# If the function is found, the feature is defined and 'lib_$function' is defined
          208  +# to '-l$lib' where the function was found, or "" if no library required.
          209  +# In addition, '-l$lib' is prepended to the 'LIBS' define.
          210  +#
          211  +# If additional libraries may be needed for linking, they should be specified
          212  +# with '$extralibs' as '-lotherlib1 -lotherlib2'.
          213  +# These libraries are not automatically added to 'LIBS'.
          214  +#
          215  +# Returns 1 if found or 0 if not.
          216  +#
          217  +proc cc-check-function-in-lib {function libs {otherlibs {}}} {
          218  +	msg-checking "Checking libs for $function..."
          219  +	set found 0
          220  +	cc-with [list -libs $otherlibs] {
          221  +		if {[cctest_function $function]} {
          222  +			msg-result "none needed"
          223  +			define lib_$function ""
          224  +			incr found
          225  +		} else {
          226  +			foreach lib $libs {
          227  +				cc-with [list -libs -l$lib] {
          228  +					if {[cctest_function $function]} {
          229  +						msg-result -l$lib
          230  +						define lib_$function -l$lib
          231  +						# prepend to LIBS
          232  +						define LIBS "-l$lib [get-define LIBS]"
          233  +						incr found
          234  +						break
          235  +					}
          236  +				}
          237  +			}
          238  +		}
          239  +	}
          240  +	define-feature $function $found
          241  +	if {!$found} {
          242  +		msg-result "no"
          243  +	}
          244  +	return $found
          245  +}
          246  +
          247  +# @cc-check-tools tool ...
          248  +#
          249  +# Checks for existence of the given compiler tools, taking
          250  +# into account any cross compilation prefix.
          251  +#
          252  +# For example, when checking for 'ar', first 'AR' is checked on the command
          253  +# line and then in the environment. If not found, '${host}-ar' or
          254  +# simply 'ar' is assumed depending upon whether cross compiling.
          255  +# The path is searched for this executable, and if found 'AR' is defined
          256  +# to the executable name.
          257  +# Note that even when cross compiling, the simple 'ar' is used as a fallback,
          258  +# but a warning is generated. This is necessary for some toolchains.
          259  +#
          260  +# It is an error if the executable is not found.
          261  +#
          262  +proc cc-check-tools {args} {
          263  +	foreach tool $args {
          264  +		set TOOL [string toupper $tool]
          265  +		set exe [get-env $TOOL [get-define cross]$tool]
          266  +		if {[find-executable {*}$exe]} {
          267  +			define $TOOL $exe
          268  +			continue
          269  +		}
          270  +		if {[find-executable {*}$tool]} {
          271  +			msg-result "Warning: Failed to find $exe, falling back to $tool which may be incorrect"
          272  +			define $TOOL $tool
          273  +			continue
          274  +		}
          275  +		user-error "Failed to find $exe"
          276  +	}
          277  +}
          278  +
          279  +# @cc-check-progs prog ...
          280  +#
          281  +# Checks for existence of the given executables on the path.
          282  +#
          283  +# For example, when checking for 'grep', the path is searched for
          284  +# the executable, 'grep', and if found 'GREP' is defined as 'grep'.
          285  +#
          286  +# If the executable is not found, the variable is defined as 'false'.
          287  +# Returns 1 if all programs were found, or 0 otherwise.
          288  +#
          289  +proc cc-check-progs {args} {
          290  +	set failed 0
          291  +	foreach prog $args {
          292  +		set PROG [string toupper $prog]
          293  +		msg-checking "Checking for $prog..."
          294  +		if {![find-executable $prog]} {
          295  +			msg-result no
          296  +			define $PROG false
          297  +			incr failed
          298  +		} else {
          299  +			msg-result ok
          300  +			define $PROG $prog
          301  +		}
          302  +	}
          303  +	expr {!$failed}
          304  +}
          305  +
          306  +# @cc-path-progs prog ...
          307  +#
          308  +# Like cc-check-progs, but sets the define to the full path rather
          309  +# than just the program name.
          310  +#
          311  +proc cc-path-progs {args} {
          312  +	set failed 0
          313  +	foreach prog $args {
          314  +		set PROG [string toupper $prog]
          315  +		msg-checking "Checking for $prog..."
          316  +		set path [find-executable-path $prog]
          317  +		if {$path eq ""} {
          318  +			msg-result no
          319  +			define $PROG false
          320  +			incr failed
          321  +		} else {
          322  +			msg-result $path
          323  +			define $PROG $path
          324  +		}
          325  +	}
          326  +	expr {!$failed}
          327  +}
          328  +
          329  +# Adds the given settings to $::autosetup(ccsettings) and
          330  +# returns the old settings.
          331  +#
          332  +proc cc-add-settings {settings} {
          333  +	if {[llength $settings] % 2} {
          334  +		autosetup-error "settings list is missing a value: $settings"
          335  +	}
          336  +
          337  +	set prev [cc-get-settings]
          338  +	# workaround a bug in some versions of jimsh by forcing
          339  +	# conversion of $prev to a list
          340  +	llength $prev
          341  +
          342  +	array set new $prev
          343  +
          344  +	foreach {name value} $settings {
          345  +		switch -exact -- $name {
          346  +			-cflags - -includes {
          347  +				# These are given as lists
          348  +				lappend new($name) {*}[list-non-empty $value]
          349  +			}
          350  +			-declare {
          351  +				lappend new($name) $value
          352  +			}
          353  +			-libs {
          354  +				# Note that new libraries are added before previous libraries
          355  +				set new($name) [list {*}[list-non-empty $value] {*}$new($name)]
          356  +			}
          357  +			-link - -lang - -nooutput {
          358  +				set new($name) $value
          359  +			}
          360  +			-source - -sourcefile - -code {
          361  +				# XXX: These probably are only valid directly from cctest
          362  +				set new($name) $value
          363  +			}
          364  +			default {
          365  +				autosetup-error "unknown cctest setting: $name"
          366  +			}
          367  +		}
          368  +	}
          369  +
          370  +	cc-store-settings [array get new]
          371  +
          372  +	return $prev
          373  +}
          374  +
          375  +proc cc-store-settings {new} {
          376  +	set ::autosetup(ccsettings) $new
          377  +}
          378  +
          379  +proc cc-get-settings {} {
          380  +	return $::autosetup(ccsettings)
          381  +}
          382  +
          383  +# Similar to cc-add-settings, but each given setting
          384  +# simply replaces the existing value.
          385  +#
          386  +# Returns the previous settings
          387  +proc cc-update-settings {args} {
          388  +	set prev [cc-get-settings]
          389  +	cc-store-settings [dict merge $prev $args]
          390  +	return $prev
          391  +}
          392  +
          393  +# @cc-with settings ?{ script }?
          394  +#
          395  +# Sets the given 'cctest' settings and then runs the tests in '$script'.
          396  +# Note that settings such as '-lang' replace the current setting, while
          397  +# those such as '-includes' are appended to the existing setting.
          398  +#
          399  +# If no script is given, the settings become the default for the remainder
          400  +# of the 'auto.def' file.
          401  +#
          402  +## cc-with {-lang c++} {
          403  +##   # This will check with the C++ compiler
          404  +##   cc-check-types bool
          405  +##   cc-with {-includes signal.h} {
          406  +##     # This will check with the C++ compiler, signal.h and any existing includes.
          407  +##     ...
          408  +##   }
          409  +##   # back to just the C++ compiler
          410  +## }
          411  +#
          412  +# The '-libs' setting is special in that newer values are added *before* earlier ones.
          413  +#
          414  +## cc-with {-libs {-lc -lm}} {
          415  +##   cc-with {-libs -ldl} {
          416  +##     cctest -libs -lsocket ...
          417  +##     # libs will be in this order: -lsocket -ldl -lc -lm
          418  +##   }
          419  +## }
          420  +proc cc-with {settings args} {
          421  +	if {[llength $args] == 0} {
          422  +		cc-add-settings $settings
          423  +	} elseif {[llength $args] > 1} {
          424  +		autosetup-error "usage: cc-with settings ?script?"
          425  +	} else {
          426  +		set save [cc-add-settings $settings]
          427  +		set rc [catch {uplevel 1 [lindex $args 0]} result info]
          428  +		cc-store-settings $save
          429  +		if {$rc != 0} {
          430  +			return -code [dict get $info -code] $result
          431  +		}
          432  +		return $result
          433  +	}
          434  +}
          435  +
          436  +# @cctest ?settings?
          437  +#
          438  +# Low level C/C++ compiler checker. Compiles and or links a small C program
          439  +# according to the arguments and returns 1 if OK, or 0 if not.
          440  +#
          441  +# Supported settings are:
          442  +#
          443  +## -cflags cflags      A list of flags to pass to the compiler
          444  +## -includes list      A list of includes, e.g. {stdlib.h stdio.h}
          445  +## -declare code       Code to declare before main()
          446  +## -link 1             Don't just compile, link too
          447  +## -lang c|c++         Use the C (default) or C++ compiler
          448  +## -libs liblist       List of libraries to link, e.g. {-ldl -lm}
          449  +## -code code          Code to compile in the body of main()
          450  +## -source code        Compile a complete program. Ignore -includes, -declare and -code
          451  +## -sourcefile file    Shorthand for -source [readfile [get-define srcdir]/$file]
          452  +## -nooutput 1         Treat any compiler output (e.g. a warning) as an error
          453  +#
          454  +# Unless '-source' or '-sourcefile' is specified, the C program looks like:
          455  +#
          456  +## #include <firstinclude>   /* same for remaining includes in the list */
          457  +##
          458  +## declare-code              /* any code in -declare, verbatim */
          459  +##
          460  +## int main(void) {
          461  +##   code                    /* any code in -code, verbatim */
          462  +##   return 0;
          463  +## }
          464  +#
          465  +# Any failures are recorded in 'config.log'
          466  +#
          467  +proc cctest {args} {
          468  +	set src conftest__.c
          469  +	set tmp conftest__
          470  +
          471  +	# Easiest way to merge in the settings
          472  +	cc-with $args {
          473  +		array set opts [cc-get-settings]
          474  +	}
          475  +
          476  +	if {[info exists opts(-sourcefile)]} {
          477  +		set opts(-source) [readfile [get-define srcdir]/$opts(-sourcefile) "#error can't find $opts(-sourcefile)"]
          478  +	}
          479  +	if {[info exists opts(-source)]} {
          480  +		set lines $opts(-source)
          481  +	} else {
          482  +		foreach i $opts(-includes) {
          483  +			if {$opts(-code) ne "" && ![feature-checked $i]} {
          484  +				# Compiling real code with an unchecked header file
          485  +				# Quickly (and silently) check for it now
          486  +
          487  +				# Remove all -includes from settings before checking
          488  +				set saveopts [cc-update-settings -includes {}]
          489  +				msg-quiet cc-check-includes $i
          490  +				cc-store-settings $saveopts
          491  +			}
          492  +			if {$opts(-code) eq "" || [have-feature $i]} {
          493  +				lappend source "#include <$i>"
          494  +			}
          495  +		}
          496  +		lappend source {*}$opts(-declare)
          497  +		lappend source "int main(void) {"
          498  +		lappend source $opts(-code)
          499  +		lappend source "return 0;"
          500  +		lappend source "}"
          501  +
          502  +		set lines [join $source \n]
          503  +	}
          504  +
          505  +	# Build the command line
          506  +	set cmdline {}
          507  +	lappend cmdline {*}[get-define CCACHE]
          508  +	switch -exact -- $opts(-lang) {
          509  +		c++ {
          510  +			lappend cmdline {*}[get-define CXX] {*}[get-define CXXFLAGS]
          511  +		}
          512  +		c {
          513  +			lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
          514  +		}
          515  +		default {
          516  +			autosetup-error "cctest called with unknown language: $opts(-lang)"
          517  +		}
          518  +	}
          519  +
          520  +	if {$opts(-link)} {
          521  +		lappend cmdline {*}[get-define LDFLAGS]
          522  +	} else {
          523  +		set tmp conftest__.o
          524  +		lappend cmdline -c
          525  +	}
          526  +	lappend cmdline {*}$opts(-cflags) {*}[get-define cc-default-debug ""]
          527  +	lappend cmdline $src -o $tmp {*}$opts(-libs)
          528  +	if {$opts(-link)} {
          529  +		lappend cmdline {*}[get-define LIBS]
          530  +	}
          531  +
          532  +	# At this point we have the complete command line and the
          533  +	# complete source to be compiled. Get the result from cache if
          534  +	# we can
          535  +	if {[info exists ::cc_cache($cmdline,$lines)]} {
          536  +		msg-checking "(cached) "
          537  +		set ok $::cc_cache($cmdline,$lines)
          538  +		if {$::autosetup(debug)} {
          539  +			configlog "From cache (ok=$ok): [join $cmdline]"
          540  +			configlog "============"
          541  +			configlog $lines
          542  +			configlog "============"
          543  +		}
          544  +		return $ok
          545  +	}
          546  +
          547  +	writefile $src $lines\n
          548  +
          549  +	set ok 1
          550  +	set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
          551  +	if {$err || ($opts(-nooutput) && [string length $result])} {
          552  +		configlog "Failed: [join $cmdline]"
          553  +		configlog $result
          554  +		configlog "============"
          555  +		configlog "The failed code was:"
          556  +		configlog $lines
          557  +		configlog "============"
          558  +		set ok 0
          559  +	} elseif {$::autosetup(debug)} {
          560  +		configlog "Compiled OK: [join $cmdline]"
          561  +		configlog "============"
          562  +		configlog $lines
          563  +		configlog "============"
          564  +	}
          565  +	file delete $src
          566  +	file delete $tmp
          567  +
          568  +	# cache it
          569  +	set ::cc_cache($cmdline,$lines) $ok
          570  +
          571  +	return $ok
          572  +}
          573  +
          574  +# @make-autoconf-h outfile ?auto-patterns=HAVE_*? ?bare-patterns=SIZEOF_*?
          575  +#
          576  +# Deprecated - see 'make-config-header'
          577  +proc make-autoconf-h {file {autopatterns {HAVE_*}} {barepatterns {SIZEOF_* HAVE_DECL_*}}} {
          578  +	user-notice "*** make-autoconf-h is deprecated -- use make-config-header instead"
          579  +	make-config-header $file -auto $autopatterns -bare $barepatterns
          580  +}
          581  +
          582  +# @make-config-header outfile ?-auto patternlist? ?-bare patternlist? ?-none patternlist? ?-str patternlist? ...
          583  +#
          584  +# Examines all defined variables which match the given patterns
          585  +# and writes an include file, '$file', which defines each of these.
          586  +# Variables which match '-auto' are output as follows:
          587  +# - defines which have the value '0' are ignored.
          588  +# - defines which have integer values are defined as the integer value.
          589  +# - any other value is defined as a string, e.g. '"value"'
          590  +# Variables which match '-bare' are defined as-is.
          591  +# Variables which match '-str' are defined as a string, e.g. '"value"'
          592  +# Variables which match '-none' are omitted.
          593  +#
          594  +# Note that order is important. The first pattern that matches is selected.
          595  +# Default behaviour is:
          596  +#
          597  +##  -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_* -none *
          598  +#
          599  +# If the file would be unchanged, it is not written.
          600  +proc make-config-header {file args} {
          601  +	set guard _[string toupper [regsub -all {[^a-zA-Z0-9]} [file tail $file] _]]
          602  +	file mkdir [file dirname $file]
          603  +	set lines {}
          604  +	lappend lines "#ifndef $guard"
          605  +	lappend lines "#define $guard"
          606  +
          607  +	# Add some defaults
          608  +	lappend args -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_*
          609  +
          610  +	foreach n [lsort [dict keys [all-defines]]] {
          611  +		set value [get-define $n]
          612  +		set type [calc-define-output-type $n $args]
          613  +		switch -exact -- $type {
          614  +			-bare {
          615  +				# Just output the value unchanged
          616  +			}
          617  +			-none {
          618  +				continue
          619  +			}
          620  +			-str {
          621  +				set value \"[string map [list \\ \\\\ \" \\\"] $value]\"
          622  +			}
          623  +			-auto {
          624  +				# Automatically determine the type
          625  +				if {$value eq "0"} {
          626  +					lappend lines "/* #undef $n */"
          627  +					continue
          628  +				}
          629  +				if {![string is integer -strict $value]} {
          630  +					set value \"[string map [list \\ \\\\ \" \\\"] $value]\"
          631  +				}
          632  +			}
          633  +			"" {
          634  +				continue
          635  +			}
          636  +			default {
          637  +				autosetup-error "Unknown type in make-config-header: $type"
          638  +			}
          639  +		}
          640  +		lappend lines "#define $n $value"
          641  +	}
          642  +	lappend lines "#endif"
          643  +	set buf [join $lines \n]
          644  +	write-if-changed $file $buf {
          645  +		msg-result "Created $file"
          646  +	}
          647  +}
          648  +
          649  +proc calc-define-output-type {name spec} {
          650  +	foreach {type patterns} $spec {
          651  +		foreach pattern $patterns {
          652  +			if {[string match $pattern $name]} {
          653  +				return $type
          654  +			}
          655  +		}
          656  +	}
          657  +	return ""
          658  +}
          659  +
          660  +# Initialise some values from the environment or commandline or default settings
          661  +foreach i {LDFLAGS LIBS CPPFLAGS LINKFLAGS {CFLAGS "-g -O2"}} {
          662  +	lassign $i var default
          663  +	define $var [get-env $var $default]
          664  +}
          665  +
          666  +if {[env-is-set CC]} {
          667  +	# Set by the user, so don't try anything else
          668  +	set try [list [get-env CC ""]]
          669  +} else {
          670  +	# Try some reasonable options
          671  +	set try [list [get-define cross]cc [get-define cross]gcc]
          672  +}
          673  +define CC [find-an-executable {*}$try]
          674  +if {[get-define CC] eq ""} {
          675  +	user-error "Could not find a C compiler. Tried: [join $try ", "]"
          676  +}
          677  +
          678  +define CPP [get-env CPP "[get-define CC] -E"]
          679  +
          680  +# XXX: Could avoid looking for a C++ compiler until requested
          681  +# Note that if CXX isn't found, we just set it to "false". It might not be needed.
          682  +if {[env-is-set CXX]} {
          683  +	define CXX [find-an-executable -required [get-env CXX ""]]
          684  +} else {
          685  +	define CXX [find-an-executable [get-define cross]c++ [get-define cross]g++ false]
          686  +}
          687  +
          688  +# CXXFLAGS default to CFLAGS if not specified
          689  +define CXXFLAGS [get-env CXXFLAGS [get-define CFLAGS]]
          690  +
          691  +# May need a CC_FOR_BUILD, so look for one
          692  +define CC_FOR_BUILD [find-an-executable [get-env CC_FOR_BUILD ""] cc gcc false]
          693  +
          694  +if {[get-define CC] eq ""} {
          695  +	user-error "Could not find a C compiler. Tried: [join $try ", "]"
          696  +}
          697  +
          698  +define CCACHE [find-an-executable [get-env CCACHE ccache]]
          699  +
          700  +# Initial cctest settings
          701  +cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0}
          702  +set autosetup(cc-include-deps) {}
          703  +
          704  +msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS]"
          705  +if {[get-define CXX] ne "false"} {
          706  +	msg-result "C++ compiler...[get-define CCACHE] [get-define CXX] [get-define CXXFLAGS]"
          707  +}
          708  +msg-result "Build C compiler...[get-define CC_FOR_BUILD]"
          709  +
          710  +# On Darwin, we prefer to use -g0 to avoid creating .dSYM directories
          711  +# but some compilers may not support it, so test here.
          712  +switch -glob -- [get-define host] {
          713  +	*-*-darwin* {
          714  +		if {[cctest -cflags {-g0}]} {
          715  +			define cc-default-debug -g0
          716  +		}
          717  +	}
          718  +}
          719  +
          720  +if {![cc-check-includes stdlib.h]} {
          721  +	user-error "Compiler does not work. See config.log"
          722  +}

Added autosetup/default.auto.

            1  +# Copyright (c) 2012 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# Auto-load module for 'make' build system integration
            5  +
            6  +use init
            7  +
            8  +autosetup_add_init_type make {Simple "make" build system} {
            9  +	autosetup_check_create auto.def \
           10  +{# Initial auto.def created by 'autosetup --init=make'
           11  +
           12  +use cc
           13  +
           14  +# Add any user options here
           15  +options {
           16  +}
           17  +
           18  +make-config-header config.h
           19  +make-template Makefile.in
           20  +}
           21  +
           22  +	if {![file exists Makefile.in]} {
           23  +		puts "Note: I don't see Makefile.in. You will probably need to create one."
           24  +	}
           25  +}

Added autosetup/jimsh0.c.

more than 10,000 changes

Added autosetup/local.tcl.

            1  +puts "LOCAL.TCL"
            2  +# For this project, disable the pager for --help and --ref
            3  +# The user can still enable by using --nopager=0 or --disable-nopager
            4  +dict set autosetup(optdefault) nopager 1
            5  +
            6  +
            7  +# This procedure is a customized version of "cc-check-function-in-lib",
            8  +# that does not modify the LIBS variable.  Its use prevents prematurely
            9  +# pulling in libraries that will be added later anyhow (e.g. "-ldl").
           10  +proc check-function-in-lib {function libs {otherlibs {}}} {
           11  +    if {[string length $otherlibs]} {
           12  +        msg-checking "Checking for $function in $libs with $otherlibs..."
           13  +    } else {
           14  +        msg-checking "Checking for $function in $libs..."
           15  +    }
           16  +    set found 0
           17  +    cc-with [list -libs $otherlibs] {
           18  +        if {[cctest_function $function]} {
           19  +            msg-result "none needed"
           20  +            define lib_$function ""
           21  +            incr found
           22  +        } else {
           23  +            foreach lib $libs {
           24  +                cc-with [list -libs -l$lib] {
           25  +                    if {[cctest_function $function]} {
           26  +                        msg-result -l$lib
           27  +                        define lib_$function -l$lib
           28  +                        incr found
           29  +                        break
           30  +                    }
           31  +                }
           32  +            }
           33  +        }
           34  +    }
           35  +    if {$found} {
           36  +        define [feature-define-name $function]
           37  +    } else {
           38  +        msg-result "no"
           39  +    }
           40  +    return $found
           41  +}
           42  +
           43  +# Searches for a usable Tcl (prefer 8.6, 8.5, 8.4) in the given paths
           44  +# Returns a dictionary of the contents of the tclConfig.sh file, or
           45  +# empty if not found
           46  +proc parse-tclconfig-sh {args} {
           47  +	foreach p $args {
           48  +		# Allow pointing directly to the path containing tclConfig.sh
           49  +		if {[file exists $p/tclConfig.sh]} {
           50  +			return [parse-tclconfig-sh-file $p/tclConfig.sh]
           51  +		}
           52  +		# Some systems allow for multiple versions
           53  +		foreach libpath {lib/tcl8.6 lib/tcl8.5 lib/tcl8.4 lib/tcl tcl lib}  {
           54  +			if {[file exists $p/$libpath/tclConfig.sh]} {
           55  +				return [parse-tclconfig-sh-file $p/$libpath/tclConfig.sh]
           56  +			}
           57  +		}
           58  +	}
           59  +}
           60  +
           61  +proc parse-tclconfig-sh-file {filename} {
           62  +  define TCL_BIN_DIR [file normalize [file dirname $filename]]
           63  +	return [read_sh_file $filename]
           64  +}
           65  +proc read_sh_subst {line info} {
           66  +  regsub -all {\x28} $line \x7B line
           67  +  regsub -all {\x29} $line \x7D line
           68  +
           69  +  #set line [string map $key [string trim $line]]
           70  +  foreach {field value} $info {
           71  +    catch {set $field $value}
           72  +  }
           73  +  if [catch {subst $line} result] {
           74  +    return {}
           75  +  }
           76  +  set result [string trim $result]
           77  +  return [string trim $result ']
           78  +}
           79  +proc read_sh_file {filename {localdat {}}} {
           80  +  set fin [open $filename r]
           81  +  set result {}
           82  +  if {$localdat eq {}} {
           83  +    set top 1
           84  +    set local [array get ::env]
           85  +    dict set local EXE {}
           86  +  } else {
           87  +    set top 0
           88  +    set local $localdat
           89  +  }
           90  +  while {[gets $fin line] >= 0} {
           91  +    set line [string trim $line]
           92  +    if {[string index $line 0] eq "#"} continue
           93  +    if {$line eq {}} continue
           94  +    catch {
           95  +    if {[string range $line 0 6] eq "export "} {
           96  +      set eq [string first "=" $line]
           97  +      set field [string trim [string range $line 6 [expr {$eq - 1}]]]
           98  +      set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local]
           99  +      dict set result $field [read_sh_subst $value $local]
          100  +      dict set local $field $value
          101  +    } elseif {[string range $line 0 7] eq "include "} {
          102  +      set subfile [read_sh_subst [string range $line 7 end] $local]
          103  +      foreach {field value} [read_sh_file $subfile $local] {
          104  +        dict set result $field $value
          105  +      }
          106  +    } else {
          107  +      set eq [string first "=" $line]
          108  +      if {$eq > 0} {
          109  +        set field [read_sh_subst [string range $line 0 [expr {$eq - 1}]] $local]
          110  +        set value [string trim [string range $line [expr {$eq+1}] end] ']
          111  +        #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local]
          112  +        dict set local $field $value
          113  +        dict set result $field $value
          114  +      }
          115  +    }
          116  +    } err opts
          117  +    if {[dict get $opts -code] != 0} {
          118  +      #puts $opts
          119  +      puts "Error reading line:\n$line\nerr: $err\n***"
          120  +      return $err {*}$opts
          121  +    }
          122  +  }
          123  +  return $result
          124  +}
          125  +
          126  +
          127  +proc is_mingw {} {
          128  +    return [string match *mingw* [get-define host]]
          129  +}
          130  +
          131  +proc tea-generate {tclpath} {
          132  +
          133  +  puts "BEGIN TEA-GENERATE"
          134  +  set windows 0
          135  +  # Until we hear otherwise, assume Unix
          136  +  define TEA_PLATFORM unix
          137  +  define TEA_WINDOWINGSYSTEM x11
          138  +  define EXTRA_CFLAGS "-Wall"
          139  +  define TEACUP_TOOLSET gcc
          140  +  define PRACTCL_TOOLSET gcc
          141  +  define OBJEXT o
          142  +  define PRACTCL_VC_MANIFEST_EMBED_DLL :
          143  +	define PRACTCL_VC_MANIFEST_EMBED_EXE :
          144  +	set shared [opt-bool enable-shared]
          145  +  define SHARED_BUILD $shared
          146  +  define PRACTCL_DEFS {}
          147  +  define DEFS {}
          148  +  define PACKAGE_LIB_PREFIX {}
          149  +  define LIBRARY_PREFIX {}
          150  +  #set tclprivatestubs [opt-bool with-tcl-private-stubs]
          151  +  set tclprivatestubs 1
          152  +  # Note parse-tclconfig-sh is in autosetup/local.tcl
          153  +  if {$tclpath eq "1"} {
          154  +      set tcldir [file dirname $autosetup(dir)]/compat/tcl-8.6
          155  +      if {$tclprivatestubs} {
          156  +          set tclconfig(TCL_INCLUDE_SPEC) -I$tcldir/generic
          157  +          set tclconfig(TCL_VERSION) {Private Stubs}
          158  +          set tclconfig(TCL_PATCH_LEVEL) {}
          159  +          set tclconfig(TCL_PREFIX) $tcldir
          160  +          set tclconfig(TCL_LD_FLAGS) { }
          161  +      } else {
          162  +          # Use the system Tcl. Look in some likely places.
          163  +          array set tclconfig [parse-tclconfig-sh \
          164  +              $tcldir/unix $tcldir/win \
          165  +              /usr /usr/local /usr/share /opt/local]
          166  +          set msg "on your system"
          167  +      }
          168  +  } else {
          169  +      array set tclconfig [parse-tclconfig-sh $tclpath]
          170  +      set msg "at $tclpath"
          171  +  }
          172  +  if {![opt-bool enable-shared]} {
          173  +      set tclconfig(TCL_LD_FLAGS) { }
          174  +  }
          175  +  if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
          176  +      user-error "Cannot find Tcl $msg"
          177  +  }
          178  +  set tclstubs [opt-bool with-tcl-stubs]
          179  +  if {$tclprivatestubs} {
          180  +      define MIGRATE_ENABLE_TCL_PRIVATE_STUBS
          181  +      define USE_TCL_STUBS
          182  +  } elseif {$tclstubs && $tclconfig(TCL_SUPPORTS_STUBS)} {
          183  +      set libs "$tclconfig(TCL_STUB_LIB_SPEC)"
          184  +      define MIGRATE_ENABLE_TCL_STUBS
          185  +      define USE_TCL_STUBS
          186  +  } else {
          187  +      set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
          188  +  }
          189  +  set cflags $tclconfig(TCL_INCLUDE_SPEC)
          190  +  if {!$tclprivatestubs} {
          191  +      set foundtcl 0; # Did we find a working Tcl library?
          192  +      cc-with [list -cflags $cflags -libs $libs] {
          193  +          if {$tclstubs} {
          194  +              if {[cc-check-functions Tcl_InitStubs]} {
          195  +                  set foundtcl 1
          196  +              }
          197  +          } else {
          198  +              if {[cc-check-functions Tcl_CreateInterp]} {
          199  +                  set foundtcl 1
          200  +              }
          201  +          }
          202  +      }
          203  +      if {!$foundtcl && [string match *-lieee* $libs]} {
          204  +          # On some systems, using "-lieee" from TCL_LIB_SPEC appears
          205  +          # to cause issues.
          206  +          msg-result "Removing \"-lieee\" and retrying for Tcl..."
          207  +          set libs [string map [list -lieee ""] $libs]
          208  +          cc-with [list -cflags $cflags -libs $libs] {
          209  +              if {$tclstubs} {
          210  +                  if {[cc-check-functions Tcl_InitStubs]} {
          211  +                      set foundtcl 1
          212  +                  }
          213  +              } else {
          214  +                  if {[cc-check-functions Tcl_CreateInterp]} {
          215  +                      set foundtcl 1
          216  +                  }
          217  +              }
          218  +          }
          219  +      }
          220  +      if {!$foundtcl && ![string match *-lpthread* $libs]} {
          221  +          # On some systems, TCL_LIB_SPEC appears to be missing
          222  +          # "-lpthread".  Try adding it.
          223  +          msg-result "Adding \"-lpthread\" and retrying for Tcl..."
          224  +          set libs "$libs -lpthread"
          225  +          cc-with [list -cflags $cflags -libs $libs] {
          226  +              if {$tclstubs} {
          227  +                  if {[cc-check-functions Tcl_InitStubs]} {
          228  +                      set foundtcl 1
          229  +                  }
          230  +              } else {
          231  +                  if {[cc-check-functions Tcl_CreateInterp]} {
          232  +                      set foundtcl 1
          233  +                  }
          234  +              }
          235  +          }
          236  +      }
          237  +      if {!$foundtcl} {
          238  +          if {$tclstubs} {
          239  +              user-error "Cannot find a usable Tcl stubs library $msg"
          240  +          } else {
          241  +              user-error "Cannot find a usable Tcl library $msg"
          242  +          }
          243  +      }
          244  +  }
          245  +  set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
          246  +  msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
          247  +  define-append LIBS " $tclconfig(TCL_BUILD_LIB_SPEC)"
          248  +  if {!$tclprivatestubs} {
          249  +      define-append LIBS $libs
          250  +  }
          251  +  define-append EXTRA_CFLAGS $cflags
          252  +  if {[info exists zlibpath] && $zlibpath eq "tree"} {
          253  +    #
          254  +    # NOTE: When using zlib in the source tree, prevent Tcl from
          255  +    #       pulling in the system one.
          256  +    #
          257  +    set tclconfig(TCL_LD_FLAGS) [string map [list -lz ""] \
          258  +        $tclconfig(TCL_LD_FLAGS)]
          259  +  }
          260  +  #
          261  +  # NOTE: Remove "-ldl" from the TCL_LD_FLAGS because it will be
          262  +  #       be checked for near the bottom of this file.
          263  +  #
          264  +  set tclconfig(TCL_LD_FLAGS) [string map [list -ldl ""] \
          265  +      $tclconfig(TCL_LD_FLAGS)]
          266  +  define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
          267  +
          268  +
          269  +
          270  +  if {!$shared} {
          271  +    # XXX: This will not work on all systems.
          272  +    define-append EXTRA_LDFLAGS -static
          273  +    msg-result "Trying to link statically"
          274  +  } else {
          275  +  }
          276  +
          277  +  foreach {f v} [array get tclconfig] {
          278  +    switch $f {
          279  +      TCL_LD_FLAGS {
          280  +        define LDFLAGS $v
          281  +        define LDFLAGS_DEFAULT $v
          282  +      }
          283  +      TCL_LIBS -
          284  +      TCL_BUILD_LIB_SPEC -
          285  +      TCL_BUILD_STUB_LIB_SPEC -
          286  +      TCL_SHLIB_LD -
          287  +      TCL_STLIB_LD -
          288  +      TCL_DEFS -
          289  +      TCL_VERSION -
          290  +      TCL_MAJOR_VERSION -
          291  +      TCL_MINOR_VERSION -
          292  +      TCL_PATCH_LEVEL -
          293  +      TCL_SHARED_BUILD -
          294  +      TCL_BIN_DIR -
          295  +      TCL_SRC_DIR -
          296  +      TCL_ZIP_FILE -
          297  +      TCL_STUB_LIB_SPEC -
          298  +      TCL_LIB_FILE {
          299  +        define $f $v
          300  +      }
          301  +      default {
          302  +        #puts [list [string range $f 4 end] $f $v]
          303  +        define [string range $f 4 end] $v
          304  +      }
          305  +    }
          306  +  }
          307  +  define CFLAGS_DEFAULT  [get-define CFLAGS]
          308  +  define CFLAGS_WARNING  {-Wall}
          309  +  define CFLAGS {-pipe  ${CFLAGS_DEFAULT} ${CFLAGS_WARNING}  }
          310  +  #define SHLIB_LD "[get-define CC] [get-define SHOBJ_CFLAGS] [get-define CFLAGS] [get-define TCL_LD_FLAGS] "
          311  +  define MAKE_STATIC_LIB    "\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
          312  +  define MAKE_SHARED_LIB    "\${SHLIB_LD} -o \[\$\]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
          313  +  define MAKE_STUB_LIB      "\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)"
          314  +  define PRACTCL_STATIC_LIB "%STLIB_LD% %OUTFILE% %LIBRARY_OBJECTS%"
          315  +  define PRACTCL_SHARED_LIB "%SHLIB_LD% -o %OUTFILE% %LIBRARY_OBJECTS% %SHLIB_LD_LIBS%"
          316  +  define PRACTCL_STUB_LIB   "%STLIB_LD% %OUTFILE% %LIBRARY_OBJECTS%"
          317  +  define PRACTCL_NAME_LIBRARY "lib%LIBRARY_PREFIX%%LIBRARY_NAME%%LIBRARY_VERSION%"
          318  +  define RANLIB_STUB        [get-define RANLIB]
          319  +  define SHLIB_LD_LIBS [get-define LIBS]
          320  +
          321  +  set HOST [get-define host]
          322  +  define TEA_SYSTEM $HOST
          323  +  switch -glob -- [string tolower $HOST] {
          324  +    *-*-darwin* {
          325  +      define TEA_PLATFORM unix
          326  +      define TEA_WINDOWINGSYSTEM aqua
          327  +      define TEACUP_OS macosx
          328  +      define TEACUP_PROFILE macosx-universal
          329  +      set arch [lindex [split $HOST -] 0]
          330  +      if {$arch eq "x86_64"} {
          331  +        define TEACUP_PROFILE macosx10.5-i386-x86_84
          332  +      }
          333  +      define TEACUP_ARCH $arch
          334  +    }
          335  +    *-*-ming* - *-*-cygwin - *-*-msys {
          336  +      set windows 1
          337  +      define TEACUP_OS windows
          338  +      if {[string match "*mingw32*" $HOST]} {
          339  +        set arch ix86
          340  +        define TEACUP_PROFILE win32-ix86
          341  +      }
          342  +      if {[string match "*mingw64*" $HOST]} {
          343  +        set arch x86_64
          344  +        define TEACUP_PROFILE win32-x86_64
          345  +      }
          346  +      define TEACUP_ARCH $arch
          347  +      define TEA_PLATFORM windows
          348  +      define TEA_WINDOWINGSYSTEM win32
          349  +      if {![is_mingw]} {
          350  +        # Assume msvc
          351  +        define PRACTCL_TOOLSET msvc
          352  +        define PRACTCL_STATIC_LIB  "%STLIB_LD% -out:%OUTFILE% %LIBRARY_OBJECTS%"
          353  +        define PRACTCL_SHARED_LIB  "%SHLIB_LD% %SHLIB_LD_LIBS% %LDFLAGS_DEFAULT% -out:%OUTFILE% %LIBRARY_OBJECTS%"
          354  +        define MAKE_STATIC_LIB     "\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
          355  +        define MAKE_SHARED_LIB     "\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
          356  +		    define PRACTCL_STUB_LIB    "%STLIB_LD% -nodefaultlib -out:%OUTFILE% %LIBRARY_OBJECTS%"
          357  +	      define MAKE_STUB_LIB       "\${STLIB_LD} -nodefaultlib -out:\[$]@ \$(PKG_STUB_OBJECTS)"
          358  +        define OBJEXT obj
          359  +        if 0 {
          360  +        {
          361  +    #if defined(_MSC_VER) && _MSC_VER >= 1400
          362  +    print("manifest needed")
          363  +    #endif
          364  +    }
          365  +          # Could do a CHECK_PROG for mt, but should always be with MSVC8+
          366  +          define PRACTCL_VC_MANIFEST_EMBED_DLL "mt.exe -nologo -manifest %OUTFILE%.manifest -outputresource:%OUTFILE%\;2"
          367  +          define PRACTCL_VC_MANIFEST_EMBED_EXE "mt.exe -nologo -manifest %OUTFILE%.manifest -outputresource:%OUTFILE%\;1"
          368  +          define VC_MANIFEST_EMBED_DLL "if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;2 ; fi"
          369  +          define VC_MANIFEST_EMBED_EXE "if test -f \[$]@.manifest ; then mt.exe -nologo -manifest \[$]@.manifest -outputresource:\[$]@\;1 ; fi"
          370  +          define MAKE_SHARED_LIB "${MAKE_SHARED_LIB} ; ${VC_MANIFEST_EMBED_DLL}"
          371  +          define-append TEA_ADD_CLEANFILES *.manifest
          372  +        }
          373  +      }
          374  +    }
          375  +    *-*-linux* {
          376  +      define TEACUP_OS linux
          377  +    }
          378  +    *-*-gnu* {
          379  +      define TEACUP_OS gnu
          380  +    }
          381  +    *-*-netbsd*debian* {
          382  +      define TEACUP_OS netbsd-debian
          383  +    }
          384  +    *-*-netbsd* {
          385  +      define TEACUP_OS netbsd
          386  +    }
          387  +    *openbsd* {
          388  +      define TEACUP_OS openbsd
          389  +    }
          390  +    default {
          391  +      set os   [lindex [split $HOST -] 2]
          392  +      define TEACUP_OS $os
          393  +    }
          394  +  }
          395  +  if {$arch eq "unknown"} {
          396  +    set arch [lindex [split $HOST -] 0]
          397  +    define TEACUP_ARCH $arch
          398  +    define TEACUP_PROFILE "[get-define TEACUP_OS]-$arch"
          399  +  }
          400  +
          401  +  switch -glob -- $HOST {
          402  +    sparc* {
          403  +      if {[msg-quiet cc-check-decls __SUNPRO_C]} {
          404  +      }
          405  +    }
          406  +    *-*-solaris* {
          407  +      if {[msg-quiet cc-check-decls __SUNPRO_C]} {
          408  +
          409  +      }
          410  +    }
          411  +    *-*-hpux {
          412  +
          413  +    }
          414  +    *-*-haiku {
          415  +    }
          416  +  }
          417  +  if {[get-define SHARED_BUILD]} {
          418  +	  define MAKE_LIB [get-define MAKE_SHARED_LIB]
          419  +  } else {
          420  +	  define MAKE_LIB [get-define MAKE_STATIC_LIB]
          421  +  }
          422  +  define SHLIB_LD [get-define TCL_SHLIB_LD]
          423  +  define DEFS "[get-define PACKAGE_DEFS] [get-define TCL_DEFS]"
          424  +  ###
          425  +  # autosetup -> TEA mappings
          426  +  ###
          427  +  puts "END TEA-GENERATE"
          428  +
          429  +}

Added autosetup/pkg-config.tcl.

            1  +# Copyright (c) 2016 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# @synopsis:
            5  +#
            6  +# The 'pkg-config' module allows package information to be found via 'pkg-config'.
            7  +#
            8  +# If not cross-compiling, the package path should be determined automatically
            9  +# by 'pkg-config'.
           10  +# If cross-compiling, the default package path is the compiler sysroot.
           11  +# If the C compiler doesn't support '-print-sysroot', the path can be supplied
           12  +# by the '--sysroot' option or by defining 'SYSROOT'.
           13  +#
           14  +# 'PKG_CONFIG' may be set to use an alternative to 'pkg-config'.
           15  +
           16  +use cc
           17  +
           18  +module-options {
           19  +	sysroot:dir => "Override compiler sysroot for pkg-config search path"
           20  +}
           21  +
           22  +# @pkg-config-init ?required?
           23  +#
           24  +# Initialises the 'pkg-config' system. Unless '$required' is set to 0,
           25  +# it is a fatal error if a usable 'pkg-config' is not found .
           26  +#
           27  +# This command will normally be called automatically as required,
           28  +# but it may be invoked explicitly if lack of 'pkg-config' is acceptable.
           29  +#
           30  +# Returns 1 if ok, or 0 if 'pkg-config' not found/usable (only if '$required' is 0).
           31  +#
           32  +proc pkg-config-init {{required 1}} {
           33  +	if {[is-defined HAVE_PKG_CONFIG]} {
           34  +		return [get-define HAVE_PKG_CONFIG]
           35  +	}
           36  +	set found 0
           37  +
           38  +	define PKG_CONFIG [get-env PKG_CONFIG pkg-config]
           39  +	msg-checking "Checking for pkg-config..."
           40  +
           41  +	if {[catch {exec [get-define PKG_CONFIG] --version} version]} {
           42  +		msg-result "[get-define PKG_CONFIG] (not found)"
           43  +		if {$required} {
           44  +			user-error "No usable pkg-config"
           45  +		}
           46  +	} else {
           47  +		msg-result $version
           48  +		define PKG_CONFIG_VERSION $version
           49  +
           50  +		set found 1
           51  +
           52  +		if {[opt-str sysroot o]} {
           53  +			define SYSROOT [file-normalize $o]
           54  +			msg-result "Using specified sysroot [get-define SYSROOT]"
           55  +		} elseif {[get-define build] ne [get-define host]} {
           56  +			if {[catch {exec-with-stderr [get-define CC] -print-sysroot} result errinfo] == 0} {
           57  +				# Use the compiler sysroot, if there is one
           58  +				define SYSROOT $result
           59  +				msg-result "Found compiler sysroot $result"
           60  +			} else {
           61  +				set msg "pkg-config: Cross compiling, but no compiler sysroot and no --sysroot supplied"
           62  +				if {$required} {
           63  +					user-error $msg
           64  +				} else {
           65  +					msg-result $msg
           66  +				}
           67  +				set found 0
           68  +			}
           69  +		}
           70  +		if {[is-defined SYSROOT]} {
           71  +			set sysroot [get-define SYSROOT]
           72  +
           73  +			# XXX: It's possible that these should be set only when invoking pkg-config
           74  +			global env
           75  +			set env(PKG_CONFIG_DIR) ""
           76  +			# Do we need to try /usr/local as well or instead?
           77  +			set env(PKG_CONFIG_LIBDIR) $sysroot/usr/lib/pkgconfig:$sysroot/usr/share/pkgconfig
           78  +			set env(PKG_CONFIG_SYSROOT_DIR) $sysroot
           79  +		}
           80  +	}
           81  +	define HAVE_PKG_CONFIG $found
           82  +	return $found
           83  +}
           84  +
           85  +# @pkg-config module ?requirements?
           86  +#
           87  +# Use 'pkg-config' to find the given module meeting the given requirements.
           88  +# e.g.
           89  +#
           90  +## pkg-config pango >= 1.37.0
           91  +#
           92  +# If found, returns 1 and sets 'HAVE_PKG_PANGO' to 1 along with:
           93  +#
           94  +## PKG_PANGO_VERSION to the found version
           95  +## PKG_PANGO_LIBS    to the required libs (--libs-only-l)
           96  +## PKG_PANGO_LDFLAGS to the required linker flags (--libs-only-L)
           97  +## PKG_PANGO_CFLAGS  to the required compiler flags (--cflags)
           98  +#
           99  +# If not found, returns 0.
          100  +#
          101  +proc pkg-config {module args} {
          102  +	set ok [pkg-config-init]
          103  +
          104  +	msg-checking "Checking for $module $args..."
          105  +
          106  +	if {!$ok} {
          107  +		msg-result "no pkg-config"
          108  +		return 0
          109  +	}
          110  +
          111  +	if {[catch {exec [get-define PKG_CONFIG] --modversion "$module $args"} version]} {
          112  +		msg-result "not found"
          113  +		configlog "pkg-config --modversion $module $args: $version"
          114  +		return 0
          115  +	}
          116  +	msg-result $version
          117  +	set prefix [feature-define-name $module PKG_]
          118  +	define HAVE_${prefix}
          119  +	define ${prefix}_VERSION $version
          120  +	define ${prefix}_LIBS [exec pkg-config --libs-only-l $module]
          121  +	define ${prefix}_LDFLAGS [exec pkg-config --libs-only-L $module]
          122  +	define ${prefix}_CFLAGS [exec pkg-config --cflags $module]
          123  +	return 1
          124  +}
          125  +
          126  +# @pkg-config-get module setting
          127  +#
          128  +# Convenience access to the results of 'pkg-config'.
          129  +#
          130  +# For example, '[pkg-config-get pango CFLAGS]' returns
          131  +# the value of 'PKG_PANGO_CFLAGS', or '""' if not defined.
          132  +proc pkg-config-get {module name} {
          133  +	set prefix [feature-define-name $module PKG_]
          134  +	get-define ${prefix}_${name} ""
          135  +}

Added autosetup/system.tcl.

            1  +# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# @synopsis:
            5  +#
            6  +# This module supports common system interrogation and options
            7  +# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
            8  +#
            9  +# It also support the "feature" naming convention, where searching
           10  +# for a feature such as 'sys/type.h' defines 'HAVE_SYS_TYPES_H'.
           11  +#
           12  +# It defines the following variables, based on '--prefix' unless overridden by the user:
           13  +#
           14  +## datadir
           15  +## sysconfdir
           16  +## sharedstatedir
           17  +## localstatedir
           18  +## infodir
           19  +## mandir
           20  +## includedir
           21  +#
           22  +# If '--prefix' is not supplied, it defaults to '/usr/local' unless 'defaultprefix' is defined *before*
           23  +# including the 'system' module.
           24  +
           25  +if {[is-defined defaultprefix]} {
           26  +	user-notice "Note: defaultprefix is deprecated. Use options-defaults to set default options"
           27  +	options-defaults [list prefix [get-define defaultprefix]]
           28  +}
           29  +
           30  +module-options [subst -noc -nob {
           31  +	host:host-alias =>		{a complete or partial cpu-vendor-opsys for the system where
           32  +							the application will run (defaults to the same value as --build)}
           33  +	build:build-alias =>	{a complete or partial cpu-vendor-opsys for the system
           34  +							where the application will be built (defaults to the
           35  +							result of running config.guess)}
           36  +	prefix:dir=/usr/local => {the target directory for the build (default: '@[email protected]')}
           37  +
           38  +	# These (hidden) options are supported for autoconf/automake compatibility
           39  +	exec-prefix:
           40  +	bindir:
           41  +	sbindir:
           42  +	includedir:
           43  +	mandir:
           44  +	infodir:
           45  +	libexecdir:
           46  +	datadir:
           47  +	libdir:
           48  +	sysconfdir:
           49  +	sharedstatedir:
           50  +	localstatedir:
           51  +	runstatedir:
           52  +	maintainer-mode=0
           53  +	dependency-tracking=0
           54  +	silent-rules=0
           55  +}]
           56  +
           57  +# @check-feature name { script }
           58  +#
           59  +# defines feature '$name' to the return value of '$script',
           60  +# which should be 1 if found or 0 if not found.
           61  +#
           62  +# e.g. the following will define 'HAVE_CONST' to 0 or 1.
           63  +#
           64  +## check-feature const {
           65  +##     cctest -code {const int _x = 0;}
           66  +## }
           67  +proc check-feature {name code} {
           68  +	msg-checking "Checking for $name..."
           69  +	set r [uplevel 1 $code]
           70  +	define-feature $name $r
           71  +	if {$r} {
           72  +		msg-result "ok"
           73  +	} else {
           74  +		msg-result "not found"
           75  +	}
           76  +	return $r
           77  +}
           78  +
           79  +# @have-feature name ?default=0?
           80  +#
           81  +# Returns the value of feature '$name' if defined, or '$default' if not.
           82  +#
           83  +# See 'feature-define-name' for how the "feature" name
           84  +# is translated into the "define" name.
           85  +#
           86  +proc have-feature {name {default 0}} {
           87  +	get-define [feature-define-name $name] $default
           88  +}
           89  +
           90  +# @define-feature name ?value=1?
           91  +#
           92  +# Sets the feature 'define' to '$value'.
           93  +#
           94  +# See 'feature-define-name' for how the "feature" name
           95  +# is translated into the "define" name.
           96  +#
           97  +proc define-feature {name {value 1}} {
           98  +	define [feature-define-name $name] $value
           99  +}
          100  +
          101  +# @feature-checked name
          102  +#
          103  +# Returns 1 if feature '$name' has been checked, whether true or not.
          104  +#
          105  +proc feature-checked {name} {
          106  +	is-defined [feature-define-name $name]
          107  +}
          108  +
          109  +# @feature-define-name name ?prefix=HAVE_?
          110  +#
          111  +# Converts a "feature" name to the corresponding "define",
          112  +# e.g. 'sys/stat.h' becomes 'HAVE_SYS_STAT_H'.
          113  +#
          114  +# Converts '*' to 'P' and all non-alphanumeric to underscore.
          115  +#
          116  +proc feature-define-name {name {prefix HAVE_}} {
          117  +	string toupper $prefix[regsub -all {[^a-zA-Z0-9]} [regsub -all {[*]} $name p] _]
          118  +}
          119  +
          120  +# @write-if-changed filename contents ?script?
          121  +#
          122  +# If '$filename' doesn't exist, or it's contents are different to '$contents',
          123  +# the file is written and '$script' is evaluated.
          124  +#
          125  +# Otherwise a "file is unchanged" message is displayed.
          126  +proc write-if-changed {file buf {script {}}} {
          127  +	set old [readfile $file ""]
          128  +	if {$old eq $buf && [file exists $file]} {
          129  +		msg-result "$file is unchanged"
          130  +	} else {
          131  +		writefile $file $buf\n
          132  +		uplevel 1 $script
          133  +	}
          134  +}
          135  +
          136  +# @make-template template ?outfile?
          137  +#
          138  +# Reads the input file '<srcdir>/$template' and writes the output file '$outfile'
          139  +# (unless unchanged).
          140  +# If '$outfile' is blank/omitted, '$template' should end with '.in' which
          141  +# is removed to create the output file name.
          142  +#
          143  +# Each pattern of the form '@[email protected]' is replaced with the corresponding
          144  +# "define", if it exists, or left unchanged if not.
          145  +#
          146  +# The special value '@[email protected]' is substituted with the relative
          147  +# path to the source directory from the directory where the output
          148  +# file is created, while the special value '@[email protected]' is substituted
          149  +# with the relative path to the top level source directory.
          150  +#
          151  +# Conditional sections may be specified as follows:
          152  +## @if NAME eq "value"
          153  +## lines
          154  +## @else
          155  +## lines
          156  +## @endif
          157  +#
          158  +# Where 'NAME' is a defined variable name and '@else' is optional.
          159  +# Note that variables names *must* start with an uppercase letter.
          160  +# If the expression does not match, all lines through '@endif' are ignored.
          161  +#
          162  +# The alternative forms may also be used:
          163  +## @if NAME  (true if the variable is defined, but not empty and not "0")
          164  +## @if !NAME  (opposite of the form above)
          165  +## @if <general-tcl-expression>
          166  +#
          167  +# In the general Tcl expression, any words beginning with an uppercase letter
          168  +# are translated into [get-define NAME]
          169  +#
          170  +# Expressions may be nested
          171  +#
          172  +proc make-template {template {out {}}} {
          173  +	set infile [file join $::autosetup(srcdir) $template]
          174  +
          175  +	if {![file exists $infile]} {
          176  +		user-error "Template $template is missing"
          177  +	}
          178  +
          179  +	# Define this as late as possible
          180  +	define AUTODEPS $::autosetup(deps)
          181  +
          182  +	if {$out eq ""} {
          183  +		if {[file ext $template] ne ".in"} {
          184  +			autosetup-error "make_template $template has no target file and can't guess"
          185  +		}
          186  +		set out [file rootname $template]
          187  +	}
          188  +
          189  +	set outdir [file dirname $out]
          190  +
          191  +	# Make sure the directory exists
          192  +	file mkdir $outdir
          193  +
          194  +	# Set up srcdir and top_srcdir to be relative to the target dir
          195  +	define srcdir [relative-path [file join $::autosetup(srcdir) $outdir] $outdir]
          196  +	define top_srcdir [relative-path $::autosetup(srcdir) $outdir]
          197  +
          198  +	set mapping {}
          199  +	foreach {n v} [array get ::define] {
          200  +		lappend mapping @[email protected] $v
          201  +	}
          202  +
          203  +	# A stack of true/false conditions, one for each nested conditional
          204  +	# starting with "true"
          205  +	set condstack {1}
          206  +	set result {}
          207  +	set linenum 0
          208  +	foreach line [split [readfile $infile] \n] {
          209  +		incr linenum
          210  +		if {[regexp {^@(if|else|endif)\s*(.*)} $line -> condtype condargs]} {
          211  +			if {$condtype eq "if"} {
          212  +				if {[llength $condargs] == 1} {
          213  +					# ABC => [get-define ABC] ni {0 ""}
          214  +					# !ABC => [get-define ABC] in {0 ""}
          215  +					lassign $condargs condvar
          216  +					if {[regexp {^!(.*)} $condvar -> condvar]} {
          217  +						set op in
          218  +					} else {
          219  +						set op ni
          220  +					}
          221  +					set condexpr "\[[list get-define $condvar]\] $op {0 {}}"
          222  +				} else {
          223  +					# Translate alphanumeric ABC into [get-define ABC] and leave the
          224  +					# rest of the expression untouched
          225  +					regsub -all {([A-Z][[:alnum:]_]*)} $condargs {[get-define \1]} condexpr
          226  +				}
          227  +				if {[catch [list expr $condexpr] condval]} {
          228  +					dputs $condval
          229  +					autosetup-error "$infile:$linenum: Invalid expression: $line"
          230  +				}
          231  +				dputs "@$condtype: $condexpr => $condval"
          232  +			}
          233  +			if {$condtype ne "if" && [llength $condstack] <= 1} {
          234  +				autosetup-error "$infile:$linenum: Error: @$condtype missing @if"
          235  +			}
          236  +			switch -exact $condtype {
          237  +				if {
          238  +					# push condval
          239  +					lappend condstack $condval
          240  +				}
          241  +				else {
          242  +					# Toggle the last entry
          243  +					set condval [lpop condstack]
          244  +					set condval [expr {!$condval}]
          245  +					lappend condstack $condval
          246  +				}
          247  +				endif {
          248  +					if {[llength $condstack] == 0} {
          249  +						user-notice "$infile:$linenum: Error: @endif missing @if"
          250  +					}
          251  +					lpop condstack
          252  +				}
          253  +			}
          254  +			continue
          255  +		}
          256  +		# Only output this line if the stack contains all "true"
          257  +		if {"0" in $condstack} {
          258  +			continue
          259  +		}
          260  +		lappend result $line
          261  +	}
          262  +	write-if-changed $out [string map $mapping [join $result \n]] {
          263  +		msg-result "Created [relative-path $out] from [relative-path $template]"
          264  +	}
          265  +}
          266  +
          267  +# build/host tuples and cross-compilation prefix
          268  +opt-str build build ""
          269  +define build_alias $build
          270  +if {$build eq ""} {
          271  +	define build [config_guess]
          272  +} else {
          273  +	define build [config_sub $build]
          274  +}
          275  +
          276  +opt-str host host ""
          277  +define host_alias $host
          278  +if {$host eq ""} {
          279  +	define host [get-define build]
          280  +	set cross ""
          281  +} else {
          282  +	define host [config_sub $host]
          283  +	set cross $host-
          284  +}
          285  +define cross [get-env CROSS $cross]
          286  +
          287  +# build/host _cpu, _vendor and _os
          288  +foreach type {build host} {
          289  +	set v [get-define $type]
          290  +	if {![regexp {^([^-]+)-([^-]+)-(.*)$} $v -> cpu vendor os]} {
          291  +		user-error "Invalid canonical $type: $v"
          292  +	}
          293  +	define ${type}_cpu $cpu
          294  +	define ${type}_vendor $vendor
          295  +	define ${type}_os $os
          296  +}
          297  +
          298  +opt-str prefix prefix /usr/local
          299  +
          300  +# These are for compatibility with autoconf
          301  +define target [get-define host]
          302  +define prefix $prefix
          303  +define builddir $autosetup(builddir)
          304  +define srcdir $autosetup(srcdir)
          305  +define top_srcdir $autosetup(srcdir)
          306  +define abs_top_srcdir [file-normalize $autosetup(srcdir)]
          307  +define abs_top_builddir [file-normalize $autosetup(builddir)]
          308  +
          309  +# autoconf supports all of these
          310  +define exec_prefix [opt-str exec-prefix exec_prefix $prefix]
          311  +foreach {name defpath} {
          312  +	bindir /bin
          313  +	sbindir /sbin
          314  +	libexecdir /libexec
          315  +	libdir /lib
          316  +} {
          317  +	define $name [opt-str $name o $exec_prefix$defpath]
          318  +}
          319  +foreach {name defpath} {
          320  +	datadir /share
          321  +	sharedstatedir /com
          322  +	infodir /share/info
          323  +	mandir /share/man
          324  +	includedir /include
          325  +} {
          326  +	define $name [opt-str $name o $prefix$defpath]
          327  +}
          328  +if {$prefix ne {/usr}} {
          329  +	opt-str sysconfdir sysconfdir $prefix/etc
          330  +} else {
          331  +	opt-str sysconfdir sysconfdir /etc
          332  +}
          333  +define sysconfdir $sysconfdir
          334  +
          335  +define localstatedir [opt-str localstatedir o /var]
          336  +define runstatedir [opt-str runstatedir o /run]
          337  +
          338  +define SHELL [get-env SHELL [find-an-executable sh bash ksh]]
          339  +
          340  +# These could be used to generate Makefiles following some automake conventions
          341  +define AM_SILENT_RULES [opt-bool silent-rules]
          342  +define AM_MAINTAINER_MODE [opt-bool maintainer-mode]
          343  +define AM_DEPENDENCY_TRACKING [opt-bool dependency-tracking]
          344  +
          345  +# Windows vs. non-Windows
          346  +switch -glob -- [get-define host] {
          347  +	*-*-ming* - *-*-cygwin - *-*-msys {
          348  +		define-feature windows
          349  +		define EXEEXT .exe
          350  +	}
          351  +	default {
          352  +		define EXEEXT ""
          353  +	}
          354  +}
          355  +
          356  +# Display
          357  +msg-result "Host System...[get-define host]"
          358  +msg-result "Build System...[get-define build]"

Added autosetup/tmake.auto.

            1  +# Copyright (c) 2016 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# Auto-load module for 'tmake' build system integration
            5  +
            6  +use init
            7  +
            8  +autosetup_add_init_type tmake "Tcl-based tmake build system" {
            9  +	autosetup_check_create auto.def \
           10  +{# Initial auto.def created by 'autosetup --init=tmake'
           11  +# vim:set syntax=tcl:
           12  +
           13  +use cc cc-lib cc-db cc-shared
           14  +use tmake
           15  +
           16  +# Add any user options here
           17  +# Really want a --configure that takes over the rest of the command line
           18  +options {
           19  +}
           20  +
           21  +cc-check-tools ar ranlib
           22  +
           23  +set objdir [get-env BUILDDIR objdir]
           24  +
           25  +make-config-header $objdir/include/autoconf.h
           26  +make-tmake-settings $objdir/settings.conf {[A-Z]*} *dir lib_*
           27  +}
           28  +
           29  +	autosetup_check_create project.spec \
           30  +{# Initial project.spec created by 'autosetup --init=tmake'
           31  +
           32  +tmake-require-version 0.7.3
           33  +
           34  +# vim:set syntax=tcl:
           35  +define? DESTDIR _install
           36  +
           37  +# XXX If configure creates additional/different files than include/autoconf.h
           38  +#     that should be reflected here
           39  +Autosetup include/autoconf.h
           40  +
           41  +# e.g. for autoconf.h
           42  +IncludePaths include
           43  +
           44  +ifconfig !CONFIGURED {
           45  +	# Not configured, so don't process subdirs
           46  +	AutoSubDirs off
           47  +	# And don't process this file any further
           48  +	ifconfig false
           49  +}
           50  +}
           51  +
           52  +	if {![file exists build.spec]} {
           53  +		puts "Note: I don't see build.spec. Try running: tmake --genie"
           54  +	}
           55  +}

Added autosetup/tmake.tcl.

            1  +# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
            2  +# All rights reserved
            3  +
            4  +# @synopsis:
            5  +#
            6  +# The 'tmake' module makes it easy to support the tmake build system.
            7  +#
            8  +# The following variables are set:
            9  +#
           10  +## CONFIGURED  - to indicate that the project is configured
           11  +
           12  +use system
           13  +
           14  +module-options {}
           15  +
           16  +define CONFIGURED
           17  +
           18  +# @make-tmake-settings outfile patterns ...
           19  +#
           20  +# Examines all defined variables which match the given patterns (defaults to '*')
           21  +# and writes a tmake-compatible .conf file defining those variables.
           22  +# For example, if 'ABC' is '"3 monkeys"' and 'ABC' matches a pattern, then the file will include:
           23  +#
           24  +## define ABC {3 monkeys}
           25  +#
           26  +# If the file would be unchanged, it is not written.
           27  +#
           28  +# Typical usage is:
           29  +#
           30  +## make-tmake-settings [get-env BUILDDIR objdir]/settings.conf {[A-Z]*}
           31  +proc make-tmake-settings {file args} {
           32  +	file mkdir [file dirname $file]
           33  +	set lines {}
           34  +
           35  +	if {[llength $args] == 0} {
           36  +		set args *
           37  +	}
           38  +
           39  +	foreach n [lsort [dict keys [all-defines]]] {
           40  +		foreach p $args {
           41  +			if {[string match $p $n]} {
           42  +				set value [get-define $n]
           43  +				lappend lines "define $n [list $value]"
           44  +				break
           45  +			}
           46  +		}
           47  +	}
           48  +	set buf [join $lines \n]
           49  +	write-if-changed $file $buf {
           50  +		msg-result "Created $file"
           51  +	}
           52  +}

Added config.tcl.in.

            1  +###
            2  +# Tcl Parsable version of data from xxxConfig.sh
            3  +###
            4  +name {@[email protected]}
            5  +version {@[email protected]}
            6  +libfile {@[email protected]}
            7  +srcdir  {@[email protected]}
            8  +prefix  {@[email protected]}
            9  +exec_prefix {@[email protected]}
           10  +exeext  {@[email protected]}
           11  +tk      {@[email protected]}
           12  +
           13  +bindir {@[email protected]}
           14  +libdir {@[email protected]}
           15  +includedir {@[email protected]}
           16  +datarootdir	{@[email protected]}
           17  +datadir {@[email protected]}
           18  +mandir  {@[email protected]}
           19  +cleanfiles {@[email protected]}
           20  +
           21  +TCLSH {@[email protected]}
           22  +
           23  +AR		{@[email protected]}
           24  +CC		{@[email protected]}
           25  +CFLAGS          {@[email protected]}
           26  +CFLAGS_DEBUG	{@[email protected]}
           27  +CFLAGS_OPTIMIZE	{@[email protected]}
           28  +CFLAGS_DEFAULT	{@[email protected]}
           29  +CFLAGS_WARNING	{@[email protected]}
           30  +CPPFLAGS        {@[email protected]}
           31  +DEFS  {@[email protected] @[email protected]}
           32  +EXEEXT		{@[email protected]}
           33  +LDFLAGS {@[email protected]}
           34  +LDFLAGS_DEFAULT	{@[email protected]}
           35  +LIBS    {@[email protected] @[email protected]}
           36  +MAKE_LIB	{@[email protected]}
           37  +MAKE_SHARED_LIB	{@[email protected]}
           38  +MAKE_STATIC_LIB	{@[email protected]}
           39  +MAKE_STUB_LIB	{@[email protected]}
           40  +OBJEXT		{@[email protected]}
           41  +PKG_CFLAGS      {@[email protected]}
           42  +RANLIB		{@[email protected]}
           43  +RANLIB_STUB	{@[email protected]}
           44  +
           45  +SHELL           {@[email protected]}
           46  +
           47  +SHARED_BUILD  {@[email protected]}
           48  +
           49  +SHLIB_CFLAGS	{@[email protected]}
           50  +SHLIB_LD	{@[email protected]}
           51  +SHLIB_LD_LIBS	{@[email protected]}
           52  +SHLIB_SUFFIX  {@[email protected]}
           53  +STLIB_LD	{@[email protected]}
           54  +TCL_DEFS	{@[email protected]}
           55  +TCL_VERSION {@[email protected]}
           56  +TCL_PATCH_LEVEL {@[email protected]}
           57  +TCL_BIN_DIR	{@[email protected]}
           58  +TCL_SRC_DIR	{@[email protected]}
           59  +
           60  +TK_VERSION {@[email protected]}
           61  +TK_PATCH_LEVEL {@[email protected]}
           62  +TK_BIN_DIR	{@[email protected]}
           63  +TK_SRC_DIR	{@[email protected]}
           64  +
           65  +TEA_TK_EXTENSION {@[email protected]}
           66  +TEA_PRIVATE_TCL_HEADERS {@[email protected]}
           67  +TEA_PRIVATE_TK_HEADERS  {@[email protected]}
           68  +
           69  +TEA_PLATFORM {@[email protected]}
           70  +TEA_WINDOWINGSYSTEM {@[email protected]}
           71  +TEA_SYSTEM {@[email protected]}
           72  +TEACUP_OS {@[email protected]}
           73  +TEACUP_ARCH {@[email protected]}
           74  +TEACUP_TOOLSET {@[email protected]}
           75  +TEACUP_PROFILE {@[email protected]}
           76  +TEACUP_ZIPFILE {@[email protected]@[email protected]@[email protected]}
           77  +
           78  +PRACTCL_DEFS {@[email protected]}
           79  +PRACTCL_TOOLSET {@[email protected]}
           80  +PRACTCL_SHARED_LIB {@[email protected]}
           81  +PRACTCL_STATIC_LIB {@[email protected]}
           82  +PRACTCL_STUB_LIB {@[email protected]}
           83  +PRACTCL_LIBS {@[email protected] @[email protected]}
           84  +PRACTCL_VC_MANIFEST_EMBED_DLL {@[email protected]}
           85  +PRACTCL_VC_MANIFEST_EMBED_EXE {@P[email protected]}
           86  +PRACTCL_NAME_LIBRARY {@[email protected]}
           87  +
           88  +PRACTCL_PKG_LIBS {@[email protected]}

Changes to configure.

     1         -#! /bin/sh
     2         -# Guess values for system-dependent variables and create Makefiles.
     3         -# Generated by GNU Autoconf 2.69 for sample 0.6.
     4         -#
     5         -#
     6         -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
     7         -#
     8         -#
     9         -# This configure script is free software; the Free Software Foundation
    10         -# gives unlimited permission to copy, distribute and modify it.
    11         -## -------------------- ##
    12         -## M4sh Initialization. ##
    13         -## -------------------- ##
    14         -
    15         -# Be more Bourne compatible
    16         -DUALCASE=1; export DUALCASE # for MKS sh
    17         -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
    18         -  emulate sh
    19         -  NULLCMD=:
    20         -  # Pre-4.2 versions of Zsh do word splitting on ${1+"[email protected]"}, which
    21         -  # is contrary to our usage.  Disable this feature.
    22         -  alias -g '${1+"[email protected]"}'='"[email protected]"'
    23         -  setopt NO_GLOB_SUBST
    24         -else
    25         -  case `(set -o) 2>/dev/null` in #(
    26         -  *posix*) :
    27         -    set -o posix ;; #(
    28         -  *) :
    29         -     ;;
    30         -esac
    31         -fi
    32         -
    33         -
    34         -as_nl='
    35         -'
    36         -export as_nl
    37         -# Printing a long string crashes Solaris 7 /usr/bin/printf.
    38         -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
    39         -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
    40         -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
    41         -# Prefer a ksh shell builtin over an external printf program on Solaris,
    42         -# but without wasting forks for bash or zsh.
    43         -if test -z "$BASH_VERSION$ZSH_VERSION" \
    44         -    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
    45         -  as_echo='print -r --'
    46         -  as_echo_n='print -rn --'
    47         -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
    48         -  as_echo='printf %s\n'
    49         -  as_echo_n='printf %s'
    50         -else
    51         -  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
    52         -    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
    53         -    as_echo_n='/usr/ucb/echo -n'
    54         -  else
    55         -    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
    56         -    as_echo_n_body='eval
    57         -      arg=$1;
    58         -      case $arg in #(
    59         -      *"$as_nl"*)
    60         -	expr "X$arg" : "X\\(.*\\)$as_nl";
    61         -	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
    62         -      esac;
    63         -      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
    64         -    '
    65         -    export as_echo_n_body
    66         -    as_echo_n='sh -c $as_echo_n_body as_echo'
    67         -  fi
    68         -  export as_echo_body
    69         -  as_echo='sh -c $as_echo_body as_echo'
    70         -fi
    71         -
    72         -# The user is always right.
    73         -if test "${PATH_SEPARATOR+set}" != set; then
    74         -  PATH_SEPARATOR=:
    75         -  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
    76         -    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
    77         -      PATH_SEPARATOR=';'
    78         -  }
    79         -fi
    80         -
    81         -
    82         -# IFS
    83         -# We need space, tab and new line, in precisely that order.  Quoting is
    84         -# there to prevent editors from complaining about space-tab.
    85         -# (If _AS_PATH_WALK were called with IFS unset, it would disable word
    86         -# splitting by setting IFS to empty value.)
    87         -IFS=" ""	$as_nl"
    88         -
    89         -# Find who we are.  Look in the path if we contain no directory separator.
    90         -as_myself=
    91         -case $0 in #((
    92         -  *[\\/]* ) as_myself=$0 ;;
    93         -  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
    94         -for as_dir in $PATH
    95         -do
    96         -  IFS=$as_save_IFS
    97         -  test -z "$as_dir" && as_dir=.
    98         -    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
    99         -  done
   100         -IFS=$as_save_IFS
   101         -
   102         -     ;;
   103         -esac
   104         -# We did not find ourselves, most probably we were run as `sh COMMAND'
   105         -# in which case we are not to be found in the path.
   106         -if test "x$as_myself" = x; then
   107         -  as_myself=$0
   108         -fi
   109         -if test ! -f "$as_myself"; then
   110         -  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
   111         -  exit 1
   112         -fi
   113         -
   114         -# Unset variables that we do not need and which cause bugs (e.g. in
   115         -# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
   116         -# suppresses any "Segmentation fault" message there.  '((' could
   117         -# trigger a bug in pdksh 5.2.14.
   118         -for as_var in BASH_ENV ENV MAIL MAILPATH
   119         -do eval test x\${$as_var+set} = xset \
   120         -  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
   121         -done
   122         -PS1='$ '
   123         -PS2='> '
   124         -PS4='+ '
   125         -
   126         -# NLS nuisances.
   127         -LC_ALL=C
   128         -export LC_ALL
   129         -LANGUAGE=C
   130         -export LANGUAGE
   131         -
   132         -# CDPATH.
   133         -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
   134         -
   135         -# Use a proper internal environment variable to ensure we don't fall
   136         -  # into an infinite loop, continuously re-executing ourselves.
   137         -  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
   138         -    _as_can_reexec=no; export _as_can_reexec;
   139         -    # We cannot yet assume a decent shell, so we have to provide a
   140         -# neutralization value for shells without unset; and this also
   141         -# works around shells that cannot unset nonexistent variables.
   142         -# Preserve -v and -x to the replacement shell.
   143         -BASH_ENV=/dev/null
   144         -ENV=/dev/null
   145         -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
   146         -case $- in # ((((
   147         -  *v*x* | *x*v* ) as_opts=-vx ;;
   148         -  *v* ) as_opts=-v ;;
   149         -  *x* ) as_opts=-x ;;
   150         -  * ) as_opts= ;;
   151         -esac
   152         -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"[email protected]"}
   153         -# Admittedly, this is quite paranoid, since all the known shells bail
   154         -# out after a failed `exec'.
   155         -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
   156         -as_fn_exit 255
   157         -  fi
   158         -  # We don't want this to propagate to other subprocesses.
   159         -          { _as_can_reexec=; unset _as_can_reexec;}
   160         -if test "x$CONFIG_SHELL" = x; then
   161         -  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   162         -  emulate sh
   163         -  NULLCMD=:
   164         -  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\[email protected]\"}, which
   165         -  # is contrary to our usage.  Disable this feature.
   166         -  alias -g '\${1+\"\[email protected]\"}'='\"\[email protected]\"'
   167         -  setopt NO_GLOB_SUBST
   168         -else
   169         -  case \`(set -o) 2>/dev/null\` in #(
   170         -  *posix*) :
   171         -    set -o posix ;; #(
   172         -  *) :
   173         -     ;;
   174         -esac
   175         -fi
   176         -"
   177         -  as_required="as_fn_return () { (exit \$1); }
   178         -as_fn_success () { as_fn_return 0; }
   179         -as_fn_failure () { as_fn_return 1; }
   180         -as_fn_ret_success () { return 0; }
   181         -as_fn_ret_failure () { return 1; }
   182         -
   183         -exitcode=0
   184         -as_fn_success || { exitcode=1; echo as_fn_success failed.; }
   185         -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
   186         -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
   187         -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
   188         -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
   189         -
   190         -else
   191         -  exitcode=1; echo positional parameters were not saved.
   192         -fi
   193         -test x\$exitcode = x0 || exit 1
   194         -test -x / || exit 1"
   195         -  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   196         -  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   197         -  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
   198         -  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
   199         -test \$(( 1 + 1 )) = 2 || exit 1"
   200         -  if (eval "$as_required") 2>/dev/null; then :
   201         -  as_have_required=yes
   202         -else
   203         -  as_have_required=no
   204         -fi
   205         -  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
   206         -
   207         -else
   208         -  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
   209         -as_found=false
   210         -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
   211         -do
   212         -  IFS=$as_save_IFS
   213         -  test -z "$as_dir" && as_dir=.
   214         -  as_found=:
   215         -  case $as_dir in #(
   216         -	 /*)
   217         -	   for as_base in sh bash ksh sh5; do
   218         -	     # Try only shells that exist, to save several forks.
   219         -	     as_shell=$as_dir/$as_base
   220         -	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
   221         -		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
   222         -  CONFIG_SHELL=$as_shell as_have_required=yes
   223         -		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
   224         -  break 2
   225         -fi
   226         -fi
   227         -	   done;;
   228         -       esac
   229         -  as_found=false
   230         -done
   231         -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
   232         -	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
   233         -  CONFIG_SHELL=$SHELL as_have_required=yes
   234         -fi; }
   235         -IFS=$as_save_IFS
   236         -
   237         -
   238         -      if test "x$CONFIG_SHELL" != x; then :
   239         -  export CONFIG_SHELL
   240         -             # We cannot yet assume a decent shell, so we have to provide a
   241         -# neutralization value for shells without unset; and this also
   242         -# works around shells that cannot unset nonexistent variables.
   243         -# Preserve -v and -x to the replacement shell.
   244         -BASH_ENV=/dev/null
   245         -ENV=/dev/null
   246         -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
   247         -case $- in # ((((
   248         -  *v*x* | *x*v* ) as_opts=-vx ;;
   249         -  *v* ) as_opts=-v ;;
   250         -  *x* ) as_opts=-x ;;
   251         -  * ) as_opts= ;;
   252         -esac
   253         -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"[email protected]"}
   254         -# Admittedly, this is quite paranoid, since all the known shells bail
   255         -# out after a failed `exec'.
   256         -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
   257         -exit 255
   258         -fi
   259         -
   260         -    if test x$as_have_required = xno; then :
   261         -  $as_echo "$0: This script requires a shell more modern than all"
   262         -  $as_echo "$0: the shells that I found on your system."
   263         -  if test x${ZSH_VERSION+set} = xset ; then
   264         -    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
   265         -    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   266         -  else
   267         -    $as_echo "$0: Please tell [email protected] about your system,
   268         -$0: including any error possibly output before this
   269         -$0: message. Then install a modern shell, or manually run
   270         -$0: the script under such a shell if you do have one."
   271         -  fi
   272         -  exit 1
   273         -fi
   274         -fi
   275         -fi
   276         -SHELL=${CONFIG_SHELL-/bin/sh}
   277         -export SHELL
   278         -# Unset more variables known to interfere with behavior of common tools.
   279         -CLICOLOR_FORCE= GREP_OPTIONS=
   280         -unset CLICOLOR_FORCE GREP_OPTIONS
   281         -
   282         -## --------------------- ##
   283         -## M4sh Shell Functions. ##
   284         -## --------------------- ##
   285         -# as_fn_unset VAR
   286         -# ---------------
   287         -# Portably unset VAR.
   288         -as_fn_unset ()
   289         -{
   290         -  { eval $1=; unset $1;}
   291         -}
   292         -as_unset=as_fn_unset
   293         -
   294         -# as_fn_set_status STATUS
   295         -# -----------------------
   296         -# Set $? to STATUS, without forking.
   297         -as_fn_set_status ()
   298         -{
   299         -  return $1
   300         -} # as_fn_set_status
   301         -
   302         -# as_fn_exit STATUS
   303         -# -----------------
   304         -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
   305         -as_fn_exit ()
   306         -{
   307         -  set +e
   308         -  as_fn_set_status $1
   309         -  exit $1
   310         -} # as_fn_exit
   311         -
   312         -# as_fn_mkdir_p
   313         -# -------------
   314         -# Create "$as_dir" as a directory, including parents if necessary.
   315         -as_fn_mkdir_p ()
   316         -{
   317         -
   318         -  case $as_dir in #(
   319         -  -*) as_dir=./$as_dir;;
   320         -  esac
   321         -  test -d "$as_dir" || eval $as_mkdir_p || {
   322         -    as_dirs=
   323         -    while :; do
   324         -      case $as_dir in #(
   325         -      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
   326         -      *) as_qdir=$as_dir;;
   327         -      esac
   328         -      as_dirs="'$as_qdir' $as_dirs"
   329         -      as_dir=`$as_dirname -- "$as_dir" ||
   330         -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
   331         -	 X"$as_dir" : 'X\(//\)[^/]' \| \
   332         -	 X"$as_dir" : 'X\(//\)$' \| \
   333         -	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
   334         -$as_echo X"$as_dir" |
   335         -    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
   336         -	    s//\1/
   337         -	    q
   338         -	  }
   339         -	  /^X\(\/\/\)[^/].*/{
   340         -	    s//\1/
   341         -	    q
   342         -	  }
   343         -	  /^X\(\/\/\)$/{
   344         -	    s//\1/
   345         -	    q
   346         -	  }
   347         -	  /^X\(\/\).*/{
   348         -	    s//\1/
   349         -	    q
   350         -	  }
   351         -	  s/.*/./; q'`
   352         -      test -d "$as_dir" && break
   353         -    done
   354         -    test -z "$as_dirs" || eval "mkdir $as_dirs"
   355         -  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
   356         -
   357         -
   358         -} # as_fn_mkdir_p
   359         -
   360         -# as_fn_executable_p FILE
   361         -# -----------------------
   362         -# Test if FILE is an executable regular file.
   363         -as_fn_executable_p ()
   364         -{
   365         -  test -f "$1" && test -x "$1"
   366         -} # as_fn_executable_p
   367         -# as_fn_append VAR VALUE
   368         -# ----------------------
   369         -# Append the text in VALUE to the end of the definition contained in VAR. Take
   370         -# advantage of any shell optimizations that allow amortized linear growth over
   371         -# repeated appends, instead of the typical quadratic growth present in naive
   372         -# implementations.
   373         -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
   374         -  eval 'as_fn_append ()
   375         -  {
   376         -    eval $1+=\$2
   377         -  }'
   378         -else
   379         -  as_fn_append ()
   380         -  {
   381         -    eval $1=\$$1\$2
   382         -  }
   383         -fi # as_fn_append
   384         -
   385         -# as_fn_arith ARG...
   386         -# ------------------
   387         -# Perform arithmetic evaluation on the ARGs, and store the result in the
   388         -# global $as_val. Take advantage of shells that can avoid forks. The arguments
   389         -# must be portable across $(()) and expr.
   390         -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
   391         -  eval 'as_fn_arith ()
   392         -  {
   393         -    as_val=$(( $* ))
   394         -  }'
   395         -else
   396         -  as_fn_arith ()
   397         -  {
   398         -    as_val=`expr "[email protected]" || test $? -eq 1`
   399         -  }
   400         -fi # as_fn_arith
   401         -
   402         -
   403         -# as_fn_error STATUS ERROR [LINENO LOG_FD]
   404         -# ----------------------------------------
   405         -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
   406         -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
   407         -# script with STATUS, using 1 if that was 0.
   408         -as_fn_error ()
   409         -{
   410         -  as_status=$1; test $as_status -eq 0 && as_status=1
   411         -  if test "$4"; then
   412         -    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
   413         -    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
   414         -  fi
   415         -  $as_echo "$as_me: error: $2" >&2
   416         -  as_fn_exit $as_status
   417         -} # as_fn_error
   418         -
   419         -if expr a : '\(a\)' >/dev/null 2>&1 &&
   420         -   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   421         -  as_expr=expr
   422         -else
   423         -  as_expr=false
   424         -fi
   425         -
   426         -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
   427         -  as_basename=basename
   428         -else
   429         -  as_basename=false
   430         -fi
   431         -
   432         -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
   433         -  as_dirname=dirname
   434         -else
   435         -  as_dirname=false
   436         -fi
   437         -
   438         -as_me=`$as_basename -- "$0" ||
   439         -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
   440         -	 X"$0" : 'X\(//\)$' \| \
   441         -	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
   442         -$as_echo X/"$0" |
   443         -    sed '/^.*\/\([^/][^/]*\)\/*$/{
   444         -	    s//\1/
   445         -	    q
   446         -	  }
   447         -	  /^X\/\(\/\/\)$/{
   448         -	    s//\1/
   449         -	    q
   450         -	  }
   451         -	  /^X\/\(\/\).*/{
   452         -	    s//\1/
   453         -	    q
   454         -	  }
   455         -	  s/.*/./; q'`
   456         -
   457         -# Avoid depending upon Character Ranges.
   458         -as_cr_letters='abcdefghijklmnopqrstuvwxyz'
   459         -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
   460         -as_cr_Letters=$as_cr_letters$as_cr_LETTERS
   461         -as_cr_digits='0123456789'
   462         -as_cr_alnum=$as_cr_Letters$as_cr_digits
   463         -
   464         -
   465         -  as_lineno_1=$LINENO as_lineno_1a=$LINENO
   466         -  as_lineno_2=$LINENO as_lineno_2a=$LINENO
   467         -  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
   468         -  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
   469         -  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
   470         -  sed -n '
   471         -    p
   472         -    /[$]LINENO/=
   473         -  ' <$as_myself |
   474         -    sed '
   475         -      s/[$]LINENO.*/&-/
   476         -      t lineno
   477         -      b
   478         -      :lineno
   479         -      N
   480         -      :loop
   481         -      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
   482         -      t loop
   483         -      s/-\n.*//
   484         -    ' >$as_me.lineno &&
   485         -  chmod +x "$as_me.lineno" ||
   486         -    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
   487         -
   488         -  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
   489         -  # already done that, so ensure we don't try to do so again and fall
   490         -  # in an infinite loop.  This has already happened in practice.
   491         -  _as_can_reexec=no; export _as_can_reexec
   492         -  # Don't try to exec as it changes $[0], causing all sort of problems
   493         -  # (the dirname of $[0] is not the place where we might find the
   494         -  # original and so on.  Autoconf is especially sensitive to this).
   495         -  . "./$as_me.lineno"
   496         -  # Exit status is that of the last command.
   497         -  exit
   498         -}
   499         -
   500         -ECHO_C= ECHO_N= ECHO_T=
   501         -case `echo -n x` in #(((((
   502         --n*)
   503         -  case `echo 'xy\c'` in
   504         -  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
   505         -  xy)  ECHO_C='\c';;
   506         -  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
   507         -       ECHO_T='	';;
   508         -  esac;;
   509         -*)
   510         -  ECHO_N='-n';;
   511         -esac
   512         -
   513         -rm -f conf$$ conf$$.exe conf$$.file
   514         -if test -d conf$$.dir; then
   515         -  rm -f conf$$.dir/conf$$.file
   516         -else
   517         -  rm -f conf$$.dir
   518         -  mkdir conf$$.dir 2>/dev/null
   519         -fi
   520         -if (echo >conf$$.file) 2>/dev/null; then
   521         -  if ln -s conf$$.file conf$$ 2>/dev/null; then
   522         -    as_ln_s='ln -s'
   523         -    # ... but there are two gotchas:
   524         -    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
   525         -    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
   526         -    # In both cases, we have to default to `cp -pR'.
   527         -    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
   528         -      as_ln_s='cp -pR'
   529         -  elif ln conf$$.file conf$$ 2>/dev/null; then
   530         -    as_ln_s=ln
   531         -  else
   532         -    as_ln_s='cp -pR'
   533         -  fi
   534         -else
   535         -  as_ln_s='cp -pR'
   536         -fi
   537         -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
   538         -rmdir conf$$.dir 2>/dev/null
   539         -
   540         -if mkdir -p . 2>/dev/null; then
   541         -  as_mkdir_p='mkdir -p "$as_dir"'
   542         -else
   543         -  test -d ./-p && rmdir ./-p
   544         -  as_mkdir_p=false
   545         -fi
   546         -
   547         -as_test_x='test -x'
   548         -as_executable_p=as_fn_executable_p
   549         -
   550         -# Sed expression to map a string onto a valid CPP name.
   551         -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
   552         -
   553         -# Sed expression to map a string onto a valid variable name.
   554         -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
   555         -
   556         -
   557         -test -n "$DJDIR" || exec 7<&0 </dev/null
   558         -exec 6>&1
   559         -
   560         -# Name of the host.
   561         -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
   562         -# so uname gets run too.
   563         -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
   564         -
   565         -#
   566         -# Initializations.
   567         -#
   568         -ac_default_prefix=/usr/local
   569         -ac_clean_files=
   570         -ac_config_libobj_dir=.
   571         -LIBOBJS=
   572         -cross_compiling=no
   573         -subdirs=
   574         -MFLAGS=
   575         -MAKEFLAGS=
   576         -
   577         -# Identity of this package.
   578         -PACKAGE_NAME='sample'
   579         -PACKAGE_TARNAME='sample'
   580         -PACKAGE_VERSION='0.6'
   581         -PACKAGE_STRING='sample 0.6'
   582         -PACKAGE_BUGREPORT=''
   583         -PACKAGE_URL=''
   584         -
   585         -# Factoring default headers for most tests.
   586         -ac_includes_default="\
   587         -#include <stdio.h>
   588         -#ifdef HAVE_SYS_TYPES_H
   589         -# include <sys/types.h>
   590         -#endif
   591         -#ifdef HAVE_SYS_STAT_H
   592         -# include <sys/stat.h>
   593         -#endif
   594         -#ifdef STDC_HEADERS
   595         -# include <stdlib.h>
   596         -# include <stddef.h>
   597         -#else
   598         -# ifdef HAVE_STDLIB_H
   599         -#  include <stdlib.h>
   600         -# endif
   601         -#endif
   602         -#ifdef HAVE_STRING_H
   603         -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
   604         -#  include <memory.h>
   605         -# endif
   606         -# include <string.h>
   607         -#endif
   608         -#ifdef HAVE_STRINGS_H
   609         -# include <strings.h>
   610         -#endif
   611         -#ifdef HAVE_INTTYPES_H
   612         -# include <inttypes.h>
   613         -#endif
   614         -#ifdef HAVE_STDINT_H
   615         -# include <stdint.h>
   616         -#endif
   617         -#ifdef HAVE_UNISTD_H
   618         -# include <unistd.h>
   619         -#endif"
   620         -
   621         -ac_subst_vars='LTLIBOBJS
   622         -LIBOBJS
   623         -TEACUP_PROFILE
   624         -TEACUP_TOOLSET
   625         -TEACUP_ARCH
   626         -TEACUP_OS
   627         -TEA_WINDOWINGSYSTEM
   628         -TEA_PLATFORM
   629         -TEA_SYSTEM
   630         -TCLSH_PROG
   631         -PRACTCL_NAME_LIBRARY
   632         -PRACTCL_VC_MANIFEST_EMBED_EXE
   633         -PRACTCL_VC_MANIFEST_EMBED_DLL
   634         -PRACTCL_STUB_LIB
   635         -PRACTCL_STATIC_LIB
   636         -PRACTCL_SHARED_LIB
   637         -PRACTCL_TOOLSET
   638         -PRACTCL_CFLAGS
   639         -VC_MANIFEST_EMBED_EXE
   640         -VC_MANIFEST_EMBED_DLL
   641         -RANLIB_STUB
   642         -MAKE_STUB_LIB
   643         -MAKE_STATIC_LIB
   644         -MAKE_SHARED_LIB
   645         -MAKE_LIB
   646         -TCL_DBGX
   647         -LDFLAGS_DEFAULT
   648         -CFLAGS_DEFAULT
   649         -LD_LIBRARY_PATH_VAR
   650         -SHLIB_CFLAGS
   651         -SHLIB_LD_LIBS
   652         -SHLIB_SUFFIX
   653         -SHLIB_LD
   654         -STLIB_LD
   655         -CFLAGS_WARNING
   656         -CFLAGS_OPTIMIZE
   657         -CFLAGS_DEBUG
   658         -RC
   659         -CELIB_DIR
   660         -AR
   661         -STUBS_BUILD
   662         -SHARED_BUILD
   663         -TCL_THREADS
   664         -TCL_INCLUDES
   665         -PKG_OBJECTS
   666         -PKG_SOURCES
   667         -EGREP
   668         -GREP
   669         -RANLIB
   670         -SET_MAKE
   671         -CPP
   672         -TCL_SHLIB_LD_LIBS
   673         -TCL_LD_FLAGS
   674         -TCL_EXTRA_CFLAGS
   675         -TCL_DEFS
   676         -TCL_LIBS
   677         -CLEANFILES
   678         -OBJEXT
   679         -ac_ct_CC
   680         -CPPFLAGS
   681         -LDFLAGS
   682         -CFLAGS
   683         -CC
   684         -TCL_STUB_LIB_SPEC
   685         -TCL_STUB_LIB_FLAG
   686         -TCL_STUB_LIB_FILE
   687         -TCL_LIB_SPEC
   688         -TCL_LIB_FLAG
   689         -TCL_LIB_FILE
   690         -TCL_SRC_DIR
   691         -TCL_BIN_DIR
   692         -TCL_PATCH_LEVEL
   693         -TCL_VERSION
   694         -CONFIG_CLEAN_FILES
   695         -LN_S
   696         -INSTALL_LIBRARY
   697         -INSTALL_SCRIPT
   698         -INSTALL_PROGRAM
   699         -INSTALL_DATA
   700         -INSTALL_DATA_DIR
   701         -INSTALL
   702         -PKG_CFLAGS
   703         -PKG_LIBS
   704         -PKG_INCLUDES
   705         -PKG_HEADERS
   706         -PKG_TCL_SOURCES
   707         -PKG_STUB_OBJECTS
   708         -PKG_STUB_SOURCES
   709         -PKG_STUB_LIB_FILE
   710         -PKG_LIB_FILE
   711         -EXEEXT
   712         -CYGPATH
   713         -TEA_TK_EXTENSION
   714         -target_alias
   715         -host_alias
   716         -build_alias
   717         -LIBS
   718         -ECHO_T
   719         -ECHO_N
   720         -ECHO_C
   721         -DEFS
   722         -mandir
   723         -localedir
   724         -libdir
   725         -psdir
   726         -pdfdir
   727         -dvidir
   728         -htmldir
   729         -infodir
   730         -docdir
   731         -oldincludedir
   732         -includedir
   733         -localstatedir
   734         -sharedstatedir
   735         -sysconfdir
   736         -datadir
   737         -datarootdir
   738         -libexecdir
   739         -sbindir
   740         -bindir
   741         -program_transform_name
   742         -prefix
   743         -exec_prefix
   744         -PACKAGE_URL
   745         -PACKAGE_BUGREPORT
   746         -PACKAGE_STRING
   747         -PACKAGE_VERSION
   748         -PACKAGE_TARNAME
   749         -PACKAGE_NAME
   750         -PATH_SEPARATOR
   751         -SHELL'
   752         -ac_subst_files=''
   753         -ac_user_opts='
   754         -enable_option_checking
   755         -with_tcl
   756         -with_tclinclude
   757         -enable_threads
   758         -enable_shared
   759         -enable_stubs
   760         -enable_64bit
   761         -enable_64bit_vis
   762         -enable_rpath
   763         -enable_wince
   764         -with_celib
   765         -enable_symbols
   766         -with_tclsh
   767         -'
   768         -      ac_precious_vars='build_alias
   769         -host_alias
   770         -target_alias
   771         -CC
   772         -CFLAGS
   773         -LDFLAGS
   774         -LIBS
   775         -CPPFLAGS
   776         -CPP'
   777         -
   778         -
   779         -# Initialize some variables set by options.
   780         -ac_init_help=
   781         -ac_init_version=false
   782         -ac_unrecognized_opts=
   783         -ac_unrecognized_sep=
   784         -# The variables have the same names as the options, with
   785         -# dashes changed to underlines.
   786         -cache_file=/dev/null
   787         -exec_prefix=NONE
   788         -no_create=
   789         -no_recursion=
   790         -prefix=NONE
   791         -program_prefix=NONE
   792         -program_suffix=NONE
   793         -program_transform_name=s,x,x,
   794         -silent=
   795         -site=
   796         -srcdir=
   797         -verbose=
   798         -x_includes=NONE
   799         -x_libraries=NONE
   800         -
   801         -# Installation directory options.
   802         -# These are left unexpanded so users can "make install exec_prefix=/foo"
   803         -# and all the variables that are supposed to be based on exec_prefix
   804         -# by default will actually change.
   805         -# Use braces instead of parens because sh, perl, etc. also accept them.
   806         -# (The list follows the same order as the GNU Coding Standards.)
   807         -bindir='${exec_prefix}/bin'
   808         -sbindir='${exec_prefix}/sbin'
   809         -libexecdir='${exec_prefix}/libexec'
   810         -datarootdir='${prefix}/share'
   811         -datadir='${datarootdir}'
   812         -sysconfdir='${prefix}/etc'
   813         -sharedstatedir='${prefix}/com'
   814         -localstatedir='${prefix}/var'
   815         -includedir='${prefix}/include'
   816         -oldincludedir='/usr/include'
   817         -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
   818         -infodir='${datarootdir}/info'
   819         -htmldir='${docdir}'
   820         -dvidir='${docdir}'
   821         -pdfdir='${docdir}'
   822         -psdir='${docdir}'
   823         -libdir='${exec_prefix}/lib'
   824         -localedir='${datarootdir}/locale'
   825         -mandir='${datarootdir}/man'
   826         -
   827         -ac_prev=
   828         -ac_dashdash=
   829         -for ac_option
   830         -do
   831         -  # If the previous option needs an argument, assign it.
   832         -  if test -n "$ac_prev"; then
   833         -    eval $ac_prev=\$ac_option
   834         -    ac_prev=
   835         -    continue
   836         -  fi
   837         -
   838         -  case $ac_option in
   839         -  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
   840         -  *=)   ac_optarg= ;;
   841         -  *)    ac_optarg=yes ;;
   842         -  esac
   843         -
   844         -  # Accept the important Cygnus configure options, so we can diagnose typos.
   845         -
   846         -  case $ac_dashdash$ac_option in
   847         -  --)
   848         -    ac_dashdash=yes ;;
   849         -
   850         -  -bindir | --bindir | --bindi | --bind | --bin | --bi)
   851         -    ac_prev=bindir ;;
   852         -  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
   853         -    bindir=$ac_optarg ;;
   854         -
   855         -  -build | --build | --buil | --bui | --bu)
   856         -    ac_prev=build_alias ;;
   857         -  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
   858         -    build_alias=$ac_optarg ;;
   859         -
   860         -  -cache-file | --cache-file | --cache-fil | --cache-fi \
   861         -  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
   862         -    ac_prev=cache_file ;;
   863         -  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
   864         -  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
   865         -    cache_file=$ac_optarg ;;
   866         -
   867         -  --config-cache | -C)
   868         -    cache_file=config.cache ;;
   869         -
   870         -  -datadir | --datadir | --datadi | --datad)
   871         -    ac_prev=datadir ;;
   872         -  -datadir=* | --datadir=* | --datadi=* | --datad=*)
   873         -    datadir=$ac_optarg ;;
   874         -
   875         -  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
   876         -  | --dataroo | --dataro | --datar)
   877         -    ac_prev=datarootdir ;;
   878         -  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
   879         -  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
   880         -    datarootdir=$ac_optarg ;;
   881         -
   882         -  -disable-* | --disable-*)
   883         -    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
   884         -    # Reject names that are not valid shell variable names.
   885         -    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
   886         -      as_fn_error $? "invalid feature name: $ac_useropt"
   887         -    ac_useropt_orig=$ac_useropt
   888         -    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
   889         -    case $ac_user_opts in
   890         -      *"
   891         -"enable_$ac_useropt"
   892         -"*) ;;
   893         -      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
   894         -	 ac_unrecognized_sep=', ';;
   895         -    esac
   896         -    eval enable_$ac_useropt=no ;;
   897         -
   898         -  -docdir | --docdir | --docdi | --doc | --do)
   899         -    ac_prev=docdir ;;
   900         -  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
   901         -    docdir=$ac_optarg ;;
   902         -
   903         -  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
   904         -    ac_prev=dvidir ;;
   905         -  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
   906         -    dvidir=$ac_optarg ;;
   907         -
   908         -  -enable-* | --enable-*)
   909         -    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
   910         -    # Reject names that are not valid shell variable names.
   911         -    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
   912         -      as_fn_error $? "invalid feature name: $ac_useropt"
   913         -    ac_useropt_orig=$ac_useropt
   914         -    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
   915         -    case $ac_user_opts in
   916         -      *"
   917         -"enable_$ac_useropt"
   918         -"*) ;;
   919         -      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
   920         -	 ac_unrecognized_sep=', ';;
   921         -    esac
   922         -    eval enable_$ac_useropt=\$ac_optarg ;;
   923         -
   924         -  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   925         -  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
   926         -  | --exec | --exe | --ex)
   927         -    ac_prev=exec_prefix ;;
   928         -  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
   929         -  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
   930         -  | --exec=* | --exe=* | --ex=*)
   931         -    exec_prefix=$ac_optarg ;;
   932         -
   933         -  -gas | --gas | --ga | --g)
   934         -    # Obsolete; use --with-gas.
   935         -    with_gas=yes ;;
   936         -
   937         -  -help | --help | --hel | --he | -h)
   938         -    ac_init_help=long ;;
   939         -  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
   940         -    ac_init_help=recursive ;;
   941         -  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
   942         -    ac_init_help=short ;;
   943         -
   944         -  -host | --host | --hos | --ho)
   945         -    ac_prev=host_alias ;;
   946         -  -host=* | --host=* | --hos=* | --ho=*)
   947         -    host_alias=$ac_optarg ;;
   948         -
   949         -  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
   950         -    ac_prev=htmldir ;;
   951         -  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
   952         -  | --ht=*)
   953         -    htmldir=$ac_optarg ;;
   954         -
   955         -  -includedir | --includedir | --includedi | --included | --include \
   956         -  | --includ | --inclu | --incl | --inc)
   957         -    ac_prev=includedir ;;
   958         -  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
   959         -  | --includ=* | --inclu=* | --incl=* | --inc=*)
   960         -    includedir=$ac_optarg ;;
   961         -
   962         -  -infodir | --infodir | --infodi | --infod | --info | --inf)
   963         -    ac_prev=infodir ;;
   964         -  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
   965         -    infodir=$ac_optarg ;;
   966         -
   967         -  -libdir | --libdir | --libdi | --libd)
   968         -    ac_prev=libdir ;;
   969         -  -libdir=* | --libdir=* | --libdi=* | --libd=*)
   970         -    libdir=$ac_optarg ;;
   971         -
   972         -  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
   973         -  | --libexe | --libex | --libe)
   974         -    ac_prev=libexecdir ;;
   975         -  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
   976         -  | --libexe=* | --libex=* | --libe=*)
   977         -    libexecdir=$ac_optarg ;;
   978         -
   979         -  -localedir | --localedir | --localedi | --localed | --locale)
   980         -    ac_prev=localedir ;;
   981         -  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
   982         -    localedir=$ac_optarg ;;
   983         -
   984         -  -localstatedir | --localstatedir | --localstatedi | --localstated \
   985         -  | --localstate | --localstat | --localsta | --localst | --locals)
   986         -    ac_prev=localstatedir ;;
   987         -  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
   988         -  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
   989         -    localstatedir=$ac_optarg ;;
   990         -
   991         -  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
   992         -    ac_prev=mandir ;;
   993         -  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
   994         -    mandir=$ac_optarg ;;
   995         -
   996         -  -nfp | --nfp | --nf)
   997         -    # Obsolete; use --without-fp.
   998         -    with_fp=no ;;
   999         -
  1000         -  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  1001         -  | --no-cr | --no-c | -n)
  1002         -    no_create=yes ;;
  1003         -
  1004         -  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  1005         -  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
  1006         -    no_recursion=yes ;;
  1007         -
  1008         -  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
  1009         -  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
  1010         -  | --oldin | --oldi | --old | --ol | --o)
  1011         -    ac_prev=oldincludedir ;;
  1012         -  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
  1013         -  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
  1014         -  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
  1015         -    oldincludedir=$ac_optarg ;;
  1016         -
  1017         -  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  1018         -    ac_prev=prefix ;;
  1019         -  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  1020         -    prefix=$ac_optarg ;;
  1021         -
  1022         -  -program-prefix | --program-prefix | --program-prefi | --program-pref \
  1023         -  | --program-pre | --program-pr | --program-p)
  1024         -    ac_prev=program_prefix ;;
  1025         -  -program-prefix=* | --program-prefix=* | --program-prefi=* \
  1026         -  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
  1027         -    program_prefix=$ac_optarg ;;
  1028         -
  1029         -  -program-suffix | --program-suffix | --program-suffi | --program-suff \
  1030         -  | --program-suf | --program-su | --program-s)
  1031         -    ac_prev=program_suffix ;;
  1032         -  -program-suffix=* | --program-suffix=* | --program-suffi=* \
  1033         -  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
  1034         -    program_suffix=$ac_optarg ;;
  1035         -
  1036         -  -program-transform-name | --program-transform-name \
  1037         -  | --program-transform-nam | --program-transform-na \
  1038         -  | --program-transform-n | --program-transform- \
  1039         -  | --program-transform | --program-transfor \
  1040         -  | --program-transfo | --program-transf \
  1041         -  | --program-trans | --program-tran \
  1042         -  | --progr-tra | --program-tr | --program-t)
  1043         -    ac_prev=program_transform_name ;;
  1044         -  -program-transform-name=* | --program-transform-name=* \
  1045         -  | --program-transform-nam=* | --program-transform-na=* \
  1046         -  | --program-transform-n=* | --program-transform-=* \
  1047         -  | --program-transform=* | --program-transfor=* \
  1048         -  | --program-transfo=* | --program-transf=* \
  1049         -  | --program-trans=* | --program-tran=* \
  1050         -  | --progr-tra=* | --program-tr=* | --program-t=*)
  1051         -    program_transform_name=$ac_optarg ;;
  1052         -
  1053         -  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
  1054         -    ac_prev=pdfdir ;;
  1055         -  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
  1056         -    pdfdir=$ac_optarg ;;
  1057         -
  1058         -  -psdir | --psdir | --psdi | --psd | --ps)
  1059         -    ac_prev=psdir ;;
  1060         -  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
  1061         -    psdir=$ac_optarg ;;
  1062         -
  1063         -  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  1064         -  | -silent | --silent | --silen | --sile | --sil)
  1065         -    silent=yes ;;
  1066         -
  1067         -  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
  1068         -    ac_prev=sbindir ;;
  1069         -  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
  1070         -  | --sbi=* | --sb=*)
  1071         -    sbindir=$ac_optarg ;;
  1072         -
  1073         -  -sharedstatedir | --sharedstatedir | --sharedstatedi \
  1074         -  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
  1075         -  | --sharedst | --shareds | --shared | --share | --shar \
  1076         -  | --sha | --sh)
  1077         -    ac_prev=sharedstatedir ;;
  1078         -  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
  1079         -  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
  1080         -  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
  1081         -  | --sha=* | --sh=*)
  1082         -    sharedstatedir=$ac_optarg ;;
  1083         -
  1084         -  -site | --site | --sit)
  1085         -    ac_prev=site ;;
  1086         -  -site=* | --site=* | --sit=*)
  1087         -    site=$ac_optarg ;;
  1088         -
  1089         -  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  1090         -    ac_prev=srcdir ;;
  1091         -  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  1092         -    srcdir=$ac_optarg ;;
  1093         -
  1094         -  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
  1095         -  | --syscon | --sysco | --sysc | --sys | --sy)
  1096         -    ac_prev=sysconfdir ;;
  1097         -  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
  1098         -  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
  1099         -    sysconfdir=$ac_optarg ;;
  1100         -
  1101         -  -target | --target | --targe | --targ | --tar | --ta | --t)
  1102         -    ac_prev=target_alias ;;
  1103         -  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
  1104         -    target_alias=$ac_optarg ;;
  1105         -
  1106         -  -v | -verbose | --verbose | --verbos | --verbo | --verb)
  1107         -    verbose=yes ;;
  1108         -
  1109         -  -version | --version | --versio | --versi | --vers | -V)
  1110         -    ac_init_version=: ;;
  1111         -
  1112         -  -with-* | --with-*)
  1113         -    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
  1114         -    # Reject names that are not valid shell variable names.
  1115         -    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
  1116         -      as_fn_error $? "invalid package name: $ac_useropt"
  1117         -    ac_useropt_orig=$ac_useropt
  1118         -    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
  1119         -    case $ac_user_opts in
  1120         -      *"
  1121         -"with_$ac_useropt"
  1122         -"*) ;;
  1123         -      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
  1124         -	 ac_unrecognized_sep=', ';;
  1125         -    esac
  1126         -    eval with_$ac_useropt=\$ac_optarg ;;
  1127         -
  1128         -  -without-* | --without-*)
  1129         -    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
  1130         -    # Reject names that are not valid shell variable names.
  1131         -    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
  1132         -      as_fn_error $? "invalid package name: $ac_useropt"
  1133         -    ac_useropt_orig=$ac_useropt
  1134         -    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
  1135         -    case $ac_user_opts in
  1136         -      *"
  1137         -"with_$ac_useropt"
  1138         -"*) ;;
  1139         -      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
  1140         -	 ac_unrecognized_sep=', ';;
  1141         -    esac
  1142         -    eval with_$ac_useropt=no ;;
  1143         -
  1144         -  --x)
  1145         -    # Obsolete; use --with-x.
  1146         -    with_x=yes ;;
  1147         -
  1148         -  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
  1149         -  | --x-incl | --x-inc | --x-in | --x-i)
  1150         -    ac_prev=x_includes ;;
  1151         -  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
  1152         -  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
  1153         -    x_includes=$ac_optarg ;;
  1154         -
  1155         -  -x-libraries | --x-libraries | --x-librarie | --x-librari \
  1156         -  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
  1157         -    ac_prev=x_libraries ;;
  1158         -  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
  1159         -  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
  1160         -    x_libraries=$ac_optarg ;;
  1161         -
  1162         -  -*) as_fn_error $? "unrecognized option: \`$ac_option'
  1163         -Try \`$0 --help' for more information"
  1164         -    ;;
  1165         -
  1166         -  *=*)
  1167         -    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
  1168         -    # Reject names that are not valid shell variable names.
  1169         -    case $ac_envvar in #(
  1170         -      '' | [0-9]* | *[!_$as_cr_alnum]* )
  1171         -      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
  1172         -    esac
  1173         -    eval $ac_envvar=\$ac_optarg
  1174         -    export $ac_envvar ;;
  1175         -
  1176         -  *)
  1177         -    # FIXME: should be removed in autoconf 3.0.
  1178         -    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
  1179         -    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
  1180         -      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
  1181         -    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
  1182         -    ;;
  1183         -
  1184         -  esac
  1185         -done
  1186         -
  1187         -if test -n "$ac_prev"; then
  1188         -  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
  1189         -  as_fn_error $? "missing argument to $ac_option"
  1190         -fi
  1191         -
  1192         -if test -n "$ac_unrecognized_opts"; then
  1193         -  case $enable_option_checking in
  1194         -    no) ;;
  1195         -    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
  1196         -    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
  1197         -  esac
  1198         -fi
  1199         -
  1200         -# Check all directory arguments for consistency.
  1201         -for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
  1202         -		datadir sysconfdir sharedstatedir localstatedir includedir \
  1203         -		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
  1204         -		libdir localedir mandir
  1205         -do
  1206         -  eval ac_val=\$$ac_var
  1207         -  # Remove trailing slashes.
  1208         -  case $ac_val in
  1209         -    */ )
  1210         -      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
  1211         -      eval $ac_var=\$ac_val;;
  1212         -  esac
  1213         -  # Be sure to have absolute directory names.
  1214         -  case $ac_val in
  1215         -    [\\/$]* | ?:[\\/]* )  continue;;
  1216         -    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
  1217         -  esac
  1218         -  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
  1219         -done
  1220         -
  1221         -# There might be people who depend on the old broken behavior: `$host'
  1222         -# used to hold the argument of --host etc.
  1223         -# FIXME: To remove some day.
  1224         -build=$build_alias
  1225         -host=$host_alias
  1226         -target=$target_alias
  1227         -
  1228         -# FIXME: To remove some day.
  1229         -if test "x$host_alias" != x; then
  1230         -  if test "x$build_alias" = x; then
  1231         -    cross_compiling=maybe
  1232         -  elif test "x$build_alias" != "x$host_alias"; then
  1233         -    cross_compiling=yes
  1234         -  fi
  1235         -fi
  1236         -
  1237         -ac_tool_prefix=
  1238         -test -n "$host_alias" && ac_tool_prefix=$host_alias-
  1239         -
  1240         -test "$silent" = yes && exec 6>/dev/null
  1241         -
  1242         -
  1243         -ac_pwd=`pwd` && test -n "$ac_pwd" &&
  1244         -ac_ls_di=`ls -di .` &&
  1245         -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
  1246         -  as_fn_error $? "working directory cannot be determined"
  1247         -test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
  1248         -  as_fn_error $? "pwd does not report name of working directory"
  1249         -
  1250         -
  1251         -# Find the source files, if location was not specified.
  1252         -if test -z "$srcdir"; then
  1253         -  ac_srcdir_defaulted=yes
  1254         -  # Try the directory containing this script, then the parent directory.
  1255         -  ac_confdir=`$as_dirname -- "$as_myself" ||
  1256         -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
  1257         -	 X"$as_myself" : 'X\(//\)[^/]' \| \
  1258         -	 X"$as_myself" : 'X\(//\)$' \| \
  1259         -	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
  1260         -$as_echo X"$as_myself" |
  1261         -    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
  1262         -	    s//\1/
  1263         -	    q
  1264         -	  }
  1265         -	  /^X\(\/\/\)[^/].*/{
  1266         -	    s//\1/
  1267         -	    q
  1268         -	  }
  1269         -	  /^X\(\/\/\)$/{
  1270         -	    s//\1/
  1271         -	    q
  1272         -	  }
  1273         -	  /^X\(\/\).*/{
  1274         -	    s//\1/
  1275         -	    q
  1276         -	  }
  1277         -	  s/.*/./; q'`
  1278         -  srcdir=$ac_confdir
  1279         -  if test ! -r "$srcdir/$ac_unique_file"; then
  1280         -    srcdir=..
  1281         -  fi
  1282         -else
  1283         -  ac_srcdir_defaulted=no
  1284         -fi
  1285         -if test ! -r "$srcdir/$ac_unique_file"; then
  1286         -  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
  1287         -  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
  1288         -fi
  1289         -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
  1290         -ac_abs_confdir=`(
  1291         -	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
  1292         -	pwd)`
  1293         -# When building in place, set srcdir=.
  1294         -if test "$ac_abs_confdir" = "$ac_pwd"; then
  1295         -  srcdir=.
  1296         -fi
  1297         -# Remove unnecessary trailing slashes from srcdir.
  1298         -# Double slashes in file names in object file debugging info
  1299         -# mess up M-x gdb in Emacs.
  1300         -case $srcdir in
  1301         -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
  1302         -esac
  1303         -for ac_var in $ac_precious_vars; do
  1304         -  eval ac_env_${ac_var}_set=\${${ac_var}+set}
  1305         -  eval ac_env_${ac_var}_value=\$${ac_var}
  1306         -  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
  1307         -  eval ac_cv_env_${ac_var}_value=\$${ac_var}
  1308         -done
  1309         -
  1310         -#
  1311         -# Report the --help message.
  1312         -#
  1313         -if test "$ac_init_help" = "long"; then
  1314         -  # Omit some internal or obsolete options to make the list less imposing.
  1315         -  # This message is too long to be a string in the A/UX 3.1 sh.
  1316         -  cat <<_ACEOF
  1317         -\`configure' configures sample 0.6 to adapt to many kinds of systems.
  1318         -
  1319         -Usage: $0 [OPTION]... [VAR=VALUE]...
  1320         -
  1321         -To assign environment variables (e.g., CC, CFLAGS...), specify them as
  1322         -VAR=VALUE.  See below for descriptions of some of the useful variables.
  1323         -
  1324         -Defaults for the options are specified in brackets.
  1325         -
  1326         -Configuration:
  1327         -  -h, --help              display this help and exit
  1328         -      --help=short        display options specific to this package
  1329         -      --help=recursive    display the short help of all the included packages
  1330         -  -V, --version           display version information and exit
  1331         -  -q, --quiet, --silent   do not print \`checking ...' messages
  1332         -      --cache-file=FILE   cache test results in FILE [disabled]
  1333         -  -C, --config-cache      alias for \`--cache-file=config.cache'
  1334         -  -n, --no-create         do not create output files
  1335         -      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
  1336         -
  1337         -Installation directories:
  1338         -  --prefix=PREFIX         install architecture-independent files in PREFIX
  1339         -                          [$ac_default_prefix]
  1340         -  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
  1341         -                          [PREFIX]
  1342         -
  1343         -By default, \`make install' will install all the files in
  1344         -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
  1345         -an installation prefix other than \`$ac_default_prefix' using \`--prefix',
  1346         -for instance \`--prefix=\$HOME'.
  1347         -
  1348         -For better control, use the options below.
  1349         -
  1350         -Fine tuning of the installation directories:
  1351         -  --bindir=DIR            user executables [EPREFIX/bin]
  1352         -  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  1353         -  --libexecdir=DIR        program executables [EPREFIX/libexec]
  1354         -  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  1355         -  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  1356         -  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  1357         -  --libdir=DIR            object code libraries [EPREFIX/lib]
  1358         -  --includedir=DIR        C header files [PREFIX/include]
  1359         -  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  1360         -  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  1361         -  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  1362         -  --infodir=DIR           info documentation [DATAROOTDIR/info]
  1363         -  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  1364         -  --mandir=DIR            man documentation [DATAROOTDIR/man]
  1365         -  --docdir=DIR            documentation root [DATAROOTDIR/doc/sample]
  1366         -  --htmldir=DIR           html documentation [DOCDIR]
  1367         -  --dvidir=DIR            dvi documentation [DOCDIR]
  1368         -  --pdfdir=DIR            pdf documentation [DOCDIR]
  1369         -  --psdir=DIR             ps documentation [DOCDIR]
  1370         -_ACEOF
  1371         -
  1372         -  cat <<\_ACEOF
  1373         -_ACEOF
  1374         -fi
  1375         -
  1376         -if test -n "$ac_init_help"; then
  1377         -  case $ac_init_help in
  1378         -     short | recursive ) echo "Configuration of sample 0.6:";;
  1379         -   esac
  1380         -  cat <<\_ACEOF
  1381         -
  1382         -Optional Features:
  1383         -  --disable-option-checking  ignore unrecognized --enable/--with options
  1384         -  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  1385         -  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  1386         -