You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by rv...@apache.org on 2015/09/19 02:36:33 UTC

[50/51] [partial] incubator-hawq git commit: SGA import

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index f81ae45..d1100fa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,51 @@
-# This file should contain patterns all developers want to ignore
-# If you have workspace specific files, add them 
-# to .git/info/exclude.
-#
-# see git help gitignore for more details
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+.deps
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
+*.o
+*.ko
+*.obj
+*.elf
+objfiles.txt
+
+# Eclipse Project
+.project
+.pydevproject
+
+# Generated files
+GNUmakefile
+config.log
+config.status
+VERSION
+env.sh
+ext/
+plr.tgz
+autom4te.cache/

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/.p4ignore
----------------------------------------------------------------------
diff --git a/.p4ignore b/.p4ignore
new file mode 100644
index 0000000..874517f
--- /dev/null
+++ b/.p4ignore
@@ -0,0 +1,38 @@
+GNUmakefile
+config.status
+a.out.dSYM
+confdefs.h
+conftest.c
+conftest.err
+config.status.lineno
+config.log
+configure.lineno
+.config.log.swp
+Debug
+Release
+*.log
+pgsql.sln
+*.vcproj
+autom4te.cache
+*.o
+*.so
+*.so.[0-9]
+*.so.[0-9].[0-9]
+*.sl
+*.sl.[0-9]
+*.sl.[0-9].[0-9]
+*.dylib
+*.dll
+*.a
+*.mo
+objfiles.txt
+.deps/
+*.gcno
+*.gcda
+*.gcov
+*.gcov.out
+lcov.info
+*.vcproj
+win32ver.rc
+*.exe
+lib*dll.defautom4te.cache

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/BUILD_INSTRUCTIONS
----------------------------------------------------------------------
diff --git a/BUILD_INSTRUCTIONS b/BUILD_INSTRUCTIONS
new file mode 100644
index 0000000..c19db42
--- /dev/null
+++ b/BUILD_INSTRUCTIONS
@@ -0,0 +1,43 @@
+Instruction for Building the Apache HAWQ
+
+September 2015
+
+Dependencies:
+
+Tested on Centos 6 with the following version.
+
+autoconf		2.63
+binutils		2.20.51
+bison			2.4.1
+flex			2.5.35
+gperf			3.0.4
+gcc				4.4.7
+g++				4.4.7
+make			3.81 
+perl			5.10.1
+python-devel	2.6.2
+zlib-devel		1.2.3
+bzip2-devel		1.0.5
+readline-devel	6.0
+libevent-devel	1.4.6
+LibYAML			0.1.1
+boost			1.55
+snappy			1.1.1
+thrift			0.9.1
+json-c			0.9
+libcurl			7.21.7
+libhdfs3		2.2.30
+libyarn			code shipped with HAWQ 
+
+
+Build
+
+./configure --prefix=/somewhere/you/want/to/install
+make -j8
+make install
+
+Test
+
+After setup a HAWQ cluster.
+
+make installcheck-good

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/COPYRIGHT
----------------------------------------------------------------------
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000..aad9ed4
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,25 @@
+Greenplum Database version of PostgreSQL Database Management System
+(formerly known as Postgres, then as Postgres95)
+
+Portions Copyright (c) 2011 EMC
+
+Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
+
+Portions Copyright (c) 1994, The Regents of the University of California
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose, without fee, and without a written agreement
+is hereby granted, provided that the above copyright notice and this
+paragraph and the following two paragraphs appear in all copies.
+
+IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
+PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/GNUmakefile.in
----------------------------------------------------------------------
diff --git a/GNUmakefile.in b/GNUmakefile.in
new file mode 100644
index 0000000..1dbf91a
--- /dev/null
+++ b/GNUmakefile.in
@@ -0,0 +1,157 @@
+#
+# PostgreSQL top level makefile
+#
+# $PostgreSQL: pgsql/GNUmakefile.in,v 1.45 2006/08/18 19:58:05 adunstan Exp $
+#
+
+subdir =
+top_builddir = .
+include $(top_builddir)/src/Makefile.global
+
+all:
+#	$(MAKE) -C doc all
+	$(MAKE) -C src all
+	$(MAKE) -C config all
+	$(MAKE) -C contrib/formatter_fixedwidth all
+	$(MAKE) -C contrib/gp_sparse_vector all
+#	$(MAKE) -C contrib/hawq-hadoop all
+	$(MAKE) -C contrib/gp_mdver all
+	$(MAKE) -C tools all
+	@echo "All of HAWQ successfully made. Ready to install."
+
+install: 
+#	$(MAKE) -C doc $@
+	$(MAKE) -C src $@
+	$(MAKE) -C config $@
+	$(MAKE) -C contrib/formatter_fixedwidth $@
+	$(MAKE) -C contrib/gp_sparse_vector $@
+#	$(MAKE) -C contrib/hawq-hadoop $@
+	$(MAKE) -C contrib/gp_mdver $@
+	$(MAKE) -C tools $@
+	@echo "HAWQ installation complete."
+
+installdirs uninstall:
+#	$(MAKE) -C doc $@
+	$(MAKE) -C src $@
+	$(MAKE) -C config $@
+	$(MAKE) -C contrib/formatter_fixedwidth $@
+	$(MAKE) -C contrib/gp_sparse_vector $@
+#	$(MAKE) -C contrib/hawq-hadoop $@
+	$(MAKE) -C contrib/gp_mdver $@	
+
+distprep:
+#	$(MAKE) -C doc $@
+	$(MAKE) -C src $@
+	$(MAKE) -C config $@
+	$(MAKE) -C contrib $@
+
+# clean, distclean, etc should apply to contrib too, even though
+# it's not built by default
+clean:
+#	$(MAKE) -C doc $@
+	$(MAKE) -C contrib $@
+	$(MAKE) -C src $@
+	$(MAKE) -C config $@
+	$(MAKE) -C contrib/formatter_fixedwidth $@
+	$(MAKE) -C contrib/gp_sparse_vector $@
+#	$(MAKE) -C contrib/hawq-hadoop $@
+	$(MAKE) -C contrib/gp_mdver $@	
+	$(MAKE) -C tools $@
+# Garbage from autoconf:
+	@rm -rf autom4te.cache/
+
+# Important: distclean `src' last, otherwise Makefile.global
+# will be gone too soon.
+distclean maintainer-clean:
+#	-$(MAKE) -C doc $@
+	-$(MAKE) -C contrib $@
+	-$(MAKE) -C config $@
+	-$(MAKE) -C tools $@
+	-$(MAKE) -C src $@
+	-rm -f config.cache config.log config.status GNUmakefile
+# Garbage from autoconf:
+	@rm -rf autom4te.cache/
+
+installcheck installcheck-parallel installcheck-good:
+	$(MAKE) -C src/test $@
+
+GNUmakefile: GNUmakefile.in $(top_builddir)/config.status
+	./config.status $@
+
+
+##########################################################################
+
+distdir	= postgresql-$(VERSION)
+dummy	= =install=
+garbage = =*  "#"*  ."#"*  *~*  *.orig  *.rej  core  postgresql-*
+
+dist: $(distdir).tar.gz 
+ifeq ($(split-dist), yes)
+dist: postgresql-base-$(VERSION).tar.gz postgresql-docs-$(VERSION).tar.gz postgresql-opt-$(VERSION).tar.gz postgresql-test-$(VERSION).tar.gz 
+endif
+dist:
+	-rm -rf $(distdir)
+
+$(distdir).tar: distdir
+	$(TAR) chf $@ $(distdir)
+
+opt_files = \
+	src/tools src/tutorial \
+	$(addprefix src/pl/, plpython tcl)
+
+#docs_files = doc/postgres.tar.gz doc/src doc/TODO.detail
+docs_files :=
+
+postgresql-base-$(VERSION).tar: distdir
+	$(TAR) -c $(addprefix --exclude $(distdir)/, $(docs_files) $(opt_files) src/test) \
+	  -f $@ $(distdir)
+
+postgresql-docs-$(VERSION).tar: distdir
+	$(TAR) cf $@ $(addprefix $(distdir)/, $(docs_files))
+
+postgresql-opt-$(VERSION).tar: distdir
+	$(TAR) cf $@ $(addprefix $(distdir)/, $(opt_files))
+
+postgresql-test-$(VERSION).tar: distdir
+	$(TAR) cf $@ $(distdir)/src/test
+
+distdir:
+	-rm -rf $(distdir)* $(dummy)
+	for x in `cd $(top_srcdir) && find . -name CVS -prune -o -print`; do \
+	  file=`expr X$$x : 'X\./\(.*\)'`; \
+	  if test -d "$(top_srcdir)/$$file" ; then \
+	    mkdir "$(distdir)/$$file" && chmod 777 "$(distdir)/$$file";	\
+	  else \
+	    ln "$(top_srcdir)/$$file" "$(distdir)/$$file" >/dev/null 2>&1 \
+	      || cp "$(top_srcdir)/$$file" "$(distdir)/$$file"; \
+	  fi || exit; \
+	done
+	$(MAKE) -C $(distdir) distprep
+	#$(MAKE) -C $(distdir)/doc/src/sgml/ HISTORY INSTALL regress_README
+	#cp $(distdir)/doc/src/sgml/HISTORY $(distdir)/
+	#cp $(distdir)/doc/src/sgml/INSTALL $(distdir)/
+	#cp $(distdir)/doc/src/sgml/regress_README $(distdir)/src/test/regress/README
+	$(MAKE) -C $(distdir) distclean
+	-rm -f $(distdir)/README.CVS
+
+distcheck: $(distdir).tar.gz
+	-rm -rf $(dummy)
+	mkdir $(dummy)
+	$(GZIP) -d -c $< | $(TAR) xf -
+	install_prefix=`cd $(dummy) && pwd`; \
+	cd $(distdir) \
+	&& ./configure --prefix="$$install_prefix"
+	$(MAKE) -C $(distdir) -q distprep
+	$(MAKE) -C $(distdir)
+	$(MAKE) -C $(distdir) install
+	$(MAKE) -C $(distdir) uninstall
+	@echo "checking whether \`$(MAKE) uninstall' works"
+	test `find $(dummy) ! -type d | wc -l` -eq 0
+	$(MAKE) -C $(distdir) dist
+# Room for improvement: Check here whether this distribution tarball
+# is sufficiently similar to the original one.
+	-rm -rf $(distdir) $(dummy)
+	@echo "Distribution integrity checks out."
+
+.PHONY: dist distdir distcheck
+unexport split-dist

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8f71f43
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..06c421a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+# The PostgreSQL make files exploit features of GNU make that other
+# makes do not have. Because it is a common mistake for users to try
+# to build Postgres with a different make, we have this make file
+# that, as a service, will look for a GNU make and invoke it, or show
+# an error message if none could be found.
+
+# If the user were using GNU make now, this file would not get used
+# because GNU make uses a make file named "GNUmakefile" in preference
+# to "Makefile" if it exists. PostgreSQL is shipped with a
+# "GNUmakefile". If the user hasn't run the configure script yet, the
+# GNUmakefile won't exist yet, so we catch that case as well.
+
+
+all check install installdirs installcheck installcheck-parallel installcheck-good dist distcheck world check-world install-world installcheck-world uninstall clean distclean maintainer-clean:
+	@if [ ! -f GNUmakefile ] ; then \
+	   echo "You need to run the 'configure' program first. See the file"; \
+	   echo "'INSTALL' for installation instructions." ; \
+	   false ; \
+	 fi
+	@IFS=':' ; \
+	 for dir in $$PATH; do \
+	   for prog in gmake gnumake make; do \
+	     if [ -f $$dir/$$prog ] && ( $$dir/$$prog -f /dev/null --version 2>/dev/null | grep GNU >/dev/null 2>&1 ) ; then \
+	       GMAKE=$$dir/$$prog; \
+	       break 2; \
+	     fi; \
+	   done; \
+	 done; \
+	\
+	 if [ x"$${GMAKE+set}" = xset ]; then \
+	   echo "Using GNU make found at $${GMAKE}"; \
+	   $${GMAKE} $@ ; \
+	 else \
+	   echo "You must use GNU make to build PostgreSQL." ; \
+	   false; \
+	 fi

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/README-PostgreSQL
----------------------------------------------------------------------
diff --git a/README-PostgreSQL b/README-PostgreSQL
new file mode 100644
index 0000000..49d55af
--- /dev/null
+++ b/README-PostgreSQL
@@ -0,0 +1,28 @@
+PostgreSQL Database Management System
+=====================================
+
+This directory contains the source code distribution of the PostgreSQL
+database management system.
+
+PostgreSQL is an advanced object-relational database management system
+that supports an extended subset of the SQL standard, including
+transactions, foreign keys, subqueries, triggers, user-defined types
+and functions.  This distribution also contains C language bindings.
+
+PostgreSQL has many language interfaces, many of which are listed here:
+
+	http://www.postgresql.org/download
+
+See the file INSTALL for instructions on how to build and install
+PostgreSQL.  That file also lists supported operating systems and
+hardware platforms and contains information regarding any other
+software packages that are required to build or run the PostgreSQL
+system.  Changes between all PostgreSQL releases are recorded in the
+file HISTORY.  Copyright and license information can be found in the
+file COPYRIGHT.  A comprehensive documentation set is included in this
+distribution; it can be read as described in the installation
+instructions.
+
+The latest version of this software may be obtained at
+http://www.postgresql.org/download/.  For more information look at our
+web site located at http://www.postgresql.org/.

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1379f5d
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# Apache HAWQ

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/aclocal.m4
----------------------------------------------------------------------
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..df6ee3a
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,15 @@
+dnl aclocal.m4
+m4_include([config/ac_func_accept_argtypes.m4])
+m4_include([config/acx_pthread.m4])
+m4_include([config/c-compiler.m4])
+m4_include([config/c-library.m4])
+m4_include([config/docbook.m4])
+m4_include([config/general.m4])
+m4_include([config/libtool.m4])
+m4_include([config/perl.m4])
+m4_include([config/programs.m4])
+m4_include([config/python.m4])
+m4_include([config/java.m4])
+m4_include([config/tcl.m4])
+m4_include([config/curl.m4])
+m4_include([config/maven.m4])

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/config/Makefile
----------------------------------------------------------------------
diff --git a/config/Makefile b/config/Makefile
new file mode 100644
index 0000000..b4d99ea
--- /dev/null
+++ b/config/Makefile
@@ -0,0 +1,16 @@
+# config/Makefile
+
+subdir = config
+top_builddir = ..
+include $(top_builddir)/src/Makefile.global
+
+
+install: all installdirs
+	$(INSTALL_SCRIPT) $(srcdir)/install-sh '$(DESTDIR)$(pgxsdir)/config/install-sh'
+	$(INSTALL_SCRIPT) $(srcdir)/mkinstalldirs '$(DESTDIR)$(pgxsdir)/config/mkinstalldirs'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(pgxsdir)/config'
+
+uninstall:
+	rm -f '$(DESTDIR)$(pgxsdir)/config/install-sh' '$(DESTDIR)$(pgxsdir)/config/mkinstalldirs'

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/config/ac_func_accept_argtypes.m4
----------------------------------------------------------------------
diff --git a/config/ac_func_accept_argtypes.m4 b/config/ac_func_accept_argtypes.m4
new file mode 100644
index 0000000..4a9aa31
--- /dev/null
+++ b/config/ac_func_accept_argtypes.m4
@@ -0,0 +1,85 @@
+# config/ac_func_accept_argtypes.m4
+# This comes from the official Autoconf macro archive at
+# <http://research.cys.de/autoconf-archive/>
+
+
+dnl @synopsis AC_FUNC_ACCEPT_ARGTYPES
+dnl
+dnl Checks the data types of the three arguments to accept(). Results are
+dnl placed into the symbols ACCEPT_TYPE_RETURN and ACCEPT_TYPE_ARG[123],
+dnl consistent with the following example:
+dnl
+dnl       #define ACCEPT_TYPE_RETURN int
+dnl       #define ACCEPT_TYPE_ARG1 int
+dnl       #define ACCEPT_TYPE_ARG2 struct sockaddr *
+dnl       #define ACCEPT_TYPE_ARG3 socklen_t
+dnl
+dnl This macro requires AC_CHECK_HEADERS to have already verified the
+dnl presence or absence of sys/types.h and sys/socket.h.
+dnl
+dnl NOTE: This is just a modified version of the AC_FUNC_SELECT_ARGTYPES
+dnl macro. Credit for that one goes to David MacKenzie et. al.
+dnl
+dnl @version Id: ac_func_accept_argtypes.m4,v 1.1 1999/12/03 11:29:29 simons Exp $
+dnl @author Daniel Richard G. <sk...@mit.edu>
+dnl
+
+# PostgreSQL local changes: In the original version ACCEPT_TYPE_ARG3
+# is a pointer type. That's kind of useless because then you can't
+# use the macro to define a corresponding variable. We also make the
+# reasonable(?) assumption that you can use arg3 for getsocktype etc.
+# as well (i.e., anywhere POSIX.2 has socklen_t).
+#
+# arg2 can also be `const' (e.g., RH 4.2). Change the order of tests
+# for arg3 so that `int' is first, in case there is no prototype at all.
+#
+# Solaris 7 and 8 have arg3 as 'void *' (disguised as 'Psocklen_t'
+# which is *not* 'socklen_t *').  If we detect that, then we assume
+# 'int' as the result, because that ought to work best.
+#
+# On Win32, accept() returns 'unsigned int PASCAL'
+# Win64 uses SOCKET for return and arg1
+
+AC_DEFUN([AC_FUNC_ACCEPT_ARGTYPES],
+[AC_MSG_CHECKING([types of arguments for accept()])
+ AC_CACHE_VAL(ac_cv_func_accept_return,dnl
+ [AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl
+  [AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
+   [AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl
+    [for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL' 'SOCKET'; do
+      for ac_cv_func_accept_arg1 in 'int' 'unsigned int' 'SOCKET'; do
+       for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
+        for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do
+         AC_TRY_COMPILE(
+[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],
+         [], [ac_not_found=no; break 4], [ac_not_found=yes])
+       done
+      done
+     done
+    done
+    if test "$ac_not_found" = yes; then
+      AC_MSG_ERROR([could not determine argument types])
+    fi
+    if test "$ac_cv_func_accept_arg3" = "void"; then
+      ac_cv_func_accept_arg3=int
+    fi
+    ])dnl AC_CACHE_VAL
+   ])dnl AC_CACHE_VAL
+  ])dnl AC_CACHE_VAL
+ ])dnl AC_CACHE_VAL
+ AC_MSG_RESULT([$ac_cv_func_accept_return, $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *])
+ AC_DEFINE_UNQUOTED(ACCEPT_TYPE_RETURN, $ac_cv_func_accept_return,
+                    [Define to the return type of 'accept'])
+ AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1, $ac_cv_func_accept_arg1,
+                    [Define to the type of arg 1 of 'accept'])
+ AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2, $ac_cv_func_accept_arg2,
+                    [Define to the type of arg 2 of 'accept'])
+ AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG3, $ac_cv_func_accept_arg3,
+                    [Define to the type of arg 3 of 'accept'])
+])

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/config/acx_pthread.m4
----------------------------------------------------------------------
diff --git a/config/acx_pthread.m4 b/config/acx_pthread.m4
new file mode 100644
index 0000000..6ff241e
--- /dev/null
+++ b/config/acx_pthread.m4
@@ -0,0 +1,228 @@
+dnl PGSGL:  When updating, comment out port-specific part below;
+dnl see the comment below with the word "PostgreSQL".
+dnl
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
+dnl
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config pthreadGC2"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthread or
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        tryPTHREAD_CFLAGS=""
+        tryPTHREAD_LIBS=""
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                tryPTHREAD_CFLAGS="$flag"
+                ;;
+
+                pthread-config)
+                # skip this if we already have flags defined, for PostgreSQL
+                if test x"$PTHREAD_CFLAGS" != x -o x"$PTHREAD_LIBS" != x; then continue; fi
+                AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+                if test x"$acx_pthread_config" = xno; then continue; fi
+                tryPTHREAD_CFLAGS="`pthread-config --cflags`"
+                tryPTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+                ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                tryPTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$tryPTHREAD_LIBS $PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS $tryPTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [acx_pthread_ok=yes], [acx_pthread_ok=no])
+
+        if test "x$acx_pthread_ok" = xyes; then
+            # Don't use options that are ignored by the compiler.
+            # We find them by checking stderror.
+            cat >conftest.$ac_ext <<_ACEOF
+int
+main (int argc, char **argv)
+{
+  (void) argc;
+  (void) argv;
+  return 0;
+}
+_ACEOF
+            rm -f conftest.$ac_objext conftest$ac_exeext
+            # Check both linking and compiling, because they might tolerate different options.
+            if test "`(eval $ac_link 2>&1 1>&5)`" = "" && test "`(eval $ac_compile 2>&1 1>&5)`" = ""; then
+                # we continue with more flags because Linux needs -lpthread
+                # for libpq builds on PostgreSQL.  The test above only
+                # tests for building binaries, not shared libraries.
+                PTHREAD_LIBS=" $tryPTHREAD_LIBS $PTHREAD_LIBS"
+                PTHREAD_CFLAGS="$PTHREAD_CFLAGS $tryPTHREAD_CFLAGS"
+            else   acx_pthread_ok=no
+            fi
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: threads are created detached by default
+        # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
+        AC_MSG_CHECKING([for joinable pthread attribute])
+        AC_TRY_LINK([#include <pthread.h>],
+                    [int attr=PTHREAD_CREATE_JOINABLE;],
+                    ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
+        if test x"$ok" = xunknown; then
+                AC_TRY_LINK([#include <pthread.h>],
+                            [int attr=PTHREAD_CREATE_UNDETACHED;],
+                            ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
+        fi
+        if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
+                AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
+                          [Define to the necessary symbol if this constant
+                           uses a non-standard name on your system.])
+        fi
+        AC_MSG_RESULT(${ok})
+        if test x"$ok" = xunknown; then
+                AC_MSG_WARN([we do not know how to create joinable pthreads])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+# We always add these in PostgreSQL
+#       case "${host_cpu}-${host_os}" in
+#               *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+#               *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+#       esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+                PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+# Supporting cc_r would require a special CC in all places that
+# use libpq, and that is ugly, so we don't do it.  Users can still
+# define their compiler as cc_r to do thread builds of everything.
+        # More AIX lossage: must compile with cc_r
+        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/config/ax_pthread.m4
----------------------------------------------------------------------
diff --git a/config/ax_pthread.m4 b/config/ax_pthread.m4
new file mode 100644
index 0000000..83d8d1b
--- /dev/null
+++ b/config/ax_pthread.m4
@@ -0,0 +1,272 @@
+# ===========================================================================
+#           http://www.nongnu.org/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+#   This macro figures out how to build C programs using POSIX threads. It
+#   sets the PTHREAD_LIBS output variable to the threads library and linker
+#   flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+#   flags that are needed. (The user can also force certain compiler
+#   flags/libs to be tested by setting these environment variables.)
+#
+#   Also sets PTHREAD_CC to any special C compiler that is needed for
+#   multi-threaded programs (defaults to the value of CC otherwise). (This
+#   is necessary on AIX to use the special cc_r compiler alias.)
+#
+#   NOTE: You are assumed to not only compile your program with these flags,
+#   but also link it with them as well. e.g. you should link with
+#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+#   If you are only building threads programs, you may wish to use these
+#   variables in your default LIBS, CFLAGS, and CC:
+#
+#          LIBS="$PTHREAD_LIBS $LIBS"
+#          CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+#          CC="$PTHREAD_CC"
+#
+#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+#   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+#   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+#   ACTION-IF-FOUND is a list of shell commands to run if a threads library
+#   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+#   is not found. If ACTION-IF-FOUND is not specified, the default action
+#   will define HAVE_PTHREAD.
+#
+#   Please let the authors know if this macro fails on any platform, or if
+#   you have any other suggestions or comments. This macro was based on work
+#   by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+#   from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+#   Alejandro Forero Cuervo to the autoconf macro repository. We are also
+#   grateful for the helpful feedback of numerous users.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Steven G. Johnson <st...@alum.mit.edu>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
+        AC_MSG_RESULT($ax_pthread_ok)
+        if test x"$ax_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+#      ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+        ;;
+esac
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+		pthread-config)
+		AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
+		if test x"$ax_pthread_config" = xno; then continue; fi
+		PTHREAD_CFLAGS="`pthread-config --cflags`"
+		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+		;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [ax_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($ax_pthread_ok)
+        if test "x$ax_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+	AC_MSG_CHECKING([for joinable pthread attribute])
+	attr_name=unknown
+	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+	    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
+                        [attr_name=$attr; break])
+	done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with xlc_r or cc_r
+	if test x"$GCC" != xyes; then
+          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+        else
+          PTHREAD_CC=$CC
+	fi
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        ax_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl AX_PTHREAD

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/config/c-compiler.m4
----------------------------------------------------------------------
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
new file mode 100644
index 0000000..778a8f8
--- /dev/null
+++ b/config/c-compiler.m4
@@ -0,0 +1,183 @@
+# Macros to detect C compiler features
+# config/c-compiler.m4
+
+
+# PGAC_C_SIGNED
+# -------------
+# Check if the C compiler understands signed types.
+AC_DEFUN([PGAC_C_SIGNED],
+[AC_CACHE_CHECK(for signed types, pgac_cv_c_signed,
+[AC_TRY_COMPILE([],
+[signed char c; signed short s; signed int i;],
+[pgac_cv_c_signed=yes],
+[pgac_cv_c_signed=no])])
+if test x"$pgac_cv_c_signed" = xno ; then
+  AC_DEFINE(signed,, [Define to empty if the C compiler does not understand signed types.])
+fi])# PGAC_C_SIGNED
+
+
+
+# PGAC_C_INLINE
+# -------------
+# Check if the C compiler understands inline functions.
+# Defines: inline, USE_INLINE
+AC_DEFUN([PGAC_C_INLINE],
+[AC_C_INLINE
+AC_CACHE_CHECK([for quiet inline (no complaint if unreferenced)], pgac_cv_c_inline_quietly,
+  [pgac_cv_c_inline_quietly=no
+  if test "$ac_cv_c_inline" != no; then
+    pgac_c_inline_save_werror=$ac_c_werror_flag
+    ac_c_werror_flag=yes
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([static inline int fun () {return 0;}],[])],
+                   [pgac_cv_c_inline_quietly=yes])
+    ac_c_werror_flag=$pgac_c_inline_save_werror
+  fi])
+if test "$pgac_cv_c_inline_quietly" != no; then
+  AC_DEFINE_UNQUOTED([USE_INLINE], 1,
+    [Define to 1 if "static inline" works without unwanted warnings from ]
+    [compilations where static inline functions are defined but not called.])
+fi
+])# PGAC_C_INLINE
+
+
+
+# PGAC_TYPE_64BIT_INT(TYPE)
+# -------------------------
+# Check if TYPE is a working 64 bit integer type. Set HAVE_TYPE_64 to
+# yes or no respectively, and define HAVE_TYPE_64 if yes.
+AC_DEFUN([PGAC_TYPE_64BIT_INT],
+[define([Ac_define], [translit([have_$1_64], [a-z *], [A-Z_P])])dnl
+define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
+AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
+[AC_TRY_RUN(
+[typedef $1 ac_int64;
+
+/*
+ * These are globals to discourage the compiler from folding all the
+ * arithmetic tests down to compile-time constants.
+ */
+ac_int64 a = 20000001;
+ac_int64 b = 40000005;
+
+int does_int64_work()
+{
+  ac_int64 c,d;
+
+  if (sizeof(ac_int64) != 8)
+    return 0;			/* definitely not the right size */
+
+  /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
+  c = a * b;
+  d = (c + b) / b;
+  if (d != a+1)
+    return 0;
+  return 1;
+}
+main() {
+  exit(! does_int64_work());
+}],
+[Ac_cachevar=yes],
+[Ac_cachevar=no],
+[# If cross-compiling, check the size reported by the compiler and
+# trust that the arithmetic works.
+AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([], [sizeof($1) == 8])],
+                  Ac_cachevar=yes,
+                  Ac_cachevar=no)])])
+
+Ac_define=$Ac_cachevar
+if test x"$Ac_cachevar" = xyes ; then
+  AC_DEFINE(Ac_define, 1, [Define to 1 if `]$1[' works and is 64 bits.])
+fi
+undefine([Ac_define])dnl
+undefine([Ac_cachevar])dnl
+])# PGAC_TYPE_64BIT_INT
+
+
+
+# PGAC_CHECK_ALIGNOF(TYPE, [INCLUDES = DEFAULT-INCLUDES])
+# -----------------------------------------------------
+# Find the alignment requirement of the given type. Define the result
+# as ALIGNOF_TYPE.  This macro works even when cross compiling.
+# (Modelled after AC_CHECK_SIZEOF.)
+
+AC_DEFUN([PGAC_CHECK_ALIGNOF],
+[AS_LITERAL_IF([$1], [],
+               [AC_FATAL([$0: requires literal arguments])])dnl
+AC_CHECK_TYPE([$1], [], [], [$2])
+AC_CACHE_CHECK([alignment of $1], [AS_TR_SH([pgac_cv_alignof_$1])],
+[if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
+  _AC_COMPUTE_INT([((char*) & pgac_struct.field) - ((char*) & pgac_struct)],
+                  [AS_TR_SH([pgac_cv_alignof_$1])],
+                  [AC_INCLUDES_DEFAULT([$2])
+struct { char filler; $1 field; } pgac_struct;],
+                  [AC_MSG_ERROR([cannot compute alignment of $1, 77])])
+else
+  AS_TR_SH([pgac_cv_alignof_$1])=0
+fi])dnl
+AC_DEFINE_UNQUOTED(AS_TR_CPP(alignof_$1),
+                   [$AS_TR_SH([pgac_cv_alignof_$1])],
+                   [The alignment requirement of a `$1'.])
+])# PGAC_CHECK_ALIGNOF
+
+
+# PGAC_C_FUNCNAME_SUPPORT
+# -----------------------
+# Check if the C compiler understands __func__ (C99) or __FUNCTION__ (gcc).
+# Define HAVE_FUNCNAME__FUNC or HAVE_FUNCNAME__FUNCTION accordingly.
+AC_DEFUN([PGAC_C_FUNCNAME_SUPPORT],
+[AC_CACHE_CHECK(for __func__, pgac_cv_funcname_func_support,
+[AC_TRY_COMPILE([#include <stdio.h>],
+[printf("%s\n", __func__);],
+[pgac_cv_funcname_func_support=yes],
+[pgac_cv_funcname_func_support=no])])
+if test x"$pgac_cv_funcname_func_support" = xyes ; then
+AC_DEFINE(HAVE_FUNCNAME__FUNC, 1,
+          [Define to 1 if your compiler understands __func__.])
+else
+AC_CACHE_CHECK(for __FUNCTION__, pgac_cv_funcname_function_support,
+[AC_TRY_COMPILE([#include <stdio.h>],
+[printf("%s\n", __FUNCTION__);],
+[pgac_cv_funcname_function_support=yes],
+[pgac_cv_funcname_function_support=no])])
+if test x"$pgac_cv_funcname_function_support" = xyes ; then
+AC_DEFINE(HAVE_FUNCNAME__FUNCTION, 1,
+          [Define to 1 if your compiler understands __FUNCTION__.])
+fi
+fi])# PGAC_C_FUNCNAME_SUPPORT
+
+
+
+# PGAC_PROG_CC_CFLAGS_OPT
+# -----------------------
+# Given a string, check if the compiler supports the string as a
+# command-line option. If it does, add the string to CFLAGS.
+AC_DEFUN([PGAC_PROG_CC_CFLAGS_OPT],
+[AC_MSG_CHECKING([if $CC supports $1])
+pgac_save_CFLAGS=$CFLAGS
+CFLAGS="$pgac_save_CFLAGS $1"
+_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+                   AC_MSG_RESULT(yes),
+                   [CFLAGS="$pgac_save_CFLAGS"
+                    AC_MSG_RESULT(no)])
+])# PGAC_PROG_CC_CFLAGS_OPT
+
+
+
+# PGAC_PROG_CC_LDFLAGS_OPT
+# ------------------------
+# Given a string, check if the compiler supports the string as a
+# command-line option. If it does, add the string to LDFLAGS.
+# For reasons you'd really rather not know about, this checks whether
+# you can link to a particular function, not just whether you can link.
+# In fact, we must actually check that the resulting program runs :-(
+AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT],
+[AC_MSG_CHECKING([if $CC supports $1])
+pgac_save_LDFLAGS=$LDFLAGS
+LDFLAGS="$pgac_save_LDFLAGS $1"
+AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () = $2;],[])],
+              AC_MSG_RESULT(yes),
+              [LDFLAGS="$pgac_save_LDFLAGS"
+               AC_MSG_RESULT(no)],
+              [LDFLAGS="$pgac_save_LDFLAGS"
+               AC_MSG_RESULT(assuming no)])
+])# PGAC_PROG_CC_LDFLAGS_OPT

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/8b26974c/config/c-library.m4
----------------------------------------------------------------------
diff --git a/config/c-library.m4 b/config/c-library.m4
new file mode 100644
index 0000000..e4b2c0b
--- /dev/null
+++ b/config/c-library.m4
@@ -0,0 +1,352 @@
+# Macros that test various C library quirks
+# $PostgreSQL: pgsql/config/c-library.m4,v 1.33 2008/08/21 13:53:28 petere Exp $
+
+
+# PGAC_VAR_INT_TIMEZONE
+# ---------------------
+# Check if the global variable `timezone' exists. If so, define
+# HAVE_INT_TIMEZONE.
+AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
+[AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
+[AC_TRY_LINK([#include <time.h>
+int res;],
+  [#ifndef __CYGWIN__
+res = timezone / 60;
+#else
+res = _timezone / 60;
+#endif],
+  [pgac_cv_var_int_timezone=yes],
+  [pgac_cv_var_int_timezone=no])])
+if test x"$pgac_cv_var_int_timezone" = xyes ; then
+  AC_DEFINE(HAVE_INT_TIMEZONE,, [Define to 1 if you have the global variable 'int timezone'.])
+fi])# PGAC_VAR_INT_TIMEZONE
+
+
+# PGAC_STRUCT_TIMEZONE
+# ------------------
+# Figure out how to get the current timezone.  If `struct tm' has a
+# `tm_zone' member, define `HAVE_TM_ZONE'.  Also, if the
+# external array `tzname' is found, define `HAVE_TZNAME'.
+# This is the same as the standard macro AC_STRUCT_TIMEZONE, except that
+# tzname[] is checked for regardless of whether we find tm_zone.
+AC_DEFUN([PGAC_STRUCT_TIMEZONE],
+[AC_REQUIRE([AC_STRUCT_TM])dnl
+AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h>
+#include <$ac_cv_struct_tm>
+])
+if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
+  AC_DEFINE(HAVE_TM_ZONE, 1,
+            [Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
+             `HAVE_STRUCT_TM_TM_ZONE' instead.])
+fi
+AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
+[AC_TRY_LINK(
+[#include <time.h>
+#ifndef tzname /* For SGI.  */
+extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
+#endif
+],
+[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
+if test $ac_cv_var_tzname = yes; then
+    AC_DEFINE(HAVE_TZNAME, 1,
+              [Define to 1 if you have the external array `tzname'.])
+fi
+])# PGAC_STRUCT_TIMEZONE
+
+
+# PGAC_FUNC_GETTIMEOFDAY_1ARG
+# ---------------------------
+# Check if gettimeofday() has only one arguments. (Normal is two.)
+# If so, define GETTIMEOFDAY_1ARG.
+AC_DEFUN([PGAC_FUNC_GETTIMEOFDAY_1ARG],
+[AC_CACHE_CHECK(whether gettimeofday takes only one argument,
+pgac_cv_func_gettimeofday_1arg,
+[AC_TRY_COMPILE([#include <sys/time.h>],
+[struct timeval *tp;
+struct timezone *tzp;
+gettimeofday(tp,tzp);],
+[pgac_cv_func_gettimeofday_1arg=no],
+[pgac_cv_func_gettimeofday_1arg=yes])])
+if test x"$pgac_cv_func_gettimeofday_1arg" = xyes ; then
+  AC_DEFINE(GETTIMEOFDAY_1ARG,, [Define to 1 if gettimeofday() takes only 1 argument.])
+fi
+AH_VERBATIM(GETTIMEOFDAY_1ARG_,
+[@%:@ifdef GETTIMEOFDAY_1ARG
+@%:@ define gettimeofday(a,b) gettimeofday(a)
+@%:@endif])dnl
+])# PGAC_FUNC_GETTIMEOFDAY_1ARG
+
+
+# PGAC_FUNC_GETPWUID_R_5ARG
+# ---------------------------
+# Check if getpwuid_r() takes a fifth argument (later POSIX standard, not draft version)
+# If so, define GETPWUID_R_5ARG
+AC_DEFUN([PGAC_FUNC_GETPWUID_R_5ARG],
+[AC_CACHE_CHECK(whether getpwuid_r takes a fifth argument,
+pgac_cv_func_getpwuid_r_5arg,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <pwd.h>],
+[uid_t uid;
+struct passwd *space;
+char *buf;
+size_t bufsize;
+struct passwd **result;
+getpwuid_r(uid, space, buf, bufsize, result);],
+[pgac_cv_func_getpwuid_r_5arg=yes],
+[pgac_cv_func_getpwuid_r_5arg=no])])
+if test x"$pgac_cv_func_getpwuid_r_5arg" = xyes ; then
+  AC_DEFINE(GETPWUID_R_5ARG,, [Define to 1 if getpwuid_r() takes a 5th argument.])
+fi
+])# PGAC_FUNC_GETPWUID_R_5ARG
+
+
+# PGAC_FUNC_STRERROR_R_INT
+# ---------------------------
+# Check if strerror_r() returns an int (SUSv3) rather than a char * (GNU libc)
+# If so, define STRERROR_R_INT
+AC_DEFUN([PGAC_FUNC_STRERROR_R_INT],
+[AC_CACHE_CHECK(whether strerror_r returns int,
+pgac_cv_func_strerror_r_int,
+[AC_TRY_COMPILE([#include <string.h>],
+[#ifndef _AIX
+int strerror_r(int, char *, size_t);
+#else
+/* Older AIX has 'int' for the third argument so we don't test the args. */
+int strerror_r();
+#endif],
+[pgac_cv_func_strerror_r_int=yes],
+[pgac_cv_func_strerror_r_int=no])])
+if test x"$pgac_cv_func_strerror_r_int" = xyes ; then
+  AC_DEFINE(STRERROR_R_INT,, [Define to 1 if strerror_r() returns a int.])
+fi
+])# PGAC_FUNC_STRERROR_R_INT
+
+
+# PGAC_UNION_SEMUN
+# ----------------
+# Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
+# If it doesn't then one could define it as
+# union semun { int val; struct semid_ds *buf; unsigned short *array; }
+AC_DEFUN([PGAC_UNION_SEMUN],
+[AC_CHECK_TYPES([union semun], [], [],
+[#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>])])# PGAC_UNION_SEMUN
+
+
+# PGAC_STRUCT_SOCKADDR_UN
+# -----------------------
+# If `struct sockaddr_un' exists, define HAVE_UNIX_SOCKETS.
+# (Requires test for <sys/un.h>!)
+AC_DEFUN([PGAC_STRUCT_SOCKADDR_UN],
+[AC_CHECK_TYPES([struct sockaddr_un], [AC_DEFINE(HAVE_UNIX_SOCKETS, 1, [Define to 1 if you have unix sockets.])], [],
+[#include <sys/types.h>
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+])])# PGAC_STRUCT_SOCKADDR_UN
+
+
+# PGAC_STRUCT_SOCKADDR_STORAGE
+# ----------------------------
+# If `struct sockaddr_storage' exists, define HAVE_STRUCT_SOCKADDR_STORAGE.
+# If it is missing then one could define it.
+AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE],
+[AC_CHECK_TYPES([struct sockaddr_storage], [], [],
+[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+])])# PGAC_STRUCT_SOCKADDR_STORAGE
+
+# PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
+# --------------------------------------
+# Check the members of `struct sockaddr_storage'.  We need to know about
+# ss_family and ss_len.  (Some platforms follow RFC 2553 and call them
+# __ss_family and __ss_len.)  We also check struct sockaddr's sa_len;
+# if we have to define our own `struct sockaddr_storage', this tells us
+# whether we need to provide an ss_len field.
+AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS],
+[AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family,
+		   struct sockaddr_storage.__ss_family,
+		   struct sockaddr_storage.ss_len,
+		   struct sockaddr_storage.__ss_len,
+		   struct sockaddr.sa_len], [], [],
+[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+])])# PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
+
+
+# PGAC_STRUCT_ADDRINFO
+# -----------------------
+# If `struct addrinfo' exists, define HAVE_STRUCT_ADDRINFO.
+AC_DEFUN([PGAC_STRUCT_ADDRINFO],
+[AC_CHECK_TYPES([struct addrinfo], [], [],
+[#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+])])# PGAC_STRUCT_ADDRINFO
+
+
+# PGAC_FUNC_POSIX_SIGNALS
+# -----------------------
+# Check to see if the machine has the POSIX signal interface. Define
+# HAVE_POSIX_SIGNALS if so. Also set the output variable HAVE_POSIX_SIGNALS
+# to yes or no.
+#
+# Note that this test only compiles a test program, it doesn't check
+# whether the routines actually work. If that becomes a problem, make
+# a fancier check.
+AC_DEFUN([PGAC_FUNC_POSIX_SIGNALS],
+[AC_CACHE_CHECK(for POSIX signal interface, pgac_cv_func_posix_signals,
+[AC_TRY_LINK([#include <signal.h>
+],
+[struct sigaction act, oact;
+sigemptyset(&act.sa_mask);
+act.sa_flags = SA_RESTART;
+sigaction(0, &act, &oact);],
+[pgac_cv_func_posix_signals=yes],
+[pgac_cv_func_posix_signals=no])])
+if test x"$pgac_cv_func_posix_signals" = xyes ; then
+  AC_DEFINE(HAVE_POSIX_SIGNALS,, [Define to 1 if you have the POSIX signal interface.])
+fi
+HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
+AC_SUBST(HAVE_POSIX_SIGNALS)])# PGAC_FUNC_POSIX_SIGNALS
+
+
+# PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
+# ---------------------------------------
+# Determine which format snprintf uses for long long int.  We handle
+# %lld, %qd, %I64d.  The result is in shell variable
+# LONG_LONG_INT_FORMAT.
+#
+# MinGW uses '%I64d', though gcc throws an warning with -Wall,
+# while '%lld' doesn't generate a warning, but doesn't work.
+#
+AC_DEFUN([PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT],
+[AC_MSG_CHECKING([snprintf format for long long int])
+AC_CACHE_VAL(pgac_cv_snprintf_long_long_int_format,
+[for pgac_format in '%lld' '%qd' '%I64d'; do
+AC_TRY_RUN([#include <stdio.h>
+typedef long long int ac_int64;
+#define INT64_FORMAT "$pgac_format"
+
+ac_int64 a = 20000001;
+ac_int64 b = 40000005;
+
+int does_int64_snprintf_work()
+{
+  ac_int64 c;
+  char buf[100];
+
+  if (sizeof(ac_int64) != 8)
+    return 0;			/* doesn't look like the right size */
+
+  c = a * b;
+  snprintf(buf, 100, INT64_FORMAT, c);
+  if (strcmp(buf, "800000140000005") != 0)
+    return 0;			/* either multiply or snprintf is busted */
+  return 1;
+}
+main() {
+  exit(! does_int64_snprintf_work());
+}],
+[pgac_cv_snprintf_long_long_int_format=$pgac_format; break],
+[],
+[pgac_cv_snprintf_long_long_int_format=cross; break])
+done])dnl AC_CACHE_VAL
+
+LONG_LONG_INT_FORMAT=''
+
+case $pgac_cv_snprintf_long_long_int_format in
+  cross) AC_MSG_RESULT([cannot test (not on host machine)]);;
+  ?*)    AC_MSG_RESULT([$pgac_cv_snprintf_long_long_int_format])
+         LONG_LONG_INT_FORMAT=$pgac_cv_snprintf_long_long_int_format;;
+  *)     AC_MSG_RESULT(none);;
+esac])# PGAC_FUNC_SNPRINTF_LONG_LONG_INT_FORMAT
+
+
+# PGAC_FUNC_PRINTF_ARG_CONTROL
+# ---------------------------------------
+# Determine if printf supports %1$ argument selection, e.g. %5$ selects
+# the fifth argument after the printf print string.
+# This is not in the C99 standard, but in the Single Unix Specification (SUS).
+# It is used in our language translation strings.
+#
+AC_DEFUN([PGAC_FUNC_PRINTF_ARG_CONTROL],
+[AC_MSG_CHECKING([whether printf supports argument control])
+AC_CACHE_VAL(pgac_cv_printf_arg_control,
+[AC_TRY_RUN([#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+  char buf[100];
+
+  /* can it swap arguments? */
+  snprintf(buf, 100, "%2\$d %1\$d", 3, 4);
+  if (strcmp(buf, "4 3") != 0)
+    return 1;
+  return 0;
+}],
+[pgac_cv_printf_arg_control=yes],
+[pgac_cv_printf_arg_control=no],
+[pgac_cv_printf_arg_control=cross])
+])dnl AC_CACHE_VAL
+AC_MSG_RESULT([$pgac_cv_printf_arg_control])
+])# PGAC_FUNC_PRINTF_ARG_CONTROL
+
+# PGAC_TYPE_LOCALE_T
+# ------------------
+# Check for the locale_t type and find the right header file.  Mac OS
+# X needs xlocale.h; standard is locale.h, but glibc also has an
+# xlocale.h file that we should not use.
+#
+AC_DEFUN([PGAC_TYPE_LOCALE_T],
+[AC_CACHE_CHECK([for locale_t], pgac_cv_type_locale_t,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[#include <locale.h>
+locale_t x;],
+[])],
+[pgac_cv_type_locale_t=yes],
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+[#include <xlocale.h>
+locale_t x;],
+[])],
+[pgac_cv_type_locale_t='yes (in xlocale.h)'],
+[pgac_cv_type_locale_t=no])])])
+if test "$pgac_cv_type_locale_t" != no; then
+  AC_DEFINE(HAVE_LOCALE_T, 1,
+            [Define to 1 if the system has the type `locale_t'.])
+fi
+if test "$pgac_cv_type_locale_t" = 'yes (in xlocale.h)'; then
+  AC_DEFINE(LOCALE_T_IN_XLOCALE, 1,
+            [Define to 1 if `locale_t' requires <xlocale.h>.])
+fi])])# PGAC_HEADER_XLOCALE
+
+# backport from Autoconf 2.61a
+# http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=f0c325537a22105536ac8c4e88656e50f9946486
+
+# AC_FUNC_FSEEKO
+# --------------
+AN_FUNCTION([ftello], [AC_FUNC_FSEEKO])
+AN_FUNCTION([fseeko], [AC_FUNC_FSEEKO])
+AC_DEFUN([AC_FUNC_FSEEKO],
+[_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
+   [ac_cv_sys_largefile_source],
+   [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).],
+   [[#include <sys/types.h> /* for off_t */
+     #include <stdio.h>]],
+   [[int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);]])
+
+# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+# in glibc 2.1.3, but that breaks too many other things.
+# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+if test $ac_cv_sys_largefile_source != unknown; then
+  AC_DEFINE(HAVE_FSEEKO, 1,
+    [Define to 1 if fseeko (and presumably ftello) exists and is declared.])
+fi
+])# AC_FUNC_FSEEKO