Repository: spack/spack

Issue:
Installation issue: environment-modules 4.5.2
### Steps to reproduce the issue

<!-- Fill in the exact spec you are trying to build and the relevant part of the error message -->
```console
$ spack install environment-modules
...
==> Installing environment-modules
==> No binary for environment-modules found: installing from source
==> Using cached archive: /home/user/devel/spack/var/spack/cache/_source-cache/archive/74/74ccc9ab0fea0064ff3f4c5841435cef13cc6d9869b3c2b25e5ca4efa64a69a1.tar.gz
==> environment-modules: Executing phase: 'install'
==> Error: ProcessError: Command exited with status 1:
    './configure' '--prefix=/home/user/devel/spack/opt/spack/linux-fedora31-skylake/gcc-9.3.1/environment-modules-4.5.2-4c4w5hh4haydx7hhfdq2ivev7f4qlmbc' '--without-tclx' '--with-tclx-ver=0.0' '--with-tcl=/home/user/devel/spack/opt/spack/linux-fedora31-skylake/gcc-9.3.1/tcl-8.6.10-k3hv6crasymrpcelqmbxounnhlbi5a7s/lib' '--with-tcl-ver=8.6' '--disable-dependency-tracking' '--disable-silent-rules' '--disable-versioning' '--datarootdir=/home/user/devel/spack/opt/spack/linux-fedora31-skylake/gcc-9.3.1/environment-modules-4.5.2-4c4w5hh4haydx7hhfdq2ivev7f4qlmbc/share' '--with-icase=search' '--enable-extended-default' '--enable-advanced-version-spec' '--enable-color' '--enable-auto-handling' '--with-quarantine-vars=LD_LIBRARY_PATH LD_PRELOAD' '--disable-compat-version' '--with-tclsh=/home/user/devel/spack/opt/spack/linux-fedora31-skylake/gcc-9.3.1/tcl-8.6.10-k3hv6crasymrpcelqmbxounnhlbi5a7s/bin/tclsh'

1 error found in build log:
     1    ==> environment-modules: Executing phase: 'install'
     2    ==> [2020-08-31-15:10:41.525647] './configure' '--prefix=/home/user/devel/spack/opt/spack/linux-fedora31-skylake/gcc-9.3.1/environment-modules-4.5.2-4c4w5hh4haydx7hhfdq2ivev7f4qlmbc' '--without-tclx' '-
          -with-tclx-ver=0.0' '--with-tcl=/home/user/devel/spack/opt/spack/linux-fedora31-skylake/gcc-9.3.1/tcl-8.6.10-k3hv6crasymrpcelqmbxounnhlbi5a7s/lib' '--with-tcl-ver=8.6' '--disable-dependency-tracking' '-
          -disable-silent-rules' '--disable-versioning' '--datarootdir=/home/user/devel/spack/opt/spack/linux-fedora31-skylake/gcc-9.3.1/environment-modules-4.5.2-4c4w5hh4haydx7hhfdq2ivev7f4qlmbc/share' '--with-i
          case=search' '--enable-extended-default' '--enable-advanced-version-spec' '--enable-color' '--enable-auto-handling' '--with-quarantine-vars=LD_LIBRARY_PATH LD_PRELOAD' '--disable-compat-version' '--wi
          th-tclsh=/home/user/devel/spack/opt/spack/linux-fedora31-skylake/gcc-9.3.1/tcl-8.6.10-k3hv6crasymrpcelqmbxounnhlbi5a7s/bin/tclsh'
  >> 3    ERROR: Unrecognized option `--disable-dependency-tracking'
     4      Try `./configure --help' for more information

```

### Additional information

I will not provide spack build logs, as issue comes from the `environment-modules` package and it has already been reported on Modules project (see cea-hpc/modules#354).

On version 4.5.2 of environment-modules, the `configure` script is a bit too strict and does not accept anymore options like `--disable-dependency-tracking` which are used in spack build recipe.

I will provide a PR to skip these special `configure` options which are not supported on version 4.5.2. But it will only be a special case for this version, as on newer versions of environment-modules all special `configure` options can be set again.

### General information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [ ] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [ ] I have run `spack maintainers <name-of-the-package>` and @mentioned any maintainers
- [ ] I have uploaded the build log and environment files
- [x] I have searched the issues of this repo and believe this is not a duplicate



Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/environment-modules/package.py b/var/spack/repos/builtin/packages/environment-modules/package.py
--- a/var/spack/repos/builtin/packages/environment-modules/package.py
+++ b/var/spack/repos/builtin/packages/environment-modules/package.py
@@ -64,12 +64,18 @@ def install(self, spec, prefix):
             # It looks for tclConfig.sh
             "--with-tcl=" + tcl_lib_dir,
             "--with-tcl-ver={0}.{1}".format(*tcl.version.version[0:2]),
-            '--disable-dependency-tracking',
-            '--disable-silent-rules',
             '--disable-versioning',
             '--datarootdir=' + prefix.share
         ]
 
+        # ./configure script on version 4.5.2 breaks when specific options are
+        # set (see https://github.com/cea-hpc/modules/issues/354)
+        if not spec.satisfies('@4.5.2'):
+            config_args.extend([
+                '--disable-dependency-tracking',
+                '--disable-silent-rules'
+            ])
+
         if '~X' in spec:
             config_args = ['--without-x'] + config_args
 


Test patch: