~drizzle-trunk/drizzle/development

1099.1.6 by Monty Taylor
pandora-build v0.25
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.
1126.6.8 by Monty Taylor
pandora-build v0.62 - cleaned up some copyright header mistakes. Merged in trond's innodb detection.
6
dnl This file is free software; Sun Microsystems
1099.1.6 by Monty Taylor
pandora-build v0.25
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])
1948.1.4 by Monty Taylor
protobuf requires pthread. It's just the way it is.
26
  CXXFLAGS="${PTHREAD_CFLAGS} ${save_CXXFLAGS}"
27
  LIBPROTOBUF="${LIBPROTOBUF} ${PTHREAD_LIBS}"
28
  LTLIBPROTOBUF="${LTLIBPROTOBUF} ${PTHREAD_LIBS}"
1099.1.6 by Monty Taylor
pandora-build v0.25
29
  AC_LANG_POP()
30
])
31
32
AC_DEFUN([PANDORA_HAVE_LIBPROTOBUF],[
33
  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
34
])
35
36
AC_DEFUN([PANDORA_REQUIRE_LIBPROTOBUF],[
37
  AC_REQUIRE([PANDORA_HAVE_LIBPROTOBUF])
38
  AS_IF([test x$ac_cv_libprotobuf = xno],
2221.1.8 by Monty Taylor
Adds ability to just build libdrizzle without needing all of the rest of the
39
      PANDORA_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.]))
1099.1.6 by Monty Taylor
pandora-build v0.25
40
])
41
1093.9.16 by Monty Taylor
pandora-build v0.44 - add support for specifying the version required of protobuf
42
AC_DEFUN([PANDORA_PROTOBUF_REQUIRE_VERSION],[
1099.1.6 by Monty Taylor
pandora-build v0.25
43
  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
1093.9.16 by Monty Taylor
pandora-build v0.44 - add support for specifying the version required of protobuf
44
  p_recent_ver=$1
45
  p_recent_ver_major=`echo $p_recent_ver | cut -f1 -d.`
46
  p_recent_ver_minor=`echo $p_recent_ver | cut -f2 -d.`
47
  p_recent_ver_patch=`echo $p_recent_ver | cut -f3 -d.`
48
  p_recent_ver_hex=`printf "%d%03d%03d" $p_recent_ver_major $p_recent_ver_minor $p_recent_ver_patch` 
1099.1.6 by Monty Taylor
pandora-build v0.25
49
  AC_LANG_PUSH([C++])
1093.9.18 by Monty Taylor
Changed status message for protobuf check.
50
  AC_CACHE_CHECK([for protobuf >= $p_recent_ver],
51
    [drizzle_cv_protobuf_recent],
1099.1.6 by Monty Taylor
pandora-build v0.25
52
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
53
#include <google/protobuf/descriptor.h>
1093.9.16 by Monty Taylor
pandora-build v0.44 - add support for specifying the version required of protobuf
54
#if GOOGLE_PROTOBUF_VERSION < $p_recent_ver_hex
1099.1.6 by Monty Taylor
pandora-build v0.25
55
# error Your version of Protobuf is too old
56
#endif
57
      ]])],
1093.9.18 by Monty Taylor
Changed status message for protobuf check.
58
    [drizzle_cv_protobuf_recent=yes],
59
    [drizzle_cv_protobuf_recent=no])])
1099.1.6 by Monty Taylor
pandora-build v0.25
60
  AS_IF([test "$drizzle_cv_protobuf_recent" = "no"],[
2221.1.8 by Monty Taylor
Adds ability to just build libdrizzle without needing all of the rest of the
61
    PANDORA_MSG_ERROR([Your version of Google Protocol Buffers is too old. ${PACKAGE} requires at least version $p_recent_ver])
1099.1.6 by Monty Taylor
pandora-build v0.25
62
  ])
63
  AC_LANG_POP()
64
])
65
66
AC_DEFUN([_PANDORA_SEARCH_PROTOC],[
67
  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
68
  AC_PATH_PROG([PROTOC],[protoc],[no],[$LIBPROTOBUF_PREFIX/bin:$PATH])
69
])
70
71
AC_DEFUN([PANDORA_HAVE_PROTOC],[
72
  AC_REQUIRE([_PANDORA_SEARCH_PROTOC])
73
])
74
75
AC_DEFUN([PANDORA_REQUIRE_PROTOC],[
76
  AC_REQUIRE([PANDORA_HAVE_PROTOC])
77
  AS_IF([test "x$PROTOC" = "xno"],[
2221.1.8 by Monty Taylor
Adds ability to just build libdrizzle without needing all of the rest of the
78
    PANDORA_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.])
1099.1.6 by Monty Taylor
pandora-build v0.25
79
  ])
80
])
81
82