Skip to content

Commit

Permalink
Enabled -std=c++11 option if compiler supported
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazuki OIKAWA committed Mar 18, 2016
1 parent f237b05 commit 076da8d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
13 changes: 12 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,19 @@ else
fi
AC_MSG_RESULT($enable_debug)

AC_CONFIG_FILES([jubatus/mp/config.h])
AC_LANG(C++)
mp_cxxflags_backup="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -std=c++11 -Wno-deprecated-declarations"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
mp_use_cpp11_standard="#define MP_FUNCTIONAL_STANDARD
#define MP_MEMORY_STANDARD
#define MP_UNORDERED_MAP_STANDARD"
AC_SUBST([mp_use_cpp11_standard]),
CXXFLAGS="$mp_cxxflags_backup"
)

AC_OUTPUT([Makefile
jubatus/mp/Makefile
mpsrc/Makefile
test/Makefile])

1 change: 1 addition & 0 deletions jubatus/mp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
libjubatus_mpio_includedir = $(includedir)/jubatus/mp

libjubatus_mpio_include_HEADERS = \
config.h \
endian.h \
exception.h \
functional.h \
Expand Down
6 changes: 6 additions & 0 deletions jubatus/mp/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef MP_CONFIG_H__
#define MP_CONFIG_H__

@mp_use_cpp11_standard@

#endif
2 changes: 2 additions & 0 deletions jubatus/mp/functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#ifndef MP_FUNCTIONAL_H__
#define MP_FUNCTIONAL_H__

#include "jubatus/mp/config.h"

#ifdef MP_FUNCTIONAL_BOOST
#include <boost/tr1/functional.hpp>
namespace mp {
Expand Down
2 changes: 2 additions & 0 deletions jubatus/mp/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#ifndef MP_MEMORY_H__
#define MP_MEMORY_H__

#include "jubatus/mp/config.h"

#ifdef MP_MEMORY_BOOST
#include <boost/tr1/memory>
namespace mp {
Expand Down
2 changes: 2 additions & 0 deletions jubatus/mp/unordered.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#ifndef MP_UNORDERED_H__
#define MP_UNORDERED_H__

#include "jubatus/mp/config.h"

#if defined(MP_UNORDERED_MAP_BOOST)
#include <boost/tr1/unordered_map.hpp>
#include <boost/tr1/unordered_set.hpp>
Expand Down

0 comments on commit 076da8d

Please sign in to comment.