]> granicus.if.org Git - neomutt/commitdiff
Update autosetup
authorPietro Cerutti <gahr@gahr.ch>
Mon, 9 Sep 2019 10:38:40 +0000 (10:38 +0000)
committerPietro Cerutti <gahr@gahr.ch>
Mon, 9 Sep 2019 10:38:40 +0000 (10:38 +0000)
autosetup/README.autosetup
autosetup/autosetup
autosetup/cc-db.tcl
autosetup/cc-lib.tcl
autosetup/cc-shared.tcl
autosetup/cc.tcl
autosetup/pkg-config.tcl
autosetup/system.tcl
autosetup/tmake.tcl

index a6215e80a680f0e9bb71c4c464633cb6d57e2009..a848c3f888cd4779cee10cc78fa8e12bee755e6e 100644 (file)
@@ -1,4 +1,4 @@
-README.autosetup created by autosetup v0.6.9
+README.autosetup created by autosetup v0.6.9+
 
 This is the autosetup directory for a local install of autosetup.
 It contains autosetup, support files and loadable modules.
index da3a83573df5cd16f81cbc4b103bc31d30e53d01..0ea1219f7721da5f74197fe3c86034827800d737 100755 (executable)
@@ -6,7 +6,7 @@
 dir=`dirname "$0"`; exec "`$dir/autosetup-find-tclsh`" "$0" "$@"
 
 # Note that the version has a trailing + on unreleased versions
-set autosetup(version) 0.6.9
+set autosetup(version) 0.6.9+
 
 # Can be set to 1 to debug early-init problems
 set autosetup(debug) [expr {"--debug" in $argv}]
