Skip to content

Commit

Permalink
mkmf: Add a configure option to set verbose mode (V=1 or 0) in mkmf.rb.
Browse files Browse the repository at this point in the history
Note this change is only for `configure.ac`, not for Windows using
`win32/configure.bat`.

```
$ ./configure --help | grep mkmf
  --enable-mkmf-verbose   enable verbose in mkmf
```

Run the following command to enable the mkmf verbose mode.

```
$ ./configure --enable-mkmf-verbose
$ grep MKMF_VERBOSE config.status
S["MKMF_VERBOSE"]="1"
```

In this mkmf verbose mode, when compiling a native extension, the
`rake compile` prints the compiling commands such as
"gcc -I. <...> path/to/file" instead of "compiling path/to/file".

```
$ git clone https://github.com/deivid-rodriguez/byebug.git
$ cd byebug
$ bundle install --standalone
$ bundle exec rake compile
...
gcc -I. <...> path/to/file
...
```
  • Loading branch information
junaruga committed May 12, 2022
1 parent 40ca208 commit 019cbde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4227,6 +4227,13 @@ AS_IF([test -z "$MANTYPE"], [
])
AC_SUBST(MANTYPE)

MKMF_VERBOSE=0
AC_ARG_ENABLE(mkmf-verbose,
AS_HELP_STRING([--enable-mkmf-verbose], [enable verbose in mkmf]),
[MKMF_VERBOSE=1],
[MKMF_VERBOSE=0])
AC_SUBST(MKMF_VERBOSE)

AC_ARG_ENABLE(rubygems,
AS_HELP_STRING([--disable-rubygems], [disable rubygems by default]),
[enable_rubygems="$enableval"], [enable_rubygems=yes])
Expand Down
3 changes: 2 additions & 1 deletion lib/mkmf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1964,13 +1964,14 @@ def mkintpath(path)

def configuration(srcdir)
mk = []
CONFIG['MKMF_VERBOSE'] ||= "0"
vpath = $VPATH.dup
CONFIG["hdrdir"] ||= $hdrdir
mk << %{
SHELL = /bin/sh
# V=0 quiet, V=1 verbose. other values don't work.
V = 0
V = #{CONFIG['MKMF_VERBOSE']}
V0 = $(V:0=)
Q1 = $(V:1=)
Q = $(Q1:0=@)
Expand Down

0 comments on commit 019cbde

Please sign in to comment.