Stepping on thin ice here ...

My intention of passing a single C++11 flag on the command to make was primarily to keep things simple for ARM/R users (vs. BDA/R users).

At the moment I don't have GCC 4.8 on my system but I seem to remember that GCC 4.8 does not require the -stdlib=libc++ addition, just -std=c++11.

If that is true a similar nested ifeq could be added in make/os_linux:

ifeq (g++,$(CC_TYPE))
  LDFLAGS += -lpthread
  CFLAGS_GTEST += -DGTEST_HAS_PTHREAD=0
  ifeq (4.8,$(CC_MAJOR).$(CC_MINOR))
    CFLAGS += -Wno-unused-local-typedefs
    ifeq (true,$(C++11))
       CFLAGS += -std=c++11
    endif
  endif
  PCH = .gch
endif

Using a make/user_options file is another good solution. It does worry me to go to twice nested 'ifeq' constructs vs. just simply redefining flags.

Rob J. Goedman
goedman@icloud.com


On Aug 30, 2013, at 11:14 AM, bgoodri <notifications@github.com> wrote:

> You could have two flags, one for the -std and one for the -stdlib, but that just seems overly complicated to me. For R users, they essentially have to add to the Makeflags anyway.
> 
> —
> Reply to this email directly or view it on GitHub.
On Aug 30, 2013, at 10:27 AM, Bob Carpenter <notifications@github.com> wrote:

> In make/os_mac:
> 
> >  ifeq (clang++,$(CC_TYPE))
> >    CFLAGS_GTEST += -Wc++11-extensions
> >    CFLAGS_GTEST += -Wno-c++11-long-long
> >    CFLAGS += -Wno-unused-function
> >    CFLAGS += -Wno-tautological-compare
> >    CFLAGS += -Wno-c++11-long-long
> > +  CFLAGS += -ftemplate-depth=256
> > +  ifeq (true,$(C++11))
> > +    CFLAGS += -stdlib=libc++ -std=c++11
> I am not a makefile guru or shell developer, but for what it's worth, I like the calling of user options rather than having people edit our makefiles. - Bob
> …
> —
> Reply to this email directly or view it on GitHub.
> 


On Aug 30, 2013, at 10:04 AM, bgoodri <notifications@github.com> wrote:

> In make/os_mac:
> 
> >  ifeq (clang++,$(CC_TYPE))
> >    CFLAGS_GTEST += -Wc++11-extensions
> >    CFLAGS_GTEST += -Wno-c++11-long-long
> >    CFLAGS += -Wno-unused-function
> >    CFLAGS += -Wno-tautological-compare
> >    CFLAGS += -Wno-c++11-long-long
> > +  CFLAGS += -ftemplate-depth=256
> > +  ifeq (true,$(C++11))
> > +    CFLAGS += -stdlib=libc++ -std=c++11
> @goedman @bob-carpenter
> 
> I think having the C++11 flag imply CFLAGS += -stdlib=libc++ -std=c++11 is not quite right because we also want to support the c++11 standard under g++ (>= 4.7). It is technically possible to use LLVM's version of the standard c++ library with g++ but that is sort of an academic exercise and essentially everyone using g++ would be using GCC's version of the standard c++ library.
> 
> So, I think if someone wants to use the C++11 standard, they should just add the appropriate flags locally to their make/os_{win,mac,linux} file. Or maybe we should source another (possibly empty) file under make/ called user_options or something.
> 
> —
> Reply to this email directly or view it on GitHub.