9
9
# * src/google/protobuf/stubs/common.h
10
10
# * src/Makefile.am (Update -version-info for LDFLAGS if needed)
11
AC_INIT([protobuf],[2.0.3],[protobuf@googlegroups.com])
12
# In the SVN trunk, the version should always be the next anticipated release
13
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
14
# the size of one file name in the dist tarfile over the 99-char limit.)
15
AC_INIT([Protocol Buffers],[2.1.0],[protobuf@googlegroups.com],[protobuf])
17
# Detect whether the user specified their own compilation flags. If so then
18
# we want to respect their decision, otherwise we will twiddle them later.
19
AS_IF([test "$CXXFLAGS" = ""],[
20
protobuf_default_cxxflags=yes
13
23
AC_CONFIG_SRCDIR(src/google/protobuf/message.cc)
14
24
AC_CONFIG_HEADERS([config.h])
15
25
AC_CONFIG_MACRO_DIR([m4])
29
[AS_HELP_STRING([--with-zlib],
30
[include classes for streaming compressed data in and out @<:@default=check@:>@])],
34
[AS_HELP_STRING([--with-protoc=COMMAND],
35
[use the given protoc command instead of building a new one when building tests (useful for cross-compiling)])],
18
38
# Checks for programs.
21
42
ACX_USE_SYSTEM_EXTENSIONS
23
44
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
24
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
26
AS_IF([test "$SUNCC" = "yes"],[
27
CFLAGS="$CFLAGS -xO4 -xlibmil -xdepend -Xa -mt -xstrconst -D_FORTEC_"
28
CXXFLAGS="$CXXFLAGS -xO4 -xlibmil -mt -D_FORTEC_ -xlang=c99 -compat=5 -library=stlport4 -template=no%extdef"
46
# autoconf's default CXXFLAGS are usually "-g -O2". These aren't necessarily
47
# the best choice for libprotobuf.
48
AC_MSG_CHECKING([C++ compiler flags...])
49
AS_IF([test "$protobuf_default_cxxflags" = "yes"],[
51
# test_util.cc takes forever to compile with GCC and optimization turned on.
52
# But we cannot override anything that is part of CXXFLAGS since it is the
53
# last thing added to the command line. The automake docs insist that you
54
# should never want to override CXXFLAGS because they represent the intent of
55
# the user, and the user knows best. But if the user actually did not set
56
# any CXXFLAGS, then AC_PROG_CXX sets them to a rather arbitrary default.
57
# That's not user intent at all, but automake still treats it like it is.
58
# Grr. Anyway, getting back to the point, this hack here strips out the -O
59
# flag from autoconf's defaults and puts it into another variable so that
60
# we can override it. BTW, m4 escaping sucks.
61
PROTOBUF_OPT_FLAG=`echo "$CXXFLAGS" | grep -o '\-O@<:@0-9@:>@\?'`
62
CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ \?-O@<:@0-9@:>@\?//g'`
64
# Protocol Buffers contains several checks that are intended to be used only
65
# for debugging and which might hurt performance. Most users are probably
66
# end users who don't want these checks, so add -DNDEBUG by default.
67
CXXFLAGS="$CXXFLAGS -DNDEBUG"
69
AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS])
72
AC_MSG_RESULT([use user-supplied: $CXXFLAGS])
75
AC_SUBST(PROTOBUF_OPT_FLAG)
32
79
# Checks for header files.
39
86
AC_CHECK_FUNCS([ftruncate memset mkdir strchr strerror strtol])
89
AS_IF([test "$with_zlib" != no],
90
[AC_SEARCH_LIBS([zlibVersion], [z],
91
[AC_DEFINE([HAVE_ZLIB], [1], [Enable classes using zlib compression.])
93
[if test "$with_zlib" != check; then
94
AC_MSG_FAILURE([--with-zlib was given, but test for zlib failed])
96
AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1])
98
AS_IF([test "$with_protoc" != "no"], [
100
AS_IF([test "$with_protoc" == "yes"], [
101
# No argument given. Use system protoc.
104
AS_IF([echo "$PROTOC" | grep -q '^@<:@^/@:>@.*/'], [
105
# Does not start with a slash, but contains a slash. So, it's a relative
106
# path (as opposed to an absolute path or an executable in $PATH).
107
# Since it will actually be executed from the src directory, prefix with
108
# the current directory. We also insert $ac_top_build_prefix in case this
109
# is a nested package and --with-protoc was actually given on the outer
110
# package's configure script.
111
PROTOC=`pwd`/${ac_top_build_prefix}$PROTOC
115
AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"])
120
AC_CONFIG_SUBDIRS([gtest])
44
122
AC_CONFIG_FILES([Makefile src/Makefile ])