~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/pandora_have_libndbclient.m4

pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.

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  Copyright (C) 2010 Monty Taylor
 
5
dnl  This file is free software; Sun Microsystems
 
6
dnl  gives unlimited permission to copy and/or distribute it,
 
7
dnl  with or without modifications, as long as this notice is preserved.
 
8
dnl
 
9
 
 
10
AC_DEFUN([_PANDORA_SEARCH_LIBNDBCLIENT],[
 
11
 
 
12
  AC_REQUIRE([AC_LIB_PREFIX])
 
13
  AC_REQUIRE([PANDORA_WITH_MYSQL])
 
14
 
 
15
  AC_ARG_ENABLE([libndbclient],
 
16
    [AS_HELP_STRING([--disable-libndbclient],
 
17
      [Build with libndbclient support @<:@default=on@:>@])],
 
18
    [ac_enable_libndbclient="$enableval"],
 
19
    [ac_enable_libndbclient="yes"])
 
20
 
 
21
  AC_ARG_WITH([libndbclient-prefix],
 
22
    [AS_HELP_STRING([--with-libndbclient-prefix],
 
23
      [search for libndbclient in DIR])],
 
24
    [ac_with_libndbclient=${withval}],
 
25
    [ac_with_libndbclient=${pandora_cv_mysql_base}])
 
26
 
 
27
  save_LIBS="${LIBS}"
 
28
  LIBS=""
 
29
  save_CPPFLAGS="${CPPFLAGS}"
 
30
  AS_IF([test "x${ac_with_libndbclient}" != "x"],[
 
31
    LIBS="-L${ac_with_libndbclient}/lib/mysql -L${ac_with_libndbclient}/lib"
 
32
    AS_IF([test "$GCC" = "yes"],[
 
33
      ndb_include_prefix="-isystem "
 
34
    ],[
 
35
      ndb_include_prefix="-I"
 
36
    ])
 
37
    CPPFLAGS="${CPPFLAGS} ${ndb_include_prefix}${ac_with_libndbclient}/include ${ndb_include_prefix}${ac_with_libndbclient}/include/mysql ${ndb_include_prefix}${ac_with_libndbclient}/include/mysql/storage/ndb ${ndb_include_prefix}${ac_with_libndbclient}/include/mysql/storage/ndb/ndbapi ${ndb_include_prefix}${ac_with_libndbclient}/include/mysql/storage/ndb/mgmapi"
 
38
  ])
 
39
  LIBS="${LIBS} -lndbclient -lmysqlclient_r"
 
40
 
 
41
  AC_CACHE_CHECK([if NdbApi works],[ac_cv_libndbclient],[
 
42
    AC_LANG_PUSH(C++)
 
43
    AC_LINK_IFELSE([
 
44
      AC_LANG_PROGRAM([[
 
45
#include <NdbApi.hpp>
 
46
      ]],[[
 
47
Ndb *ndb;
 
48
ndb_init();
 
49
      ]])
 
50
    ],[
 
51
      ac_cv_libndbclient=yes
 
52
    ],[
 
53
      ac_cv_libndbclient=no
 
54
    ])
 
55
  ])
 
56
  AC_LANG_POP()
 
57
 
 
58
  LIBNDBCLIENT="${LIBS}"
 
59
  LTLIBNDBCLIENT="${LIBS}"
 
60
  AC_SUBST([LIBNDBCLIENT])
 
61
  AC_SUBST([LTLIBNDBCLIENT])
 
62
 
 
63
  AS_IF([test "x${ac_cv_libndbclient}" = "xno"],[
 
64
    CPPFLAGS="${save_CPPFLAGS}"
 
65
  ])    
 
66
  LIBS="${save_LIBS}"
 
67
  
 
68
  AM_CONDITIONAL(HAVE_LIBNDBCLIENT, [test "x${ac_cv_libndbclient}" = "xyes"])
 
69
])
 
70
  
 
71
AC_DEFUN([PANDORA_HAVE_LIBNDBCLIENT],[
 
72
  AC_REQUIRE([_PANDORA_SEARCH_LIBNDBCLIENT])
 
73
])
 
74
 
 
75
AC_DEFUN([PANDORA_REQUIRE_LIBNDBCLIENT],[
 
76
  AC_REQUIRE([PANDORA_HAVE_LIBNDBCLIENT])
 
77
  AS_IF([test "x${ac_cv_libndbclient}" = "xno"],
 
78
      AC_MSG_ERROR([libndbclient is required for ${PACKAGE}]))
 
79
])
 
80