Bug 15989 - Mishandled x11 flags in autoconf
Summary: Mishandled x11 flags in autoconf
Alias: None
Product: R
Classification: Unclassified
Component: Installation (show other bugs)
Version: R 3.1.1
Hardware: All OS X Mavericks
: P5 minor
Assignee: R-core
Depends on:
Reported: 2014-09-22 05:44 UTC by Daniel Macks
Modified: 2015-08-21 13:28 UTC (History)
1 user (show)

See Also:

Fix X_CFLAGS propagation in autoconf tests (1.75 KB, patch)
2014-09-22 06:16 UTC, Daniel Macks
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Macks 2014-09-22 05:44:49 UTC
Building R-3.1.1 on OS X 10.8 and 10.9 (via fink) gives some warnings during ./configure:

 checking X11/Intrinsic.h usability... yes
 checking X11/Intrinsic.h presence... no
 configure: WARNING: X11/Intrinsic.h: accepted by the compiler, rejected by the preprocessor!
 configure: WARNING: X11/Intrinsic.h: proceeding with the compiler's result
 checking for X11/Intrinsic.h... yes

and likewise for X11/Xmu/Atoms.h a few lines later. In config.log, I see the following different compiler calls used for those two consecutive checks:

 configure:32347: flag-sort -r gcc -ffor-scope -c -g -O3 -fPIC   -I/usr/X11R6/include -I/sw/include  conftest.c >&5
 configure:32347: $? = 0
 configure:32347: result: yes
 configure:32347: flag-sort -r gcc -ffor-scope -E -I/sw/include  conftest.c
 conftest.c:219:10: fatal error: 'X11/Intrinsic.h' file not found

The -I for x11 in the second case, which is required in order to find the x11 headers. The problem is that the standard autoconf segments for x11 propagate that flag via X_CFLAGS but R's own tests (m4/R.m4) for those specific headers pass it via CFLAGS. CFLAGS is only used for compiler, not for preprocessor. Instead, X_CFLAGS should be passed via CPPFLAGS, which is used for preprocessor (and therefore also compiler, because that is built on top of preprocessor).
Comment 1 Daniel Macks 2014-09-22 05:51:32 UTC
The various Makefile.in, Makeconf.in, and TCLTK flag variables eventually do handle X_CFLAGS correctly (via their *_CPPFLAGS), it's just a few R.m4 tests that are incorrect. As the output notes, for now, there is no effect because autoconf winds up using what is correct for R in this case, but it's technically broken and may break in the future if autoconf changes how it handles this situation.
Comment 2 Daniel Macks 2014-09-22 06:16:02 UTC
Created attachment 1666 [details]
Fix X_CFLAGS propagation in autoconf tests
Comment 3 Peter Dalgaard 2015-03-25 19:36:40 UTC
Fixed in R-devel
Comment 4 Brian Ripley 2015-08-21 13:28:22 UTC
Finally ported to 3.2.2 patched, having bitten again in 3.2.2.