~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to m4/pandora_have_protobuf.m4

  • Committer: Jay Pipes
  • Date: 2009-08-03 14:23:22 UTC
  • mfrom: (1039.2.68 staging)
  • mto: This revision was merged to the branch mainline in revision 1078.
  • Revision ID: jpipes@serialcoder-20090803142322-1g67h7su9mocg9ig
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
dnl   
 
4
dnl pandora-build: A pedantic build system
 
5
dnl Copyright (C) 2009 Sun Microsystems, Inc.
 
6
dnl This file is free software; the Free Software Foundation
 
7
dnl gives unlimited permission to copy and/or distribute it,
 
8
dnl with or without modifications, as long as this notice is preserved.
 
9
dnl
 
10
dnl From Monty Taylor
 
11
 
 
12
dnl --------------------------------------------------------------------
 
13
dnl  Check for Google Proto Buffers
 
14
dnl --------------------------------------------------------------------
 
15
 
 
16
AC_DEFUN([_PANDORA_SEARCH_LIBPROTOBUF],[
 
17
  AC_REQUIRE([PANDORA_HAVE_PTHREAD])
 
18
 
 
19
  AC_LANG_PUSH([C++])
 
20
  save_CXXFLAGS="${CXXFLAGS}"
 
21
  CXXFLAGS="${PTHREAD_CFLAGS} ${CXXFLAGS}"
 
22
  AC_LIB_HAVE_LINKFLAGS(protobuf,,
 
23
    [#include <google/protobuf/descriptor.h>],
 
24
    [google::protobuf::FileDescriptor* file;],
 
25
    [system])
 
26
  CXXFLAGS="${save_CXXFLAGS}"
 
27
  AC_LANG_POP()
 
28
])
 
29
 
 
30
AC_DEFUN([PANDORA_HAVE_LIBPROTOBUF],[
 
31
  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
 
32
])
 
33
 
 
34
AC_DEFUN([PANDORA_REQUIRE_LIBPROTOBUF],[
 
35
  AC_REQUIRE([PANDORA_HAVE_LIBPROTOBUF])
 
36
  AS_IF([test x$ac_cv_libprotobuf = xno],
 
37
      AC_MSG_ERROR([libprotobuf is required for ${PACKAGE}. On Debian this can be found in libprotobuf-dev. On RedHat this can be found in protobuf-devel.]))
 
38
])
 
39
 
 
40
AC_DEFUN([PANDORA_PROTOBUF_RECENT],[
 
41
  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
 
42
  AC_LANG_PUSH([C++])
 
43
  AC_CACHE_CHECK([if protobuf is recent enough], [drizzle_cv_protobuf_recent],
 
44
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 
45
#include <google/protobuf/descriptor.h>
 
46
#if GOOGLE_PROTOBUF_VERSION < 2000002
 
47
# error Your version of Protobuf is too old
 
48
#endif
 
49
      ]])],
 
50
      [drizzle_cv_protobuf_recent=yes],
 
51
      [drizzle_cv_protobuf_recent=no])])
 
52
  AS_IF([test "$drizzle_cv_protobuf_recent" = "no"],[
 
53
    AC_MSG_ERROR([Your version of Google Protocol Buffers is too old. ${PACKAGE} requires at least version 2.0.2])
 
54
  ])
 
55
  AC_LANG_POP()
 
56
])
 
57
 
 
58
AC_DEFUN([_PANDORA_SEARCH_PROTOC],[
 
59
  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
 
60
  AC_PATH_PROG([PROTOC],[protoc],[no],[$LIBPROTOBUF_PREFIX/bin:$PATH])
 
61
])
 
62
 
 
63
AC_DEFUN([PANDORA_HAVE_PROTOC],[
 
64
  AC_REQUIRE([_PANDORA_SEARCH_PROTOC])
 
65
])
 
66
 
 
67
AC_DEFUN([PANDORA_REQUIRE_PROTOC],[
 
68
  AC_REQUIRE([PANDORA_HAVE_PROTOC])
 
69
  AS_IF([test "x$PROTOC" = "xno"],[
 
70
    AC_MSG_ERROR([Couldn't find the protoc compiler. On Debian this can be found in protobuf-compiler. On RedHat this can be found in protobuf-compiler.])
 
71
  ])
 
72
])
 
73
 
 
74