@@ -93,13 +93,13 @@ proc main {argv} {
 
        #"=Core Options:"
        options-add {
-               help:=local  => "display help and options. Optionally specify a module name, such as --help=system"
+               help:=all       => "display help and options. Optional: module name, such as --help=system"
                licence license => "display the autosetup license"
-               version      => "display the version of autosetup"
+               version         => "display the version of autosetup"
                ref:=text manual:=text
                reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'"
-               debug        => "display debugging output as autosetup runs"
-               install:=.   => "install autosetup to the current or given directory"
+               debug           => "display debugging output as autosetup runs"
+               install:=.      => "install autosetup to the current or given directory"
        }
        if {$autosetup(installed)} {
                # hidden options so we can produce a nice error
@@ -216,8 +216,8 @@ proc main {argv} {
        configlog "Invoked as: [getenv WRAPPER $::argv0] [quote-argv $autosetup(argv)]"
        configlog "Tclsh: [info nameofexecutable]"
 
-       # Note that auto.def is *not* loaded in the global scope
-       source $autosetup(autodef)
+       # Load auto.def as module "auto.def"
+       autosetup_load_module auto.def source $autosetup(autodef)
 
        # Could warn here if options {} was not specified
 
@@ -375,7 +375,7 @@ proc option-check-names {args} {
 # Parse the option definition in $opts and update
 # ::autosetup(setoptions) and ::autosetup(optionhelp) appropriately
 #
-proc options-add {opts {header ""}} {
+proc options-add {opts} {
        global autosetup
 
        # First weed out comment lines
@@ -391,8 +391,7 @@ proc options-add {opts {header ""}} {
                set opt [lindex $opts $i]
                if {[string match =* $opt]} {
                        # This is a special heading
-                       lappend autosetup(optionhelp) $opt ""
-                       set header {}
+                       lappend autosetup(optionhelp) [list $opt $autosetup(module)]
                        continue
                }
                unset -nocomplain defaultvalue equal value
@@ -509,13 +508,8 @@ proc options-add {opts {header ""}} {
                        if {[info exists defaultvalue]} {
                                set desc [string map [list @default@ $defaultvalue] $desc]
                        }
-                       #string match \n* $desc
-                       if {$header ne ""} {
-                               lappend autosetup(optionhelp) $header ""
-                               set header ""
-                       }
                        # A multi-line description
-                       lappend autosetup(optionhelp) $opthelp $desc
+                       lappend autosetup(optionhelp) [list $opthelp $autosetup(module) $desc]
                        incr i 2
                }
        }
@@ -523,21 +517,9 @@ proc options-add {opts {header ""}} {
 
 # @module-options optionlist
 #
-# Like 'options', but used within a module.
+# Deprecated. Simply use 'options' from within a module.
 proc module-options {opts} {
-       set header ""
-       if {$::autosetup(showhelp) > 1 && [llength $opts]} {
-               set header "Module Options:"
-       }
-       options-add $opts $header
-
-       if {$::autosetup(showhelp)} {
-               # Ensure that the module isn't executed on --help
-               # We are running under eval or source, so use break
-               # to prevent further execution
-               #return -code break -level 2
-               return -code break
-       }
+       options $opts
 }
 
 proc max {a b} {
@@ -566,10 +548,17 @@ proc options-wrap-desc {text length firstprefix nextprefix initial} {
        }
 }
 
-proc options-show {} {
+# Display options (from $autosetup(optionhelp)) for modules that match
+# glob pattern $what
+proc options-show {what} {
+       set local 0
        # Determine the max option width
        set max 0
-       foreach {opt desc} $::autosetup(optionhelp) {
+       foreach help $::autosetup(optionhelp) {
+               lassign $help opt module desc
+               if {![string match $what $module]} {
+                       continue
+               }
                if {[string match =* $opt] || [string match \n* $desc]} {
                        continue
                }
@@ -582,13 +571,23 @@ proc options-show {} {
        }
        incr cols -1
        # Now output
-       foreach {opt desc} $::autosetup(optionhelp) {
+       foreach help $::autosetup(optionhelp) {
+               lassign $help opt module desc
+               if {![string match $what $module]} {
+                       continue
+               }
+               if {$local == 0 && $module eq "auto.def"} {
+                       puts "Local Options:"
+                       incr local
+               }
                if {[string match =* $opt]} {
+                       # Output a special heading line"
                        puts [string range $opt 1 end]
                        continue
                }
                puts -nonewline "  [format %-${max}s $opt]"
                if {[string match \n* $desc]} {
+                       # Output a pre-formatted help description as-is
                        puts $desc
                } else {
                        options-wrap-desc [string trim $desc] $cols "  " $indent [expr $max + 2]
@@ -629,19 +628,22 @@ proc options-show {} {
 ## lfs=1 largefile=1 => "Disable large file support"
 #
 proc options {optlist} {
-       # Allow options as a list or args
-       options-add $optlist "Local Options:"
+       global autosetup
 
-       if {$::autosetup(showhelp)} {
-               options-show
-               exit 0
+       options-add $optlist
+
+       if {$autosetup(showhelp)} {
+               # If --help, stop now to show help
+               return -code break
        }
 
-       # Check for invalid options
-       if {[opt-bool option-checking]} {
-               foreach o [dict keys $::autosetup(getopt)] {
-                       if {$o ni $::autosetup(options)} {
-                               user-error "Unknown option --$o"
+       if {$autosetup(module) eq "auto.def"} {
+               # Check for invalid options
+               if {[opt-bool option-checking]} {
+                       foreach o [dict keys $::autosetup(getopt)] {
+                               if {$o ni $::autosetup(options)} {
+                                       user-error "Unknown option --$o"
+                               }
                        }
                }
        }
@@ -1173,8 +1175,9 @@ proc use {args} {
                        continue
                }
                set libmodule($m) 1
+
                if {[info exists modsource(${m}.tcl)]} {
-                       automf_load eval $modsource(${m}.tcl)
+                       autosetup_load_module $m eval $modsource(${m}.tcl)
                } else {
                        set locs [list ${m}.tcl ${m}/init.tcl]
                        set found 0
@@ -1194,7 +1197,7 @@ proc use {args} {
                                # For the convenience of the "use" source, point to the directory
                                # it is being loaded from
                                set ::usedir [file dirname $source]
-                               automf_load source $source
+                               autosetup_load_module $m source $source
                                autosetup_add_dep $source
                        } else {
                                autosetup-error "use: No such module: $m"
@@ -1207,19 +1210,24 @@ proc autosetup_load_auto_modules {} {
        global autosetup modsource
        # First load any embedded auto modules
        foreach mod [array names modsource *.auto] {
-               automf_load eval $modsource($mod)
+               autosetup_load_module $mod eval $modsource($mod)
        }
        # Now any external auto modules
        foreach file [glob -nocomplain $autosetup(libdir)/*.auto $autosetup(libdir)/*/*.auto] {
-               automf_load source $file
+               autosetup_load_module [file tail $file] source $file
        }
 }
 
 # Load module source in the global scope by executing the given command
-proc automf_load {args} {
+proc autosetup_load_module {module args} {
+       global autosetup
+       set prev $autosetup(module)
+       set autosetup(module) $module
+
        if {[catch [list uplevel #0 $args] msg opts] ni {0 2 3}} {
                autosetup-full-error [error-dump $msg $opts $::autosetup(debug)]
        }
+       set autosetup(module) $prev
 }
 
 # Initial settings
@@ -1231,6 +1239,7 @@ set autosetup(sysinstall) 0
 set autosetup(msg-checking) 0
 set autosetup(msg-quiet) 0
 set autosetup(inittypes) {}
+set autosetup(module) autosetup
 
 # Embedded modules are inserted below here
 set autosetup(installed) 1
@@ -1436,22 +1445,22 @@ proc autosetup_help {what} {
     puts "This is [autosetup_version], a build environment \"autoconfigurator\""
     puts "See the documentation online at http://msteveb.github.com/autosetup/\n"
 
-    if {$what eq "local"} {
+    if {$what in {all local}} {
+        # Need to load auto.def now
         if {[file exists $::autosetup(autodef)]} {
-            # This relies on auto.def having a call to 'options'
-            # which will display options and quit
-            source $::autosetup(autodef)
-        } else {
-            options-show
+            # Load auto.def as module "auto.def"
+            autosetup_load_module auto.def source $::autosetup(autodef)
         }
-    } else {
-        incr ::autosetup(showhelp)
-        if {[catch {use $what}]} {
-            user-error "Unknown module: $what"
+        if {$what eq "all"} {
+            set what *
         } else {
-            options-show
+            set what auto.def
         }
+    } else {
+        use $what
+        puts "Options for module $what:"
     }
+    options-show $what
     exit 0
 }
 
index 5dadbafa307c186c88fe86347fff9ed7b6be85ed..12f1aed2c91b1c8045a488d1e2a4bdcca98e0aa2 100644 (file)
@@ -8,7 +8,7 @@
 
 use cc
 
-module-options {}
+options {}
 
 # openbsd needs sys/types.h to detect some system headers
 cc-include-needs sys/socket.h sys/types.h
index 80ee0788abf698d8b97ef0acf7524f9ef51b2bc3..45a3b0d3cc5252789c825c610413fa545ac9a1dd 100644 (file)
@@ -7,8 +7,6 @@
 
 use cc
 
-module-options {}
-
 # @cc-check-lfs
 #
 # The equivalent of the 'AC_SYS_LARGEFILE' macro.
index 0d6d52218ddd838f1134e419ec98538dd9d0be29..cbe568018e9683802333396a778e69fc56abe85d 100644 (file)
@@ -20,7 +20,7 @@
 ## LD_LIBRARY_PATH   Environment variable which specifies path to shared libraries
 ## STRIPLIBFLAGS     Arguments to strip a dynamic library
 
-module-options {}
+options {}
 
 # Defaults: gcc on unix
 define SHOBJ_CFLAGS -fPIC
index 585d25986d361c3c2cef651a9359146565e04148..7bbdb0013c44f4998ca489285465667f246c0ab0 100644 (file)
@@ -29,7 +29,7 @@
 
 use system
 
-module-options {}
+options {}
 
 # Checks for the existence of the given function by linking
 #
index 0883e4c32f0cd33547ce4d2e35aa0358f415058f..31debcac2977375ecd35d348b6398eb9c92376f4 100644 (file)
@@ -15,7 +15,7 @@
 
 use cc
 
-module-options {
+options {
        sysroot:dir => "Override compiler sysroot for pkg-config search path"
 }
 
index b98b5c083016b1bb29444c313c3678610e9deff0..15ab017a05253e07183c4d6daa1a9cc832286491 100644 (file)
@@ -27,7 +27,7 @@ if {[is-defined defaultprefix]} {
        options-defaults [list prefix [get-define defaultprefix]]
 }
 
-module-options [subst -noc -nob {
+options {
        host:host-alias =>              {a complete or partial cpu-vendor-opsys for the system where
                                                        the application will run (defaults to the same value as --build)}
        build:build-alias =>    {a complete or partial cpu-vendor-opsys for the system
@@ -52,7 +52,7 @@ module-options [subst -noc -nob {
        maintainer-mode=0
        dependency-tracking=0
        silent-rules=0
-}]
+}
 
 # @check-feature name { script }
 #
index a9d721975dc1489d66971c9ec90449128847722a..3269193aa77da4168b58f6f6de05f72e6a5602a0 100644 (file)
@@ -11,7 +11,7 @@
 
 use system
 
-module-options {}
+options {}
 
 define CONFIGURED