aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-08-06 20:47:45 +0000
committerkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-08-06 20:47:45 +0000
commit6be265a8269f3d83a54fbc1e26cd6fa72e2b886e (patch)
tree90f83f75013a87fa45bb00e380828250f02de5cd /configure.ac
parent6c9f0020e2b1c45c752ca87ebc2f2eb0934ab6ca (diff)
downloadprotobuf-6be265a8269f3d83a54fbc1e26cd6fa72e2b886e.tar.gz
protobuf-6be265a8269f3d83a54fbc1e26cd6fa72e2b886e.tar.bz2
protobuf-6be265a8269f3d83a54fbc1e26cd6fa72e2b886e.zip
Improve Sun Studio support. Patch from Monty Taylor.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac43
1 files changed, 20 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac
index 42a7fe70..b847f3da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,15 +14,20 @@ AC_PREREQ(2.59)
# the size of one file name in the dist tarfile over the 99-char limit.)
AC_INIT([Protocol Buffers],[2.1.1-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])
+
+# autoconf's default CXXFLAGS are usually "-g -O2". These aren't necessarily
+# the best choice for libprotobuf.
+AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
+ [CFLAGS=""])
+AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
+ [CXXFLAGS=""])
+
+AC_CANONICAL_TARGET
+
AM_INIT_AUTOMAKE
AC_ARG_WITH([zlib],
@@ -40,26 +45,15 @@ AC_PROG_CC
AC_PROG_CXX
AC_LANG([C++])
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.
+# test_util.cc takes forever to compile with GCC and optimization turned on.
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'`
+AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
+ AS_IF([test "$GCC" = "yes"],[
+ PROTOBUF_OPT_FLAG="-O2"
+ CXXFLAGS="${CXXFLAGS} -g"
+ ])
# Protocol Buffers contains several checks that are intended to be used only
# for debugging and which might hurt performance. Most users are probably
@@ -68,7 +62,6 @@ AS_IF([test "$protobuf_default_cxxflags" = "yes"],[
AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS])
],[
- PROTOBUF_OPT_FLAG=
AC_MSG_RESULT([use user-supplied: $CXXFLAGS])
])
@@ -76,6 +69,10 @@ AC_SUBST(PROTOBUF_OPT_FLAG)
ACX_CHECK_SUNCC
+# Have to do libtool after SUNCC, other wise it "helpfully" adds Crun Cstd
+# to the link
+AC_PROG_LIBTOOL
+
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdlib.h unistd.h])