Commit a29e7e5d authored by Kenton Varda's avatar Kenton Varda

autoconf build

parent 41d2b217
# Kenton's personal backup script.
/backup.sh
# Eclipse-generated stuff.
.cproject
.project
.settings
.dist-buildwrapper
/c++/gen/
# Code you may want to map in from elsewhere.
/c++/src/base
/c++/src/capnproto/compilerbin
/c++/src/ekam
/c++/src/os
/c++/src/protobuf
/c++/src/snappy
# Ekam build artifacts.
/c++/tmp/
/c++/bin/
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
AM_CXXFLAGS = -I$(srcdir)/src
EXTRA_DIST = \
README.txt \
INSTALL.txt \
COPYING.txt \
CONTRIBUTORS.txt \
CHANGES.txt
CLEANFILES = $(capnpc_outputs) test_capnpc_middleman
# Deletes all the files generated by autoreconf.
MAINTAINERCLEANFILES = \
aclocal.m4 \
config.guess \
config.sub \
configure \
depcomp \
install-sh \
ltmain.sh \
Makefile.in \
missing \
mkinstalldirs \
config.h.in \
stamp.h.in \
m4/ltsugar.m4 \
m4/libtool.m4 \
m4/ltversion.m4 \
m4/lt~obsolete.m4 \
m4/ltoptions.m4
nobase_include_HEADERS = \
src/capnproto/macros.h \
src/capnproto/type-safety.h \
src/capnproto/blob.h \
src/capnproto/layout.h \
src/capnproto/list.h \
src/capnproto/message.h \
src/capnproto/io.h \
src/capnproto/serialize.h \
src/capnproto/serialize-packed.h \
src/capnproto/generated-header-support.h
# No dynamic library for now since C++ binary compatibility is hard.
# It may make more sense to have every module statically link Cap'n Proto
# and pass around messages via memory pointers.
lib_LIBRARIES = libcapnproto.a
libcapnproto_a_SOURCES= \
src/capnproto/macros.c++ \
src/capnproto/type-safety.c++ \
src/capnproto/blob.c++ \
src/capnproto/arena.h \
src/capnproto/arena.c++ \
src/capnproto/layout.c++ \
src/capnproto/list.c++ \
src/capnproto/message.c++ \
src/capnproto/io.c++ \
src/capnproto/serialize.c++ \
src/capnproto/serialize-packed.c++
# Source files intentionally not included in the dist at this time:
# src/capnproto/serialize-snappy*
# src/capnproto/benchmark/...
# Tests ==============================================================
capnpc_inputs = \
src/capnproto/test.capnp
capnpc_outputs = \
src/capnproto/test.capnp.c++ \
src/capnproto/test.capnp.h
BUILT_SOURCES = $(capnpc_outputs)
test_capnpc_middleman:# $(capnpc_inputs)
$(CAPNPC) $^
touch test_capnpc_middleman
$(capnpc_outputs): test_capnpc_middleman
check_PROGRAMS = capnproto-test
capnproto_test_LDADD = -lgtest -lgtest_main libcapnproto.a
capnproto_test_SOURCES = \
src/capnproto/type-safety-test.c++ \
src/capnproto/blob-test.c++ \
src/capnproto/layout-test.c++ \
src/capnproto/message-test.c++ \
src/capnproto/encoding-test.c++ \
src/capnproto/serialize-test.c++ \
src/capnproto/serialize-packed-test.c++ \
src/capnproto/test-util.c++ \
src/capnproto/test-util.h
nodist_capnproto_test_SOURCES = $(capnpc_outputs)
TESTS = capnproto-test
## Process this file with autoconf to produce configure.
# autoconf can't handle apostrophes in names...
AC_INIT([Capn Proto],[0.1.0],[capnproto@googlegroups.com],[capnproto])
AC_CONFIG_SRCDIR([src/capnproto/layout.c++])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
# autoconf's default CXXFLAGS are usually "-g -O2". A far more reasonable
# default is -O2 -NDEBUG.
AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
[CFLAGS="-O2 -DNDEBUG"])
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
[CXXFLAGS="-O2 -DNDEBUG"])
AS_IF([test "x$CAPNPC" = "x"], [CAPNPC="capnpc"])
AC_SUBST([CAPNPC])
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_LANG([C++])
AX_CXX_COMPILE_STDCXX_11
ACX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS"
CXXFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
This diff is collapsed.
# ============================================================================
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
# ============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_11([ext|noext])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++11
# standard; if necessary, add switches to CXXFLAGS to enable support.
# Errors out if no mode that supports C++11 baseline syntax can be found.
# The argument, if specified, indicates whether you insist on an extended
# mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -std=c++11).
# If neither is specified, you get whatever works, with preference for an
# extended mode.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 1
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [
template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
typedef check<check<bool>> right_angle_brackets;
int a;
decltype(a) b;
typedef check<int> check_type;
check_type c;
check_type&& cr = static_cast<check_type&&>(c);
])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
m4_if([$1], [], [],
[$1], [ext], [],
[$1], [noext], [],
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
AC_LANG_ASSERT([C++])dnl
ac_success=no
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
ax_cv_cxx_compile_cxx11,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[ax_cv_cxx_compile_cxx11=yes],
[ax_cv_cxx_compile_cxx11=no])])
if test x$ax_cv_cxx_compile_cxx11 = xyes; then
ac_success=yes
fi
m4_if([$1], [noext], [], [dnl
if test x$ac_success = xno; then
for switch in -std=gnu++11 -std=gnu++0x; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
$cachevar,
[ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
ac_success=yes
break
fi
done
fi])
m4_if([$1], [ext], [], [dnl
if test x$ac_success = xno; then
for switch in -std=c++11 -std=c++0x; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
$cachevar,
[ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXXFLAGS="$ac_save_CXXFLAGS"])
if eval test x\$$cachevar = xyes; then
CXXFLAGS="$CXXFLAGS $switch"
ac_success=yes
break
fi
done
fi])
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
fi
])
......@@ -25,17 +25,9 @@
#include <gtest/gtest.h>
#include <iostream>
#include <string>
#include "test-util.h"
namespace capnproto {
std::ostream& operator<<(std::ostream& os, const Data::Reader& value) {
return os.write(value.data(), value.size());
}
std::ostream& operator<<(std::ostream& os, const Data::Builder& value) {
return os.write(value.data(), value.size());
}
namespace {
TEST(Blob, Text) {
......
......@@ -23,8 +23,6 @@
#include "serialize-packed.h"
#include "layout.h"
#include <snappy/snappy.h>
#include <snappy/snappy-sinksource.h>
#include <vector>
namespace capnproto {
......
......@@ -26,7 +26,6 @@
namespace capnproto {
namespace internal {
namespace {
template <typename Builder>
......
......@@ -25,8 +25,27 @@
#define CAPNPROTO_TEST_UTIL_H_
#include "test.capnp.h"
#include <iostream>
#include "blob.h"
namespace capnproto {
inline std::ostream& operator<<(std::ostream& os, const Data::Reader& value) {
return os.write(value.data(), value.size());
}
inline std::ostream& operator<<(std::ostream& os, const Data::Builder& value) {
return os.write(value.data(), value.size());
}
inline std::ostream& operator<<(std::ostream& os, const Text::Reader& value) {
return os.write(value.data(), value.size());
}
inline std::ostream& operator<<(std::ostream& os, const Text::Builder& value) {
return os.write(value.data(), value.size());
}
inline std::ostream& operator<<(std::ostream& os, Void) {
return os << "void";
}
namespace internal {
void initTestMessage(TestAllTypes::Builder builder);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment