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
6be265a8
Commit
6be265a8
authored
Aug 06, 2009
by
kenton@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Sun Studio support. Patch from Monty Taylor.
parent
6c9f0020
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
38 deletions
+71
-38
configure.ac
configure.ac
+20
-23
acx_check_suncc.m4
m4/acx_check_suncc.m4
+51
-15
No files found.
configure.ac
View file @
6be265a8
...
...
@@ -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])
...
...
m4/acx_check_suncc.m4
View file @
6be265a8
...
...
@@ -14,22 +14,58 @@ AC_DEFUN([ACX_CHECK_SUNCC],[
AC_LANG_PUSH([C++])
AC_CHECK_DECL([__SUNPRO_CC], [SUNCC="yes"], [SUNCC="no"])
AC_LANG_POP()
AS_IF([test "$SUNCC" = "yes"],[
isainfo_k=`isainfo -k`
AS_IF([test "$target_cpu" = "sparc"],[
MEMALIGN_FLAGS="-xmemalign=8s"
IS_64="-m64"
LDFLAGS="${LDFLAGS} -L/usr/lib/${isainfo_k} -L/usr/local/lib/${isainfo_k}"
],[
AS_IF([test "$isainfo_k" = "amd64"],[
IS_64="-m64"
LDFLAGS="${LDFLAGS} -L/usr/lib/${isainfo_k} -L/usr/local/lib/${isainfo_k}"
])
])
CFLAGS="-g -xO4 -xlibmil -xdepend -Xa -mt -xstrconst ${IS_64} ${MEMALIGN_FLAGS} $CFLAGS"
CXXFLAGS="-g -xO4 -xlibmil -mt ${IS_64} ${MEMALIGN_FLAGS} -xlang=c99 -compat=5 -library=stlport4 -template=no%extdef $CXXFLAGS"
AC_ARG_ENABLE([64bit-solaris],
[AS_HELP_STRING([--disable-64bit-solaris],
[Build 64 bit binary on Solaris @<:@default=on@:>@])],
[ac_enable_64bit="$enableval"],
[ac_enable_64bit="yes"])
AS_IF([test "$SUNCC" = "yes" -a "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
dnl Sun Studio has a crashing bug with -xO4 in some cases. Keep this
dnl at -xO3 until a proper test to detect those crashes can be done.
CXXFLAGS="-g0 -xO3 -xlibmil -xdepend -xbuiltin -mt -compat=5 -library=stlport4 -template=no%extdef ${CXXFLAGS}"
])
AC_LANG_POP()
case $host_os in
*solaris*)
AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
AS_IF([test "x$ISAINFO" != "xno"],
[isainfo_b=`${ISAINFO} -b`],
[isainfo_b="x"])
AS_IF([test "$isainfo_b" != "x"],[
isainfo_k=`${ISAINFO} -k`
AS_IF([test "x$ac_enable_64bit" = "xyes"],[
AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[
LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}"
])
AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[
dnl The user hasn't overridden the default libdir, so we'll
dnl the dir suffix to match solaris 32/64-bit policy
libdir="${libdir}/${isainfo_k}"
])
dnl This should just be set in CPPFLAGS and in LDFLAGS, but libtool
dnl does the wrong thing if you don't put it into CXXFLAGS. sigh.
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
CXXFLAGS="${CXXFLAGS} -m64"
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-m64'
])
AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes" ],[
CXXFLAGS="-xmemalign=8s ${CXXFLAGS}"
])
])
])
;;
esac
])
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