Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
42c81e1a
Commit
42c81e1a
authored
May 06, 2009
by
kenton@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set better default CXXFLAGS and don't use optimization when compiling tests
(takes too long).
parent
3d694ad2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
2 deletions
+45
-2
configure.ac
configure.ac
+37
-0
Makefile.am
src/Makefile.am
+8
-2
No files found.
configure.ac
View file @
42c81e1a
...
...
@@ -14,6 +14,12 @@ AC_PREREQ(2.59)
# the size of one file name in the dist tarfile over the 99-char limit.)
AC_INIT([Protocol Buffers],[2.0.4-pre],[protobuf@googlegroups.com],[protobuf])
# Detect whether the user specified their own compilation flags. If so then
# we want to respect their decision, otherwise we will twiddle them later.
AS_IF([test "$CXXFLAGS" = ""],[
protobuf_default_cxxflags=yes
])
AC_CONFIG_SRCDIR(src/google/protobuf/message.cc)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
...
...
@@ -32,6 +38,37 @@ ACX_USE_SYSTEM_EXTENSIONS
AC_PROG_LIBTOOL
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
# autoconf's default CXXFLAGS are usually "-g -O2". These aren't necessarily
# the best choice for libprotobuf.
AC_MSG_CHECKING([C++ compiler flags...])
AS_IF([test "$protobuf_default_cxxflags" = "yes"],[
# test_util.cc takes forever to compile with GCC and optimization turned on.
# But we cannot override anything that is part of CXXFLAGS since it is the
# last thing added to the command line. The automake docs insist that you
# should never want to override CXXFLAGS because they represent the intent of
# the user, and the user knows best. But if the user actually did not set
# any CXXFLAGS, then AC_PROG_CXX sets them to a rather arbitrary default.
# That's not user intent at all, but automake still treats it like it is.
# Grr. Anyway, getting back to the point, this hack here strips out the -O
# flag from autoconf's defaults and puts it into another variable so that
# we can override it. BTW, m4 escaping sucks.
PROTOBUF_OPT_FLAG=`echo "$CXXFLAGS" | grep -o '\-O@<:@0-9@:>@\?'`
CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ \?-O@<:@0-9@:>@\?//g'`
# Protocol Buffers contains several checks that are intended to be used only
# for debugging and which might hurt performance. Most users are probably
# end users who don't want these checks, so add -DNDEBUG by default.
CXXFLAGS="$CXXFLAGS -DNDEBUG"
AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS])
],[
PROTOBUF_OPT_FLAG=
AC_MSG_RESULT([use user-supplied: $CXXFLAGS])
])
AC_SUBST(PROTOBUF_OPT_FLAG)
ACX_CHECK_SUNCC
# Checks for header files.
...
...
src/Makefile.am
View file @
42c81e1a
...
...
@@ -12,11 +12,13 @@ endif
if
GCC
# These are good warnings to turn on by default
AM
_CXXFLAGS
=
$(PTHREAD_CFLAGS)
-Wall
-Wwrite-strings
-Woverloaded-virtual
-Wno-sign-compare
NO_OPT
_CXXFLAGS
=
$(PTHREAD_CFLAGS)
-Wall
-Wwrite-strings
-Woverloaded-virtual
-Wno-sign-compare
else
AM
_CXXFLAGS
=
$(PTHREAD_CFLAGS)
NO_OPT
_CXXFLAGS
=
$(PTHREAD_CFLAGS)
endif
AM_CXXFLAGS
=
$(NO_OPT_CXXFLAGS)
$(PROTOBUF_OPT_FLAG)
AM_LDFLAGS
=
$(PTHREAD_CFLAGS)
# If I say "dist_include_DATA", automake complains that $(includedir) is not
...
...
@@ -234,6 +236,10 @@ protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
$(top_builddir)
/gtest/lib/libgtest_main.la
protobuf_test_CPPFLAGS
=
-I
$(top_srcdir)
/gtest/include
\
-I
$(top_builddir)
/gtest/include
# Disable optimization for tests unless the user explicitly asked for it,
# since test_util.cc takes forever to compile with optimization (with GCC).
# See configure.ac for more info.
protobuf_test_CXXFLAGS
=
$(NO_OPT_CXXFLAGS)
protobuf_test_SOURCES
=
\
google/protobuf/stubs/common_unittest.cc
\
google/protobuf/stubs/once_unittest.cc
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment