[PATCH xlocale-config 3/6] Hook up nls/ to the build

Ran Benita ran234 at gmail.com
Sun Sep 14 13:44:36 PDT 2014


Adapted from libX11 as of commit
6101b967b641355dd863fd1ce52c6a7d58bcbe68.

The various files mention the following preprocessor definitions:

    WIN32  WCHAR32   SVR4  sun  VeryOldFreeBSD  INCLUDE_ru_SU  __uxp__
    USE_CTRL_SHIFT_T_SEQS

Besides WCHAR32, libX11 does not define any of these itself, so the
resulting files are the same.

Signed-off-by: Ran Benita <ran234 at gmail.com>
---
 Makefile.am         |  4 ++++
 configure.ac        | 38 +++++++++++++++++++++++++++++++++++++-
 cpprules.in         | 30 ++++++++++++++++++++++++++++++
 m4/ax_define_dir.m4 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 120 insertions(+), 1 deletion(-)
 create mode 100644 cpprules.in
 create mode 100644 m4/ax_define_dir.m4

diff --git a/Makefile.am b/Makefile.am
index 801fc5a..07dce46 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,7 @@
+SUBDIRS=nls
+
+ACLOCAL_AMFLAGS = -I m4
+
 MAINTAINERCLEANFILES = ChangeLog INSTALL
 
 .PHONY: ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index 16a2937..b89e141 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,6 +3,8 @@ AC_PREREQ([2.60])
 AC_INIT([xlocale-config], [0.0.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xlocale-config])
 AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CANONICAL_HOST
 
 # Initialize Automake
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -13,6 +15,40 @@ XORG_MACROS_VERSION(1.15)
 XORG_RELEASE_VERSION
 XORG_CHANGELOG
 XORG_INSTALL
+XORG_PROG_RAWCPP
+XORG_WITH_PERL
 
-AC_CONFIG_FILES([Makefile])
+# arch specific things
+WCHAR32="1"
+case $host_os in
+  os2*) WCHAR32="0" ;;
+  *) ;;
+esac
+AC_SUBST(WCHAR32)
+
+X11_DATADIR="${datadir}/X11"
+AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of X11 data])
+AC_SUBST(X11_DATADIR)
+
+X11_LOCALEDATADIR="${X11_DATADIR}/locale"
+AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of X11 locale data])
+AC_SUBST(X11_LOCALEDATADIR)
+
+locales="\
+ am_ET.UTF-8  armscii-8   C           cs_CZ.UTF-8  el_GR.UTF-8  en_US.UTF-8 \
+ fi_FI.UTF-8  georgian-academy        georgian-ps  ibm-cp1133   iscii-dev \
+ isiri-3342   iso8859-1   iso8859-10  iso8859-11   iso8859-13   iso8859-14 \
+ iso8859-15   iso8859-2   iso8859-3   iso8859-4    iso8859-5    iso8859-6 \
+ iso8859-7    iso8859-8   iso8859-9   iso8859-9e   ja           ja.JIS \
+ ja_JP.UTF-8  ja.SJIS     km_KH.UTF-8 ko           koi8-c       koi8-r \
+ koi8-u       ko_KR.UTF-8 microsoft-cp1251         microsoft-cp1255 \
+ microsoft-cp1256         mulelao-1   nokhchi-1    pt_BR.UTF-8  ru_RU.UTF-8 \
+ sr_CS.UTF-8  tatar-cyr   th_TH       th_TH.UTF-8  tscii-0      vi_VN.tcvn \
+ vi_VN.viscii zh_CN       zh_CN.gb18030            zh_CN.gbk    zh_CN.UTF-8 \
+ zh_HK.big5   zh_HK.big5hkscs         zh_HK.UTF-8  zh_TW        zh_TW.big5 \
+ zh_TW.UTF-8"
+AC_SUBST(locales)
+
+AC_CONFIG_FILES([Makefile
+		nls/Makefile])
 AC_OUTPUT
diff --git a/cpprules.in b/cpprules.in
new file mode 100644
index 0000000..03d6701
--- /dev/null
+++ b/cpprules.in
@@ -0,0 +1,30 @@
+#							-*- Makefile -*-
+# Rules for generating files using the C pre-processor
+# (Replaces CppFileTarget from Imake)
+
+SED = LC_CTYPE=C sed
+
+SUFFIXES += .pre
+
+WCHAR32_FLAGS = -DWCHAR32=@WCHAR32@
+
+CPP_FILES_FLAGS = $(WCHAR32_FLAGS)
+
+# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
+# to cpp, because that trick does not work on all ANSI C preprocessors.
+# Delete line numbers from the cpp output (-P is not portable, I guess).
+# Allow XCOMM to be preceded by whitespace and provide a means of generating
+# output lines with trailing backslashes.
+# Allow XHASH to always be substituted, even in cases where XCOMM isn't.
+
+CPP_SED_MAGIC = $(SED) -e '/^\#  *[0-9][0-9]*  *.*$$/d' \
+                       -e '/^\#line  *[0-9][0-9]*  *.*$$/d' \
+                       -e '/^[	 ]*XCOMM$$/s/XCOMM/\#/' \
+                       -e '/^[	 ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
+                       -e '/^[	 ]*XHASH/s/XHASH/\#/' \
+                       -e 's,X11_LOCALEDATADIR,$(X11_LOCALEDATADIR),g' \
+                       -e '/\@\@$$/s/\@\@$$/\\/'
+
+.pre:
+	@$(MKDIR_P) $(@D)
+	$(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@
diff --git a/m4/ax_define_dir.m4 b/m4/ax_define_dir.m4
new file mode 100644
index 0000000..b74d155
--- /dev/null
+++ b/m4/ax_define_dir.m4
@@ -0,0 +1,49 @@
+# ===========================================================================
+#       http://www.gnu.org/software/autoconf-archive/ax_define_dir.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
+#
+# DESCRIPTION
+#
+#   This macro sets VARNAME to the expansion of the DIR variable, taking
+#   care of fixing up ${prefix} and such.
+#
+#   VARNAME is then offered as both an output variable and a C preprocessor
+#   symbol.
+#
+#   Example:
+#
+#     AX_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Stepan Kasal <kasal at ucw.cz>
+#   Copyright (c) 2008 Andreas Schwab <schwab at suse.de>
+#   Copyright (c) 2008 Guido U. Draheim <guidod at gmx.de>
+#   Copyright (c) 2008 Alexandre Oliva
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 6
+
+AU_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR])
+AC_DEFUN([AX_DEFINE_DIR], [
+  prefix_NONE=
+  exec_prefix_NONE=
+  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
+dnl refers to ${prefix}.  Thus we have to use `eval' twice.
+  eval ax_define_dir="\"[$]$2\""
+  eval ax_define_dir="\"$ax_define_dir\""
+  AC_SUBST($1, "$ax_define_dir")
+  AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3])
+  test "$prefix_NONE" && prefix=NONE
+  test "$exec_prefix_NONE" && exec_prefix=NONE
+])
-- 
2.1.0



More information about the xorg-devel mailing list