[evolution-data-server/openismus-phonenumber-work: 2/3] build: Check for Google's libphonenumber
- From: Mathias Hasselmann <hasselmm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/openismus-phonenumber-work: 2/3] build: Check for Google's libphonenumber
- Date: Wed, 5 Dec 2012 00:02:27 +0000 (UTC)
commit e8157a6be93e0cf35a5b3a7b18e359b88b09cd8f
Author: Mathias Hasselmann <mathias openismus com>
Date: Tue Dec 4 22:44:03 2012 +0100
build: Check for Google's libphonenumber
This adds the EVO_PHONENUMBER_SUPPORT autconf macro and uses it.
configure.ac | 7 +++++
m4/evo_phonenumber.m4 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 74a5368..11fd8ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -217,6 +217,7 @@ fi
AC_PROG_CC
AC_PROG_CPP
+AC_PROG_CXX
AC_C_INLINE
AM_PROG_CC_C_O
AC_PROG_INSTALL
@@ -1246,6 +1247,11 @@ else
fi
dnl ******************************
+dnl libphonenumber support
+dnl ******************************
+EVO_PHONENUMBER_SUPPORT
+
+dnl ******************************
dnl GObject marshalling
dnl ******************************
AM_PATH_GLIB_2_0
@@ -1661,6 +1667,7 @@ echo "
Kerberos 5: $msg_krb5
SMIME support: $msg_smime
IPv6 support: $msg_ipv6
+ Phone number support: $msg_phonenumber
Dot Locking: $msg_dot
File Locking: $msg_file
Large files: $enable_largefile
diff --git a/m4/evo_phonenumber.m4 b/m4/evo_phonenumber.m4
new file mode 100644
index 0000000..395a3bc
--- /dev/null
+++ b/m4/evo_phonenumber.m4
@@ -0,0 +1,68 @@
+dnl EVO_PHONENUMBER_SUPPORT([default])
+dnl Check for Google's libphonenumber. Adds a --with-phonenumber option
+dnl to explicitly enable and disable phonenumber support, but also for
+dnl pointing to libphonenumber's install prefix.
+AC_DEFUN([EVO_PHONENUMBER_SUPPORT],[
+ AC_MSG_CHECKING([whether to enable phonenumber support])
+
+ evo_phonenumber_prefix=
+ msg_phonenumber=no
+
+ PHONENUMBER_INCLUDES=
+ PHONENUMBER_LIBS=
+
+ AC_ARG_WITH([phonenumber],
+ [AS_HELP_STRING([--with-phonenumber@<:@=PREFIX@:>@],
+ [use libphonenumber at PREFIX])],
+ [evo_phonenumber_prefix=$withval],
+ [with_phonenumber=m4_default([$1],[check])])
+
+ AC_MSG_RESULT([$with_phonenumber])
+
+ AS_VAR_IF([with_phonenumber], [no],, [
+ AC_LANG_PUSH(C++)
+
+ PHONENUMBER_LIBS="-lphonenumber -lboost_thread"
+
+ AS_VAR_IF([evo_phonenumber_prefix],,,[
+ PHONENUMBER_INCLUDES="-I$evo_phonenumber_prefix/include"
+ PHONENUMBER_LIBS="-L$evo_phonenumber_prefix/lib $PHONENUMBER_LIBS"
+ ])
+
+ evo_cxxflags_saved="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS $PHONENUMBER_INCLUDES"
+
+ evo_libs_saved="$LIBS"
+ LIBS="$LIBS $PHONENUMBER_LIBS"
+
+ AC_MSG_CHECKING([if libphonenumber is usable])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <phonenumbers/phonenumberutil.h>]],
+ [[i18n::phonenumbers::PhoneNumberUtil::GetInstance();]])],
+ [with_phonenumber=yes],
+ [AS_VAR_IF([with_phonenumber], [check], [with_phonenumber=no], [
+ AC_MSG_ERROR([libphonenumber cannot be used. Use --with-phonenumber to specify the library prefix.])])
+ ])
+
+ CXXFLAGS="$evo_cxxflags_saved"
+ LDFLAGS="$evo_ldflags_saved"
+ LIBS="$evo_libs_saved"
+
+ AS_VAR_IF([evo_phonenumber_prefix],,
+ [msg_phonenumber=$with_phonenumber],
+ [msg_phonenumber=$evo_phonenumber_prefix])
+
+ AC_MSG_RESULT([$with_phonenumber])
+ AC_LANG_POP(C++)
+ ])
+
+ AM_CONDITIONAL([ENABLE_PHONENUMBER],
+ [test "x$with_phonenumber" != "xno"])
+
+ AS_VAR_IF([with_phonenumber], [yes],
+ [AC_DEFINE([ENABLE_PHONENUMBER], 1, [Enable phonenumber parsing])])
+
+ AC_SUBST([PHONENUMBER_INCLUDES])
+ AC_SUBST([PHONENUMBER_LIBS])
+])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]