[evolution-data-server] build: Move langinfo checks into autoconf macro



commit 377d1450d9c93dff884539dcdf4c90e5bd148957
Author: Mathias Hasselmann <mathias openismus com>
Date:   Tue Dec 4 22:40:11 2012 +0100

    build: Move langinfo checks into autoconf macro
    
    Also add a check for _NL_ADDRESS_COUNTRY_AB2.
    Actually this second check was the motivation for touching this.

 configure.ac             |   17 +++++------------
 m4/evo_check_langinfo.m4 |   25 +++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 911e21f..4423aac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -615,18 +615,11 @@ if test "x$enable_backtraces" = xyes; then
 	fi
 fi
 
-dnl **********************************
-dnl Check for nl_langinfo and CODESET
-dnl **********************************
-AC_MSG_CHECKING([for nl_langinfo (CODESET)])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-	[[#include <langinfo.h>]],
-	[[char *codeset = nl_langinfo (CODESET);]]
-	)],[ac_cv_langinfo_codeset=yes],[ac_cv_langinfo_codeset=no])
-if test "x$ac_cv_langinfo_codeset" = "xyes"; then
-	AC_DEFINE(HAVE_CODESET, 1, [Have nl_langinfo (CODESET)])
-fi
-AC_MSG_RESULT([$ac_cv_langinfo_codeset])
+dnl ******************************
+dnl Check for nl_langinfo features
+dnl ******************************
+EVO_CHECK_LANGINFO([CODESET])
+EVO_CHECK_LANGINFO([_NL_ADDRESS_COUNTRY_AB2])
 
 dnl *******************************************************
 dnl Check to see if strftime supports the use of %l and %k
diff --git a/m4/evo_check_langinfo.m4 b/m4/evo_check_langinfo.m4
new file mode 100644
index 0000000..a59ab29
--- /dev/null
+++ b/m4/evo_check_langinfo.m4
@@ -0,0 +1,25 @@
+dnl EVO_CHECK_LANGINFO(detail)
+dnl Checks if the given langinfo detail is supported
+AC_DEFUN([EVO_CHECK_LANGINFO],[
+	AS_VAR_PUSHDEF([ac_cv_langinfo_detail],
+	               [ac_cv_langinfo_]m4_tolower($1))
+
+	AC_MSG_CHECKING([for nl_langinfo ($1)])
+
+	AC_LANG_PUSH(C)
+
+	AC_COMPILE_IFELSE(
+		[AC_LANG_PROGRAM(
+			[[#include <langinfo.h>]],
+			[[char *detail = nl_langinfo ($1);]])],
+		[ac_cv_langinfo_detail=yes],
+		[ac_cv_langinfo_detail=no])
+
+	AC_LANG_POP(C)
+
+	AS_VAR_IF([ac_cv_langinfo_detail], [yes],
+	          [AC_DEFINE([HAVE_]m4_toupper($1), 1, [Have nl_langinfo ($1)])])
+
+	AC_MSG_RESULT([$ac_cv_langinfo_detail])
+	AS_VAR_POPDEF([ac_cv_langinfo_detail])
+])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]