Initial commit

changes/37/393737/1
Monty Taylor 6 years ago
commit 97e1650760
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594

89
.gitignore vendored

@ -0,0 +1,89 @@
*.py[cod]
# C extensions
*.so
# C++ proto files
*.pb.cc
*.pb.h
# Python protos
*pb2.py
# autotools
Makefile
config.h
config.log
config.status
libtool
stamp-h1
Makefile.in
aclocal.m4
autom4te.cache/
config.h.in
config/
configure
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
.deps
*.la
*.lo
*.o
.dirstamp
.libs
# Packages
*.egg
*.egg-info
dist
build
.eggs
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
.testrepository
.venv
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Complexity
output/*.html
output/*/index.html
# Sphinx
doc/build
# pbr generates these
AUTHORS
ChangeLog
# Editors
*~
.*.swp
.*sw?
# Protobuf Generated Files
oaktree/rpc/*_pb2.py

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/oaktreemodel.git

@ -0,0 +1,3 @@
# Format is:
# <preferred e-mail> <other e-mail 1>
# <preferred e-mail> <other e-mail 2>

@ -0,0 +1,7 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

@ -0,0 +1,17 @@
If you would like to contribute to the development of OpenStack, you must
follow the steps in this page:
http://docs.openstack.org/infra/manual/developers.html
If you already have a good understanding of how the system works and your
OpenStack accounts are set up, you can skip to the development workflow
section of this documentation to learn how changes to OpenStack should be
submitted for review via the Gerrit tool:
http://docs.openstack.org/infra/manual/developers.html#development-workflow
Pull requests submitted through GitHub will be ignored.
Bugs should be filed in Storyboard, not GitHub:
https://storyboard.openstack.org

@ -0,0 +1,176 @@
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.

@ -0,0 +1,8 @@
include AUTHORS
include ChangeLog
include oaktreemodel/*pb2.py
exclude .gitignore
exclude .gitreview
global-exclude *.pyc
global-exclude *.go

@ -0,0 +1,142 @@
# Copyright (c) 2016 Red Hat, Inc.
#
# 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.
ACLOCAL_AMFLAGS = -I m4
SUFFIXES =
lib_LTLIBRARIES = liboaktreemodel.la
noinst_LTLIBRARIES =
SUBDIRS= .
DIST_SUBDIRS = ${SUBDIRS}
BUILT_SOURCES=
BUILT_MAINT_SRC=
EXTRA_DIST= \
ChangeLog \
config/pandora_vc_revinfo \
${top_srcdir}/m4/*m4
CLEANFILES= ${BUILT_SOURCES}
DISTCLEANFILES= config/top.h
MAINTAINERCLEANFILES=
MAINTAINERCLEANFILES+= autom4te.cache
MAINTAINERCLEANFILES+= ChangeLog
maintainer-clean-local:
find . -type f -name '*~' -exec rm -f '{}' \;
-rm -rf @PACKAGE@-*.rpm
-rm -rf @PACKAGE@-*.tar.gz
-rm -r -f autom4te.cache
-rm -f Makefile.in
-rm -f aclocal.m4
-rm -f config/config.guess
-rm -f config/config.sub
-rm -f config/depcomp
-rm -f config/install-sh
-rm -f config/ltmain.sh
-rm -f config/missing
-rm -f config.in
-rm -f config.log
-rm -f config.status
-rm -f configure
-rm -f m4/libtool.m4
-rm -f m4/ltoptions.m4
-rm -f m4/ltsugar.m4
-rm -f m4/ltversion.m4
-rm -f m4/lt~obsolete.m4
liboaktreemodel_la_CXXFLAGS = ${AM_CXXFLAGS} ${PROTOSKIP_WARNINGS} ${NO_WERROR}
liboaktreemodel_la_SOURCES = \
oaktreemodel/common.pb.cc \
oaktreemodel/flavor.pb.cc \
oaktreemodel/image.pb.cc \
oaktreemodel/security_group.pb.cc \
oaktreemodel/oaktree.pb.cc \
oaktreemodel/oaktree.grpc.pb.cc
pkginclude_HEADERS = \
oaktreemodel/common.pb.h \
oaktreemodel/flavor.pb.h \
oaktreemodel/image.pb.h \
oaktreemodel/security_group.pb.h \
oaktreemodel/oaktree.pb.h \
oaktreemodel/oaktree.grpc.pb.h
# TODO: There is a lot of repetition here
BUILT_SOURCES += \
oaktreemodel/common.pb.cc \
oaktreemodel/common.pb.h \
oaktreemodel/common_pb2.py \
oaktreemodel/flavor.pb.cc \
oaktreemodel/flavor.pb.h \
oaktreemodel/flavor_pb2.py \
oaktreemodel/image.pb.cc \
oaktreemodel/image.pb.h \
oaktreemodel/image_pb2.py \
oaktreemodel/oaktree.grpc.pb.cc \
oaktreemodel/oaktree.grpc.pb.h \
oaktreemodel/oaktree.pb.cc \
oaktreemodel/oaktree.pb.h \
oaktreemodel/oaktree_pb2.py \
oaktreemodel/security_group.pb.cc \
oaktreemodel/security_group.pb.h \
oaktreemodel/security_group_pb2.py
if HAVE_GO_PLUGIN
BUILT_SOURCES += \
oaktreemodel/common.pb.go \
oaktreemodel/flavor.pb.go \
oaktreemodel/image.pb.go \
oaktreemodel/oaktree.pb.go \
oaktreemodel/security_group.pb.go
endif
EXTRA_DIST += \
oaktreemodel/common.proto \
oaktreemodel/flavor.proto \
oaktreemodel/image.proto \
oaktreemodel/security_group.proto \
oaktreemodel/oaktree.proto
SUFFIXES += .proto .grpc.pb.cc .pb.cc .pb.h py .pb.go
PROTOS_PATH=${top_srcdir}/oaktreemodel
PROTO_OUTPUT=${top_builddir}/oaktreemodel
.proto.grpc.pb.cc:
$(PROTOC) -I $(PROTOS_PATH) \
--grpc_out=${PROTO_OUTPUT} \
--plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} $<
.proto.grpc.pb.h:
$(PROTOC) -I $(PROTOS_PATH) \
--grpc_out=${PROTO_OUTPUT} \
--plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} $<
.proto.pb.cc:
$(PROTOC) -I $(PROTOS_PATH) --cpp_out=${PROTO_OUTPUT} $<
$(PROTOC) -I $(PROTOS_PATH) --go_out=${PROTO_OUTPUT} $<
.proto.pb.h:
$(PROTOC) -I $(PROTOS_PATH) --cpp_out=${PROTO_OUTPUT} $<
.proto.pb.go:
$(PROTOC) -I $(PROTOS_PATH) --go_out=${PROTO_OUTPUT} $<
# Have to do this with make matching not automake matching
# Yay _pb2.py extension!
%_pb2.py: %.proto
python -m grpc.tools.protoc -I $(PROTOS_PATH) \
--python_out=${PROTO_OUTPUT} \
--grpc_python_out=${PROTO_OUTPUT} $<

@ -0,0 +1,85 @@
============
oaktreemodel
============
oaktree is a gRPC interface for interacting with OpenStack clouds that is
inherently interoperable and multi-cloud aware.
oaktreemodel is the protobuf definitions and the libraries and/or code
generated from that to make it possible for people of all languages to
interact with the gRPC system without developing a python dependency anywhere.
At start, go, C++ and python are supported.
With go, the generated files are checked in to the git repo, because that's
how go dependencies work.
With C++ and python, they are not, as we exepct the unit of consumption to
be a built library and header files for C++ or a PyPI package for Ruby. It's
the most likely that as we add structure for more languages that they will
follow the C++/Python approach and not the go approach - but the decision
will be made on a per-language basis and reported back here.
Note on API compat
------------------
tl;dr - Upgrading oaktree should NEVER negatively impact end users.
Until a 1.0.0 release is cut, please consider that literally everything in
this repo can change with no notice or consideration of breaking backwards
compat. This is a new approach to several things and it's entirely likely
we're going to get things wrong a few times.
Post 1.0.0 oaktree and oaktreemodel will be held to the same backwards-compat
promises as shade itself. That is - there will never be backwards-compat
breaking release, and it should _always_ be safe to deploy the latest release
in production. In fact, even for people running older stable releases of
OpenStack, the recommendation will be to run the latest oaktree, so that the
latest cross-compatibility changes can be picked up.
Note on Implementations
-----------------------
It is absolutely the intent of oaktreemodel that multiple implementations
based on the protobuf descriptions exist for the client interaction. In fact,
the code generated and published from this repo is fairly low-leve on a gRPC
basis, so it's almost certainly the case that each language will want to
consume this code in the context of some other library that has an end-user
focused UI.
It is absolutely NOT the intent that multiple implementations of the server
side exist.
The reason for that is that, at least as of now, the business logic in the
shade library is extensive and complex. It handles a million corner cases in
the underlying clouds. oaktree servers should all be able to talk not just
to the cloud they are deployed with, but also to other OpenStack clouds
either talking to the remote oaktree or directly to the remote OpenStack API.
The client interfaces in gRPC should be considered to be comprehensive and
as descriptive of the interface as possible. For people wanting an oaktree
server, please use actual oaktree.
Building
--------
First you need some dependencies:
.. code-block:: bash
pip install bindep
apt-get install $(bindep -b)
pip install -f requirements.txt
pip install grpcio-tools
go get -u github.com/golang/protobuf/protoc-gen-go
Then you can build the code:
.. code-block:: bash
autoreconf -fi
./configure
make
* Source: http://git.openstack.org/cgit/openstack/oaktreemodel
* Bugs: http://storyboard.openstack.org

@ -0,0 +1 @@
Get the vc_version stuff working properly with git

@ -0,0 +1,7 @@
libprotobuf-dev
protobuf-compiler
pkg-config
build-essential
autoconf
libtool
golang-go

@ -0,0 +1,17 @@
#!/bin/sh
# Copyright (c) 2016 Red Hat, Inc.
#
# 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.
autoreconf -fi

@ -0,0 +1,23 @@
#!/bin/sh
# Copyright (c) 2016 Red Hat, Inc.
#
# 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.
if [ ! -f configure ]; then
autoreconf -fi
fi
if [ ! -f Makefile ]; then
./configure
fi
make

@ -0,0 +1,142 @@
dnl -*- bash -*-
dnl Process this file with autoconf to produce a configure script.
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; version 2 of the License.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
AC_INIT(
[liboaktreemodel],
[1.0],
[http://storyboard.openstack.org],
[liboaktreemodel],
[http://openstack.org/])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar])
AC_PREREQ(2.59)dnl Minimum Autoconf version required.
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_ARG_PROGRAM
AC_USE_SYSTEM_EXTENSIONS
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([oaktreemodel/oaktree.proto])
OAKTREE_CANONICAL_TARGET([require-cxx, version-from-vc])
LT_PREREQ([2.4])
LT_INIT
LT_LANG([C++])
gl_VISIBILITY
AX_ASSERT
AS_IF([test "x${pandora_cv_skip_requires}" != "xno"],[
AC_ARG_WITH([comment],
[AS_HELP_STRING([--with-comment],
[Comment about compilation environment. @<:@default=off@:>@])],
[with_comment=$withval],
[with_comment=no])
AS_IF([test "$with_comment" != "no"],[
COMPILATION_COMMENT=$with_comment
],[
COMPILATION_COMMENT="Source distribution (${PANDORA_RELEASE_COMMENT})"
])
AC_DEFINE_UNQUOTED([COMPILATION_COMMENT],["$COMPILATION_COMMENT"],
[Comment about compilation environment])
])
PKG_CHECK_MODULES(PROTOBUF, protobuf >= 2.4.0)
AC_SUBST(PROTOBUF_LIBS)
AC_SUBST(PROTOBUF_CFLAGS)
AC_SUBST(PROTOBUF_VERSION)
AM_CFLAGS="${PROTOBUF_CFLAGS} ${AM_CFLAGS}"
AM_LDFLAGS="${PROTOBUF_LIBS} ${AM_LDFLAGS}"
AC_PATH_PROG(
[PROTOC],
[protoc],
[AC_MSG_ERROR([oaktreemodel requires protobuf])],
)
AC_PATH_PROG(
[GRPC_CPP_PLUGIN],
[grpc_cpp_plugin],
[AC_MSG_ERROR([oaktreemodel requires grpc_cpp_plugin])],
)
AC_PATH_PROG(
[GRPC_PYTHON_PLUGIN],
[grpc_python_plugin],
[AC_MSG_ERROR([oaktreemodel requires grpc_python_plugin])],
)
AC_PATH_PROG(
[GRPC_GO_PLUGIN],
[protoc-gen-go])
AM_CONDITIONAL([HAVE_GO_PLUGIN], [test "x$ac_cv_path_GRPC_GO_PLUGIN" != "x"])
AX_PTHREAD([
AM_CXXFLAGS="${PTHREAD_CFLAGS} ${AM_CXXFLAGS}"
AM_LDFLAGS="${PTHREAD_LIBS} ${AM_LDFLAGS}"
LIBS="${PTHREAD_LIBS} ${LIBS}"
], [AC_MSG_ERROR([oaktreemodel requires pthreads])])
#########################################################################
AS_IF([test "$lt_cv_prog_gnu_ld" = "yes"],[
LDFLAGS="${LDFLAGS} ${LD_VERSION_SCRIPT}"
])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
echo "---"
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
echo ""
echo " * Installation prefix: $prefix"
echo " * System type: $host_vendor-$host_os"
echo " * Host CPU: $host_cpu"
echo " * C++ Compiler: $CXX_VERSION"
echo " * C++ Flags: $CXXFLAGS"
echo " * C++ AM Flags: $AM_CXXFLAGS"
echo " * CPP Flags: $CPPFLAGS"
echo " * CPP AM Flags: $AM_CPPFLAGS"
echo " * Assertions enabled: $ac_cv_assert"
echo " * Debug enabled: $with_debug"
echo " * Profiling enabled: $ac_profiling"
echo " * Coverage enabled: $ac_coverage"
echo " * Warnings as failure: $ac_cv_warnings_as_errors"
echo ""
echo "---"
dnl libtoolize scans configure.ac and needs to see some text
m4_define([LIBTOOLIZE_AC_INIT], [])
m4_define([UNUSED_MACRO], [
LT_INIT
AC_CONFIG_MACRO_DIR([m4])
])

@ -0,0 +1,66 @@
# ===========================================================================
# https://github.com/BrianAker/ddm4/
# ===========================================================================
#
# SYNOPSIS
#
# AX_ASSERT()
#
# DESCRIPTION
#
# --enable-assert
#
# LICENSE
#
# Copyright (C) 2012 Brian Aker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#
# * The names of its contributors may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#serial 6
AC_DEFUN([AX_ASSERT],
[AC_PREREQ([2.63])dnl
AC_REQUIRE([AX_DEBUG])
AC_REQUIRE([AX_VCS_CHECKOUT])
AC_ARG_ENABLE([assert],
[AS_HELP_STRING([--enable-assert],
[Enable assert, this will be overridden by --enable-debug (yes|no) @<:@default=no@:>@])],
[ax_enable_assert=yes],
[ax_enable_assert=no])
AS_IF([ test "$ax_enable_assert" = "yes" -o "$ax_enable_debug" = "yes" -o "$ac_cv_vcs_checkout" = "yes" ],
[ax_enable_assert="yes"],
[ax_enable_assert="no"
AC_DEFINE(NDEBUG,[1],[Define to 1 to disable assert'ing code.])])
AC_MSG_CHECKING([for assert])
AC_MSG_RESULT([$ax_enable_assert])
])

@ -0,0 +1,61 @@
# ===========================================================================
# https://github.com/BrianAker/ddm4/
# ===========================================================================
#
# SYNOPSIS
#
# AX_DEBUG()
#
# DESCRIPTION
#
# --enable-debug
#
# LICENSE
#
# Copyright (C) 2012 Brian Aker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#
# * The names of its contributors may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#serial 5
AC_DEFUN([AX_DEBUG],
[AC_PREREQ([2.63])dnl
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
[ax_enable_debug=yes
AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.])],
[ax_enable_debug=no
AC_SUBST([MCHECK])
AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])])
AC_MSG_CHECKING([for debug])
AC_MSG_RESULT([$ax_enable_debug])
AM_CONDITIONAL([DEBUG],[test "x${ax_enable_debug}" = "xyes"])])

@ -0,0 +1,313 @@
# ===========================================================================
# http://www.gnu.org/software/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).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# 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.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# 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.
#serial 19
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([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_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"
;;
darwin12*)
ax_pthread_flags="$ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-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_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 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_LINK_IFELSE([AC_LANG_PROGRAM([#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_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
ax_cv_PTHREAD_PRIO_INHERIT, [
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
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_POP
])dnl AX_PTHREAD

@ -0,0 +1,75 @@
# ===========================================================================
# http://
# ===========================================================================
#
# SYNOPSIS
#
# AX_VCS_CHECKOUT
#
# DESCRIPTION
#
# Discover whether or not we are operating with a tree which
# has been checked out of a version control system.
#
#
# LICENSE
#
# Copyright (C) 2012 Brian Aker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
#
# * The names of its contributors may not be used to endorse or
# promote products derived from this software without specific prior
# written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#serial 6
AC_DEFUN([AX_VCS_SYSTEM],
[AC_PREREQ([2.63])dnl
AC_CACHE_CHECK([for vcs system], [ac_cv_vcs_system],
[ac_cv_vcs_system="none"
AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"])
AS_IF([test -d ".svn"],[ac_cv_vcs_system="svn"])
AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"])
AS_IF([test -d ".git"],[ac_cv_vcs_system="git"])
])
AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system])
])
AC_DEFUN([AX_VCS_CHECKOUT],
[AC_PREREQ([2.63])dnl
AC_REQUIRE([AX_VCS_SYSTEM])
AC_CACHE_CHECK([for vcs checkout],[ac_cv_vcs_checkout],
[AS_IF([test "x$ac_cv_vcs_system" != "xnone"],
[ac_cv_vcs_checkout=yes],
[ac_cv_vcs_checkout=no])
])
AM_CONDITIONAL([IS_VCS_CHECKOUT],[test "x$ac_cv_vcs_checkout" = "xyes"])
AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"],
[AC_DEFINE([VCS_CHECKOUT],[1],[Define if the code was built from VCS.])],
[AC_DEFINE([VCS_CHECKOUT],[0],[Define if the code was built from VCS.])])
])

@ -0,0 +1,91 @@
# Copyright (C) 2009 Sun Microsystems, Inc.
# This file is free software; Sun Microsystems, Inc.
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Which version of the canonical setup we're using
AC_DEFUN([OAKTREE_CANONICAL_VERSION],[0.175])
AC_DEFUN([OAKTREE_CANONICAL_TARGET],[
ifdef([m4_define],,[define([m4_define], defn([define]))])
ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))])
m4_define([PCT_ALL_ARGS],[$*])
m4_define([PCT_REQUIRE_CXX],[no])
m4_define([PCT_DONT_SUPPRESS_INCLUDE],[no])
m4_define([PCT_NO_VC_CHANGELOG],[no])
m4_define([PCT_VERSION_FROM_VC],[no])
m4_define([PCT_USE_VISIBILITY],[yes])
m4_foreach([pct_arg],[$*],[
m4_case(pct_arg,
[require-cxx], [
m4_undefine([PCT_REQUIRE_CXX])
m4_define([PCT_REQUIRE_CXX],[yes])
],
[skip-visibility], [
m4_undefine([PCT_USE_VISIBILITY])
m4_define([PCT_USE_VISIBILITY],[no])
],
[dont-suppress-include], [
m4_undefine([PCT_DONT_SUPPRESS_INCLUDE])
m4_define([PCT_DONT_SUPPRESS_INCLUDE],[yes])
],
[no-vc-changelog], [
m4_undefine([PCT_NO_VC_CHANGELOG])
m4_define([PCT_NO_VC_CHANGELOG],[yes])
],
[version-from-vc], [
m4_undefine([PCT_VERSION_FROM_VC])
m4_define([PCT_VERSION_FROM_VC],[yes])
])
])
# We need to prevent canonical target
# from injecting -O2 into CFLAGS - but we won't modify anything if we have
# set CFLAGS on the command line, since that should take ultimate precedence
AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
[CFLAGS=""])
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
[CXXFLAGS=""])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_REQUIRE([AC_PROG_CC])
m4_if(PCT_NO_VC_CHANGELOG,yes,[
vc_changelog=no
],[
vc_changelog=yes
])
m4_if(PCT_VERSION_FROM_VC,yes,[
PANDORA_VC_INFO_HEADER
],[
PANDORA_TEST_VC_DIR
AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["$VERSION"],
[Version of the software])
AC_SUBST(PANDORA_RELEASE_VERSION)
])
AC_REQUIRE([AC_PROG_CXX])
AM_PROG_CC_C_O
PANDORA_OPTIMIZE
PANDORA_HEADER_ASSERT
# Enable PANDORA_WARNINGS once there is C++ code that's not generated, if
# that's ever a time
dnl PANDORA_WARNINGS(PCT_ALL_ARGS)
PANDORA_ENABLE_DTRACE
AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_LDFLAGS])
])

@ -0,0 +1,60 @@
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl ---------------------------------------------------------------------------
dnl Macro: PANDORA_64BIT
dnl ---------------------------------------------------------------------------
AC_DEFUN([PANDORA_64BIT],[
AC_BEFORE([$0], [AC_LIB_PREFIX])
AC_ARG_ENABLE([64bit],
[AS_HELP_STRING([--disable-64bit],
[Build 64 bit binary @<:@default=on@:>@])],
[ac_enable_64bit="$enableval"],
[ac_enable_64bit="yes"])
AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
AS_IF([test "x$ISAINFO" != "xno"],
[isainfo_b=`${ISAINFO} -b`],
[isainfo_b="x"])
AS_IF([test "$isainfo_b" != "x" -a "$isainfo_b" != "32"],[
isainfo_k=`${ISAINFO} -k`
DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_b}"
AS_IF([test "x$ac_enable_64bit" = "xyes"],[
AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[
LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}"
])
AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[
dnl The user hasn't overridden the default libdir, so we'll
dnl the dir suffix to match solaris 32/64-bit policy
libdir="${libdir}/${isainfo_k}"
])
AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],[
CFLAGS="${CFLAGS} -m64"
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-m64'
])
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
CXXFLAGS="${CXXFLAGS} -m64"
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-m64'
])
AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"],[
AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}"
AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}"
])
])
])
])
dnl ---------------------------------------------------------------------------
dnl End Macro: PANDORA_64BIT
dnl ---------------------------------------------------------------------------

@ -0,0 +1,23 @@
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl PANDORA_HEADER_ASSERT
dnl ----------------
dnl Check whether to enable assertions.
AC_DEFUN([PANDORA_HEADER_ASSERT],
[
AC_CHECK_HEADERS(assert.h)
AC_MSG_CHECKING([whether to enable assertions])
AC_ARG_ENABLE([assert],
[AS_HELP_STRING([--disable-assert],
[Turn off assertions])],
[ac_cv_assert="no"],
[ac_cv_assert="yes"])
AC_MSG_RESULT([$ac_cv_assert])
AS_IF([test "$ac_cv_assert" = "no"],
[AC_DEFINE(NDEBUG, 1, [Define to 1 if assertions should be disabled.])])
])

@ -0,0 +1,75 @@
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([PANDORA_OPTIMIZE],[
dnl Build optimized or debug version ?
dnl First check for gcc and g++
AS_IF([test "$GCC" = "yes" -a "$INTELCC" = "no"],[
dnl The following is required for portable results of floating point
dnl calculations on PowerPC. The same must also be done for IA-64, but
dnl this options is missing in the IA-64 gcc backend.
case "$target_cpu" in
*ppc* | *powerpc*)
AM_CFLAGS="-mno-fused-madd ${AM_CFLAGS}"
AM_CXXFLAGS="-mno-fused-madd ${AM_CXXFLAGS}"
;;
esac
dnl Once we can use a modern autoconf, we can replace the std=gnu99 here
dnl with using AC_CC_STD_C99 above
CC="${CC} -std=gnu99"
AM_CPPFLAGS="-g ${AM_CPPFLAGS}"
DEBUG_CFLAGS="-O0"
DEBUG_CXXFLAGS="-O0"
OPTIMIZE_CFLAGS="-O2"
OPTIMIZE_CXXFLAGS="-O2"
])
AS_IF([test "$INTELCC" = "yes"],[
AM_CPPFLAGS="-g ${AM_CPPFLAGS}"
DEBUG_CFLAGS="-O0"
DEBUG_CXXFLAGS="-O0"
OPTIMIZE_CFLAGS="-xHOST -O2 -no-prec-div -static"
OPTIMIZE_CXXFLAGS="${OPTIMIZE_CFLAGS}"
])
AS_IF([test "$SUNCC" = "yes"],[
dnl Once we can use a modern autoconf, we can replace the -xc99=all here
dnl with using AC_CC_STD_C99 above
CC="${CC} -xc99=all"
CXX="${CXX} -xlang=c99"
AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}"
AM_CXXFLAGS="-mt -compat=5 -library=stlport4 -library=Crun -template=no%extdef ${AM_CXXFLAGS}"
DEBUG_CXXFLAGS="-g"
dnl TODO: Make a test for -xO4 usability here
OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin"
OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}"
OPTIMIZE_CXXFLAGS="-g0 ${OPTIMIZE_FLAGS}"
])
AC_ARG_WITH([debug],
[AS_HELP_STRING([--with-debug],
[Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
[with_debug=$withval],
[with_debug=no])
AS_IF([test "$with_debug" = "yes"],[
# Debugging. No optimization.
AM_CFLAGS="${AM_CFLAGS} ${DEBUG_CFLAGS} -DDEBUG"
AM_CXXFLAGS="${AM_CXXFLAGS} ${DEBUG_CXXFLAGS} -DDEBUG"
],[
# Optimized version. No debug
AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}"
AM_CXXFLAGS="${AM_CXXFLAGS} ${OPTIMIZE_CXXFLAGS}"
])
])

@ -0,0 +1,77 @@
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([PANDORA_TEST_VC_DIR],[
pandora_building_from_vc=no
if test -d ".git" ; then
pandora_building_from_git=yes
pandora_building_from_vc=yes
else
pandora_building_from_git=no
fi
])
AC_DEFUN([PANDORA_BUILDING_FROM_VC],[
m4_syscmd(PANDORA_TEST_VC_DIR
m4_if(PCT_NO_VC_CHANGELOG,yes,[
vc_changelog=no
],[
vc_changelog=yes
])
[
if test "${pandora_building_from_git}" = "yes"; then
echo "# Grabbing changelog and version information from git"
PANDORA_RELEASE_VERSION=$(python -c "import pbr.version;print(pbr.version.VersionInfo('oaktreemodel').semantic_version().release_string())")
fi
if ! test -d config ; then
mkdir -p config
fi
if test "${pandora_building_from_git}" = "yes" -o ! -f config/pandora_vc_revinfo ; then
cat > config/pandora_vc_revinfo.tmp <<EOF
PANDORA_RELEASE_VERSION=${PANDORA_RELEASE_VERSION}
EOF
if ! diff config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo >/dev/null 2>&1 ; then
mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo
fi
rm -f config/pandora_vc_revinfo.tmp
fi
])
])
AC_DEFUN([_PANDORA_READ_FROM_FILE],[
$1=`grep $1 $2 | cut -f2 -d=`
])
AC_DEFUN([PANDORA_VC_VERSION],[
AC_REQUIRE([PANDORA_BUILDING_FROM_VC])
PANDORA_TEST_VC_DIR
AS_IF([test -f ${srcdir}/config/pandora_vc_revinfo],[
_PANDORA_READ_FROM_FILE(
[PANDORA_RELEASE_VERSION],${srcdir}/config/pandora_vc_revinfo)
])
VERSION="${PANDORA_RELEASE_VERSION}"
AC_DEFINE_UNQUOTED(
[PANDORA_RELEASE_VERSION],
["${PANDORA_RELEASE_VERSION}"],
[The real version of the software])
])
AC_DEFUN([PANDORA_VC_INFO_HEADER],[
AC_REQUIRE([PANDORA_VC_VERSION])
m4_define([PANDORA_VC_PREFIX],m4_toupper(m4_normalize(AC_PACKAGE_NAME))[_])
AC_DEFINE_UNQUOTED(
PANDORA_VC_PREFIX[RELEASE_VERSION],
["$PANDORA_RELEASE_VERSION"],
[Release date and revision number of checkout])
])

@ -0,0 +1,447 @@
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl AC_PANDORA_WARNINGS([less-warnings|warnings-always-on])
dnl less-warnings turn on a limited set of warnings
dnl warnings-always-on always set warnings=error regardless of tarball/vc
dnl @TODO: remove less-warnings option as soon as Drizzle is clean enough to
dnl allow it
AC_DEFUN([PANDORA_WARNINGS],[
m4_define([PW_LESS_WARNINGS],[no])
m4_define([PW_WARN_ALWAYS_ON],[no])
ifdef([m4_define],,[define([m4_define], defn([define]))])
ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))])
m4_foreach([pw_arg],[$*],[
m4_case(pw_arg,
[less-warnings],[
m4_undefine([PW_LESS_WARNINGS])
m4_define([PW_LESS_WARNINGS],[yes])
],
[warnings-always-on],[
m4_undefine([PW_WARN_ALWAYS_ON])
m4_define([PW_WARN_ALWAYS_ON],[yes])
])
])
AC_REQUIRE([PANDORA_BUILDING_FROM_VC])
m4_if(PW_WARN_ALWAYS_ON, [yes],
[ac_cv_warnings_as_errors=yes],
AS_IF([test "$pandora_building_from_vc" = "yes"],
[ac_cv_warnings_as_errors=yes],
[ac_cv_warnings_as_errors=no]))
AC_ARG_ENABLE([gcc-profile-mode],
[AS_HELP_STRING([--enable-gcc-profile-mode],
[Toggle gcc profile mode @<:@default=off@:>@])],
[ac_gcc_profile_mode="$enableval"],
[ac_gcc_profile_mode="no"])
AC_ARG_ENABLE([profiling],
[AS_HELP_STRING([--enable-profiling],
[Toggle profiling @<:@default=off@:>@])],
[ac_profiling="$enableval"],
[ac_profiling="no"])
AC_ARG_ENABLE([coverage],
[AS_HELP_STRING([--enable-coverage],
[Toggle coverage @<:@default=off@:>@])],
[ac_coverage="$enableval"],
[ac_coverage="no"])
AS_IF([test "$GCC" = "yes"],[
AS_IF([test "$ac_profiling" = "yes"],[
CC_PROFILING="-pg"
GCOV_LIBS="-pg -lgcov"
save_LIBS="${LIBS}"
LIBS=""
AC_CHECK_LIB(c_p, read)
LIBC_P="${LIBS}"
LIBS="${save_LIBS}"
AC_SUBST(LIBC_P)
],[
CC_PROFILING=" "
])
AS_IF([test "$ac_coverage" = "yes"],
[
CC_COVERAGE="--coverage"
GCOV_LIBS="-lgcov"
])
AS_IF([test "$ac_cv_warnings_as_errors" = "yes"],[
W_FAIL="-Werror"
SPHINX_WARNINGS="-W"
dnl INTLTOOL_WARNINGS="yes"
])
AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option],
[ac_cv_safe_to_use_fdiagnostics_show_option_],
[save_CFLAGS="$CFLAGS"
CFLAGS="-fdiagnostics-show-option ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],[])],
[ac_cv_safe_to_use_fdiagnostics_show_option_=yes],
[ac_cv_safe_to_use_fdiagnostics_show_option_=no])
CFLAGS="$save_CFLAGS"])
AS_IF([test "$ac_cv_safe_to_use_fdiagnostics_show_option_" = "yes"],
[
F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option"
])
AC_CACHE_CHECK([whether it is safe to use -floop-parallelize-all],
[ac_cv_safe_to_use_floop_parallelize_all_],
[save_CFLAGS="$CFLAGS"
CFLAGS="-floop-parallelize-all ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],[])],
[ac_cv_safe_to_use_floop_parallelize_all_=yes],
[ac_cv_safe_to_use_floop_parallelize_all_=no])
CFLAGS="$save_CFLAGS"])
AS_IF([test "$ac_cv_safe_to_use_floop_parallelize_all_" = "yes"],
[
F_LOOP_PARALLELIZE_ALL="-floop-parallelize-all"
])
NO_STRICT_ALIASING="-fno-strict-aliasing -Wno-strict-aliasing"
NO_SHADOW="-Wno-shadow"
AS_IF([test "$INTELCC" = "yes"],[
m4_if(PW_LESS_WARNINGS,[no],[
BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188"
],[
dnl 2203 is like old-style-cast
dnl 1684 is like strict-aliasing
dnl 188 is about using enums as bitfields
dnl 1683 is a warning about _EXPLICIT_ casting, which we want
BASE_WARNINGS="-w1 -Werror -Wcheck -Wp64 -Woverloaded-virtual -Wcast-qual -diag-disable 188,981,2259,2203,1683,1684"
])
CC_WARNINGS="${BASE_WARNINGS}"
CXX_WARNINGS="${BASE_WARNINGS}"
PROTOSKIP_WARNINGS="-diag-disable 188,981,967,2259,1683,1684,2203"
],[
m4_if(PW_LESS_WARNINGS,[no],[
BASE_WARNINGS_FULL="${W_CONVERSION} -Wstrict-aliasing -Wswitch-enum "
CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings"
CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast"
NO_OLD_STYLE_CAST="-Wno-old-style-cast"
NO_EFF_CXX="-Wno-effc++"
],[
BASE_WARNINGS_FULL="${NO_STRICT_ALIASING}"
])
AS_IF([test "${ac_cv_assert}" = "no"],
[NO_UNUSED="-Wno-unused-variable -Wno-unused-parameter"])
AC_CACHE_CHECK([whether it is safe to use -Wextra],
[ac_cv_safe_to_use_Wextra_],
[save_CFLAGS="$CFLAGS"
CFLAGS="${W_FAIL} -pedantic -Wextra ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[
#include <stdio.h>
]], [[]])
],
[ac_cv_safe_to_use_Wextra_=yes],
[ac_cv_safe_to_use_Wextra_=no])
CFLAGS="$save_CFLAGS"])
BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${F_LOOP_PARALLELIZE_ALL} ${BASE_WARNINGS_FULL}"
AS_IF([test "$ac_cv_safe_to_use_Wextra_" = "yes"],
[BASE_WARNINGS="${BASE_WARNINGS} -Wextra"],
[BASE_WARNINGS="${BASE_WARNINGS} -W"])
AC_CACHE_CHECK([whether it is safe to use -Wformat],
[ac_cv_safe_to_use_wformat_],
[save_CFLAGS="$CFLAGS"
dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
dnl conversion warnings to all the tarball folks
CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"