Commits

Barry Schwartz  committed b67cca5

Initial checkin, with icu::unicode::* support.

  • Participants

Comments (0)

Files changed (5)

+# Copyright (c) 2011 Barry Schwartz
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+# 
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+ACLOCAL_AMFLAGS = -I m4
+
+icudir = "${pure_libdir}/icu"
+unicodedir = "${icudir}/unicode"
+
+ICUUC_H = $(addprefix $(ICUUC_INCLUDEDIR)/unicode/, icuplug.h			\
+	parseerr.h putil.h ubidi.h ubrk.h ucasemap.h ucat.h uchar.h			\
+	uclean.h ucnv.h udata.h uenum.h uidna.h uiter.h unorm2.h unorm.h	\
+	urep.h ures.h uscript.h uset.h ushape.h usprep.h ustring.h			\
+	ustringtrie.h utext.h utf16.h utf32.h utf8.h utf_old.h utf.h		\
+	utrace.h uversion.h)
+ICUUC_PURE = $(addprefix icu/unicode/, $(notdir ${ICUUC_H:%.h=%.pure}))
+ICUUC_MINUSL = $(filter -l%, $(ICUUC_LIBS))
+
+ICUI18N_H = $(addprefix $(ICUI18N_INCLUDEDIR)/unicode/, bms.h ucal.h	\
+	ucoleitr.h ucol.h ucsdet.h ucurr.h udatpg.h udat.h ulocdata.h		\
+	umsg.h unum.h uregex.h usearch.h utmscale.h utrans.h )
+ICUI18N_PURE = $(addprefix icu/unicode/, $(notdir ${ICUI18N_H:%.h=%.pure}))
+ICUI18N_MINUSL = $(filter -l%, $(ICUI18N_LIBS))
+
+ICUIO_H = $(addprefix $(ICUIO_INCLUDEDIR)/unicode/, ustdio.h)
+ICUIO_PURE = $(addprefix icu/unicode/, $(notdir ${ICUIO_H:%.h=%.pure}))
+ICUIO_MINUSL = $(filter -l%, $(ICUIO_LIBS))
+
+dist_unicode_DATA = $(ICUUC_PURE) $(ICUI18N_PURE) $(ICUIO_PURE)
+
+icu/unicode/uversion.pure: $(ICUUC_INCLUDEDIR)/unicode/uversion.h
+	$(PUREGEN) -s																			\
+		"$(ICUUC_INCLUDEDIR)/unicode/uversion.h,$(ICUUC_INCLUDEDIR)/unicode/uvernum.h::"	\
+		$(filter -I% -D%, $(ICUUC_CFLAGS) $(CPPFLAGS) $(CFLAGS)) -m							\
+		icu -o icu/unicode/uversion.pure													\
+		"$(ICUUC_INCLUDEDIR)/unicode/uversion.h"											\
+		${ICUUC_MINUSL:-l%=-llib%}
+	$(SED) -i -e "s/^\(extern .* \([^ ]*\)${U_ICU_VERSION_SUFFIX}([^(]*)\);/\1 = \2;/" $@
+
+icu/unicode/%.pure: $(ICUUC_INCLUDEDIR)/unicode/%.h
+	if test x$(filter $(ICUUC_INCLUDEDIR)/unicode/$*.h, $(ICUUC_H)) != x ; then \
+		$(PUREGEN) -s "$(ICUUC_INCLUDEDIR)/unicode/$*.h::"					\
+			$(filter -I% -D%, $(ICUUC_CFLAGS) $(CPPFLAGS) $(CFLAGS)) -m icu \
+			-o icu/unicode/$*.pure					\
+			"$(ICUUC_INCLUDEDIR)/unicode/$*.h"		\
+			${ICUUC_MINUSL:-l%=-llib%} ;			\
+	elif test x$(filter $(ICUI18N_INCLUDEDIR)/unicode/$*.h, $(ICUI18N_H)) != x ; then \
+		$(PUREGEN) -s "$(ICUI18N_INCLUDEDIR)/unicode/$*.h::"					\
+			$(filter -I% -D%, $(ICUI18N_CFLAGS) $(CPPFLAGS) $(CFLAGS)) -m icu \
+			-o icu/unicode/$*.pure					\
+			"$(ICUI18N_INCLUDEDIR)/unicode/$*.h"		\
+			${ICUI18N_MINUSL:-l%=-llib%} ;			\
+    else \
+		$(PUREGEN) -s "$(ICUIO_INCLUDEDIR)/unicode/$*.h::"					\
+			$(filter -I% -D%, $(ICUIO_CFLAGS) $(CPPFLAGS) $(CFLAGS)) -m icu \
+			-o icu/unicode/$*.pure					\
+			"$(ICUIO_INCLUDEDIR)/unicode/$*.h"		\
+			${ICUIO_MINUSL:-l%=-llib%} ;			\
+	fi
+	$(SED) -i -e "s/^\(extern .* \([^ ]*\)${U_ICU_VERSION_SUFFIX}([^(]*)\);/\1 = \2;/" $@
+
+MOSTLYCLEANFILES = $(ICUUC_PURE) $(ICUI18N_PURE) $(ICUIO_PURE)

File configure.ac

+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+dnl Copyright (c) 2011 Barry Schwartz
+dnl 
+dnl Permission is hereby granted, free of charge, to any person obtaining a copy
+dnl of this software and associated documentation files (the "Software"), to deal
+dnl in the Software without restriction, including without limitation the rights
+dnl to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+dnl copies of the Software, and to permit persons to whom the Software is
+dnl furnished to do so, subject to the following conditions:
+dnl 
+dnl The above copyright notice and this permission notice shall be included in
+dnl all copies or substantial portions of the Software.
+dnl 
+dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+dnl AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+dnl OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+dnl THE SOFTWARE.
+
+AC_PREREQ([2.68])
+AC_INIT([pure-icu],[0.1],[https://bitbucket.org/chemoelectric/pure-icu])
+AM_INIT_AUTOMAKE([foreign])
+AC_CONFIG_MACRO_DIR([m4])
+CRUDFACT_PUREINCLUDEDIR
+CRUDFACT_PURELIBDIR
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_SED
+AC_PROG_FGREP
+CRUDFACT_REQUIRE_PURE
+CRUDFACT_REQUIRE_PUREGEN
+
+# Checks for libraries.
+PKG_CHECK_MODULES([ICUUC],[icu-uc])
+AC_ARG_VAR([ICUUC_INCLUDEDIR],[directory containing icu-uc headers])
+AC_MSG_CHECKING([location of icu-uc headers])
+if test x"${ICUUC_INCLUDEDIR}" = x ; then
+   AC_SUBST([ICUUC_INCLUDEDIR],
+            [`${PKG_CONFIG} --variable=includedir icu-uc`])
+fi
+AC_MSG_RESULT([${ICUUC_INCLUDEDIR}])
+
+PKG_CHECK_MODULES([ICUI18N],[icu-i18n])
+AC_ARG_VAR([ICUI18N_INCLUDEDIR],[directory containing icu-i18n headers])
+AC_MSG_CHECKING([locati18nn of icu-i18n headers])
+if test x"${ICUI18N_INCLUDEDIR}" = x ; then
+   AC_SUBST([ICUI18N_INCLUDEDIR],
+            [`${PKG_CONFIG} --variable=includedir icu-i18n`])
+fi
+AC_MSG_RESULT([${ICUI18N_INCLUDEDIR}])
+
+PKG_CHECK_MODULES([ICUIO],[icu-io])
+AC_ARG_VAR([ICUIO_INCLUDEDIR],[directory containing icu-io headers])
+AC_MSG_CHECKING([location of icu-io headers])
+if test x"${ICUIO_INCLUDEDIR}" = x ; then
+   AC_SUBST([ICUIO_INCLUDEDIR],
+            [`${PKG_CONFIG} --variable=includedir icu-io`])
+fi
+AC_MSG_RESULT([${ICUIO_INCLUDEDIR}])
+
+AC_MSG_CHECKING([ICU version suffix (U_ICU_VERSION_SUFFIX)])
+get_icu_version_suffix () {
+AC_TRY_RUN([
+#include <stdio.h>
+#include <unicode/uvernum.h>
+#define xstr(s) str(s)
+#define str(s) #s
+int main()
+{
+    puts(xstr(U_ICU_VERSION_SUFFIX));
+    return 0;
+}
+])
+}
+AC_SUBST([U_ICU_VERSION_SUFFIX])
+U_ICU_VERSION_SUFFIX=`get_icu_version_suffix`
+AC_MSG_RESULT([${U_ICU_VERSION_SUFFIX}])
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+
+AS_MKDIR_P(icu/unicode)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT

File m4/crudfact_pure.m4

+# CRUDFACT_REQUIRE_PURE
+# ---------------------
+AC_DEFUN([CRUDFACT_REQUIRE_PURE],
+[
+AC_ARG_VAR([PURE],[Pure interpreter command])
+if test x"${PURE}" = x ; then
+   AC_PATH_PROG([PURE], [pure])
+   test x"${PURE}" = x && AC_MSG_ERROR([could not find pure])
+else
+   AC_MSG_CHECKING([for pure])
+   AC_MSG_RESULT([${PURE}])
+fi
+])

File m4/crudfact_puredir.m4

+# CRUDFACT_PUREINCLUDE
+# --------------------
+AC_DEFUN([CRUDFACT_PUREINCLUDEDIR],
+[
+AC_SUBST([pure_includedir], ['${libdir}/pure'])
+AC_ARG_ENABLE([pure-includedir],
+        [AS_HELP_STRING([--enable-pure-includedir=DIR],
+                        [directory for Pure-language included source scripts [DIR=LIBDIR/pure]])],
+        [pure_includedir=${enableval}])
+])
+
+# CRUDFACT_PURELIBRARY
+# --------------------
+AC_DEFUN([CRUDFACT_PURELIBDIR],
+[
+AC_SUBST([pure_libdir], ['${libdir}/pure'])
+AC_ARG_ENABLE([pure-libdir],
+        [AS_HELP_STRING([--enable-pure-libdir=DIR],
+                        [directory for Pure-language dynamic libraries [DIR=LIBDIR/pure]])],
+        [pure_libdir=${enableval}])
+])

File m4/crudfact_puregen.m4

+# CRUDFACT_REQUIRE_PUREGEN
+# ------------------------
+AC_DEFUN([CRUDFACT_REQUIRE_PUREGEN],
+[
+AC_ARG_VAR([PUREGEN],[pure-gen command (Pure interface generator)])
+if test x"${PUREGEN}" = x ; then
+   AC_PATH_PROG([PUREGEN],[pure-gen])
+   test x"${PUREGEN}" = x && AC_MSG_ERROR([could not find pure-gen])
+else
+   AC_MSG_CHECKING([for pure-gen])
+   AC_MSG_RESULT([${PUREGEN}])
+fi
+])