| OLD | NEW |
| (Empty) |
| 1 ## Process this file with autoconf to produce configure. | |
| 2 ## In general, the safest way to proceed is to run ./autogen.sh | |
| 3 | |
| 4 AC_PREREQ(2.59) | |
| 5 | |
| 6 # Note: If you change the version, you must also update it in: | |
| 7 # * java/pom.xml | |
| 8 # * python/setup.py | |
| 9 # * src/google/protobuf/stubs/common.h | |
| 10 # * src/Makefile.am (Update -version-info for LDFLAGS if needed) | |
| 11 # | |
| 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],[3.0.0-alpha-4-pre],[protobuf@googlegroups.com],[prot
obuf]) | |
| 16 | |
| 17 AM_MAINTAINER_MODE([enable]) | |
| 18 | |
| 19 AC_CONFIG_SRCDIR(src/google/protobuf/message.cc) | |
| 20 # The config file is generated but not used by the source code, since we only | |
| 21 # need very few of them, e.g. HAVE_PTHREAD and HAVE_ZLIB. Those macros are | |
| 22 # passed down in CXXFLAGS manually in src/Makefile.am | |
| 23 AC_CONFIG_HEADERS([config.h]) | |
| 24 AC_CONFIG_MACRO_DIR([m4]) | |
| 25 | |
| 26 AC_ARG_VAR(DIST_LANG, [language to include in the distribution package (i.e., ma
ke dist)]) | |
| 27 case "$DIST_LANG" in | |
| 28 "") DIST_LANG=all ;; | |
| 29 all | cpp | csharp | java | python | javanano | objectivec | ruby) ;; | |
| 30 *) AC_MSG_FAILURE([unknown language: $DIST_LANG]) ;; | |
| 31 esac | |
| 32 AC_SUBST(DIST_LANG) | |
| 33 | |
| 34 # autoconf's default CXXFLAGS are usually "-g -O2". These aren't necessarily | |
| 35 # the best choice for libprotobuf. | |
| 36 AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"], | |
| 37 [CFLAGS=""]) | |
| 38 AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"], | |
| 39 [CXXFLAGS=""]) | |
| 40 | |
| 41 AC_CANONICAL_TARGET | |
| 42 | |
| 43 AM_INIT_AUTOMAKE([1.9 tar-ustar subdir-objects]) | |
| 44 | |
| 45 AC_ARG_WITH([zlib], | |
| 46 [AS_HELP_STRING([--with-zlib], | |
| 47 [include classes for streaming compressed data in and out @<:@default=check@
:>@])], | |
| 48 [],[with_zlib=check]) | |
| 49 | |
| 50 AC_ARG_WITH([protoc], | |
| 51 [AS_HELP_STRING([--with-protoc=COMMAND], | |
| 52 [use the given protoc command instead of building a new one when building te
sts (useful for cross-compiling)])], | |
| 53 [],[with_protoc=no]) | |
| 54 | |
| 55 # Checks for programs. | |
| 56 AC_PROG_CC | |
| 57 AC_PROG_CXX | |
| 58 AC_LANG([C++]) | |
| 59 ACX_USE_SYSTEM_EXTENSIONS | |
| 60 m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) | |
| 61 AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc | |
| 62 | |
| 63 # test_util.cc takes forever to compile with GCC and optimization turned on. | |
| 64 AC_MSG_CHECKING([C++ compiler flags...]) | |
| 65 AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[ | |
| 66 AS_IF([test "$GCC" = "yes"],[ | |
| 67 PROTOBUF_OPT_FLAG="-O2" | |
| 68 CXXFLAGS="${CXXFLAGS} -g" | |
| 69 ]) | |
| 70 | |
| 71 # Protocol Buffers contains several checks that are intended to be used only | |
| 72 # for debugging and which might hurt performance. Most users are probably | |
| 73 # end users who don't want these checks, so add -DNDEBUG by default. | |
| 74 CXXFLAGS="$CXXFLAGS -DNDEBUG" | |
| 75 | |
| 76 AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS]) | |
| 77 ],[ | |
| 78 AC_MSG_RESULT([use user-supplied: $CXXFLAGS]) | |
| 79 ]) | |
| 80 | |
| 81 AC_SUBST(PROTOBUF_OPT_FLAG) | |
| 82 | |
| 83 ACX_CHECK_SUNCC | |
| 84 | |
| 85 # Have to do libtool after SUNCC, other wise it "helpfully" adds Crun Cstd | |
| 86 # to the link | |
| 87 AC_PROG_LIBTOOL | |
| 88 | |
| 89 # Checks for header files. | |
| 90 AC_HEADER_STDC | |
| 91 AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdlib.h unistd.h]) | |
| 92 | |
| 93 # Checks for library functions. | |
| 94 AC_FUNC_MEMCMP | |
| 95 AC_FUNC_STRTOD | |
| 96 AC_CHECK_FUNCS([ftruncate memset mkdir strchr strerror strtol]) | |
| 97 | |
| 98 # Check for zlib. | |
| 99 HAVE_ZLIB=0 | |
| 100 AS_IF([test "$with_zlib" != no], [ | |
| 101 AC_MSG_CHECKING([zlib version]) | |
| 102 | |
| 103 # First check the zlib header version. | |
| 104 AC_COMPILE_IFELSE( | |
| 105 [AC_LANG_PROGRAM([[ | |
| 106 #include <zlib.h> | |
| 107 #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1204) | |
| 108 # error zlib version too old | |
| 109 #endif | |
| 110 ]], [])], [ | |
| 111 AC_MSG_RESULT([ok (1.2.0.4 or later)]) | |
| 112 | |
| 113 # Also need to add -lz to the linker flags and make sure this succeeds. | |
| 114 AC_SEARCH_LIBS([zlibVersion], [z], [ | |
| 115 AC_DEFINE([HAVE_ZLIB], [1], [Enable classes using zlib compression.]) | |
| 116 HAVE_ZLIB=1 | |
| 117 ], [ | |
| 118 AS_IF([test "$with_zlib" != check], [ | |
| 119 AC_MSG_FAILURE([--with-zlib was given, but no working zlib library was f
ound]) | |
| 120 ]) | |
| 121 ]) | |
| 122 ], [ | |
| 123 AS_IF([test "$with_zlib" = check], [ | |
| 124 AC_MSG_RESULT([headers missing or too old (requires 1.2.0.4)]) | |
| 125 ], [ | |
| 126 AC_MSG_FAILURE([--with-zlib was given, but zlib headers were not present o
r were too old (requires 1.2.0.4)]) | |
| 127 ]) | |
| 128 ]) | |
| 129 ]) | |
| 130 AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1]) | |
| 131 | |
| 132 AS_IF([test "$with_protoc" != "no"], [ | |
| 133 PROTOC=$with_protoc | |
| 134 AS_IF([test "$with_protoc" = "yes"], [ | |
| 135 # No argument given. Use system protoc. | |
| 136 PROTOC=protoc | |
| 137 ]) | |
| 138 AS_IF([echo "$PROTOC" | grep -q '^@<:@^/@:>@.*/'], [ | |
| 139 # Does not start with a slash, but contains a slash. So, it's a relative | |
| 140 # path (as opposed to an absolute path or an executable in $PATH). | |
| 141 # Since it will actually be executed from the src directory, prefix with | |
| 142 # the current directory. We also insert $ac_top_build_prefix in case this | |
| 143 # is a nested package and --with-protoc was actually given on the outer | |
| 144 # package's configure script. | |
| 145 PROTOC=`pwd`/${ac_top_build_prefix}$PROTOC | |
| 146 ]) | |
| 147 AC_SUBST([PROTOC]) | |
| 148 ]) | |
| 149 AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"]) | |
| 150 | |
| 151 ACX_PTHREAD | |
| 152 AM_CONDITIONAL([HAVE_PTHREAD], [test "x$acx_pthread_ok" = "xyes"]) | |
| 153 | |
| 154 # We still keep this for improving pbconfig.h for unsupported platforms. | |
| 155 AC_CXX_STL_HASH | |
| 156 | |
| 157 case "$target_os" in | |
| 158 mingw* | cygwin* | win*) | |
| 159 ;; | |
| 160 *) | |
| 161 # Need to link against rt on Solaris | |
| 162 AC_SEARCH_LIBS([sched_yield], [rt], [], [AC_MSG_FAILURE([sched_yield was not
found on your system])]) | |
| 163 ;; | |
| 164 esac | |
| 165 | |
| 166 # HACK: Make gmock's configure script pick up our copy of CFLAGS and CXXFLAGS, | |
| 167 # since the flags added by ACX_CHECK_SUNCC must be used when compiling gmock | |
| 168 # too. | |
| 169 export CFLAGS | |
| 170 export CXXFLAGS | |
| 171 AC_CONFIG_SUBDIRS([gmock]) | |
| 172 | |
| 173 AC_CONFIG_FILES([Makefile src/Makefile conformance/Makefile protobuf.pc protobuf
-lite.pc]) | |
| 174 AC_OUTPUT | |
| OLD | NEW |