Skip to content

Commit 25bc5cd

Browse files
author
kenton@google.com
committed
Support "Solaris 10 using recent Sun Studio".
Patch from Monty Taylor <monty.taylor@gmail.com>.
1 parent 1ea5268 commit 25bc5cd

File tree

7 files changed

+52
-0
lines changed

7 files changed

+52
-0
lines changed

CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* Simplify template usage to work with MSVC 2003.
4242
* Work around GCC 4.3.x x86_64 compiler bug that caused crashes on startup.
4343
(This affected Fedora 9 in particular.)
44+
* Now works on "Solaris 10 using recent Sun Studio".
4445

4546
Java
4647
* New overload of mergeFrom() which parses a slice of a byte array instead

CONTRIBUTORS.txt

+2
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ Non-Google patch contributors:
5151
* Added @Override annotation to generated Java code where appropriate.
5252
Vincent Choini�re <Choiniere.Vincent@hydro.qc.ca>
5353
* Tru64 support.
54+
Monty Taylor <monty.taylor@gmail.com>
55+
* Solaris 10 + Sun Studio fix.

configure.ac

+9
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,22 @@ AC_INIT([protobuf],[2.0.3-SNAPSHOT],[protobuf@googlegroups.com])
1212

1313
AC_CONFIG_SRCDIR(src/google/protobuf/message.cc)
1414
AC_CONFIG_HEADERS([config.h])
15+
AC_CONFIG_MACRO_DIR([m4])
1516
AM_INIT_AUTOMAKE
1617

1718
# Checks for programs.
1819
AC_PROG_CC
1920
AC_PROG_CXX
21+
ACX_USE_SYSTEM_EXTENSIONS
2022
AC_PROG_LIBTOOL
2123
AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
24+
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
25+
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"
29+
])
30+
2231

2332
# Checks for header files.
2433
AC_HEADER_STDC

m4/ac_system_extensions.m4

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
dnl Provide AC_USE_SYSTEM_EXTENSIONS for old autoconf machines.
2+
AC_DEFUN([ACX_USE_SYSTEM_EXTENSIONS],[
3+
ifdef([AC_USE_SYSTEM_EXTENSIONS],[
4+
AC_USE_SYSTEM_EXTENSIONS
5+
],[
6+
AC_BEFORE([$0], [AC_COMPILE_IFELSE])
7+
AC_BEFORE([$0], [AC_RUN_IFELSE])
8+
9+
AC_REQUIRE([AC_GNU_SOURCE])
10+
AC_REQUIRE([AC_AIX])
11+
AC_REQUIRE([AC_MINIX])
12+
13+
AH_VERBATIM([__EXTENSIONS__],
14+
[/* Enable extensions on Solaris. */
15+
#ifndef __EXTENSIONS__
16+
# undef __EXTENSIONS__
17+
#endif
18+
#ifndef _POSIX_PTHREAD_SEMANTICS
19+
# undef _POSIX_PTHREAD_SEMANTICS
20+
#endif
21+
#ifndef _TANDEM_SOURCE
22+
# undef _TANDEM_SOURCE
23+
#endif])
24+
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
25+
[ac_cv_safe_to_define___extensions__],
26+
[AC_COMPILE_IFELSE(
27+
[AC_LANG_PROGRAM([
28+
# define __EXTENSIONS__ 1
29+
AC_INCLUDES_DEFAULT])],
30+
[ac_cv_safe_to_define___extensions__=yes],
31+
[ac_cv_safe_to_define___extensions__=no])])
32+
test $ac_cv_safe_to_define___extensions__ = yes &&
33+
AC_DEFINE([__EXTENSIONS__])
34+
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
35+
AC_DEFINE([_TANDEM_SOURCE])
36+
])
37+
])

src/google/protobuf/stubs/strutil.cc

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <float.h> // FLT_DIG and DBL_DIG
3636
#include <limits>
3737
#include <limits.h>
38+
#include <stdio.h>
3839

3940
#ifdef _WIN32
4041
// MSVC has only _snprintf, not snprintf.

src/google/protobuf/stubs/strutil_unittest.cc

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#include <google/protobuf/testing/googletest.h>
3636
#include <gtest/gtest.h>
37+
#include <locale.h>
3738

3839
namespace google {
3940
namespace protobuf {

src/gtest/gtest.cc

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <stdio.h>
4141
#include <stdlib.h>
4242
#include <string.h>
43+
#include <wchar.h>
4344

4445
#ifdef GTEST_OS_LINUX
4546

0 commit comments

Comments
 (0)