Repository: spack/spack

Issue:
gdbm fails with Intel 16.0.2
```
$ spack install -j16 --restage gdbm%intel@16.0.2
...
==> Created stage in /home/certik/repos/spack/var/spack/stage/gdbm-1.13-zyq65fjmx4zqrcderjlaly2j73lwtg47
==> No patches needed for gdbm
==> Building gdbm [AutotoolsPackage]
==> Executing phase: 'autoreconf'
==> Executing phase: 'configure'
==> Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16'

5 errors found in build log:
     [ ... ]
     253         ^
     254   
     255   gdbmtool.c(1220): warning #144: a value of type "int (*)()" cannot be used to initialize an entity of type "int (*)(struct handler_param *, size_t={unsigned long} *)"
     256         checkdb, recover_handler, NULL,
     257         ^
     258   
  >> 259   input-rl.c(18): catastrophic error: cannot open source file "readline/readline.h"
     260     #include <readline/readline.h>
     261                                   ^
     262   
     263   compilation aborted for input-rl.c (code 4)
     264   Makefile:694: recipe for target 'input-rl.o' failed
  >> 265   make[3]: *** [input-rl.o] Error 4
     266   make[3]: *** Waiting for unfinished jobs....
     267   make[3]: Leaving directory '/home/certik/tmp/spack-stage/spack-stage-K2UKpU/gdbm-1.13/src'
     268   Makefile:483: recipe for target 'all' failed
  >> 269   make[2]: *** [all] Error 2
     270   make[2]: Leaving directory '/home/certik/tmp/spack-stage/spack-stage-K2UKpU/gdbm-1.13/src'
     271   Makefile:456: recipe for target 'all-recursive' failed
  >> 272   make[1]: *** [all-recursive] Error 1
     273   make[1]: Leaving directory '/home/certik/tmp/spack-stage/spack-stage-K2UKpU/gdbm-1.13'
     274   Makefile:387: recipe for target 'all' failed
  >> 275   make: *** [all] Error 2

See build log for details:
  /home/certik/repos/spack/var/spack/stage/gdbm-1.13-zyq65fjmx4zqrcderjlaly2j73lwtg47/gdbm-1.13/spack-build.out
```


Discussion:
The output log says:
```
checking for readline in -lreadline... yes
checking readline/readline.h usability... no
checking readline/readline.h presence... no
checking for readline/readline.h... no
```
Which causes the error of not finding `<readline/readline.h>`. The package however depends on readline:
```
Concretized
--------------------------------
gdbm@1.13%intel@16.0.2 arch=linux-ubuntu16.04-x86_64 
    ^readline@7.0%intel@16.0.2 arch=linux-ubuntu16.04-x86_64 
        ^ncurses@6.0%intel@16.0.2 patches=f84b2708a42777aadcc7f502a261afe10ca5646a51c1ef8b5e60d2070d926b57 ~symlinks arch=linux-ubuntu16.04-x86_64 
            ^pkg-config@0.29.2%intel@16.0.2+internal_glib arch=linux-ubuntu16.04-x86_64 
```
and the header file is properly installed in:
```
ls /home/certik/repos/spack/opt/spack/linux-ubuntu16.04-x86_64/intel-16.0.2/readline-7.0-7hcgq7f4gkuv7poi2kco63irflxt7m4q/include/readline/
chardefs.h  keymaps.h   rlconf.h  rltypedefs.h
history.h   readline.h  rlstdc.h  tilde.h
```
The `config.log` shows why it can't find the header file:
```
configure:15019: checking readline/readline.h usability
configure:15019: /home/certik/intel/compilers_and_libraries/linux/bin/intel64/icc -c   conftest.c >&5
conftest.c(80): catastrophic error: cannot open source file "readline/readline.h"
  #include <readline/readline.h>
                                ^

compilation aborted for conftest.c (code 4)
```

The proper `-I` must be used, but it isn't.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/gdbm/package.py b/var/spack/repos/builtin/packages/gdbm/package.py
--- a/var/spack/repos/builtin/packages/gdbm/package.py
+++ b/var/spack/repos/builtin/packages/gdbm/package.py
@@ -45,4 +45,9 @@ class Gdbm(AutotoolsPackage):
     depends_on("readline")
 
     def configure_args(self):
-        return ['--enable-libgdbm-compat']
+        config_args = [
+            '--enable-libgdbm-compat',
+            'CC=%s' % spack_cc
+        ]
+
+        return config_args


Test patch: