From c63b9b1ddc374ab52086d4a0e9469220f051371d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter_e@gmx.net> Date: Mon, 5 Jan 2009 10:25:59 +0000 Subject: [PATCH] When cross-compiling, allow and require an external zic program to be used when --with-system-tzdata is not used. initial patch by Richard Evans --- configure | 58 +++++++++++++++++++++++++++++++++++++++++- configure.in | 12 ++++++++- src/Makefile.global.in | 3 ++- src/timezone/Makefile | 4 +-- 4 files changed, 72 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 509473a9e25..6a13a24b693 100755 --- a/configure +++ b/configure @@ -744,6 +744,7 @@ python_includespec python_libdir python_libspec python_additional_libs +ZIC OSSP_UUID_LIBS HAVE_IPV6 LIBOBJS @@ -6955,6 +6956,60 @@ fi fi +if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then + # Extract the first word of "zic", so it can be a program name with args. +set dummy zic; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_ZIC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ZIC in + [\\/]* | ?:[\\/]*) + ac_cv_path_ZIC="$ZIC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ZIC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +ZIC=$ac_cv_path_ZIC +if test -n "$ZIC"; then + { echo "$as_me:$LINENO: result: $ZIC" >&5 +echo "${ECHO_T}$ZIC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + if test -z "$ZIC"; then + { { echo "$as_me:$LINENO: error: +When cross-compiling, either use the option --with-system-tzdata to use +existing time-zone data, or set the environment variable ZIC to a zic +program to use during the build." >&5 +echo "$as_me: error: +When cross-compiling, either use the option --with-system-tzdata to use +existing time-zone data, or set the environment variable ZIC to a zic +program to use during the build." >&2;} + { (exit 1); exit 1; }; } + fi +fi + # Supply a numeric version string for use by 3rd party add-ons # awk -F is a regex on some platforms, and not on others, so make "." a tab PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' | @@ -27320,6 +27375,7 @@ python_includespec!$python_includespec$ac_delim python_libdir!$python_libdir$ac_delim python_libspec!$python_libspec$ac_delim python_additional_libs!$python_additional_libs$ac_delim +ZIC!$ZIC$ac_delim OSSP_UUID_LIBS!$OSSP_UUID_LIBS$ac_delim HAVE_IPV6!$HAVE_IPV6$ac_delim LIBOBJS!$LIBOBJS$ac_delim @@ -27352,7 +27408,7 @@ vpath_build!$vpath_build$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 59; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 60; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.in b/configure.in index 2e833e6477d..910d1f73845 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -dnl $PostgreSQL: pgsql/configure.in,v 1.578 2009/01/01 17:23:31 momjian Exp $ +dnl $PostgreSQL: pgsql/configure.in,v 1.579 2009/01/05 10:25:59 petere Exp $ dnl dnl Developers, please strive to achieve this order: dnl @@ -845,6 +845,16 @@ if test "$with_python" = yes; then PGAC_CHECK_PYTHON_EMBED_SETUP fi +if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then + AC_PATH_PROG(ZIC, zic) + if test -z "$ZIC"; then + AC_MSG_ERROR([ +When cross-compiling, either use the option --with-system-tzdata to use +existing time-zone data, or set the environment variable ZIC to a zic +program to use during the build.]) + fi +fi + # Supply a numeric version string for use by 3rd party add-ons # awk -F is a regex on some platforms, and not on others, so make "." a tab [PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' | diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 749eae5a937..343f215b03f 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -1,5 +1,5 @@ # -*-makefile-*- -# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.250 2009/01/05 09:54:12 petere Exp $ +# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.251 2009/01/05 10:25:59 petere Exp $ #------------------------------------------------------------------------------ # All PostgreSQL makefiles include this file and use the variables it sets, @@ -224,6 +224,7 @@ FLEX = @FLEX@ FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS) DTRACE = @DTRACE@ DTRACEFLAGS = @DTRACEFLAGS@ +ZIC = @ZIC@ # Linking diff --git a/src/timezone/Makefile b/src/timezone/Makefile index bd9a5f46940..1a5fc06d446 100644 --- a/src/timezone/Makefile +++ b/src/timezone/Makefile @@ -4,7 +4,7 @@ # Makefile for the timezone library # IDENTIFICATION -# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.29 2008/02/19 15:29:58 petere Exp $ +# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.30 2009/01/05 10:25:59 petere Exp $ # #------------------------------------------------------------------------- @@ -43,7 +43,7 @@ zic: $(ZICOBJS) install: all installdirs ifeq (,$(with_system_tzdata)) - ./zic -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES) + $(if $(ZIC),$(ZIC),./zic) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES) endif $(MAKE) -C tznames $@ -- GitLab