Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
4.7 KiB

  1. ## Process this file with autoconf to produce configure.
  2. ## In general, the safest way to proceed is to run ./autogen.sh
  3. AC_PREREQ(2.59)
  4. # Note: If you change the version, you must also update it in:
  5. # * java/pom.xml
  6. # * python/setup.py
  7. # * src/google/protobuf/stubs/common.h
  8. # * src/Makefile.am (Update -version-info for LDFLAGS if needed)
  9. #
  10. # In the SVN trunk, the version should always be the next anticipated release
  11. # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
  12. # the size of one file name in the dist tarfile over the 99-char limit.)
  13. AC_INIT([Protocol Buffers],[2.5.0],[[email protected]],[protobuf])
  14. AM_MAINTAINER_MODE([enable])
  15. AC_CONFIG_SRCDIR(src/google/protobuf/message.cc)
  16. AC_CONFIG_HEADERS([config.h])
  17. AC_CONFIG_MACRO_DIR([m4])
  18. # autoconf's default CXXFLAGS are usually "-g -O2". These aren't necessarily
  19. # the best choice for libprotobuf.
  20. AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
  21. [CFLAGS=""])
  22. AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
  23. [CXXFLAGS=""])
  24. AC_CANONICAL_TARGET
  25. AM_INIT_AUTOMAKE
  26. AC_ARG_WITH([zlib],
  27. [AS_HELP_STRING([--with-zlib],
  28. [include classes for streaming compressed data in and out @<:@default=check@:>@])],
  29. [],[with_zlib=check])
  30. AC_ARG_WITH([protoc],
  31. [AS_HELP_STRING([--with-protoc=COMMAND],
  32. [use the given protoc command instead of building a new one when building tests (useful for cross-compiling)])],
  33. [],[with_protoc=no])
  34. # Checks for programs.
  35. AC_PROG_CC
  36. AC_PROG_CXX
  37. AC_LANG([C++])
  38. ACX_USE_SYSTEM_EXTENSIONS
  39. AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
  40. # test_util.cc takes forever to compile with GCC and optimization turned on.
  41. AC_MSG_CHECKING([C++ compiler flags...])
  42. AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
  43. AS_IF([test "$GCC" = "yes"],[
  44. PROTOBUF_OPT_FLAG="-O2"
  45. CXXFLAGS="${CXXFLAGS} -g"
  46. ])
  47. # Protocol Buffers contains several checks that are intended to be used only
  48. # for debugging and which might hurt performance. Most users are probably
  49. # end users who don't want these checks, so add -DNDEBUG by default.
  50. CXXFLAGS="$CXXFLAGS -DNDEBUG"
  51. AC_MSG_RESULT([use default: $PROTOBUF_OPT_FLAG $CXXFLAGS])
  52. ],[
  53. AC_MSG_RESULT([use user-supplied: $CXXFLAGS])
  54. ])
  55. AC_SUBST(PROTOBUF_OPT_FLAG)
  56. ACX_CHECK_SUNCC
  57. # Have to do libtool after SUNCC, other wise it "helpfully" adds Crun Cstd
  58. # to the link
  59. AC_PROG_LIBTOOL
  60. # Checks for header files.
  61. AC_HEADER_STDC
  62. AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdlib.h unistd.h])
  63. # Checks for library functions.
  64. AC_FUNC_MEMCMP
  65. AC_FUNC_STRTOD
  66. AC_CHECK_FUNCS([ftruncate memset mkdir strchr strerror strtol])
  67. # Check for zlib.
  68. HAVE_ZLIB=0
  69. AS_IF([test "$with_zlib" != no], [
  70. AC_MSG_CHECKING([zlib version])
  71. # First check the zlib header version.
  72. AC_COMPILE_IFELSE(
  73. [AC_LANG_PROGRAM([[
  74. #include <zlib.h>
  75. #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1204)
  76. # error zlib version too old
  77. #endif
  78. ]], [])], [
  79. AC_MSG_RESULT([ok (1.2.0.4 or later)])
  80. # Also need to add -lz to the linker flags and make sure this succeeds.
  81. AC_SEARCH_LIBS([zlibVersion], [z], [
  82. AC_DEFINE([HAVE_ZLIB], [1], [Enable classes using zlib compression.])
  83. HAVE_ZLIB=1
  84. ], [
  85. AS_IF([test "$with_zlib" != check], [
  86. AC_MSG_FAILURE([--with-zlib was given, but no working zlib library was found])
  87. ])
  88. ])
  89. ], [
  90. AS_IF([test "$with_zlib" = check], [
  91. AC_MSG_RESULT([headers missing or too old (requires 1.2.0.4)])
  92. ], [
  93. AC_MSG_FAILURE([--with-zlib was given, but zlib headers were not present or were too old (requires 1.2.0.4)])
  94. ])
  95. ])
  96. ])
  97. AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1])
  98. AS_IF([test "$with_protoc" != "no"], [
  99. PROTOC=$with_protoc
  100. AS_IF([test "$with_protoc" = "yes"], [
  101. # No argument given. Use system protoc.
  102. PROTOC=protoc
  103. ])
  104. AS_IF([echo "$PROTOC" | grep -q '^@<:@^/@:>@.*/'], [
  105. # Does not start with a slash, but contains a slash. So, it's a relative
  106. # path (as opposed to an absolute path or an executable in $PATH).
  107. # Since it will actually be executed from the src directory, prefix with
  108. # the current directory. We also insert $ac_top_build_prefix in case this
  109. # is a nested package and --with-protoc was actually given on the outer
  110. # package's configure script.
  111. PROTOC=`pwd`/${ac_top_build_prefix}$PROTOC
  112. ])
  113. AC_SUBST([PROTOC])
  114. ])
  115. AM_CONDITIONAL([USE_EXTERNAL_PROTOC], [test "$with_protoc" != "no"])
  116. ACX_PTHREAD
  117. AC_CXX_STL_HASH
  118. # HACK: Make gtest's configure script pick up our copy of CFLAGS and CXXFLAGS,
  119. # since the flags added by ACX_CHECK_SUNCC must be used when compiling gtest
  120. # too.
  121. export CFLAGS
  122. export CXXFLAGS
  123. AC_CONFIG_SUBDIRS([gtest])
  124. AC_CONFIG_FILES([Makefile src/Makefile protobuf.pc protobuf-lite.pc])
  125. AC_OUTPUT