diff --git a/configure b/configure
index 509473a9e25990b7151a855650ffd01af58a5566..6a13a24b6934ce7749ca7df46a44984c805023eb 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 2e833e6477dad82d1c8e0b75ad3485dc53af7e48..910d1f738453bf25b688902498dc97711f3816a1 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 749eae5a937e1b45e27155245e3b77e75aceefa7..343f215b03f97e7342b9a30b8c64b89b100ce9e3 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 bd9a5f469409e033d86b6948e60aa3b7c42128a1..1a5fc06d4461ad5b55f2ae1e426b920e4c2ddfa7 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 $@