diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2017-02-28 21:50:44 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2017-02-28 21:50:44 +0100 |
| commit | c029d90d1975e124d237605f1edb2be16bd05b5d (patch) | |
| tree | 9df87ffb365354bdb74a969440b32c8304bdbcb7 /configure.ac | |
Initial commit
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..71452a9 --- /dev/null +++ b/configure.ac @@ -0,0 +1,74 @@ +AC_INIT([tp], [0.1], [the_jk@yahoo.com]) +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE([dist-bzip2 foreign]) +AM_SILENT_RULES([yes]) + +AC_PROG_CXX +AC_PROG_RANLIB +AM_PROG_CC_C_O + +AC_LANG([C++]) + +DEFINES= + +# Test c++11 +OLDCXXFLAGS="$CXXFLAGS" +# Check if it just works with -std=c++11 +# The code below was choosen because if you mix a compiler that is C++11 +# compatible with a libc++ that isn't fully (like clang 3.3 with gcc 4.6 +# libstdcxx) you get errors because of a missing copy constructor for +# std::shared_ptr. Add more tests as we find them. +CXXFLAGS="-std=c++11 $CXXFLAGS" +AC_MSG_CHECKING([for C++11 using (-std=c++11)]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include <memory> +]],[[ +std::shared_ptr<int> i(new int(5)); +std::shared_ptr<int> j(i); +]])], + [AC_MSG_RESULT([yes]) + DEFINES="$DEFINES -std=c++11"], + [AC_MSG_RESULT([no]) + CXXFLAGS="-std=c++11 -stdlib=libc++ $CXXFLAGS" + AC_MSG_CHECKING([for C++11 using (-std=c++11 -stdlib=libc++)]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include <memory> +]],[[ +std::shared_ptr<int> i(new int(5)); +std::shared_ptr<int> j(i); +]])], + [AC_MSG_RESULT([yes]) + DEFINES="$DEFINES -std=c++11 -stdlib=libc++"], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([No working C++11 support])])]) +CXXFLAGS="$OLDCXXFLAGS" + +AX_CXXFLAGS_WARN_ALL([DEFINES]) +AX_APPEND_COMPILE_FLAGS([-fno-rtti -fno-exceptions],DEFINES) +AX_APPEND_COMPILE_FLAGS([-Wextra -Wno-unused-parameter -Wno-missing-field-initializers],DEFINES) +AC_ARG_ENABLE([debug], AC_HELP_STRING([compile with debug options]), + if test "x$enableval" = "xyes"; then + DEFINES="$DEFINES -g -O0 -DDEBUG" + else + DEFINES="$DEFINES -DNDEBUG" + fi) +AC_SUBST([DEFINES]) + +AX_GCC_VAR_ATTRIBUTE([unused]) +AX_GCC_FUNC_ATTRIBUTE([format]) + +AC_CHECK_HEADERS([sys/ioctl.h]) + +# Thread + +THREAD_CFLAGS=-pthread +THREAD_LIBS= + +AC_SUBST([THREAD_CFLAGS]) +AC_SUBST([THREAD_LIBS]) + +# Finish up + +AC_CONFIG_HEADERS([src/config.h]) +AC_OUTPUT([Makefile src/Makefile test/Makefile]) |
