From: Monty Taylor Date: Sat, 29 May 2010 17:31:51 +0000 (-0700) Subject: Updated pandora-build files to version 0.131 X-Git-Tag: 0.41~24^2~2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=7a30c7f272a75be40015a5817007c5c7d0aeb406;p=m6w6%2Flibmemcached Updated pandora-build files to version 0.131 --- diff --git a/.quickly b/.quickly new file mode 100644 index 00000000..c33726ff --- /dev/null +++ b/.quickly @@ -0,0 +1,5 @@ +project = libmemcached +version = 0.4.2 +template = pandora-build +project-type = library +pandora-version = 0.131 diff --git a/Makefile.am b/Makefile.am index c5726772..a410902c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,9 +16,18 @@ EXTRA_HEADERS = BUILT_SOURCES= EXTRA_DIST= \ ${srcdir}/m4/pandora_*.m4 \ + .quickly \ README.FIRST \ config/autorun.sh \ - m4/pkg.m4 + config/pandora-plugin \ + config/uncrustify.cfg \ + m4/ac_cxx_header_stdcxx_98.m4 \ + m4/acx_pthread.m4 \ + m4/gettext.m4 \ + m4/iconv.m4 \ + m4/pkg.m4 \ + m4/po.m4 \ + m4/progtest.m4 SUBDIRS = docs diff --git a/config/autorun.sh b/config/autorun.sh index 4785b9fc..511b6bba 100755 --- a/config/autorun.sh +++ b/config/autorun.sh @@ -1,5 +1,32 @@ #!/bin/sh -# Taken from lighthttpd server (BSD). Thanks Jan! +# +# Copyright (c) 2006 Jan Kneschke +# Copyright (c) 2009 Sun Microsystems +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. 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. +# 3. The name of the author 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. +# # Run this to generate all the initial makefiles, etc. die() { echo "$@"; exit 1; } @@ -8,7 +35,7 @@ die() { echo "$@"; exit 1; } LIBTOOLIZE_FLAGS=" --automake --copy --force" # --add-missing instructs automake to install missing auxiliary files # and --force to overwrite them if they already exist -AUTOMAKE_FLAGS="--add-missing --copy --force" +AUTOMAKE_FLAGS="--add-missing --copy --force --foreign" ACLOCAL_FLAGS="-I m4" ARGV0=$0 @@ -41,12 +68,6 @@ then . config/pre_hook.sh fi -# We need to some file here for the m4_sinclude, even if it's just empty -if test ! -f config/plugin.ac -then - touch config/plugin.ac -fi - # Try to detect the supported binaries if the user didn't # override that by pushing the environment variable if test x$LIBTOOLIZE = x; then diff --git a/config/pandora-plugin b/config/pandora-plugin new file mode 100755 index 00000000..3ffcaaff --- /dev/null +++ b/config/pandora-plugin @@ -0,0 +1,667 @@ +#!/usr/bin/python + +# Copyright (C) 2009 Sun Microsystems +# +# 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; version 2 of the License. +# +# 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, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +pandora_plugin_file = 'config/pandora-plugin.ini' + +# Find plugins in the tree and add them to the build system + +import ConfigParser, os, sys +import datetime, time +import subprocess + +plugin_am_file=None +plugin_ac_file=None + +class ChangeProtectedFile(object): + + def __init__(self, fname): + self.bogus_file= False + self.real_fname= fname + self.new_fname= "%s.new" % fname + try: + self.new_file= open(self.new_fname,'w+') + except IOError: + self.bogus_file= True + + def write(self, text): + if not self.bogus_file: + self.new_file.write(text) + + # We've written all of this out into .new files, now we only copy them + # over the old ones if they are different, so that we don't cause + # unnecessary recompiles + def close(self): + """Return True if the file had changed.""" + if self.bogus_file: + return + self.new_file.seek(0) + new_content = self.new_file.read() + self.new_file.close() + try: + old_file = file(self.real_fname, 'r') + old_content = old_file.read() + old_file.close() + except IOError: + old_content = None + if new_content != old_content: + if old_content != None: + os.unlink(self.real_fname) + os.rename(self.new_fname, self.real_fname) + return True + else: + try: + os.unlink(self.new_fname) + except: + pass + + +def write_external_configure(plugin, plugin_file): + """Write the initial bits of the configure.ac file""" + if not os.path.exists('m4'): + os.mkdir('m4') + plugin_file.write(""" +AC_PREREQ(2.59)dnl Minimum Autoconf version required. +AC_INIT([%(name)s],[%(version)s],[%(url)s]) +AC_CONFIG_SRCDIR([%(main_source)s]) +AC_CONFIG_AUX_DIR(config) + +PANDORA_CANONICAL_TARGET(less-warnings, warnings-always-on, require-cxx, force-gcc42,skip-visibility) + +PANDORA_REQUIRE_LIBPROTOBUF +PANDORA_PROTOBUF_REQUIRE_VERSION([2.1.0]) +PANDORA_REQUIRE_PROTOC + +AC_LANG_PUSH(C++) +PANDORA_REQUIRE_PTHREAD +PANDORA_REQUIRE_LIBDL +AC_LANG_POP + +PANDORA_USE_BETTER_MALLOC + +PANDORA_DRIZZLE_BUILD +""" % plugin) + + write_plugin_ac(plugin, plugin_file) + + plugin_file.write(""" +AC_CONFIG_FILES(Makefile) + +AC_OUTPUT + +echo "---" +echo "Configuration summary for $PACKAGE_NAME version $VERSION $PANDORA_RELEASE_COMMENT" +echo "" +echo " * Installation prefix: $prefix" +echo " * System type: $host_vendor-$host_os" +echo " * Host CPU: $host_cpu" +echo " * C Compiler: $CC_VERSION" +echo " * C++ Compiler: $CXX_VERSION" +echo " * Debug enabled: $with_debug" +echo " * Warnings as failure: $ac_cv_warnings_as_errors" +echo " * C++ cstdint location: $ac_cv_cxx_cstdint" +echo " * C++ hash_map location: $ac_cv_cxx_hash_map" +echo " * C++ hash namespace: $ac_cv_cxx_hash_namespace" +echo " * C++ shared_ptr namespace: $ac_cv_shared_ptr_namespace" +echo "" +echo "---" + + """ % plugin) + +def write_external_makefile(plugin, plugin_file): + + plugin_file.write(""" +ACLOCAL_AMFLAGS = -I m4 --force +VERSION=$(PANDORA_RELEASE_VERSION) + +pkgplugindir=%(pkgplugindir)s +EXTRA_DIST = plugin.ini + +""" % plugin) + if plugin['headers'] != "": + plugin_file.write("noinst_HEADERS = %(headers)s\n" % plugin) + if plugin['install_headers'] != "": + plugin_file.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin) + if plugin['testsuite']: + if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "": + plugin_file.write("EXTRA_DIST += %(testsuitedir)s\n" % plugin) + plugin_file.write(""" +pkgplugin_LTLIBRARIES=%(libname)s.la +%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS) +%(libname)s_la_LIBADD=%(libs)s +%(libname)s_la_DEPENDENCIES=%(libs)s +%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_DYNAMIC_PLUGIN -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s %(cppflags)s +%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s +%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s +%(libname)s_la_SOURCES=%(sources)s +check_PROGRAMS += %(tests)s +""" % plugin) + plugin_am_file=os.path.join(plugin['rel_path'],'plugin.am') + if os.path.exists(plugin_am_file): + plugin_file.write('include %s\n' % plugin_am_file) + +def write_external_plugin(): + """Return True if the plugin had changed.""" + plugin = read_plugin_ini('.') + expand_plugin_ini(plugin) + plugin_file = ChangeProtectedFile('configure.ac') + write_external_configure(plugin, plugin_file) + result = plugin_file.close() + plugin_file = ChangeProtectedFile('Makefile.am') + write_external_makefile(plugin, plugin_file) + # Write some stub configure.ac and Makefile.am files that include the above + result = plugin_file.close() or result + return result + +def write_plugin(plugin, plugin_ini_list): + # Since this function is recursive, make sure we're not already in it. + if plugin.has_key('writing_status'): + if plugin['writing_status'] == 'done': + return + else: + print "Dependency loop detected with %s" % plugin['name'] + exit(1) + + plugin['writing_status'] = 'dependencies' + + # Write all dependencies first to get around annoying automake bug + for dependency in plugin['dependency_list']: + found = False + for find_plugin in plugin_ini_list: + if find_plugin['module_name'] == dependency: + found = True + write_plugin(find_plugin, plugin_ini_list) + break + if found is False: + print "Could not find dependency %s: %s" % (plugin['name'], dependency) + exit(1) + + write_plugin_ac(plugin, plugin_ac_file) + write_plugin_am(plugin, plugin_am_file) + plugin['writing_status'] = 'done' + +def write_plugin_ac(plugin, plugin_ac): + # + # Write plugin config instructions into plugin.ac file. + # + plugin_ac_file=os.path.join(plugin['rel_path'],'plugin.ac') + plugin_m4_dir=os.path.join(plugin['rel_path'],'m4') + plugin_m4_files=[] + if os.path.exists(plugin_m4_dir) and os.path.isdir(plugin_m4_dir): + for m4_file in os.listdir(plugin_m4_dir): + if os.path.splitext(m4_file)[-1] == '.m4': + plugin_m4_files.append(os.path.join(plugin['rel_path'], m4_file)) + plugin_ac.write(""" +dnl Config for %(title)s +""" % plugin) + for m4_file in plugin_m4_files: + plugin_ac.write('m4_sinclude([%s])\n' % m4_file) + plugin['plugin_dep_libs']=" ".join(["\${top_builddir}/%s" % f for f in plugin['libs'].split()]) + + plugin_ac.write(""" +AC_ARG_WITH([%(name_with_dashes)s-plugin],[ +dnl indented wierd to make the help output correct +AS_HELP_STRING([--with-%(name_with_dashes)s-plugin],[Build %(title)s. @<:@default=%(enabled)s@:>@]) +AS_HELP_STRING([--without-%(name_with_dashes)s-plugin],[Disable building %(title)s]) + ],[ + with_%(name)s_plugin="$withval" + AS_IF([test "x$with_%(name)s_plugin" = "xyes"],[ + requested_%(name)s_plugin="yes" + ],[ + requested_%(name)s_plugin="no" + ]) + ],[ + with_%(name)s_plugin="%(enabled)s" + requested_%(name)s_plugin="no" + ]) +AC_ARG_ENABLE([%(name_with_dashes)s-plugin],[ +dnl indented wierd to make the help output correct +AS_HELP_STRING([--enable-%(name_with_dashes)s-plugin],[Build %(title)s. @<:@default=%(default_yesno)s@:>@]) +AS_HELP_STRING([--disable-%(name_with_dashes)s-plugin],[Disable building %(title)s]) + ], + [enable_%(name)s_plugin="$enableval"], + [enable_%(name)s_plugin=%(default_yesno)s]) + +""" % plugin) + if os.path.exists(plugin_ac_file): + plugin_ac.write('m4_sinclude([%s])\n' % plugin_ac_file) + # The plugin author has specified some check to make to determine + # if the plugin can be built. If the plugin is turned on and this + # check fails, then configure should error out. If the plugin is not + # turned on, then the normal conditional build stuff should just let + # it silently not build + if plugin['has_build_conditional']: + plugin_ac.write(""" +AS_IF([test %(build_conditional)s], + [], dnl build_conditional can only negate + [ + AS_IF([test "x${requested_%(name)s_plugin}" = "xyes"], + [AC_MSG_ERROR([Plugin %(name)s was explicitly requested, yet failed build dependency checks. Aborting!])]) + with_%(name)s_plugin=no + ]) + +""" % plugin) + if not plugin['unconditional']: + plugin_ac.write(""" +AM_CONDITIONAL([%(build_conditional_tag)s], + [test %(build_conditional)s]) + """ % plugin) + + plugin_ac.write(""" +AS_IF([test "x$with_%(name)s_plugin" = "xyes"], + [ +""" % plugin) + if plugin['testsuite']: + plugin_ac.write(""" + pandora_plugin_test_list="%(name)s,${pandora_plugin_test_list}" + """ % plugin) + if plugin['static']: + plugin_ac.write(""" + AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[ + pandora_builtin_list="%(module_name)s,${pandora_builtin_list}" + pandora_builtin_symbols_list="_drizzled_%(module_name)s_plugin_,${pandora_builtin_symbols_list}" + pandora_plugin_libs="${pandora_plugin_libs} \${top_builddir}/%(root_plugin_dir)s/%(libname)s.la" + PANDORA_PLUGIN_DEP_LIBS="${PANDORA_PLUGIN_DEP_LIBS} %(plugin_dep_libs)s" + ]) + """ % plugin) + + else: + plugin_ac.write(""" + AS_IF([test "x$enable_%(name)s_plugin" = "xyes"],[ + pandora_default_plugin_list="%(name)s,${pandora_default_plugin_list}" + ]) + """ % plugin) + plugin_ac.write(" ])\n") + +def fix_file_paths(plugin, files): + # TODO: determine path to plugin dir relative to top_srcdir... append it to + # source files if they don't already have it + new_files="" + if plugin['plugin_dir'] != ".": + for file in files.split(): + if not file.startswith(plugin['rel_path']): + file= os.path.join(plugin['rel_path'], file) + new_files= "%s %s" % (new_files, file) + else: + new_files= " ".join(plugin['sources'].split()) + if new_files != "": + return new_files + return files + +def expand_plugin_ini(plugin): + if plugin['name'] == "**OUT-OF-TREE**": + print "Out of tree plugins require the name field to be specified in plugin.ini" + sys.exit(1) + + if plugin['plugin_dir'] == ".": + plugin['rel_path']= plugin['plugin_dir'] + plugin['unconditional']=True + else: + plugin['rel_path']= plugin['plugin_dir'][len(config['top_srcdir'])+len(os.path.sep):] + plugin['unconditional']=False + + plugin['sources']= fix_file_paths(plugin, plugin['sources']) + plugin['main_source']= plugin['sources'].split()[0] + plugin['headers']= fix_file_paths(plugin, plugin['headers']) + plugin['install_headers']= fix_file_paths(plugin, plugin['install_headers']) + plugin['tests']= fix_file_paths(plugin, plugin['tests']) + + # Make a yes/no version for autoconf help messages + if plugin['load_by_default'] or plugin['static']: + plugin['default_yesno']="yes" + else: + plugin['default_yesno']="no" + + + plugin['build_conditional_tag']= "BUILD_%s_PLUGIN" % plugin['name'].upper() + plugin['name_with_dashes']= plugin['name'].replace('_','-') + if plugin.has_key('build_conditional'): + plugin['has_build_conditional']=True + plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes" -a %(build_conditional)s' % plugin + else: + plugin['has_build_conditional']=False + plugin['build_conditional']='"x${with_%(name)s_plugin}" = "xyes"' %plugin + + if plugin['install']: + plugin['library_type']= 'pkgplugin' + else: + plugin['library_type']= 'noinst' + +def find_testsuite(plugin_dir): + for testdir in ['drizzle-tests','tests']: + if os.path.isdir(os.path.join(plugin_dir,testdir)): + return testdir + if os.path.isdir(os.path.join('tests','suite',os.path.basename(plugin_dir))): + return "" + return None + +def read_plugin_ini(plugin_dir): + if plugin_dir == ".": + plugin_name="**OUT-OF-TREE**" + else: + short_name=os.path.basename(plugin_dir) + plugin_name = plugin_dir[plugin_dir.index(config['root_plugin_dir']) + len(config['root_plugin_dir']) + 1:] + module_name = plugin_name.replace("/", config['module_name_separator']).replace("\\", config['module_name_separator']) + plugin_name = plugin_name.replace("/", config['plugin_name_separator']).replace("\\", config['plugin_name_separator']) + + + plugin_file= os.path.join(plugin_dir,config['plugin_ini_fname']) + plugin_defaults= dict(sources="%s.cc" % short_name, + headers="", + install_headers="", + cflags="", + cppflags="", + cxxflags="", + libs="", + ldflags="", + author="", + title="", + description="", + license="PLUGIN_LICENSE_GPL", + name=plugin_name, + module_name=module_name, + load_by_default=config['default_load_by_default'], + disabled="False", + static="False", + dependencies="", + dependency_aliases="", + tests="", + install=config['default_install']) + parser=ConfigParser.ConfigParser(defaults= plugin_defaults) + parser.read(plugin_file) + plugin=dict(parser.items('plugin')) + plugin['plugin_dir'] = plugin_dir + if plugin_dir == '.': + if not plugin.has_key('url'): + print "External Plugins are required to specifiy a url" + plugin['url']= 'http://launchpad.net/%(name)s' % plugin + sys.exit(1) + if plugin_dir == '.' and not plugin.has_key('version'): + print "External Plugins are required to specifiy a version" + sys.exit(1) + if not plugin.has_key('version'): + plugin['version'] = config['default_plugin_version'] + + if plugin.has_key('load_by_default'): + plugin['load_by_default']=parser.getboolean('plugin','load_by_default') + if plugin.has_key('disabled'): + plugin['disabled']=parser.getboolean('plugin','disabled') + if plugin['disabled']: + plugin['enabled']="no" + else: + plugin['enabled']="yes" + if plugin.has_key('static'): + plugin['static']= parser.getboolean('plugin','static') + if plugin.has_key('install'): + plugin['install']= parser.getboolean('plugin','install') + if plugin.has_key('testsuite'): + if plugin['testsuite'] == 'disable': + plugin['testsuite']= False + else: + plugin_testsuite= find_testsuite(plugin_dir) + plugin['testsuitedir']=plugin_testsuite + if plugin_testsuite is not None: + plugin['testsuite']=True + else: + plugin['testsuite']=False + + plugin['cflags']+= ' ' + config['extra_cflags'] + plugin['cppflags']+= ' ' + config['extra_cppflags'] + plugin['cxxflags']+= ' ' + config['extra_cxxflags'] + + plugin['libname']= "lib%s%s%s" % (config['plugin_prefix'], + plugin['name'], + config['plugin_suffix']) + if config['force_lowercase_libname']: + plugin['libname']= plugin['libname'].lower() + + plugin['root_plugin_dir']= config['root_plugin_dir'] + plugin['plugin_prefix']= config['plugin_prefix'] + plugin['plugin_suffix']= config['plugin_suffix'] + plugin['pkgplugindir']= config['pkgplugindir'] + + # Dependencies must have a module but dependency aliases are simply added + # to the variable passed during compile. + plugin['dependency_list'] = plugin['dependencies'].split() + dependency_aliases = plugin['dependency_aliases'].split() + plugin['dependencies'] = ','.join(plugin['dependency_list'] + + plugin['dependency_aliases'].split()) + dependency_libs = ["%s/lib%s%s.la" % (config['root_plugin_dir'], + dependency.lower().replace('::', '_'), + config['plugin_suffix']) + for dependency in plugin['dependency_list']] + plugin['libs'] = " ".join(plugin['libs'].split() + dependency_libs); + +# Libtool is going to expand: +# -DPANDORA_MODULE_AUTHOR='"Padraig O'"'"'Sullivan"' +# to: +# "-DPANDORA_MODULE_AUTHOR=\"Padraig O'Sullivan\"" +# So we have to replace internal ''s to '"'"' + for key in ('author','title','description','version'): + plugin[key]=plugin[key].replace('"','\\"') + plugin[key]=plugin[key].replace("'","'\"'\"'") + return plugin + + +def write_plugin_am(plugin, plugin_am): + """Write an automake fragment for this plugin. + + :param plugin: The plugin dict. + :param plugin_am: The file to write to. + """ + # The .plugin.ini.stamp avoids changing the datestamp on plugin.ini which can + # confuse VCS systems. + plugin_am.write(""" +EXTRA_DIST += %(rel_path)s/plugin.ini + +# Prevent errors when a plugin dir is removed +%(rel_path)s/plugin.ini: + +""" % plugin) + if plugin['headers'] != "": + plugin_am.write("noinst_HEADERS += %(headers)s\n" % plugin) + if plugin['install_headers'] != "": + plugin_am.write("nobase_include_HEADERS += %(install_headers)s\n" % plugin) + if plugin['testsuite']: + if plugin.has_key('testsuitedir') and plugin['testsuitedir'] != "": + plugin_am.write("EXTRA_DIST += %(rel_path)s/%(testsuitedir)s\n" % plugin) + if plugin['static']: + plugin_am.write(""" +%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s +EXTRA_DIST += %(rel_path)s/plugin.ini +if %(build_conditional_tag)s + noinst_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la + %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s + %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s + %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=$(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS) + %(root_plugin_dir)s_%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s -DPANDORA_MODULE_DEPENDENCIES='"%(dependencies)s"' %(cppflags)s + %(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s + %(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s + %(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s + check_PROGRAMS += %(tests)s + PANDORA_DYNAMIC_LDADDS+=${top_builddir}/%(root_plugin_dir)s/%(libname)s.la +endif +""" % plugin) + else: + plugin_am.write(""" +%(root_plugin_dir)s_%(plugin_prefix)s%(name)s_dir=${top_srcdir}/%(rel_path)s +EXTRA_DIST += %(rel_path)s/plugin.ini +if %(build_conditional_tag)s + %(library_type)s_LTLIBRARIES+=%(root_plugin_dir)s/%(libname)s.la + %(root_plugin_dir)s_%(libname)s_la_LDFLAGS=-avoid-version -rpath $(pkgplugindir) $(AM_LDFLAGS) %(ldflags)s $(GCOV_LIBS) + %(root_plugin_dir)s_%(libname)s_la_LIBADD=%(libs)s + %(root_plugin_dir)s_%(libname)s_la_DEPENDENCIES=%(libs)s + %(root_plugin_dir)s_%(libname)s_la_CPPFLAGS=$(AM_CPPFLAGS) -DPANDORA_DYNAMIC_PLUGIN -DPANDORA_MODULE_NAME=%(module_name)s -DPANDORA_MODULE_AUTHOR='"%(author)s"' -DPANDORA_MODULE_TITLE='"%(title)s"' -DPANDORA_MODULE_VERSION='"%(version)s"' -DPANDORA_MODULE_LICENSE=%(license)s -DPANDORA_MODULE_DEPENDENCIES='"%(dependencies)s"' %(cppflags)s + %(root_plugin_dir)s_%(libname)s_la_CXXFLAGS=$(AM_CXXFLAGS) %(cxxflags)s + %(root_plugin_dir)s_%(libname)s_la_CFLAGS=$(AM_CFLAGS) %(cflags)s + %(root_plugin_dir)s_%(libname)s_la_SOURCES=%(sources)s + check_PROGRAMS += %(tests)s +endif +""" % plugin) + plugin_am_file=os.path.join(plugin['rel_path'],'plugin.am') + if os.path.exists(plugin_am_file): + plugin_am.write('include %s\n' % plugin_am_file) + +# +# MAIN STARTS HERE: +# + +# Parse the pandora-plugin config file + +config_defaults= dict( + top_srcdir='.', + top_builddir='.', + plugin_ini_fname='plugin.ini', + plugin_prefix='', + plugin_suffix='', + extra_cflags='', + extra_cppflags='', + extra_cxxflags='', + root_plugin_dir='', + pkgplugindir='', + default_install='True', + default_plugin_version='', + default_load_by_default='False', + force_lowercase_libname='True', + plugin_name_separator='_', + module_name_separator='::' +) + +config_parser = ConfigParser.ConfigParser(defaults=config_defaults) +config_parser.read(pandora_plugin_file) +config = dict(config_parser.items('pandora-plugin')) +config['force_lowercase_libname']=config_parser.getboolean('pandora-plugin','force_lowercase_libname') + +# I'm 3 seconds away from writing a comprehensive build solution +if not os.path.exists('config/pandora_vc_revinfo'): + if os.path.exists('.bzr'): + bzr_revno= subprocess.Popen(["bzr", "revno"], stdout=subprocess.PIPE).communicate()[0].strip() + rev_date= datetime.date.fromtimestamp(time.time()) + config['default_plugin_version'] = "%d.%02d.%s" % (rev_date.year, rev_date.month, bzr_revno) + else: + config['default_plugin_version']=datetime.date.fromtimestamp(time.time()).isoformat() +else: + # need to read config/pandora_vc_revno + pandora_vc_revno=open('config/pandora_vc_revinfo','r').read().split() + rev_date="" + bzr_revno="" + for revno_line in pandora_vc_revno: + (revno_key,revno_val)= revno_line.split("=") + if revno_key == 'PANDORA_VC_REVNO': + bzr_revno=revno_val.strip() + elif revno_key == 'PANDORA_RELEASE_DATE': + rev_date=revno_val.strip() + + config['default_plugin_version'] = "%s.%s" % (rev_date, bzr_revno) + +actions=[] +for arg in sys.argv: + if arg.startswith('--top_srcdir='): + config['top_srcdir']=arg[12:] + elif arg.startswith('--top_builddir='): + config['top_builddir']=arg[14:] + elif arg == "--force-all": + actions=['plugin-list','pandora-plugin.am','write'] + break + else: + actions.append(arg) +if len(actions) == 0: + actions.append('write') + +plugin_list=[] + +def accumulate_plugins(arg, dirname, fnames): + # plugin_ini_fname is a name in dirname indicating dirname is a plugin. + if config['plugin_ini_fname'] in fnames: + arg.append(dirname) + +os.path.walk(os.path.join(config['top_srcdir'], + config['root_plugin_dir']), + accumulate_plugins, + plugin_list) + + +if not os.path.exists("config/pandora-plugin.am") or "write" in actions: + plugin_am_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.am')) + plugin_am_file.write(""" +# always the current list, generated every build so keep this lean. +# pandora-plugin.list: datestamp preserved list +${srcdir}/config/pandora-plugin.list: .plugin.scan +.plugin.scan: + @cd ${top_srcdir} && python config/pandora-plugin plugin-list + +# Plugins affect configure; so to prevent configure running twice in a tarball +# build (once up front, once with the right list of plugins, we ship the +# generated list of plugins and the housekeeping material for that list so it +# is likewise not updated. +EXTRA_DIST += \ + config/pandora-plugin.am \ + config/pandora-plugin.ac \ + config/pandora-plugin \ + config/pandora-plugin.ini + + +# Seed the list of plugin LDADDS which plugins may extend. +PANDORA_DYNAMIC_LDADDS= + +# plugin.stamp: graph dominator for creating all per pandora-plugin.ac/am +# files. This is invoked when the code to generate such files has altered.""") + +if not os.path.exists("config/pandora-plugin.ac") or "write" in actions: + plugin_ac_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.ac')) + plugin_ac_file.write("dnl Generated file, run make to rebuild\n") + + +if os.path.exists('plugin.ini'): + # Are we in a plugin dir which wants to have a self-sufficient build system? + plugin_list=['.'] + + write_external_plugin() +else: + plugin_list_file = ChangeProtectedFile(os.path.join('config', 'pandora-plugin.list')) + for p in plugin_list: + plugin_list_file.write(p) + plugin_list_file.write("\n") + plugin_list.sort() + plugin_list_file.close() + +if not os.path.exists("config/pandora-plugin.am") or 'write' in actions: + plugin_am_file.write("\n${top_srcdir}/config/pandora-plugin.am: ${top_srcdir}/config/pandora-plugin.list ${top_srcdir}/config/pandora-plugin ") + for plugin_dir in plugin_list: + plugin_am_file.write("\\\n\t%s/plugin.ini " % plugin_dir) + plugin_am_file.write("\n\tcd ${top_srcdir} && python config/pandora-plugin write\n") + plugin_ini_list=[] + + # Load all plugin.ini files first so we can do dependency tracking. + for plugin_dir in plugin_list: + plugin = read_plugin_ini(plugin_dir) + expand_plugin_ini(plugin) + plugin_ini_list.append(plugin) + + # Check for duplicates + plugin_name_list = [plugin['libname'] for plugin in plugin_ini_list] + for plugin in plugin_ini_list: + if plugin_name_list.count(plugin['libname']) != 1: + print "Duplicate module name %s" % plugin['libname'] + exit(1) + + for plugin in plugin_ini_list: + write_plugin(plugin, plugin_ini_list) + +if plugin_am_file is not None: + plugin_am_file.close() +if plugin_ac_file is not None: + plugin_ac_file.close() diff --git a/config/uncrustify.cfg b/config/uncrustify.cfg new file mode 100644 index 00000000..d3efbdcb --- /dev/null +++ b/config/uncrustify.cfg @@ -0,0 +1,1112 @@ +# +# Uncrustify options (with comments) for Pandora Projects +# + +nl_after_brace_close = TRUE + +# The type of line endings +newlines = lf # auto/lf/crlf/cr + +# The original size of tabs in the input +input_tab_size = 8 # number + +# The size of tabs in the output (only used if align_with_tabs=true) +output_tab_size = 3 # number + +# The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) +string_escape_char = 92 # number + +# Alternate string escape char for Pawn. Only works right before the quote char. +string_escape_char2 = 0 # number + +# +# Indenting +# + +# The number of columns to indent per level. +# Usually 2, 3, 4, or 8. +indent_columns = 2 # number + +# How to use tabs when indenting code +# 0=spaces only +# 1=indent with tabs, align with spaces +# 2=indent and align with tabs +indent_with_tabs = 0 # number + +# Whether to indent strings broken by '\' so that they line up +indent_align_string = true # false/true + +# The number of spaces to indent multi-line XML strings. +# Requires indent_align_string=True +indent_xml_string = 0 # number + +# Spaces to indent '{' from level +indent_brace = 0 # number + +# Whether braces are indented to the body level +indent_braces = false # false/true + +# Disabled indenting function braces if indent_braces is true +indent_braces_no_func = false # false/true + +# Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. +indent_brace_parent = false # false/true + +# Whether the 'namespace' body is indented +indent_namespace = false # false/true + +# Whether the 'extern "C"' body is indented +indent_extern = false # false/true + +# Whether the 'class' body is indented +indent_class = true # false/true + +# Whether to indent the stuff after a leading class colon +indent_class_colon = true # false/true + +# False=treat 'else\nif' as 'else if' for indenting purposes +# True=indent the 'if' one level +indent_else_if = false # false/true + +# True: indent continued function call parameters one indent level +# False: align parameters under the open paren +indent_func_call_param = false # false/true + +# Same as indent_func_call_param, but for function defs +indent_func_def_param = false # false/true + +# Same as indent_func_call_param, but for function protos +indent_func_proto_param = false # false/true + +# Same as indent_func_call_param, but for class declarations +indent_func_class_param = false # false/true + +# Same as indent_func_call_param, but for class variable constructors +indent_func_ctor_var_param = false # false/true + +# Same as indent_func_call_param, but for templates +indent_template_param = false # false/true + +# Double the indent for indent_func_xxx_param options +indent_func_param_double = false # false/true + +# Indentation column for standalone 'const' function decl/proto qualifier +indent_func_const = 0 # number + +# Indentation column for standalone 'throw' function decl/proto qualifier +indent_func_throw = 0 # number + +# The number of spaces to indent a continued '->' or '.' +# Usually set to 0, 1, or indent_columns. +indent_member = 3 # number + +# Spaces to indent single line ('//') comments on lines before code +indent_sing_line_comments = 0 # number + +# If set, will indent trailing single line ('//') comments relative +# to the code instead of trying to keep the same absolute column +indent_relative_single_line_comments = false # false/true + +# Spaces to indent 'case' from 'switch' +# Usually 0 or indent_columns. +indent_switch_case = 0 # number + +# Spaces to shift the 'case' line, without affecting any other lines +# Usually 0. +indent_case_shift = 0 # number + +# Spaces to indent '{' from 'case'. +# By default, the brace will appear under the 'c' in case. +# Usually set to 0 or indent_columns. +indent_case_brace = 0 # number + +# Whether to indent comments found in first column +indent_col1_comment = false # false/true + +# How to indent goto labels +# >0 : absolute column where 1 is the leftmost column +# <=0 : subtract from brace indent +indent_label = 1 # number + +# Same as indent_label, but for access specifiers that are followed by a colon +indent_access_spec = 1 # number + +# Indent the code after an access specifier by one level. +# If set, this option forces 'indent_access_spec=0' +indent_access_spec_body = false # false/true + +# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) +indent_paren_nl = false # false/true + +# Controls the indent of a close paren after a newline. +# 0: Indent to body level +# 1: Align under the open paren +# 2: Indent to the brace level +indent_paren_close = 0 # number + +# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren +indent_comma_paren = false # false/true + +# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren +indent_bool_paren = false # false/true + +# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) +indent_square_nl = false # false/true + +# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies +indent_preserve_sql = false # false/true + +# +# Spacing options +# + +# Add or remove space around arithmetic operator '+', '-', '/', '*', etc +sp_arith = force # ignore/add/remove/force + +# Add or remove space before assignment operator '=', '+=', etc +sp_before_assign = remove # ignore/add/remove/force + +# Add or remove space after assignment operator '=', '+=', etc +sp_after_assign = force # ignore/add/remove/force + +# Add or remove space around assignment '=' in enum +sp_enum_assign = ignore # ignore/add/remove/force + +# Add or remove space around boolean operators '&&' and '||' +sp_bool = force # ignore/add/remove/force + +# Add or remove space around compare operator '<', '>', '==', etc +sp_compare = force # ignore/add/remove/force + +# Add or remove space inside '(' and ')' +sp_inside_paren = remove # ignore/add/remove/force + +# Add or remove space between nested parens +sp_paren_paren = remove # ignore/add/remove/force + +# Whether to balance spaces inside nested parens +sp_balance_nested_parens = false # false/true + +# Add or remove space between ')' and '{' +sp_paren_brace = ignore # ignore/add/remove/force + +# Add or remove space before pointer star '*' +sp_before_ptr_star = force # ignore/add/remove/force + +# Add or remove space before pointer star '*' that isn't followed by a variable name +# If set to 'ignore', sp_before_ptr_star is used instead. +sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force + +# Add or remove space between pointer stars '*' +sp_between_ptr_star = remove # ignore/add/remove/force + +# Add or remove space after pointer star '*', if followed by a word. +sp_after_ptr_star = remove # ignore/add/remove/force + +# Add or remove space after a pointer star '*', if followed by a func proto/def. +sp_after_ptr_star_func = ignore # ignore/add/remove/force + +# Add or remove space before a pointer star '*', if followed by a func proto/def. +sp_before_ptr_star_func = ignore # ignore/add/remove/force + +# Add or remove space before a reference sign '&' +sp_before_byref = remove # ignore/add/remove/force + +# Add or remove space before a reference sign '&' that isn't followed by a variable name +# If set to 'ignore', sp_before_byref is used instead. +sp_before_unnamed_byref = ignore # ignore/add/remove/force + +# Add or remove space after reference sign '&', if followed by a word. +sp_after_byref = force # ignore/add/remove/force + +# Add or remove space after a reference sign '&', if followed by a func proto/def. +sp_after_byref_func = ignore # ignore/add/remove/force + +# Add or remove space before a reference sign '&', if followed by a func proto/def. +sp_before_byref_func = ignore # ignore/add/remove/force + +# Add or remove space between type and word +sp_after_type = force # ignore/add/remove/force + +# Add or remove space in 'template <' vs 'template<'. +# If set to ignore, sp_before_angle is used. +sp_template_angle = ignore # ignore/add/remove/force + +# Add or remove space before '<>' +sp_before_angle = remove # ignore/add/remove/force + +# Add or remove space inside '<' and '>' +sp_inside_angle = remove # ignore/add/remove/force + +# Add or remove space after '<>' +sp_after_angle = force # ignore/add/remove/force + +# Add or remove space between '<>' and '(' as found in 'new List();' +sp_angle_paren = ignore # ignore/add/remove/force + +# Add or remove space between '<>' and a word as in 'List m;' +sp_angle_word = ignore # ignore/add/remove/force + +# Add or remove space before '(' of 'if', 'for', 'switch', and 'while' +sp_before_sparen = force # ignore/add/remove/force + +# Add or remove space inside if-condition '(' and ')' +sp_inside_sparen = remove # ignore/add/remove/force + +# Add or remove space after ')' of 'if', 'for', 'switch', and 'while' +sp_after_sparen = force # ignore/add/remove/force + +# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' +sp_sparen_brace = add # ignore/add/remove/force + +# Add or remove space before empty statement ';' on 'if', 'for' and 'while' +sp_special_semi = ignore # ignore/add/remove/force + +# Add or remove space before ';' +sp_before_semi = remove # ignore/add/remove/force + +# Add or remove space before ';' in non-empty 'for' statements +sp_before_semi_for = ignore # ignore/add/remove/force + +# Add or remove space before a semicolon of an empty part of a for statment. +sp_before_semi_for_empty = force # ignore/add/remove/force + +# Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). +sp_after_semi_for_empty = ignore # ignore/add/remove/force + +# Add or remove space before '[' (except '[]') +sp_before_square = ignore # ignore/add/remove/force + +# Add or remove space before '[]' +sp_before_squares = ignore # ignore/add/remove/force + +# Add or remove space inside '[' and ']' +sp_inside_square = remove # ignore/add/remove/force + +# Add or remove space after ',' +sp_after_comma = force # ignore/add/remove/force + +# Add or remove space before ',' +sp_before_comma = remove # ignore/add/remove/force + +# Add or remove space after class ':' +sp_after_class_colon = ignore # ignore/add/remove/force + +# Add or remove space before class ':' +sp_before_class_colon = ignore # ignore/add/remove/force + +# Add or remove space between 'operator' and operator sign +sp_after_operator = ignore # ignore/add/remove/force + +# Add or remove space between the operator symbol and the open paren, as in 'operator ++(' +sp_after_operator_sym = ignore # ignore/add/remove/force + +# Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' +sp_after_cast = remove # ignore/add/remove/force + +# Add or remove spaces inside cast parens +sp_inside_paren_cast = remove # ignore/add/remove/force + +# Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' +sp_cpp_cast_paren = remove # ignore/add/remove/force + +# Add or remove space between 'sizeof' and '(' +sp_sizeof_paren = remove # ignore/add/remove/force + +# Add or remove space after the tag keyword (Pawn) +sp_after_tag = ignore # ignore/add/remove/force + +# Add or remove space inside enum '{' and '}' +sp_inside_braces_enum = force # ignore/add/remove/force + +# Add or remove space inside struct/union '{' and '}' +sp_inside_braces_struct = force # ignore/add/remove/force + +# Add or remove space inside '{' and '}' +sp_inside_braces = force # ignore/add/remove/force + +# Add or remove space inside '{}' +sp_inside_braces_empty = ignore # ignore/add/remove/force + +# Add or remove space between return type and function name +# A minimum of 1 is forced except for pointer return types. +sp_type_func = force # ignore/add/remove/force + +# Add or remove space between function name and '(' on function declaration +sp_func_proto_paren = remove # ignore/add/remove/force + +# Add or remove space between function name and '(' on function definition +sp_func_def_paren = remove # ignore/add/remove/force + +# Add or remove space inside empty function '()' +sp_inside_fparens = ignore # ignore/add/remove/force + +# Add or remove space inside function '(' and ')' +sp_inside_fparen = remove # ignore/add/remove/force + +# Add or remove space between ']' and '(' when part of a function call. +sp_square_fparen = ignore # ignore/add/remove/force + +# Add or remove space between ')' and '{' of function +sp_fparen_brace = add # ignore/add/remove/force + +# Add or remove space between function name and '(' on function calls +sp_func_call_paren = remove # ignore/add/remove/force + +# Add or remove space between the user function name and '(' on function calls +# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. +sp_func_call_user_paren = ignore # ignore/add/remove/force + +# Add or remove space between a constructor/destructor and the open paren +sp_func_class_paren = remove # ignore/add/remove/force + +# Add or remove space between 'return' and '(' +sp_return_paren = remove # ignore/add/remove/force + +# Add or remove space between '__attribute__' and '(' +sp_attribute_paren = remove # ignore/add/remove/force + +# Add or remove space between 'defined' and '(' in '#if defined (FOO)' +sp_defined_paren = remove # ignore/add/remove/force + +# Add or remove space between 'throw' and '(' in 'throw (something)' +sp_throw_paren = ignore # ignore/add/remove/force + +# Add or remove space between macro and value +sp_macro = ignore # ignore/add/remove/force + +# Add or remove space between macro function ')' and value +sp_macro_func = ignore # ignore/add/remove/force + +# Add or remove space between 'else' and '{' if on the same line +sp_else_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'else' if on the same line +sp_brace_else = ignore # ignore/add/remove/force + +# Add or remove space between '}' and the name of a typedef on the same line +sp_brace_typedef = force # ignore/add/remove/force + +# Add or remove space between 'catch' and '{' if on the same line +sp_catch_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'catch' if on the same line +sp_brace_catch = ignore # ignore/add/remove/force + +# Add or remove space between 'finally' and '{' if on the same line +sp_finally_brace = ignore # ignore/add/remove/force + +# Add or remove space between '}' and 'finally' if on the same line +sp_brace_finally = ignore # ignore/add/remove/force + +# Add or remove space between 'try' and '{' if on the same line +sp_try_brace = ignore # ignore/add/remove/force + +# Add or remove space between get/set and '{' if on the same line +sp_getset_brace = ignore # ignore/add/remove/force + +# Add or remove space before the '::' operator +sp_before_dc = remove # ignore/add/remove/force + +# Add or remove space after the '::' operator +sp_after_dc = remove # ignore/add/remove/force + +# Add or remove around the D named array initializer ':' operator +sp_d_array_colon = ignore # ignore/add/remove/force + +# Add or remove space after the '!' (not) operator. +sp_not = force # ignore/add/remove/force + +# Add or remove space after the '~' (invert) operator. +sp_inv = remove # ignore/add/remove/force + +# Add or remove space after the '&' (address-of) operator. +# This does not affect the spacing after a '&' that is part of a type. +sp_addr = remove # ignore/add/remove/force + +# Add or remove space around the '.' or '->' operators +sp_member = remove # ignore/add/remove/force + +# Add or remove space after the '*' (dereference) operator. +# This does not affect the spacing after a '*' that is part of a type. +sp_deref = remove # ignore/add/remove/force + +# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' +sp_sign = remove # ignore/add/remove/force + +# Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' +sp_incdec = remove # ignore/add/remove/force + +# Add or remove space before a backslash-newline at the end of a line +sp_before_nl_cont = add # ignore/add/remove/force + +# Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' +sp_after_oc_scope = ignore # ignore/add/remove/force + +# Add or remove space after the colon in message specs +# '-(int) f:(int) x;' vs '-(int) f: (int) x;' +sp_after_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space before the colon in message specs +# '-(int) f: (int) x;' vs '-(int) f : (int) x;' +sp_before_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space after the colon in message specs +# '[object setValue:1];' vs '[object setValue: 1];' +sp_after_send_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space before the colon in message specs +# '[object setValue:1];' vs '[object setValue :1];' +sp_before_send_oc_colon = ignore # ignore/add/remove/force + +# Add or remove space after the (type) in message specs +# '-(int) f: (int) x;' vs '-(int) f: (int)x;' +sp_after_oc_type = ignore # ignore/add/remove/force + +# Add or remove space around the ':' in 'b ? t : f' +sp_cond_colon = ignore # ignore/add/remove/force + +# Add or remove space around the '?' in 'b ? t : f' +sp_cond_question = ignore # ignore/add/remove/force + +# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. +sp_case_label = remove # ignore/add/remove/force + +# +# Code alignment (not left column spaces/tabs) +# + +# Whether to keep non-indenting tabs +align_keep_tabs = false # false/true + +# Whether to use tabs for alinging +align_with_tabs = false # false/true + +# Whether to bump out to the next tab when aligning +align_on_tabstop = false # false/true + +# Whether to left-align numbers +align_number_left = false # false/true + +# Align variable definitions in prototypes and functions +align_func_params = false # false/true + +# Align parameters in single-line functions that have the same name. +# The function names must already be aligned with each other. +align_same_func_call_params = false # false/true + +# The span for aligning variable definitions (0=don't align) +align_var_def_span = 1 # number + +# How to align the star in variable definitions. +# 0=Part of the type 'void * foo;' +# 1=Part of the variable 'void *foo;' +# 2=Dangling 'void *foo;' +align_var_def_star_style = 1 # number + +# How to align the '&' in variable definitions. +# 0=Part of the type +# 1=Part of the variable +# 2=Dangling +align_var_def_amp_style = 0 # number + +# The threshold for aligning variable definitions (0=no limit) +align_var_def_thresh = 1 # number + +# The gap for aligning variable definitions +align_var_def_gap = 0 # number + +# Whether to align the colon in struct bit fields +align_var_def_colon = false # false/true + +# Whether to align inline struct/enum/union variable definitions +align_var_def_inline = false # false/true + +# The span for aligning on '=' in assignments (0=don't align) +align_assign_span = 0 # number + +# The threshold for aligning on '=' in assignments (0=no limit) +align_assign_thresh = 12 # number + +# The span for aligning on '=' in enums (0=don't align) +align_enum_equ_span = 0 # number + +# The threshold for aligning on '=' in enums (0=no limit) +align_enum_equ_thresh = 0 # number + +# The span for aligning struct/union (0=don't align) +align_var_struct_span = 0 # number + +# The threshold for aligning struct/union member definitions (0=no limit) +align_var_struct_thresh = 0 # number + +# The gap for aligning struct/union member definitions +align_var_struct_gap = 0 # number + +# The span for aligning struct initializer values (0=don't align) +align_struct_init_span = 3 # number + +# The minimum space between the type and the synonym of a typedef +align_typedef_gap = 3 # number + +# The span for aligning single-line typedefs (0=don't align) +align_typedef_span = 5 # number + +# How to align typedef'd functions with other typedefs +# 0: Don't mix them at all +# 1: align the open paren with the types +# 2: align the function type name with the other type names +align_typedef_func = 0 # number + +# Controls the positioning of the '*' in typedefs. Just try it. +# 0: Align on typdef type, ignore '*' +# 1: The '*' is part of type name: typedef int *pint; +# 2: The '*' is part of the type, but dangling: typedef int *pint; +align_typedef_star_style = 0 # number + +# Controls the positioning of the '&' in typedefs. Just try it. +# 0: Align on typdef type, ignore '&' +# 1: The '&' is part of type name: typedef int &pint; +# 2: The '&' is part of the type, but dangling: typedef int &pint; +align_typedef_amp_style = 0 # number + +# The span for aligning comments that end lines (0=don't align) +align_right_cmt_span = 3 # number + +# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment +align_right_cmt_mix = false # false/true + +# If a trailing comment is more than this number of columns away from the text it follows, +# it will qualify for being aligned. +align_right_cmt_gap = 0 # number + +# The span for aligning function prototypes (0=don't align) +align_func_proto_span = 0 # number + +# Minimum gap between the return type and the function name. +align_func_proto_gap = 0 # number + +# Whether to mix aligning prototype and variable declarations. +# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. +align_mix_var_proto = false # false/true + +# Align single-line functions with function prototypes, uses align_func_proto_span +align_single_line_func = false # false/true + +# Aligning the open brace of single-line functions. +# Requires align_single_line_func=true, uses align_func_proto_span +align_single_line_brace = false # false/true + +# Gap for align_single_line_brace. +align_single_line_brace_gap = 0 # number + +# The span for aligning ObjC msg spec (0=don't align) +align_oc_msg_spec_span = 0 # number + +# Whether to align macros wrapped with a backslash and a newline. +# This will not work right if the macro contains a multi-line comment. +align_nl_cont = true # false/true + +# The minimum space between label and value of a preprocessor define +align_pp_define_gap = 4 # number + +# The span for aligning on '#define' bodies (0=don't align) +align_pp_define_span = 3 # number + +# Align lines that start with '<<' with previous '<<'. Default=true +align_left_shift = true # false/true + +# +# Newline adding and removing options +# + +# Whether to collapse empty blocks between '{' and '}' +nl_collapse_empty_body = true # false/true + +# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' +nl_assign_leave_one_liners = false # false/true + +# Don't split one-line braced statements inside a class xx { } body +nl_class_leave_one_liners = false # false/true + +# Don't split one-line enums: 'enum foo { BAR = 15 };' +nl_enum_leave_one_liners = false # false/true + +# Don't split one-line get or set functions +nl_getset_leave_one_liners = false # false/true + +# Don't split one-line function definitions - 'int foo() { return 0; }' +nl_func_leave_one_liners = false # false/true + +# Don't split one-line if/else statements - 'if(a) b++;' +nl_if_leave_one_liners = false # false/true + +# Add or remove newlines at the start of the file +nl_start_of_file = remove # ignore/add/remove/force + +# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' +nl_start_of_file_min = 0 # number + +# Add or remove newline at the end of the file +nl_end_of_file = force # ignore/add/remove/force + +# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') +nl_end_of_file_min = 1 # number + +# Add or remove newline between '=' and '{' +nl_assign_brace = force # ignore/add/remove/force + +# Add or remove newline between '=' and '[' (D only) +nl_assign_square = force # ignore/add/remove/force + +# Add or remove newline after '= [' (D only). Will also affect the newline before the ']' +nl_after_square_assign = force # ignore/add/remove/force + +# The number of newlines after a block of variable definitions +nl_func_var_def_blk = 1 # number + +# Add or remove newline between a function call's ')' and '{', as in: +# list_for_each(item, &list) { } +nl_fcall_brace = force # ignore/add/remove/force + +# Add or remove newline between 'enum' and '{' +nl_enum_brace = force # ignore/add/remove/force + +# Add or remove newline between 'struct and '{' +nl_struct_brace = force # ignore/add/remove/force + +# Add or remove newline between 'union' and '{' +nl_union_brace = force # ignore/add/remove/force + +# Add or remove newline between 'if' and '{' +nl_if_brace = force # ignore/add/remove/force + +# Add or remove newline between '}' and 'else' +nl_brace_else = force # ignore/add/remove/force + +# Add or remove newline between 'else if' and '{' +# If set to ignore, nl_if_brace is used instead +nl_elseif_brace = force # ignore/add/remove/force + +# Add or remove newline between 'else' and '{' +nl_else_brace = force # ignore/add/remove/force + +# Add or remove newline between 'else' and 'if' +nl_else_if = remove # ignore/add/remove/force + +# Add or remove newline between '}' and 'finally' +nl_brace_finally = force # ignore/add/remove/force + +# Add or remove newline between 'finally' and '{' +nl_finally_brace = force # ignore/add/remove/force + +# Add or remove newline between 'try' and '{' +nl_try_brace = force # ignore/add/remove/force + +# Add or remove newline between get/set and '{' +nl_getset_brace = force # ignore/add/remove/force + +# Add or remove newline between 'for' and '{' +nl_for_brace = force # ignore/add/remove/force + +# Add or remove newline between 'catch' and '{' +nl_catch_brace = force # ignore/add/remove/force + +# Add or remove newline between '}' and 'catch' +nl_brace_catch = force # ignore/add/remove/force + +# Add or remove newline between 'while' and '{' +nl_while_brace = force # ignore/add/remove/force + +# Add or remove newline between 'do' and '{' +nl_do_brace = force # ignore/add/remove/force + +# Add or remove newline between '}' and 'while' of 'do' statement +nl_brace_while = force # ignore/add/remove/force + +# Add or remove newline between 'switch' and '{' +nl_switch_brace = force # ignore/add/remove/force + +# Add or remove newline when condition spans two or more lines +nl_multi_line_cond = false # false/true + +# Force a newline in a define after the macro name for multi-line defines. +nl_multi_line_define = true # false/true + +# Whether to put a newline before 'case' statement +nl_before_case = true # false/true + +# Add or remove newline between ')' and 'throw' +nl_before_throw = ignore # ignore/add/remove/force + +# Whether to put a newline after 'case' statement +nl_after_case = true # false/true + +# Newline between namespace and { +nl_namespace_brace = add # ignore/add/remove/force + +# Add or remove newline between 'template<>' and whatever follows. +nl_template_class = add # ignore/add/remove/force + +# Add or remove newline between 'class' and '{' +nl_class_brace = add # ignore/add/remove/force + +# Add or remove newline after each ',' in the constructor member initialization +nl_class_init_args = force # ignore/add/remove/force + +# Add or remove newline between return type and function name in definition +nl_func_type_name = ignore # ignore/add/remove/force + +# Add or remove newline between return type and function name in a prototype +nl_func_proto_type_name = remove # ignore/add/remove/force + +# Add or remove newline between a function name and the opening '(' +nl_func_paren = remove # ignore/add/remove/force + +# Add or remove newline after '(' in a function declaration +nl_func_decl_start = remove # ignore/add/remove/force + +# Add or remove newline after each ',' in a function declaration +nl_func_decl_args = remove # ignore/add/remove/force + +# Add or remove newline before the ')' in a function declaration +nl_func_decl_end = remove # ignore/add/remove/force + +# Add or remove newline between function signature and '{' +nl_fdef_brace = add # ignore/add/remove/force + +# Whether to put a newline after 'return' statement +nl_after_return = true # false/true + +# Add or remove a newline between the return keyword and return expression. +nl_return_expr = remove # ignore/add/remove/force + +# Whether to put a newline after semicolons, except in 'for' statements +nl_after_semicolon = true # false/true + +# Whether to put a newline after brace open. +# This also adds a newline before the matching brace close. +nl_after_brace_open = true # false/true + +# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is +# placed between the open brace and a trailing single-line comment. +nl_after_brace_open_cmt = false # false/true + +# Whether to put a newline after a virtual brace open. +# These occur in un-braced if/while/do/for statement bodies. +nl_after_vbrace_open = true # false/true + +# Whether to alter newlines in '#define' macros +nl_define_macro = true # false/true + +# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' +nl_squeeze_ifdef = false # false/true + +# Add or remove newline before 'if' +nl_before_if = ignore # ignore/add/remove/force + +# Add or remove newline after 'if' +nl_after_if = ignore # ignore/add/remove/force + +# Add or remove newline before 'for' +nl_before_for = ignore # ignore/add/remove/force + +# Add or remove newline after 'for' +nl_after_for = ignore # ignore/add/remove/force + +# Add or remove newline before 'while' +nl_before_while = ignore # ignore/add/remove/force + +# Add or remove newline after 'while' +nl_after_while = ignore # ignore/add/remove/force + +# Add or remove newline before 'switch' +nl_before_switch = force # ignore/add/remove/force + +# Add or remove newline after 'switch' +nl_after_switch = force # ignore/add/remove/force + +# Add or remove newline before 'do' +nl_before_do = ignore # ignore/add/remove/force + +# Add or remove newline after 'do' +nl_after_do = ignore # ignore/add/remove/force + +# Whether to double-space commented-entries in struct/enum +nl_ds_struct_enum_cmt = false # false/true + +# Whether to double-space before the close brace of a struct/union/enum +nl_ds_struct_enum_close_brace = false # false/true + +# Add or remove a newline around a class colon. +# Related to pos_class_colon, nl_class_init_args, and pos_comma. +nl_class_colon = ignore # ignore/add/remove/force + +# Change simple unbraced if statements into a one-liner +# 'if(b)\n i++;' => 'if(b) i++;' +nl_create_if_one_liner = false # false/true + +# Change simple unbraced for statements into a one-liner +# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' +nl_create_for_one_liner = false # false/true + +# Change simple unbraced while statements into a one-liner +# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' +nl_create_while_one_liner = false # false/true + +# +# Positioning options +# + +# The position of arithmetic operators in wrapped expressions +pos_arith = lead # ignore/lead/trail + +# The position of assignment in wrapped expressions +pos_assign = trail # ignore/lead/trail + +# The position of boolean operators in wrapped expressions +pos_bool = lead # ignore/lead/trail + +# The position of the comma in wrapped expressions +pos_comma = trail # ignore/lead/trail + +# The position of the comma in the constructor initialization list +pos_class_comma = trail # ignore/lead/trail + +# The position of colons between constructor and member initialization +pos_class_colon = lead # ignore/lead/trail + +# +# Line Splitting options +# + +# Try to limit code width to N number of columns +code_width = 76 # number + +# Whether to fully split long 'for' statements at semi-colons +ls_for_split_full = true # false/true + +# Whether to fully split long function protos/calls at commas +ls_func_split_full = true # false/true + +# +# Blank line options +# + +# The maximum consecutive newlines +nl_max = 4 # number + +# The number of newlines after a function prototype, if followed by another function prototype +nl_after_func_proto = 0 # number + +# The number of newlines after a function prototype, if not followed by another function prototype +nl_after_func_proto_group = 3 # number + +# The number of newlines after '}' of a multi-line function body +nl_after_func_body = 3 # number + +# The number of newlines after '}' of a single line function body +nl_after_func_body_one_liner = 1 # number + +# The minimum number of newlines before a multi-line comment. +# Doesn't apply if after a brace open or another multi-line comment. +nl_before_block_comment = 2 # number + +# The minimum number of newlines before a single-line C comment. +# Doesn't apply if after a brace open or other single-line C comments. +nl_before_c_comment = 1 # number + +# The minimum number of newlines before a CPP comment. +# Doesn't apply if after a brace open or other CPP comments. +nl_before_cpp_comment = 0 # number + +# Whether to force a newline after a mulit-line comment. +nl_after_multiline_comment = false # false/true + +# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# Will not change the newline count if after a brace open. +# 0 = No change. +nl_before_access_spec = 1 # number + +# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. +# 0 = No change. +nl_after_access_spec = 1 # number + +# The number of newlines between a function def and the function comment. +# 0 = No change. +nl_comment_func_def = 0 # number + +# Whether to remove blank lines after '{' +eat_blanks_after_open_brace = true # false/true + +# Whether to remove blank lines before '}' +eat_blanks_before_close_brace = true # false/true + +# +# Code modifying options (non-whitespace) +# + +# Add or remove braces on single-line 'do' statement +mod_full_brace_do = add # ignore/add/remove/force + +# Add or remove braces on single-line 'for' statement +mod_full_brace_for = add # ignore/add/remove/force + +# Add or remove braces on single-line function defintions. (Pawn) +mod_full_brace_function = ignore # ignore/add/remove/force + +# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. +mod_full_brace_if = ignore # ignore/add/remove/force + +# Don't remove braces around statements that span N newlines +mod_full_brace_nl = 0 # number + +# Add or remove braces on single-line 'while' statement +mod_full_brace_while = add # ignore/add/remove/force + +# Add or remove unnecessary paren on 'return' statement +mod_paren_on_return = remove # ignore/add/remove/force + +# Whether to change optional semicolons to real semicolons +mod_pawn_semicolon = false # false/true + +# Add parens on 'while' and 'if' statement around bools +mod_full_paren_if_bool = true # false/true + +# Whether to remove superfluous semicolons +mod_remove_extra_semicolon = true # false/true + +# If a function body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be added. +mod_add_long_function_closebrace_comment = 5 # number + +# If a switch body exceeds the specified number of newlines and doesn't have a comment after +# the close brace, a comment will be added. +mod_add_long_switch_closebrace_comment = 5 # number + +# If TRUE, will sort consecutive single-line 'import' statements [Java, D] +mod_sort_import = false # false/true + +# If TRUE, will sort consecutive single-line 'using' statements [C#] +mod_sort_using = false # false/true + +# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] +# This is generally a bad idea, as it may break your code. +mod_sort_include = false # false/true + +# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. +mod_move_case_break = false # false/true + +# If TRUE, it will remove a void 'return;' that appears as the last statement in a function. +mod_remove_empty_return = true # false/true + +# +# Comment modifications +# + +# Try to wrap comments at cmt_width columns +cmt_width = 0 # number + +# If false, disable all multi-line comment changes, including cmt_width and leading chars. +# Default is true. +cmt_indent_multi = true # false/true + +# Whether to group c-comments that look like they are in a block +cmt_c_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined c-comment +cmt_c_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined c-comment +cmt_c_nl_end = false # false/true + +# Whether to group cpp-comments that look like they are in a block +cmt_cpp_group = false # false/true + +# Whether to put an empty '/*' on the first line of the combined cpp-comment +cmt_cpp_nl_start = false # false/true + +# Whether to put a newline before the closing '*/' of the combined cpp-comment +cmt_cpp_nl_end = false # false/true + +# Whether to change cpp-comments into c-comments +cmt_cpp_to_c = false # false/true + +# Whether to put a star on subsequent comment lines +cmt_star_cont = true # false/true + +# The number of spaces to insert at the start of subsequent comment lines +cmt_sp_before_star_cont = 0 # number + +# The number of spaces to insert after the star on subsequent comment lines +cmt_sp_after_star_cont = 1 # number + +# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of +# the comment are the same length. Default=True +cmt_multi_check_last = true # false/true + +# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. +# Will substitue $(filename) with the current file's name. +cmt_insert_file_header = "" # string + +# The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. +# Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. +# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } +cmt_insert_func_header = "" # string + +# The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. +# Will substitue $(class) with the class name. +cmt_insert_class_header = "" # string + +# If a preprocessor is encountered when stepping backwards from a function name, then +# this option decides whether the comment should be inserted. +# Affects cmt_insert_func_header and cmt_insert_class_header. +cmt_insert_before_preproc = false # false/true + +# +# Preprocessor options +# + +# Control indent of preprocessors inside #if blocks at brace level 0 +pp_indent = remove # ignore/add/remove/force + +# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) +pp_indent_at_level = false # false/true + +# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. +pp_indent_count = 1 # number + +# Add or remove space after # based on pp_level of #if blocks +pp_space = add # ignore/add/remove/force + +# Sets the number of spaces added with pp_space +pp_space_count = 1 # number + +# The indent for #region and #endregion in C# and '#pragma region' in C/C++ +pp_indent_region = 0 # number + +# Whether to indent the code between #region and #endregion +pp_region_indent_code = false # false/true + +# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level +pp_indent_if = 0 # number + +# Control whether to indent the code between #if, #else and #endif when not at file-level +pp_if_indent_code = false # false/true + +# Whether to indent '#define' at the brace level (true) or from column 1 (false) +pp_define_at_level = false # false/true + +# You can force a token to be a type with the 'type' option. +# Example: +# type myfoo1 myfoo2 +# +# You can create custom macro-based indentation using macro-open, +# macro-else and macro-close. +# Example: +# macro-open BEGIN_TEMPLATE_MESSAGE_MAP +# macro-open BEGIN_MESSAGE_MAP +# macro-close END_MESSAGE_MAP +# +# You can assign any keyword to any type with the set option. +# set func_call_user _ N_ diff --git a/configure.ac b/configure.ac index f8c5af98..9dcb53bd 100644 --- a/configure.ac +++ b/configure.ac @@ -10,8 +10,6 @@ AC_PREREQ(2.59) AC_INIT([libmemcached],[0.41],[http://libmemcached.org/]) AC_CONFIG_SRCDIR([libmemcached/memcached.c]) AC_CONFIG_AUX_DIR(config) -AM_CONFIG_HEADER([config.h]) -AC_CONFIG_MACRO_DIR([m4]) PANDORA_CANONICAL_TARGET diff --git a/m4/ac_cxx_header_stdcxx_98.m4 b/m4/ac_cxx_header_stdcxx_98.m4 index 67e4c972..856241bc 100644 --- a/m4/ac_cxx_header_stdcxx_98.m4 +++ b/m4/ac_cxx_header_stdcxx_98.m4 @@ -1,12 +1,28 @@ -dnl Copyright © 2008 Benjamin Kosnik - -dnl Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. - +# =========================================================================== +# http://autoconf-archive.cryp.to/ac_cxx_header_stdcxx_98.html +# =========================================================================== +# +# SYNOPSIS +# +# AC_CXX_HEADER_STDCXX_98 +# +# DESCRIPTION +# +# Check for complete library coverage of the C++1998/2003 standard. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. AC_DEFUN([AC_CXX_HEADER_STDCXX_98], [ AC_CACHE_CHECK(for ISO C++ 98 include files, ac_cv_cxx_stdcxx_98, - [AC_LANG_PUSH(C++) + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS AC_TRY_COMPILE([ #include #include @@ -59,7 +75,7 @@ AC_DEFUN([AC_CXX_HEADER_STDCXX_98], [ #include ],, ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no) - AC_LANG_POP() + AC_LANG_RESTORE ]) if test "$ac_cv_cxx_stdcxx_98" = yes; then AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ]) diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4 index 65f5a172..0a86dffe 100644 --- a/m4/acx_pthread.m4 +++ b/m4/acx_pthread.m4 @@ -1,4 +1,6 @@ -##### http://autoconf-archive.cryp.to/acx_pthread.html +# =========================================================================== +# http://autoconf-archive.cryp.to/acx_pthread.html +# =========================================================================== # # SYNOPSIS # @@ -6,87 +8,77 @@ # # 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.) +# 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.) +# 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 +# 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: +# 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). +# 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. +# 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. +# 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. # -# LAST MODIFICATION +# LICENSE # -# 2006-05-29 +# Copyright (c) 2008 Steven G. Johnson # -# COPYLEFT -# -# Copyright (c) 2006 Steven G. Johnson -# -# 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 2 of the -# License, or (at your option) any later version. +# 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. +# 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . # -# 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. +# 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 Macro 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. +# 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. AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) -AC_LANG_PUSH([C]) +AC_LANG_SAVE +AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h @@ -199,9 +191,11 @@ for flag in $acx_pthread_flags; do # 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_t th; pthread_join(th, 0); + AC_TRY_LINK([#include ], + [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],[]) + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" @@ -227,7 +221,8 @@ if test "x$acx_pthread_ok" = xyes; then 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 ]], [[int attr=$attr; return attr;]])],[attr_name=$attr; break],[]) + AC_TRY_LINK([#include ], [int attr=$attr; return attr;], + [attr_name=$attr; break]) done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then @@ -272,5 +267,5 @@ else acx_pthread_ok=no $2 fi -AC_LANG_POP([]) +AC_LANG_RESTORE ])dnl ACX_PTHREAD diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 00000000..25c191ae --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,379 @@ +# gettext.m4 serial 60 (gettext-0.17) +dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2006. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The +dnl default (if it is not specified or empty) is 'no-libtool'. +dnl INTLSYMBOL should be 'external' for packages with no intl directory, +dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. +dnl If INTLSYMBOL is 'use-libtool', then a libtool library +dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library +dnl $(top_builddir)/intl/libintl.a will be created. +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value `$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + dnl Hardcode this, because the previous ifdef just wasn't working + define([gt_included_intl],[no]) + define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) + gt_NEEDS_INIT + AM_GNU_GETTEXT_NEED([$2]) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + dnl ifelse(gt_included_intl, yes, [ + dnl AC_REQUIRE([AM_INTL_SUBDIR])dnl + dnl ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not + dnl documented, we avoid it. + ifelse(gt_included_intl, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. + gt_INTL_MACOSX + + dnl Set USE_NLS. + AC_REQUIRE([AM_NLS]) + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl Add a version number to the cache macros. + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], + [AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], + [eval "$gt_func_gnugettext_libc=yes"], + [eval "$gt_func_gnugettext_libc=no"])]) + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + [$gt_func_gnugettext_libintl], + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *);], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [eval "$gt_func_gnugettext_libintl=yes"], + [eval "$gt_func_gnugettext_libintl=no"]) + dnl Now see whether libintl exists and depends on libiconv. + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +$gt_revision_test_code +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *);], + [bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + eval "$gt_func_gnugettext_libintl=yes" + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + CATOBJEXT= + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Some extra flags are needed during linking. + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATOBJEXT) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLOBJS= + if test "$USE_INCLUDED_LIBINTL" = yes; then + INTLOBJS="\$(GETTOBJS)" + fi + AC_SUBST(INTLOBJS) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) +]) + + +dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. +m4_define([gt_NEEDS_INIT], +[ + m4_divert_text([DEFAULTS], [gt_needs=]) + m4_define([gt_NEEDS_INIT], []) +]) + + +dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) +AC_DEFUN([AM_GNU_GETTEXT_NEED], +[ + m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) diff --git a/m4/iconv.m4 b/m4/iconv.m4 new file mode 100644 index 00000000..66bc76f4 --- /dev/null +++ b/m4/iconv.m4 @@ -0,0 +1,180 @@ +# iconv.m4 serial AM6 (gettext-0.17) +dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [ + dnl This tests against bugs in AIX 5.1 and HP-UX 11.11. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + AC_TRY_RUN([ +#include +#include +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no], + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) +]) + +AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi +]) diff --git a/m4/pandora_canonical.m4 b/m4/pandora_canonical.m4 index 576a81ca..ed3b0642 100644 --- a/m4/pandora_canonical.m4 +++ b/m4/pandora_canonical.m4 @@ -4,7 +4,7 @@ dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Which version of the canonical setup we're using -AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.96]) +AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.131]) AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[ AC_ARG_ENABLE([fat-binaries], @@ -29,27 +29,17 @@ AC_DEFUN([PANDORA_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_USE_GNULIB],[no]) m4_define([PCT_REQUIRE_CXX],[no]) - m4_define([PCT_IGNORE_SHARED_PTR],[no]) m4_define([PCT_FORCE_GCC42],[no]) - m4_define([PCT_SRC_IN_SRC],[no]) + m4_define([PCT_DONT_SUPPRESS_INCLUDE],[no]) m4_define([PCT_VERSION_FROM_VC],[no]) m4_define([PCT_USE_VISIBILITY],[yes]) m4_foreach([pct_arg],[$*],[ m4_case(pct_arg, - [use-gnulib], [ - m4_undefine([PCT_USE_GNULIB]) - m4_define([PCT_USE_GNULIB],[yes]) - ], [require-cxx], [ m4_undefine([PCT_REQUIRE_CXX]) m4_define([PCT_REQUIRE_CXX],[yes]) ], - [ignore-shared-ptr], [ - m4_undefine([PCT_IGNORE_SHARED_PTR]) - m4_define([PCT_IGNORE_SHARED_PTR],[yes]) - ], [force-gcc42], [ m4_undefine([PCT_FORCE_GCC42]) m4_define([PCT_FORCE_GCC42],[yes]) @@ -58,9 +48,9 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ m4_undefine([PCT_USE_VISIBILITY]) m4_define([PCT_USE_VISIBILITY],[no]) ], - [src-in-src], [ - m4_undefine([PCT_SRC_IN_SRC]) - m4_define([PCT_SRC_IN_SRC],[yes]) + [dont-suppress-include], [ + m4_undefine([PCT_DONT_SUPPRESS_INCLUDE]) + m4_define([PCT_DONT_SUPPRESS_INCLUDE],[yes]) ], [version-from-vc], [ m4_undefine([PCT_VERSION_FROM_VC]) @@ -68,6 +58,14 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ ]) ]) + AC_CONFIG_MACRO_DIR([m4]) + + m4_if(m4_substr(m4_esyscmd(test -d src && echo 0),0,1),0,[ + AC_CONFIG_HEADERS([src/config.h]) + ],[ + AC_CONFIG_HEADERS([config.h]) + ]) + # 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 @@ -78,17 +76,28 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ AC_CANONICAL_TARGET - AM_INIT_AUTOMAKE(-Wall -Werror nostdinc subdir-objects foreign) + m4_if(PCT_DONT_SUPRESS_INCLUDE,yes,[ + AM_INIT_AUTOMAKE(-Wall -Werror subdir-objects foreign) + ],[ + AM_INIT_AUTOMAKE(-Wall -Werror nostdinc subdir-objects foreign) + ]) + m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) - m4_if(PCT_USE_GNULIB,yes,[ gl_EARLY ]) + m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[ + gl_EARLY + ]) AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([PANDORA_MAC_GCC42]) + m4_if(PCT_FORCE_GCC42, [yes], [ + AC_REQUIRE([PANDORA_ENSURE_GCC_VERSION]) + ]) AC_REQUIRE([PANDORA_64BIT]) m4_if(PCT_VERSION_FROM_VC,yes,[ PANDORA_VC_VERSION + ],[ + PANDORA_TEST_VC_DIR ]) PANDORA_VERSION @@ -99,9 +108,6 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ AM_PROG_CC_C_O - m4_if(PCT_FORCE_GCC42, [yes], [ - AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION) - ]) PANDORA_PLATFORM @@ -118,14 +124,7 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ ]) - PANDORA_SHARED_PTR - m4_if(PCT_IGNORE_SHARED_PTR, [no], [ - AS_IF([test "$ac_cv_shared_ptr_namespace" = "missing"],[ - AC_MSG_WARN([a usable shared_ptr implementation was not found. Let someone know what your platform is.]) - ]) - ]) - - m4_if(PCT_USE_GNULIB, [yes], [ + m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[ gl_INIT AC_CONFIG_LIBOBJ_DIR([gnulib]) ]) @@ -140,8 +139,10 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ AC_C_RESTRICT AC_HEADER_TIME + AC_STRUCT_TM AC_TYPE_SIZE_T AC_SYS_LARGEFILE + PANDORA_CLOCK_GETTIME # off_t is not a builtin type AC_CHECK_SIZEOF(off_t, 4) @@ -175,11 +176,8 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned]) ]) - dnl AC_FUNC_ALLOCA would test for stack direction if we didn't have a working - dnl alloca - but we need to know it anyway for check_stack_overrun. - PANDORA_STACK_DIRECTION - - AC_CHECK_FUNC(floorf, [], [AC_CHECK_LIB(m, floorf)]) + AC_CHECK_LIBM + AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)]) AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)]) @@ -219,22 +217,28 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[ AC_CHECK_PROGS([DOXYGEN], [doxygen]) AC_CHECK_PROGS([PERL], [perl]) + AC_CHECK_PROGS([DPKG_GENSYMBOLS], [dpkg-gensymbols], [:]) + + AM_CONDITIONAL(HAVE_DPKG_GENSYMBOLS,[test "x${DPKG_GENSYMBOLS}" != "x:"]) + + PANDORA_WITH_GETTEXT AS_IF([test "x${gl_LIBOBJS}" != "x"],[ AS_IF([test "$GCC" = "yes"],[ - AM_CPPFLAGS="-isystem \$(top_srcdir)/gnulib -isystem \$(top_builddir)/gnulib ${AM_CPPFLAGS}" + AM_CPPFLAGS="-isystem \${top_srcdir}/gnulib -isystem \${top_builddir}/gnulib ${AM_CPPFLAGS}" ],[ - AM_CPPFLAGS="-I\$(top_srcdir)/gnulib -I\$(top_builddir)/gnulib ${AM_CPPFLAGS}" + AM_CPPFLAGS="-I\${top_srcdir}/gnulib -I\${top_builddir}/gnulib ${AM_CPPFLAGS}" ]) ]) - AS_IF([test "PCT_SRC_IN_SRC" = "yes"],[ + m4_if(m4_substr(m4_esyscmd(test -d src && echo 0),0,1),0,[ AM_CPPFLAGS="-I\$(top_srcdir)/src -I\$(top_builddir)/src ${AM_CPPFLAGS}" + ],[ + AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${AM_CPPFLAGS}" ]) PANDORA_USE_PIPE - AM_CPPFLAGS="-I\${top_srcdir} -I\${top_builddir} ${AM_CPPFLAGS}" AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}" diff --git a/m4/pandora_clock_gettime.m4 b/m4/pandora_clock_gettime.m4 new file mode 100644 index 00000000..bab2f0bb --- /dev/null +++ b/m4/pandora_clock_gettime.m4 @@ -0,0 +1,15 @@ +dnl Copyright (C) 2010 Monty Taylor +dnl This file is free software; Monty Taylor +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +#-------------------------------------------------------------------- +# Check for clock_gettime +#-------------------------------------------------------------------- + +AC_DEFUN([PANDORA_CLOCK_GETTIME],[ + AC_SEARCH_LIBS([clock_gettime],[rt]) + AS_IF([test "x${ac_cv_search_clock_gettime}" != "xno"],[ + AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Have a working clock_gettime function]) + ]) +]) diff --git a/m4/pandora_drizzle_build.m4 b/m4/pandora_drizzle_build.m4 index fa132cca..2c7a321d 100644 --- a/m4/pandora_drizzle_build.m4 +++ b/m4/pandora_drizzle_build.m4 @@ -9,8 +9,7 @@ dnl are set. AC_DEFUN([PANDORA_DRIZZLE_BUILD],[ - dnl We need to turn on our CXXFLAGS to make sure it shows up correctly - PANDORA_CXX_STL_HASH + PANDORA_HAVE_CXX_UNORDERED PANDORA_CXX_CSTDINT PANDORA_CXX_CINTTYPES @@ -70,6 +69,9 @@ AC_DEFUN([PANDORA_DRIZZLE_BUILD],[ AC_CHECK_TYPES([uint, ulong]) PANDORA_CXX_DEMANGLE + PANDORA_REQUIRE_BOOST([1.38]) + PANDORA_REQUIRE_BOOST_PROGRAM_OPTIONS + AH_TOP([ #ifndef __CONFIG_H__ diff --git a/m4/pandora_enable_dtrace.m4 b/m4/pandora_enable_dtrace.m4 index 18c2d648..627fd3d0 100644 --- a/m4/pandora_enable_dtrace.m4 +++ b/m4/pandora_enable_dtrace.m4 @@ -8,32 +8,47 @@ dnl Macro: PANDORA_ENABLE_DTRACE dnl --------------------------------------------------------------------------- AC_DEFUN([PANDORA_ENABLE_DTRACE],[ AC_ARG_ENABLE([dtrace], - [AS_HELP_STRING([--enable-dtrace], - [Build with support for the DTRACE. @<:@default=off@:>@])], - [ac_cv_enable_dtrace="yes"], - [ac_cv_enable_dtrace="no"]) + [AS_HELP_STRING([--disable-dtrace], + [Build with support for the DTRACE. @<:@default=on@:>@])], + [ac_cv_enable_dtrace="$enableval"], + [ac_cv_enable_dtrace="yes"]) AS_IF([test "$ac_cv_enable_dtrace" = "yes"],[ AC_CHECK_PROGS([DTRACE], [dtrace]) AS_IF([test "x$ac_cv_prog_DTRACE" = "xdtrace"],[ - AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support]) - AC_MSG_CHECKING([if dtrace should instrument object files]) - dnl DTrace on MacOSX does not use -G option - cat >conftest.d <<_ACEOF + + AC_CACHE_CHECK([if dtrace works],[ac_cv_dtrace_works],[ + cat >conftest.d <<_ACEOF +provider Example { + probe increment(int); +}; +_ACEOF + $DTRACE -h -o conftest.h -s conftest.d 2>/dev/zero + AS_IF([test $? -eq 0],[ac_cv_dtrace_works=yes], + [ac_cv_dtrace_works=no]) + rm -f conftest.h conftest.d + ]) + AS_IF([test "x$ac_cv_dtrace_works" = "xyes"],[ + AC_DEFINE([HAVE_DTRACE], [1], [Enables DTRACE Support]) + ]) + AC_CACHE_CHECK([if dtrace should instrument object files], + [ac_cv_dtrace_needs_objects],[ + dnl DTrace on MacOSX does not use -G option + cat >conftest.d <<_ACEOF provider Example { probe increment(int); }; _ACEOF - $DTRACE -G -o conftest.d.o -s conftest.d 2>/dev/zero - AS_IF([test $? -eq 0],[ac_cv_dtrace_needs_objects=yes], + $DTRACE -G -o conftest.d.o -s conftest.d 2>/dev/zero + AS_IF([test $? -eq 0],[ac_cv_dtrace_needs_objects=yes], [ac_cv_dtrace_needs_objects=no]) - rm -f conftest.d.o conftest.d - AC_MSG_RESULT($ac_cv_dtrace_needs_objects) + rm -f conftest.d.o conftest.d + ]) AC_SUBST(DTRACEFLAGS) dnl TODO: test for -G on OSX ac_cv_have_dtrace=yes ])]) -AM_CONDITIONAL([HAVE_DTRACE], [test "x$ac_cv_have_dtrace" = "xyes"]) +AM_CONDITIONAL([HAVE_DTRACE], [test "x$ac_cv_dtrace_works" = "xyes"]) AM_CONDITIONAL([DTRACE_NEEDS_OBJECTS], [test "x$ac_cv_dtrace_needs_objects" = "xyes"]) diff --git a/m4/pandora_ensure_gcc_version.m4 b/m4/pandora_ensure_gcc_version.m4 index d8e28d8c..588fa442 100644 --- a/m4/pandora_ensure_gcc_version.m4 +++ b/m4/pandora_ensure_gcc_version.m4 @@ -3,6 +3,20 @@ dnl This file is free software; Sun Microsystems 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_TRY_GCC],[ + pushdef([Name],[translit([$1],[./-], [___])]) + pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CHECK_PROGS([CC]NAME,[gcc$1]) + AC_CHECK_PROGS([CXX]NAME,[g++$1]) + AS_IF([test "x${CC]NAME[}" != "x" -a "x${ac_cv_env_CC_set}" = "x"], + [CC="${CC]NAME[}"]) + AS_IF([test "x${CXX]NAME[}" != "x" -a "x${ac_cv_env_CCX_set}" = "x"], + [CXX="${CXX]NAME[}"]) + AS_IF([test "x${CC]NAME[}" != "x" -a "x${ac_cv_env_CPP_set}" = "x"], + [CPP="${CC]NAME[} -E"]) +]) + dnl If the user is on a Mac and didn't ask for a specific compiler dnl You're gonna get 4.2. AC_DEFUN([PANDORA_MAC_GCC42], @@ -10,30 +24,39 @@ AC_DEFUN([PANDORA_MAC_GCC42], AS_IF([test "$host_vendor" = "apple" -a "x${ac_cv_env_CC_set}" = "x"],[ host_os_version=`echo ${host_os} | perl -ple 's/^\D+//g;s,\..*,,'` AS_IF([test "$host_os_version" -lt 10],[ - AS_IF([test -f /usr/bin/gcc-4.2], - [ - CPP="/usr/bin/gcc-4.2 -E" - CC=/usr/bin/gcc-4.2 - CXX=/usr/bin/g++-4.2 - ]) + _PANDORA_TRY_GCC([-4.2]) ]) ]) ]) ]) +dnl If the user is on CentOS or RHEL and didn't ask for a specific compiler +dnl You're gonna get 4.4 (forward compatible with 4.5) +AC_DEFUN([PANDORA_RH_GCC44], + [AS_IF([test "$GCC" = "yes"],[ + AS_IF([test "x${ac_cv_env_CC_set}" = "x"],[ + _PANDORA_TRY_GCC([44]) + _PANDORA_TRY_GCC([45]) + ]) + ]) +]) + dnl AC_DEFUN([PANDORA_ENSURE_GCC_VERSION],[ AC_REQUIRE([PANDORA_MAC_GCC42]) - AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 1)) + AC_REQUIRE([PANDORA_RH_GCC44]) + AS_IF([test "$GCC" = "yes"],[ + AC_CACHE_CHECK([if GCC is recent enough], [ac_cv_gcc_recent], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 2)) # error GCC is Too Old! #endif - ]])], - [ac_cv_gcc_recent=yes], - [ac_cv_gcc_recent=no])]) - AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"], - AC_MSG_ERROR([Your version of GCC is too old. At least version 4.2 is required on OSX. You may need to install a version of XCode >= 3.1.2])) - AS_IF([test "$ac_cv_gcc_recent" = "no"], - AC_MSG_ERROR([Your version of GCC is too old. At least version 4.1 is required])) + ]])], + [ac_cv_gcc_recent=yes], + [ac_cv_gcc_recent=no])]) + AS_IF([test "$ac_cv_gcc_recent" = "no" -a "$host_vendor" = "apple"], + AC_MSG_ERROR([Your version of GCC is too old. At least version 4.2 is required on OSX. You may need to install a version of XCode >= 3.1.2])) + AS_IF([test "$ac_cv_gcc_recent" = "no"], + AC_MSG_ERROR([Your version of GCC is too old. At least version 4.2 is required. On RHEL/CentOS systems this is found in the gcc44 and gcc44-c++ packages.])) + ]) ]) diff --git a/m4/pandora_fdatasync.m4 b/m4/pandora_fdatasync.m4 index 3b9461e7..3a17c18d 100644 --- a/m4/pandora_fdatasync.m4 +++ b/m4/pandora_fdatasync.m4 @@ -11,7 +11,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([PANDORA_WORKING_FDATASYNC],[ AC_CACHE_CHECK([working fdatasync],[ac_cv_func_fdatasync],[ AC_LANG_PUSH(C++) - AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]],[[ fdatasync(4); @@ -22,4 +22,4 @@ fdatasync(4); ]) AS_IF([test "x${ac_cv_func_fdatasync}" = "xyes"], [AC_DEFINE([HAVE_FDATASYNC],[1],[If the system has a working fdatasync])]) -]) \ No newline at end of file +]) diff --git a/m4/pandora_have_boost.m4 b/m4/pandora_have_boost.m4 new file mode 100644 index 00000000..67ee1b0b --- /dev/null +++ b/m4/pandora_have_boost.m4 @@ -0,0 +1,73 @@ +dnl Copyright (C) 2010 Monty Taylor +dnl This file is free software; Monty Taylor +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_SEARCH_BOOST],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + dnl -------------------------------------------------------------------- + dnl Check for boost + dnl -------------------------------------------------------------------- + + AC_ARG_ENABLE([boost], + [AS_HELP_STRING([--disable-boost], + [Build with boost support @<:@default=on@:>@])], + [ac_enable_boost="$enableval"], + [ac_enable_boost="yes"]) + + AS_IF([test "x$ac_enable_boost" = "xyes"],[ + dnl link against libc because we're just looking for headers here + AC_LANG_PUSH(C++) + AC_LIB_HAVE_LINKFLAGS(c,,[ + #include + ],[ + boost::pool<> test_pool(1); + ]) + AC_LANG_POP() + ],[ + ac_cv_boost="no" + ]) + + + AS_IF([test "x$1" != "x"],[ + AC_CACHE_CHECK([if boost is recent enough], + [pandora_cv_recent_boost],[ + pandora_need_boost_version=`echo "$1" | perl -nle '/(\d+)\.(\d+)/; printf "%d%0.3d00", $[]1, $[]2 ;'` + AS_IF([test "x${pandora_need_boost_version}" = "x000000"],[ + pandora_cv_recent_boost=yes + ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include + +#if BOOST_VERSION < ${pandora_need_boost_version} +# error boost too old! +#endif + ]],[[]]) + ],[ + pandora_cv_recent_boost=yes + ],[ + pandora_cv_recent_boost=no + ]) + ]) + ]) + AS_IF([test "x${pandora_cv_recent_boost}" = "xno"],[ + ac_cv_boost=no + ]) + ]) + + + AM_CONDITIONAL(HAVE_BOOST, [test "x${ac_cv_boost}" = "xyes"]) + +]) + +AC_DEFUN([PANDORA_HAVE_BOOST],[ + _PANDORA_SEARCH_BOOST($1) +]) + +AC_DEFUN([PANDORA_REQUIRE_BOOST],[ + PANDORA_HAVE_BOOST($1) + AS_IF([test x$ac_cv_boost = xno], + AC_MSG_ERROR([boost is required for ${PACKAGE}])) +]) + diff --git a/m4/pandora_have_gcc_atomics.m4 b/m4/pandora_have_gcc_atomics.m4 index 5b3b21a6..47257d6a 100644 --- a/m4/pandora_have_gcc_atomics.m4 +++ b/m4/pandora_have_gcc_atomics.m4 @@ -13,7 +13,7 @@ AC_DEFUN([PANDORA_HAVE_GCC_ATOMICS],[ AC_CACHE_CHECK( [whether the compiler provides atomic builtins], [ac_cv_gcc_atomic_builtins], - [AC_RUN_IFELSE( + [AC_LINK_IFELSE( [AC_LANG_PROGRAM([],[[ int foo= -10; int bar= 10; if (!__sync_fetch_and_add(&foo, bar) || foo) @@ -34,4 +34,4 @@ AC_DEFUN([PANDORA_HAVE_GCC_ATOMICS],[ [Define to 1 if compiler provides atomic builtins.]) ]) -]) \ No newline at end of file +]) diff --git a/m4/pandora_have_libboost_options.m4 b/m4/pandora_have_libboost_options.m4 new file mode 100644 index 00000000..43fc03fc --- /dev/null +++ b/m4/pandora_have_libboost_options.m4 @@ -0,0 +1,47 @@ +dnl Copyright (C) 2010 Monty Taylor +dnl This file is free software; Monty Taylor +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_SEARCH_BOOST_PROGRAM_OPTIONS],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + dnl -------------------------------------------------------------------- + dnl Check for boost::program_options + dnl -------------------------------------------------------------------- + + AC_LANG_PUSH(C++) + AC_LIB_HAVE_LINKFLAGS(boost_program_options-mt,,[ + #include + ],[ + boost::program_options::options_description d; + d.add_options()("a","some option"); + ]) + AS_IF([test "x${ac_cv_libboost_program_options_mt}" = "xno"],[ + AC_LIB_HAVE_LINKFLAGS(boost_program_options,,[ + #include + ],[ + boost::program_options::options_description d; + d.add_options()("a","some option"); + ]) + ]) + AC_LANG_POP() + + AM_CONDITIONAL(HAVE_BOOST_PROGRAM_OPTIONS, + [test "x${ac_cv_libboost_program_options}" = "xyes" -o "x${ac_cv_libboost_program_options_mt}" = "xyes"]) + BOOST_LIBS="${BOOST_LIBS} ${LTLIBBOOST_PROGRAM_OPTIONS} ${LTLIBBOOST_PROGRAM_OPTIONS_MT}" + AC_SUBST(BOOST_LIBS) +]) + +AC_DEFUN([PANDORA_HAVE_BOOST_PROGRAM_OPTIONS],[ + PANDORA_HAVE_BOOST($1) + _PANDORA_SEARCH_BOOST_PROGRAM_OPTIONS($1) +]) + +AC_DEFUN([PANDORA_REQUIRE_BOOST_PROGRAM_OPTIONS],[ + PANDORA_REQUIRE_BOOST($1) + _PANDORA_SEARCH_BOOST_PROGRAM_OPTIONS($1) + AS_IF([test "x${ac_cv_libboost_program_options}" = "xno" -a "x${ac_cv_libboost_program_options_mt}" = "xno"], + AC_MSG_ERROR([boost::program_options is required for ${PACKAGE}])) +]) + diff --git a/m4/pandora_have_libcassandra.m4 b/m4/pandora_have_libcassandra.m4 new file mode 100644 index 00000000..e61eb2f4 --- /dev/null +++ b/m4/pandora_have_libcassandra.m4 @@ -0,0 +1,44 @@ +dnl Copyright (C) 2010 Padraig O'Sullivan +dnl This file is free software; +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_SEARCH_LIBCASSANDRA],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + dnl -------------------------------------------------------------------- + dnl Check for libcassandra + dnl -------------------------------------------------------------------- + + AC_ARG_ENABLE([libcassandra], + [AS_HELP_STRING([--disable-libcassandra], + [Build with libcassandra support @<:@default=on@:>@])], + [ac_enable_libcassandra="$enableval"], + [ac_enable_libcassandra="yes"]) + + AS_IF([test "x$ac_enable_libcassandra" = "xyes"],[ + AC_LANG_PUSH([C++]) + AC_LIB_HAVE_LINKFLAGS(cassandra,[thrift],[ + #include + ],[ + libcassandra::CassandraFactory fact("localhost", 9306); + ]) + AC_LANG_POP() + ],[ + ac_cv_libcassandra="no" + ]) + + AM_CONDITIONAL(HAVE_LIBCASSANDRA, [test "x${ac_cv_libcassandra}" = "xyes"]) + +]) + +AC_DEFUN([PANDORA_HAVE_LIBCASSANDRA],[ + AC_REQUIRE([_PANDORA_SEARCH_LIBCASSANDRA]) +]) + +AC_DEFUN([PANDORA_REQUIRE_LIBCASSANDRA],[ + AC_REQUIRE([PANDORA_HAVE_LIBCASSANDRA]) + AS_IF([test "x$ac_cv_libcassandra" = "xno"],[ + AC_MSG_ERROR([libcassandra is required for ${PACKAGE}]) + ]) +]) diff --git a/m4/pandora_have_libdrizzle.m4 b/m4/pandora_have_libdrizzle.m4 index 218d1fad..58763c1b 100644 --- a/m4/pandora_have_libdrizzle.m4 +++ b/m4/pandora_have_libdrizzle.m4 @@ -36,20 +36,26 @@ AC_DEFUN([PANDORA_HAVE_LIBDRIZZLE],[ AC_DEFUN([PANDORA_REQUIRE_LIBDRIZZLE],[ AC_REQUIRE([PANDORA_HAVE_LIBDRIZZLE]) - AS_IF([test "x${ac_cv_libdrizzle}" = "xno"], - AC_MSG_ERROR([libdrizzle is required for ${PACKAGE}])) + AS_IF([test "x${ac_cv_libdrizzle}" = "xno"],[ + AC_MSG_ERROR([libdrizzle is required for ${PACKAGE}]) + ],[ + dnl We need at least 0.8 on Solaris non-sparc + AS_IF([test "$target_cpu" != "sparc" -a "x${TARGET_SOLARIS}" = "xtrue"],[ + PANDORA_LIBDRIZZLE_RECENT + ]) + ]) ]) -AC_DEFUN([PANDORA_LIBDRIZZLE_NOVCOL],[ - AC_CACHE_CHECK([if libdrizzle still has virtual columns], - [pandora_cv_libdrizzle_vcol], +AC_DEFUN([PANDORA_LIBDRIZZLE_RECENT],[ + AC_CACHE_CHECK([if libdrizzle is recent enough], + [pandora_cv_libdrizzle_recent], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include -int foo= DRIZZLE_COLUMN_TYPE_DRIZZLE_VIRTUAL; +drizzle_con_options_t foo= DRIZZLE_CON_EXPERIMENTAL; ]])], - [pandora_cv_libdrizzle_vcol=yes], - [pandora_cv_libdrizzle_vcol=no])]) - AS_IF([test "$pandora_cv_libdrizzle_vcol" = "yes"],[ - AC_MSG_ERROR([Your version of libdrizzle is too old. ${PACKAGE} requires at least version 0.4]) + [pandora_cv_libdrizzle_recent=yes], + [pandora_cv_libdrizzle_recent=no])]) + AS_IF([test "$pandora_cv_libdrizzle_recent" = "no"],[ + AC_MSG_ERROR([Your version of libdrizzle is too old. ${PACKAGE} requires at least version 0.8]) ]) ]) diff --git a/m4/pandora_have_libgtest.m4 b/m4/pandora_have_libgtest.m4 new file mode 100644 index 00000000..f21c7ef4 --- /dev/null +++ b/m4/pandora_have_libgtest.m4 @@ -0,0 +1,44 @@ +dnl Copyright (C) 2010 Monty Taylor +dnl This file is free software; Monty Taylor +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_SEARCH_LIBGTEST],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + dnl -------------------------------------------------------------------- + dnl Check for libgtest + dnl -------------------------------------------------------------------- + + AC_ARG_ENABLE([libgtest], + [AS_HELP_STRING([--disable-libgtest], + [Build with libgtest support @<:@default=on@:>@])], + [ac_enable_libgtest="$enableval"], + [ac_enable_libgtest="yes"]) + + AS_IF([test "x$ac_enable_libgtest" = "xyes"],[ + AC_LANG_PUSH(C++) + AC_LIB_HAVE_LINKFLAGS(gtest,,[ + #include +TEST(pandora_test_libgtest, PandoraTest) +{ + ASSERT_EQ(1, 1); +} + ],[]) + AC_LANG_POP() + ],[ + ac_cv_libgtest="no" + ]) + + AM_CONDITIONAL(HAVE_LIBGTEST, [test "x${ac_cv_libgtest}" = "xyes"]) +]) + +AC_DEFUN([PANDORA_HAVE_LIBGTEST],[ + AC_REQUIRE([_PANDORA_SEARCH_LIBGTEST]) +]) + +AC_DEFUN([PANDORA_REQUIRE_LIBGTEST],[ + AC_REQUIRE([_PANDORA_SEARCH_LIBGTEST]) + AS_IF([test "x${ac_cv_libgtest}" = "xno"], + AC_MSG_ERROR([libgtest is required for ${PACKAGE}])) +]) diff --git a/m4/pandora_have_libhashkit.m4 b/m4/pandora_have_libhashkit.m4 new file mode 100644 index 00000000..a10c9aca --- /dev/null +++ b/m4/pandora_have_libhashkit.m4 @@ -0,0 +1,41 @@ +dnl Copyright (C) 2010 NorthScale +dnl This file is free software; NorthScale +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_SEARCH_LIBHASHKIT],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + dnl -------------------------------------------------------------------- + dnl Check for libhashkit + dnl -------------------------------------------------------------------- + + AC_ARG_ENABLE([libhashkit], + [AS_HELP_STRING([--disable-libhashkit], + [Build with libhashkit support @<:@default=on@:>@])], + [ac_enable_libhashkit="$enableval"], + [ac_enable_libhashkit="yes"]) + + AS_IF([test "x$ac_enable_libhashkit" = "xyes"],[ + AC_LIB_HAVE_LINKFLAGS(hashkit,,[ + #include + ],[ + hashkit_st *kit = hashkit_create(NULL); + hashkit_free(kit); + ]) + ],[ + ac_cv_libhashkit="no" + ]) + + AM_CONDITIONAL(HAVE_LIBHASHKIT, [test "x${ac_cv_libhashkit}" = "xyes"]) +]) + +AC_DEFUN([PANDORA_HAVE_LIBHASHKIT],[ + AC_REQUIRE([_PANDORA_SEARCH_LIBHASHKIT]) +]) + +AC_DEFUN([PANDORA_REQUIRE_LIBHASHKIT],[ + AC_REQUIRE([PANDORA_HAVE_LIBHASHKIT]) + AS_IF([test x$ac_cv_libhashkit = xno], + AC_MSG_ERROR([libhashkit is required for ${PACKAGE}])) +]) diff --git a/m4/pandora_have_libinnodb.m4 b/m4/pandora_have_libinnodb.m4 new file mode 100644 index 00000000..b49374a2 --- /dev/null +++ b/m4/pandora_have_libinnodb.m4 @@ -0,0 +1,64 @@ +dnl Copyright (C) 2009 Sun Microsystems +dnl This file is free software; Sun Microsystems +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_SEARCH_LIBINNODB],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + dnl -------------------------------------------------------------------- + dnl Check for libinnodb + dnl -------------------------------------------------------------------- + + AC_ARG_ENABLE([libinnodb], + [AS_HELP_STRING([--disable-libinnodb], + [Build with libinnodb support @<:@default=on@:>@])], + [ac_enable_libinnodb="$enableval"], + [ac_enable_libinnodb="yes"]) + + AS_IF([test "x$ac_enable_libinnodb" = "xyes"],[ + AC_LIB_HAVE_LINKFLAGS(innodb,,[ + #include + ],[ + ib_u64_t + ib_api_version(void); + ]) + ],[ + ac_cv_libinnodb="no" + ]) + + + AC_CACHE_CHECK([if libinnodb is recent enough], + [ac_cv_recent_innodb_h],[ + save_LIBS=${LIBS} + LIBS="${LIBS} ${LTLIBINNODB}" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ + #include + ]],[[ + /* Make sure we have the two-arg version */ + ib_table_drop(NULL, "nothing"); + ]])],[ + ac_cv_recent_innodb_h=yes + ],[ + ac_cv_recent_innodb_h=no + ]) + LIBS="${save_LIBS}" + ]) + AS_IF([test "x${ac_cv_recent_innodb_h}" = "xno"],[ + AC_MSG_WARN([${PACKAGE} requires at least version 1.0.6 of Embedded InnoDB]) + ac_cv_libinnodb=no + ]) + + AM_CONDITIONAL(HAVE_LIBINNODB, [test "x${ac_cv_libinnodb}" = "xyes"]) +]) + +AC_DEFUN([PANDORA_HAVE_LIBINNODB],[ + AC_REQUIRE([_PANDORA_SEARCH_LIBINNODB]) +]) + +AC_DEFUN([PANDORA_REQUIRE_LIBINNODB],[ + AC_REQUIRE([PANDORA_HAVE_LIBINNODB]) + AS_IF([test "x${ac_cv_libinnodb}" = "xno"], + AC_MSG_ERROR([libinnodb is required for ${PACKAGE}])) +]) diff --git a/m4/pandora_have_libldap.m4 b/m4/pandora_have_libldap.m4 new file mode 100644 index 00000000..b3f2f106 --- /dev/null +++ b/m4/pandora_have_libldap.m4 @@ -0,0 +1,73 @@ +dnl Copyright (C) 2009 Sun Microsystems +dnl This file is free software; Sun Microsystems +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +#-------------------------------------------------------------------- +# Check for libldap +#-------------------------------------------------------------------- + + +AC_DEFUN([_PANDORA_SEARCH_LIBLDAP],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + AC_LIB_HAVE_LINKFLAGS(ldap,, + [#include ], + [ + LDAP *ldap; + ldap_initialize(&ldap, "ldap://localhost/"); + ]) + AS_IF([test "x$ac_cv_libldap" = "xno"], + [ + unset ac_cv_libldap + unset HAVE_LIBLDAP + unset LIBLDAP + unset LIBLDAP_PREFIX + unset LTLIBLDAP + AC_LIB_HAVE_LINKFLAGS(ldap,, + [#include ], + [ + LDAP *ldap; + ldap_initialize(&ldap, "ldap://localhost/"); + ]) + AS_IF([test "x$ac_cv_libldap" = "xyes"], [ + ac_cv_ldap_location="" + ]) + ],[ + ac_cv_ldap_location="" + ]) + + AM_CONDITIONAL(HAVE_LIBLDAP, [test "x${ac_cv_libldap}" = "xyes"]) +]) + +AC_DEFUN([_PANDORA_HAVE_LIBLDAP],[ + + AC_ARG_ENABLE([libldap], + [AS_HELP_STRING([--disable-libldap], + [Build with libldap support @<:@default=on@:>@])], + [ac_enable_libldap="$enableval"], + [ac_enable_libldap="yes"]) + + _PANDORA_SEARCH_LIBLDAP +]) + + +AC_DEFUN([PANDORA_HAVE_LIBLDAP],[ + AC_REQUIRE([_PANDORA_HAVE_LIBLDAP]) +]) + +AC_DEFUN([_PANDORA_REQUIRE_LIBLDAP],[ + ac_enable_libldap="yes" + _PANDORA_SEARCH_LIBLDAP + + AS_IF([test x$ac_cv_libldap = xno],[ + AC_MSG_ERROR([libldap is required for ${PACKAGE}. On Debian this can be found in libldap2-dev. On RedHat this can be found in openldap-devel.]) + ],[ + AC_DEFINE_UNQUOTED(LDAP_HEADER,[${ac_cv_ldap_location}], + [Location of ldap header]) + ]) +]) + +AC_DEFUN([PANDORA_REQUIRE_LIBLDAP],[ + AC_REQUIRE([_PANDORA_REQUIRE_LIBLDAP]) +]) diff --git a/m4/pandora_have_libmemcached.m4 b/m4/pandora_have_libmemcached.m4 index 25c05613..8b20afac 100644 --- a/m4/pandora_have_libmemcached.m4 +++ b/m4/pandora_have_libmemcached.m4 @@ -24,6 +24,11 @@ AC_DEFUN([_PANDORA_SEARCH_LIBMEMCACHED],[ memcached_dump_func *df; memcached_lib_version(); ]) + ],[ + ac_cv_libmemcached="no" + ]) + + AS_IF([test "x$ac_enable_libmemcached" = "xyes"],[ AC_LIB_HAVE_LINKFLAGS(memcachedprotocol,,[ #include ],[ @@ -31,7 +36,7 @@ AC_DEFUN([_PANDORA_SEARCH_LIBMEMCACHED],[ protocol_handle= memcached_protocol_create_instance(); ]) ],[ - ac_cv_libmemcached="no" + ac_cv_libmemcachedprotocol="no" ]) AC_CACHE_CHECK([if libmemcached has memcached_server_fn], @@ -42,21 +47,60 @@ memcached_server_fn callbacks[1]; ]])], [pandora_cv_libmemcached_server_fn=yes], [pandora_cv_libmemcached_server_fn=no])]) + AS_IF([test "x$pandora_cv_libmemcached_server_fn" = "xyes"],[ AC_DEFINE([HAVE_MEMCACHED_SERVER_FN],[1],[If we have the new memcached_server_fn typedef]) ]) +]) - AM_CONDITIONAL(HAVE_LIBMEMCACHED, [test "x${ac_cv_libmemcached}" = "xyes"]) +AC_DEFUN([_PANDORA_RECENT_LIBMEMCACHED],[ + + AC_CACHE_CHECK([if libmemcached is recent enough], + [pandora_cv_recent_libmemcached],[ + AS_IF([test "x${ac_cv_libmemcached}" = "xno"],[ + pandora_cv_recent_libmemcached=no + ],[ + AS_IF([test "x$1" != "x"],[ + pandora_need_libmemcached_version=`echo "$1" | perl -nle '/(\d+)\.(\d+)/; printf "%d%0.3d000", $[]1, $[]2 ;'` + AS_IF([test "x${pandora_need_libmemcached_version}" = "x0000000"],[ + pandora_cv_recent_libmemcached=yes + ],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include + +#if !defined(LIBMEMCACHED_VERSION_HEX) || LIBMEMCACHED_VERSION_HEX < 0x]]${pandora_need_libmemcached_version}[[ +# error libmemcached too old! +#endif + ]],[[]]) + ],[ + pandora_cv_recent_libmemcached=yes + ],[ + pandora_cv_recent_libmemcached=no + ]) + ]) + ],[ + pandora_cv_recent_libmemcached=yes + ]) + ]) + ]) + + AM_CONDITIONAL(HAVE_LIBMEMCACHED,[test "x${ac_cv_libmemcached}" = "xyes" -a "x${pandora_cv_recent_libmemcached}" = "xyes"]) ]) AC_DEFUN([PANDORA_HAVE_LIBMEMCACHED],[ AC_REQUIRE([_PANDORA_SEARCH_LIBMEMCACHED]) + _PANDORA_RECENT_LIBMEMCACHED($1) ]) AC_DEFUN([PANDORA_REQUIRE_LIBMEMCACHED],[ - AC_REQUIRE([PANDORA_HAVE_LIBMEMCACHED]) - AS_IF([test x$ac_cv_libmemcached = xno], + PANDORA_HAVE_LIBMEMCACHED($1) + AS_IF([test "x{$pandora_cv_recent_libmemcached}" = "xno"], AC_MSG_ERROR([libmemcached is required for ${PACKAGE}])) ]) +AC_DEFUN([PANDORA_REQUIRE_LIBMEMCACHEDPROTOCOL],[ + PANDORA_HAVE_LIBMEMCACHED($1) + AS_IF([test x$ac_cv_libmemcachedprotocol = xno], + AC_MSG_ERROR([libmemcachedprotocol is required for ${PACKAGE}])) +]) diff --git a/m4/pandora_have_libmysqlclient.m4 b/m4/pandora_have_libmysqlclient.m4 new file mode 100644 index 00000000..63a1e2d6 --- /dev/null +++ b/m4/pandora_have_libmysqlclient.m4 @@ -0,0 +1,146 @@ +dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- +dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: +dnl +dnl Copyright (C) 2010 Monty Taylor +dnl This file is free software; Sun Microsystems +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl + +AC_DEFUN([PANDORA_WITH_MYSQL],[ + AC_ARG_WITH([mysql], + [AS_HELP_STRING([--with-mysql=PATH], + [path to mysql_config binary or mysql prefix dir])], + [with_mysql=$withval], + [with_mysql=":"]) + + dnl There are three possibilities: + dnl 1) nothing is given: we will search for mysql_config in PATH + dnl 2) the location of mysql_config is given: we'll use that to determine + dnl 3) a directory argument is given: that will be mysql_base + + + dnl option 1: nothing, we need to insert something into MYSQL_CONFIG + AS_IF([test "x$with_mysql" = "x:"],[ + AC_CHECK_PROGS(MYSQL_CONFIG,[mysql_config]) + ],[ + MYSQL_CONFIG="${with_mysql}" + ]) + + AC_CACHE_CHECK([for MySQL Base Location],[pandora_cv_mysql_base],[ + + dnl option 2: something in MYSQL_CONFIG now, use that to get a base dir + AS_IF([test -f "${MYSQL_CONFIG}" -a -x "${MYSQL_CONFIG}"],[ + pandora_cv_mysql_base=$(dirname $(MYSQL_CONFIG --include | sed 's/-I//')) + ],[ + dnl option 1: a directory + AS_IF([test -d $with_mysql],[pandora_cv_mysql_base=$with_mysql],[ + pandora_cv_mysql_base="not found" + ]) + ]) + ]) +]) + +AC_DEFUN([_PANDORA_SEARCH_LIBMYSQLCLIENT],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + AC_ARG_ENABLE([libmysqlclient], + [AS_HELP_STRING([--disable-libmysqlclient], + [Build with libmysqlclient support @<:@default=on@:>@])], + [ac_enable_libmysqlclient="$enableval"], + [ac_enable_libmysqlclient="yes"]) + + AS_IF([test "x$ac_enable_libmysqlclient" = "xyes"],[ + AC_LIB_HAVE_LINKFLAGS(mysqlclient_r,,[ +#include + ],[ +MYSQL mysql; + ])],[ + ac_cv_libmysqlclient_r="no" + ]) + + AM_CONDITIONAL(HAVE_LIBMYSQLCLIENT, [test "x${ac_cv_libmysqlclient_r}" = "xyes"]) + +AC_DEFUN([PANDORA_HAVE_LIBMYSQLCLIENT],[ + AC_REQUIRE([_PANDORA_SEARCH_LIBMYSQLCLIENT]) +]) + +AC_DEFUN([PANDORA_REQUIRE_LIBMYSQLCLIENT],[ + AC_REQUIRE([PANDORA_HAVE_LIBMYSQLCLIENT]) + AS_IF([test "x${ac_cv_libmysqlclient_r}" = "xno"], + AC_MSG_ERROR([libmysqlclient_r is required for ${PACKAGE}])) +]) + + AS_IF([test "x$MYSQL_CONFIG" = "xISDIR"],[ + IBASE="-I${with_mysql}" + MYSQL_CONFIG="${with_mysql}/scripts/mysql_config" + ADDIFLAGS="$IBASE/include " + ADDIFLAGS="$ADDIFLAGS $IBASE/storage/ndb/include/ndbapi " + ADDIFLAGS="$ADDIFLAGS $IBASE/storage/ndb/include/mgmapi " + ADDIFLAGS="$ADDIFLAGS $IBASE/storage/ndb/include " + LDFLAGS="-L${with_mysql}/storage/ndb/src/.libs -L${with_mysql}/libmysql_r/.libs/ -L${with_mysql}/mysys/.libs -L${with_mysql}/mysys -L${with_mysql}/strings/.libs -L${with_mysql}/strings " + ],[ + IBASE=`$MYSQL_CONFIG --include` + ADDIFLAGS="" + # add regular MySQL C flags + ADDCFLAGS=`$MYSQL_CONFIG --cflags` + # add NdbAPI specific C flags + LDFLAGS="$LDFLAGS "`$MYSQL_CONFIG --libs_r | sed 's/-lmysqlclient_r//'` + ]) + + + ADDIFLAGS="$ADDIFLAGS $IBASE/storage/ndb" + ADDIFLAGS="$ADDIFLAGS $IBASE/storage/ndb/ndbapi" + ADDIFLAGS="$ADDIFLAGS $IBASE/storage/ndb/mgmapi" + ADDIFLAGS="$ADDIFLAGS $IBASE/ndb" + ADDIFLAGS="$ADDIFLAGS $IBASE/ndb/ndbapi" + ADDIFLAGS="$ADDIFLAGS $IBASE/ndb/mgmapi" + ADDIFLAGS="$ADDIFLAGS $IBASE" + + CFLAGS="$CFLAGS $ADDCFLAGS $ADDIFLAGS" + CXXFLAGS="$CXXFLAGS $ADDCFLAGS $ADDIFLAGS" + MYSQL_INCLUDES="$IBASE $ADDIFLAGS" + + + dnl AC_CHECK_LIB([mysqlclient_r],[safe_mutex_init],,[AC_MSG_ERROR([Can't link against libmysqlclient_r])]) + dnl First test to see if we can run with only ndbclient + AC_CHECK_LIB([ndbclient],[decimal_bin_size],,[dnl else + LDFLAGS="$LDFLAGS -lmysys -ldbug" + AC_CHECK_LIB([mysqlclient_r],[safe_mutex_init],,) + AC_CHECK_LIB([ndbclient],[ndb_init],,[ + AC_MSG_ERROR([Can't link against libndbclient])]) + AC_CHECK_LIB([mystrings],[decimal_bin_size],,[ + AC_MSG_ERROR([Can't find decimal_bin_size])])]) + AC_MSG_CHECKING(for NdbApi headers) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[int attr=NdbTransaction::Commit; ]])],[ndbapi_found="yes"],[]) + AS_IF([test "$ndbapi_found" = "yes"], + [AC_MSG_RESULT(found)], + [AC_MSG_ERROR([Couldn't find NdbApi.hpp!])]) + AC_MSG_CHECKING(for NDB_LE_ThreadConfigLoop) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[int attr=NDB_LE_ThreadConfigLoop; ]])],[have_cge63="yes"],[]) + AS_IF([test "$have_cge63" = "yes"], + [AC_MSG_RESULT(found) + HAVE_CGE63="-DCGE63" + AC_SUBST(HAVE_CGE63)], + [AC_MSG_RESULT(missing)]) + + LDFLAGS="$LDFLAGS $LIBS" + + + MYSQL_MAJOR_VERSION=`$MYSQL_CONFIG --version | sed -e 's/\.//g' -e 's/-//g' -e 's/[A-Za-z]//g' | cut -c1-2` + + case "$MYSQL_MAJOR_VERSION" in + 50) AC_DEFINE(MYSQL_50, [1], [mysql5.0]) + ;; + 51) AC_DEFINE(MYSQL_51, [1], [mysql5.1]) + ;; + *) echo "Unsupported version of MySQL Detected!" + ;; + esac + + AC_SUBST(MYSQL_MAJOR_VERSION) + AC_SUBST(MYSQL_CONFIG) + + +]) + diff --git a/m4/pandora_have_libndbclient.m4 b/m4/pandora_have_libndbclient.m4 new file mode 100644 index 00000000..08337ea7 --- /dev/null +++ b/m4/pandora_have_libndbclient.m4 @@ -0,0 +1,80 @@ +dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- +dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: +dnl +dnl Copyright (C) 2010 Monty Taylor +dnl This file is free software; Sun Microsystems +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl + +AC_DEFUN([_PANDORA_SEARCH_LIBNDBCLIENT],[ + + AC_REQUIRE([AC_LIB_PREFIX]) + AC_REQUIRE([PANDORA_WITH_MYSQL]) + + AC_ARG_ENABLE([libndbclient], + [AS_HELP_STRING([--disable-libndbclient], + [Build with libndbclient support @<:@default=on@:>@])], + [ac_enable_libndbclient="$enableval"], + [ac_enable_libndbclient="yes"]) + + AC_ARG_WITH([libndbclient-prefix], + [AS_HELP_STRING([--with-libndbclient-prefix], + [search for libndbclient in DIR])], + [ac_with_libndbclient=${withval}], + [ac_with_libndbclient=${pandora_cv_mysql_base}]) + + save_LIBS="${LIBS}" + LIBS="" + save_CPPFLAGS="${CPPFLAGS}" + AS_IF([test "x${ac_with_libndbclient}" != "x"],[ + LIBS="-L${ac_with_libndbclient}/lib/mysql -L${ac_with_libndbclient}/lib" + AS_IF([test "$GCC" = "yes"],[ + ndb_include_prefix="-isystem " + ],[ + ndb_include_prefix="-I" + ]) + CPPFLAGS="${CPPFLAGS} ${ndb_include_prefix}${ac_with_libndbclient}/include ${ndb_include_prefix}${ac_with_libndbclient}/include/mysql ${ndb_include_prefix}${ac_with_libndbclient}/include/mysql/storage/ndb ${ndb_include_prefix}${ac_with_libndbclient}/include/mysql/storage/ndb/ndbapi ${ndb_include_prefix}${ac_with_libndbclient}/include/mysql/storage/ndb/mgmapi" + ]) + LIBS="${LIBS} -lndbclient -lmysqlclient_r" + + AC_CACHE_CHECK([if NdbApi works],[ac_cv_libndbclient],[ + AC_LANG_PUSH(C++) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include + ]],[[ +Ndb *ndb; +ndb_init(); + ]]) + ],[ + ac_cv_libndbclient=yes + ],[ + ac_cv_libndbclient=no + ]) + ]) + AC_LANG_POP() + + LIBNDBCLIENT="${LIBS}" + LTLIBNDBCLIENT="${LIBS}" + AC_SUBST([LIBNDBCLIENT]) + AC_SUBST([LTLIBNDBCLIENT]) + + AS_IF([test "x${ac_cv_libndbclient}" = "xno"],[ + CPPFLAGS="${save_CPPFLAGS}" + ]) + LIBS="${save_LIBS}" + + AM_CONDITIONAL(HAVE_LIBNDBCLIENT, [test "x${ac_cv_libndbclient}" = "xyes"]) +]) + +AC_DEFUN([PANDORA_HAVE_LIBNDBCLIENT],[ + AC_REQUIRE([_PANDORA_SEARCH_LIBNDBCLIENT]) +]) + +AC_DEFUN([PANDORA_REQUIRE_LIBNDBCLIENT],[ + AC_REQUIRE([PANDORA_HAVE_LIBNDBCLIENT]) + AS_IF([test "x${ac_cv_libndbclient}" = "xno"], + AC_MSG_ERROR([libndbclient is required for ${PACKAGE}])) +]) + diff --git a/m4/pandora_have_libtokyocabinet.m4 b/m4/pandora_have_libtokyocabinet.m4 index cc4d8878..eb0062d5 100644 --- a/m4/pandora_have_libtokyocabinet.m4 +++ b/m4/pandora_have_libtokyocabinet.m4 @@ -22,8 +22,10 @@ AC_DEFUN([_PANDORA_SEARCH_LIBTOKYOCABINET],[ AS_IF([test "x$ac_enable_libtokyocabinet" = "xyes"],[ AC_LIB_HAVE_LINKFLAGS(tokyocabinet,,[ #include +#include ],[ const char *test= tcversion; +bool ret= tcadboptimize(NULL, "params"); ]) ],[ ac_cv_libtokyocabinet="no" @@ -31,11 +33,11 @@ const char *test= tcversion; AS_IF([test "${ac_cv_libtokyocabinet}" = "no" -a "${ac_enable_libtokyocabinet}" = "yes"],[ - PKG_CHECK_MODULES([LIBTOKYOCABINET], [libtokyocabinet], [ + PKG_CHECK_MODULES([LIBTOKYOCABINET], [libtokyocabinet >= 1.4.15], [ ac_cv_libtokyocabinet=yes LTLIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS} LIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS} - ],[]) + ],[test x = y]) ]) AM_CONDITIONAL(HAVE_LIBTOKYOCABINET, [test "${ac_cv_libtokyocabinet}" = "yes"]) diff --git a/m4/pandora_have_libvbucket.m4 b/m4/pandora_have_libvbucket.m4 new file mode 100644 index 00000000..d8a2f473 --- /dev/null +++ b/m4/pandora_have_libvbucket.m4 @@ -0,0 +1,40 @@ +dnl Copyright (C) 2010 NorthScale +dnl This file is free software; NorthScale +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_SEARCH_LIBVBUCKET],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + dnl -------------------------------------------------------------------- + dnl Check for libvbucket + dnl -------------------------------------------------------------------- + + AC_ARG_ENABLE([libvbucket], + [AS_HELP_STRING([--disable-libvbucket], + [Build with libvbucket support @<:@default=on@:>@])], + [ac_enable_libvbucket="$enableval"], + [ac_enable_libvbucket="yes"]) + + AS_IF([test "x$ac_enable_libvbucket" = "xyes"],[ + AC_LIB_HAVE_LINKFLAGS(vbucket,,[ + #include + ],[ + VBUCKET_CONFIG_HANDLE config = vbucket_config_parse_file(NULL); + ]) + ],[ + ac_cv_libvbucket="no" + ]) + + AM_CONDITIONAL(HAVE_LIBVBUCKET, [test "x${ac_cv_libvbucket}" = "xyes"]) +]) + +AC_DEFUN([PANDORA_HAVE_LIBVBUCKET],[ + AC_REQUIRE([_PANDORA_SEARCH_LIBVBUCKET]) +]) + +AC_DEFUN([PANDORA_REQUIRE_LIBVBUCKET],[ + AC_REQUIRE([PANDORA_HAVE_LIBVBUCKET]) + AS_IF([test x$ac_cv_libvbucket = xno], + AC_MSG_ERROR([libvbucket is required for ${PACKAGE}])) +]) diff --git a/m4/pandora_have_thrift.m4 b/m4/pandora_have_thrift.m4 new file mode 100644 index 00000000..b0b3a6c0 --- /dev/null +++ b/m4/pandora_have_thrift.m4 @@ -0,0 +1,45 @@ +dnl Copyright (C) 2010 Padraig O'Sullivan +dnl This file is free software; Padraig O'Sullivan +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_SEARCH_THRIFT],[ + AC_REQUIRE([AC_LIB_PREFIX]) + + dnl -------------------------------------------------------------------- + dnl Check for thrift + dnl -------------------------------------------------------------------- + + AC_ARG_ENABLE([thrift], + [AS_HELP_STRING([--disable-thrift], + [Build with thrift support @<:@default=on@:>@])], + [ac_enable_thrift="$enableval"], + [ac_enable_thrift="yes"]) + + AS_IF([test "x$ac_enable_thrift" = "xyes"],[ + AC_LANG_PUSH(C++) + AC_LIB_HAVE_LINKFLAGS(thrift,,[ + #include + ],[ + apache::thrift::TOutput test_output; + ]) + AC_LANG_POP() + ],[ + ac_cv_thrift="no" + ]) + + AM_CONDITIONAL(HAVE_THRIFT, [test "x${ac_cv_thrift}" = "xyes"]) + +]) + +AC_DEFUN([PANDORA_HAVE_THRIFT],[ + AC_REQUIRE([_PANDORA_SEARCH_THRIFT]) +]) + +AC_DEFUN([PANDORA_REQUIRE_THRIFT],[ + AC_REQUIRE([PANDORA_HAVE_THRIFT]) + AS_IF([test x$ac_cv_thrift= xno],[ + AC_MSG_ERROR([thrift required for ${PACKAGE}]) + ]) +]) + diff --git a/m4/pandora_platform.m4 b/m4/pandora_platform.m4 index 4e54562d..aaec77de 100644 --- a/m4/pandora_platform.m4 +++ b/m4/pandora_platform.m4 @@ -34,6 +34,8 @@ AC_DEFUN([PANDORA_PLATFORM],[ ;; esac + PANDORA_OPTIMIZE_BITFIELD=1 + case "$target_os" in *linux*) TARGET_LINUX="true" @@ -47,6 +49,7 @@ AC_DEFUN([PANDORA_PLATFORM],[ ;; *solaris*) TARGET_SOLARIS="true" + PANDORA_OPTIMIZE_BITFIELD=0 AC_SUBST(TARGET_SOLARIS) AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris]) ;; @@ -60,6 +63,8 @@ AC_DEFUN([PANDORA_PLATFORM],[ ;; esac + AC_SUBST(PANDORA_OPTIMIZE_BITFIELD) + AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) AC_CHECK_DECL([__ICC], [INTELCC="yes"], [INTELCC="no"]) diff --git a/m4/pandora_plugins.m4 b/m4/pandora_plugins.m4 index 25ed1e91..217a0968 100644 --- a/m4/pandora_plugins.m4 +++ b/m4/pandora_plugins.m4 @@ -24,14 +24,18 @@ AC_DEFUN([PANDORA_PLUGINS],[ dnl Add code here to read set plugin lists and set drizzled_default_plugin_list pandora_builtin_list=`echo $pandora_builtin_list | sed 's/, *$//'` - AS_IF([test "x$pandora_builtin_list" = "x"], pandora_builtin_list="NULL") + pandora_builtin_symbols_list=`echo $pandora_builtin_symbols_list | sed 's/, *$//'` + AS_IF([test "x$pandora_builtin_symbols_list" = "x"], pandora_builtin_symbols_list="NULL") AC_SUBST([PANDORA_BUILTIN_LIST],[$pandora_builtin_list]) + AC_SUBST([PANDORA_BUILTIN_SYMBOLS_LIST],[$pandora_builtin_symbols_list]) AC_SUBST([PANDORA_PLUGIN_LIST],[$pandora_default_plugin_list]) m4_ifval(m4_normalize([$1]),[ AC_CONFIG_FILES($*) ],[ - AC_DEFINE_UNQUOTED([PANDORA_BUILTIN_LIST],[$pandora_builtin_list], + AC_DEFINE_UNQUOTED([PANDORA_BUILTIN_LIST],["$pandora_builtin_list"], [List of plugins to be built in]) + AC_DEFINE_UNQUOTED([PANDORA_BUILTIN_SYMBOLS_LIST],["$pandora_builtin_symbols_list"], + [List of builtin plugin symbols to be built in]) AC_DEFINE_UNQUOTED([PANDORA_PLUGIN_LIST],["$pandora_default_plugin_list"], [List of plugins that should be loaded on startup if no value is given for --plugin-load]) @@ -45,7 +49,7 @@ AC_DEFUN([PANDORA_PLUGINS],[ AC_SUBST(pandora_plugin_defs) AC_SUBST(PANDORA_PLUGIN_DEP_LIBS) - AC_SUBST(pkgplugindir,"\$(pkglibdir)/plugin") + AC_SUBST(pkgplugindir,"\$(pkglibdir)") ]) AC_DEFUN([PANDORA_ADD_PLUGIN_DEP_LIB],[ diff --git a/m4/pandora_sasl.m4 b/m4/pandora_sasl.m4 index 70750abf..75513d12 100644 --- a/m4/pandora_sasl.m4 +++ b/m4/pandora_sasl.m4 @@ -13,7 +13,7 @@ AC_DEFUN([_PANDORA_SEARCH_SASL],[ [AS_HELP_STRING([--disable-sasl], [Build with sasl support @<:@default=on@:>@])], [ac_enable_sasl="$enableval"], - [ac_enable_sasl="no"]) + [ac_enable_sasl="yes"]) AS_IF([test "x$ac_enable_sasl" = "xyes"], [ diff --git a/m4/pandora_stl_hash.m4 b/m4/pandora_stl_hash.m4 index 26281aee..30277d2f 100644 --- a/m4/pandora_stl_hash.m4 +++ b/m4/pandora_stl_hash.m4 @@ -1,110 +1,89 @@ -# We check two things: where the include file is for hash_map, and -# what namespace hash_map lives in within that include file. We +# We check two things: where the include file is for unordered_map, and +# what namespace unordered_map lives in within that include file. We # include AC_COMPILE_IFELSE for all the combinations we've seen in the -# wild. We define one of HAVE_HASH_MAP or HAVE_EXT_HASH_MAP depending -# on location, and HASH_NAMESPACE to be the namespace hash_map is -# defined in. -# -# Ideally we'd use AC_CACHE_CHECK, but that only lets us store one value -# at a time, and we need to store two (filename and namespace). -# prints messages itself, so we have to do the message-printing ourselves -# via AC_MSG_CHECKING + AC_MSG_RESULT. (TODO(csilvers): can we cache?) +# wild. We define HAVE_UNORDERED_MAP and HAVE_UNORDERED_SET if we have +# them, UNORDERED_MAP_H and UNORDERED_SET_H to their location and +# UNORDERED_NAMESPACE to be the namespace unordered_map is defined in. -AC_DEFUN([PANDORA_CXX_STL_HASH], - [AC_MSG_CHECKING(the location of hash_map) - save_CXXFLAGS="${CXXFLAGS}" - CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}" - AC_LANG_PUSH(C++) - ac_cv_cxx_hash_map="" - for location in "" "ext/" "tr1/" ; do - for namespace in __gnu_cxx "" std stdext; do - for classprefix in unordered hash; do - if test -z "$ac_cv_cxx_hash_map"; then - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include <${location}${classprefix}_map>]], - [[${namespace}::${classprefix}_map t]])], - [ac_cv_cxx_hash_map="<${location}${classprefix}_map>"; - ac_cv_cxx_hash_set="<${location}${classprefix}_set>"; - ac_cv_cxx_hash_namespace="$namespace"; - ac_cv_cxx_hash_map_class="${classprefix}_map"; - ac_cv_cxx_hash_set_class="${classprefix}_set"]) +AC_DEFUN([PANDORA_CXX_STL_UNORDERED],[ + save_CXXFLAGS="${CXXFLAGS}" + CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}" + AC_LANG_PUSH(C++) + AC_CACHE_CHECK([for STL unordered_map], + [pandora_cv_stl_unordered],[ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[std::unordered_map t]])], + [pandora_cv_stl_unordered="yes"], + [pandora_cv_stl_unordered="no"])]) - fi - done - done - done - - if test -n "$ac_cv_cxx_hash_map"; then - AC_DEFINE(HAVE_HASH_MAP, 1, [define if the compiler has hash_map]) - AC_DEFINE(HAVE_HASH_SET, 1, [define if the compiler has hash_set]) - AC_DEFINE_UNQUOTED(HASH_MAP_H,$ac_cv_cxx_hash_map, - [the location of ]) - AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set, - [the location of ]) - AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace, - [the namespace of hash_map/hash_set]) - AC_DEFINE_UNQUOTED(HASH_MAP_CLASS,$ac_cv_cxx_hash_map_class, - [the classname of hash_map]) - AC_DEFINE_UNQUOTED(HASH_SET_CLASS,$ac_cv_cxx_hash_set_class, - [the classname of hash_set]) - AC_MSG_RESULT([$ac_cv_cxx_hash_map]) - else - AC_MSG_RESULT() - AC_MSG_WARN([could not find an STL hash_map]) - fi - AC_CACHE_CHECK( - [whether hash_map has rehash method], - [ac_cv_hash_map_has_rehash], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -#include HASH_MAP_H -using namespace HASH_NAMESPACE; - ]],[[ -HASH_MAP_CLASS test_hash; -test_hash.rehash(100); - ]])], - [ac_cv_hash_map_has_rehash=yes], - [ac_cv_hash_map_has_rehash=no])]) - AS_IF([test $ac_cv_hash_map_has_rehash = yes],[ - AC_DEFINE(HASH_MAP_HAS_REHASH, 1, [if hash_map<> hash rehash method]) - ]) - AC_CACHE_CHECK( - [whether hash_map has resize method], - [ac_cv_hash_map_has_resize], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -#include HASH_MAP_H -using namespace HASH_NAMESPACE; - ]],[[ -HASH_MAP_CLASS test_hash; -test_hash.resize(100); - ]])], - [ac_cv_hash_map_has_resize=yes], - [ac_cv_hash_map_has_resize=no])]) - AS_IF([test $ac_cv_hash_map_has_resize = yes],[ - AC_DEFINE(HASH_MAP_HAS_RESIZE, 1, [if hash_map<> hash resize method]) - ]) - AC_CACHE_CHECK( - [whether to redefine hash], - [ac_cv_redefine_hash_string], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -#include HASH_SET_H -#include -using namespace HASH_NAMESPACE; -using namespace std; - ]],[[ -string teststr("test"); -HASH_SET_CLASS test_hash; -HASH_SET_CLASS::iterator iter= test_hash.find(teststr); -if (iter != test_hash.end()) - return 1; + AS_IF([test "x${pandora_cv_stl_unordered}" != "xyes"],[ + AC_CACHE_CHECK([for tr1 unordered_map], + [pandora_cv_tr1_unordered],[ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +/* We put in this define because of a YACC symbol clash in Drizzle. + Seriously... I cannot believe the GCC guys defined a piece of the internals + of this named IF - and I can't believe that YACC generates a token define + called IF. Really? +*/ +#define IF 21; +#include + ]],[[ +std::tr1::unordered_map t ]])], - [ac_cv_redefine_hash_string=no], - [ac_cv_redefine_hash_string=yes])]) - AS_IF([test $ac_cv_redefine_hash_string = yes],[ - AC_DEFINE(REDEFINE_HASH_STRING, 1, [if hash needs to be defined]) - ]) - CXXFLAGS="${save_CXXFLAGS}" - AC_LANG_POP() + [pandora_cv_tr1_unordered="yes"], + [pandora_cv_tr1_unordered="no"])]) + ]) + + AS_IF([test "x${pandora_cv_stl_unordered}" != "xyes" -a "x${pandora_cv_tr1_unordered}" != "xyes"],[ + AC_CACHE_CHECK([for boost unordered_map], + [pandora_cv_boost_unordered],[ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[boost::unordered_map t]])], + [pandora_cv_boost_unordered="yes"], + [pandora_cv_boost_unordered="no"])]) + ]) + + CXXFLAGS="${save_CXXFLAGS}" + AC_LANG_POP() + + AS_IF([test "x${pandora_cv_stl_unordered}" = "xyes"],[ + AC_DEFINE(HAVE_STD_UNORDERED_MAP, 1, + [if the compiler has std::unordered_map]) + AC_DEFINE(HAVE_STD_UNORDERED_SET, 1, + [if the compiler has std::unordered_set]) + pandora_has_unordered=yes + ]) + AS_IF([test "x${pandora_cv_tr1_unordered}" = "xyes"],[ + AC_DEFINE(HAVE_TR1_UNORDERED_MAP, 1, + [if the compiler has std::tr1::unordered_map]) + AC_DEFINE(HAVE_TR1_UNORDERED_SET, 1, + [if the compiler has std::tr1::unordered_set]) + pandora_has_unordered=yes + ]) + AS_IF([test "x${pandora_cv_boost_unordered}" = "xyes"],[ + AC_DEFINE(HAVE_BOOST_UNORDERED_MAP, 1, + [if the compiler has boost::unordered_map]) + AC_DEFINE(HAVE_BOOST_UNORDERED_SET, 1, + [if the compiler has boost::unordered_set]) + pandora_has_unordered=yes + ]) + + AS_IF([test "x${pandora_has_unordered}" != "xyes"],[ + AC_MSG_WARN([could not find an STL unordered_map]) + ]) +]) + +AC_DEFUN([PANDORA_HAVE_CXX_UNORDERED],[ + AC_REQUIRE([PANDORA_CXX_STL_UNORDERED]) +]) + +AC_DEFUN([PANDORA_REQUIRE_CXX_UNORDERED],[ + AC_REQUIRE([PANDORA_HAVE_CXX_UNORDERED]) + AS_IF([test "x${pandora_has_unordered}" != "xyes"],[ + AC_MSG_ERROR([An STL compliant unordered_map is required for ${PACKAGE}. + Implementations can be found in Recent versions of gcc and in boost]) + ]) ]) diff --git a/m4/pandora_use_pipe.m4 b/m4/pandora_use_pipe.m4 index 7fee06a7..f877b7f6 100644 --- a/m4/pandora_use_pipe.m4 +++ b/m4/pandora_use_pipe.m4 @@ -16,7 +16,7 @@ AC_DEFUN([PANDORA_USE_PIPE],[ AS_IF([test "$GCC" = "yes"],[ AC_CACHE_CHECK([for working -pipe], [pandora_cv_use_pipe], [ - AC_RUN_IFELSE([AC_LANG_SOURCE([[ + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include int main(int argc, char** argv) diff --git a/m4/pandora_vc_build.m4 b/m4/pandora_vc_build.m4 index 9bff0835..c1a8fba5 100644 --- a/m4/pandora_vc_build.m4 +++ b/m4/pandora_vc_build.m4 @@ -3,57 +3,79 @@ dnl This file is free software; Sun Microsystems 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_BUILDING_FROM_VC],[ +AC_DEFUN([PANDORA_TEST_VC_DIR],[ + pandora_building_from_vc=no - ac_cv_building_from_vc=no + if test -d ".bzr" ; then + pandora_building_from_bzr=yes + pandora_building_from_vc=yes + else + pandora_building_from_bzr=no + fi - AS_IF([test -d "${srcdir}/.bzr"],[ - ac_cv_building_from_bzr=yes - ac_cv_building_from_vc=yes - ],[ - ac_cv_building_from_bzr=no - ]) + if test -d ".svn" ; then + pandora_building_from_svn=yes + pandora_building_from_vc=yes + else + pandora_building_from_svn=no + fi - AS_IF([test -d "${srcdir}/.svn"],[ - ac_cv_building_from_svn=yes - ac_cv_building_from_vc=yes - ],[ - ac_cv_building_from_svn=no - ]) + if test -d ".hg" ; then + pandora_building_from_hg=yes + pandora_building_from_vc=yes + else + pandora_building_from_hg=no + fi - AS_IF([test -d "${srcdir}/.hg"],[ - ac_cv_building_from_hg=yes - ac_cv_building_from_vc=yes - ],[ - ac_cv_building_from_hg=no - ]) + if test -d ".git" ; then + pandora_building_from_git=yes + pandora_building_from_vc=yes + else + pandora_building_from_git=no + fi +]) - AS_IF([test -d "${srcdir}/.git"],[ - ac_cv_building_from_git=yes - ac_cv_building_from_vc=yes - ],[ - ac_cv_building_from_git=no - ]) +AC_DEFUN([PANDORA_BUILDING_FROM_VC],[ + m4_syscmd(PANDORA_TEST_VC_DIR [ + PANDORA_RELEASE_DATE=`date +%Y.%m` + PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m` -]) - -dnl Takes one argument which is the prefix to append -AC_DEFUN([PANDORA_EXPORT_BZR_INFO],[ - m4_ifval(m4_normalize([$1]),[ - m4_define([PEBI_PREFIX],[]) - ],[ - m4_define([PEBI_PREFIX],m4_toupper(m4_normalize($1))[_]) - ]) + # Set some defaults + PANDORA_VC_REVNO="0" + PANDORA_VC_REVID="unknown" + PANDORA_VC_BRANCH="bzr-export" - AC_DEFINE(PEBI_PREFIX[BZR_REVID], ["BZR_REVID"], [bzr revision ID]) - AC_DEFINE(PEBI_PREFIX[BZR_BRANCH], ["BZR_BRANCH"], [bzr branch name]) - AC_DEFINE(PEBI_PREFIX[RELEASE_DATE], ["RELEASE_DATE"], [Release date based on the date of the repo checkout]) - AC_DEFINE(PEBI_PREFIX[RELEASE_VERSION], ["RELEASE_VERSION"], [$1 version number formatted for display]) - AC_DEFINE(PEBI_PREFIX[RELEASE_COMMENT], ["RELEASE_COMMENT"], [Set to trunk if the branch is the main $1 branch]) - AC_DEFINE(PEBI_PREFIX[RELEASE_ID], [RELEASE_ID], [$1 version number formatted for numerical comparison]) -]) + if test "${pandora_building_from_bzr}" = "yes"; then + echo "# Grabbing changelog and version information from bzr" + PANDORA_BZR_REVNO=`bzr revno` + if test "x$PANDORA_BZR_REVNO" != "x${PANDORA_VC_REVNO}" ; then + PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}" + PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | cut -f2 -d' ' | head -1` + PANDORA_VC_BRANCH=`bzr nick` + fi + fi + + if ! test -d config ; then + mkdir -p config + fi + if test "${pandora_building_from_bzr}" = "yes" -o ! -f config/pandora_vc_revinfo ; then + cat > config/pandora_vc_revinfo.tmp </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=` ]) @@ -61,50 +83,23 @@ AC_DEFUN([_PANDORA_READ_FROM_FILE],[ AC_DEFUN([PANDORA_VC_VERSION],[ AC_REQUIRE([PANDORA_BUILDING_FROM_VC]) - PANDORA_RELEASE_DATE=`date +%Y.%m` - PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m` - - dnl Set some defaults - PANDORA_VC_REVNO="0" - PANDORA_VC_REVID="unknown" - PANDORA_VC_BRANCH="bzr-export" + PANDORA_TEST_VC_DIR - AS_IF([test -f ${srcdir}/config/bzr_revinfo],[ - _PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/bzr_revinfo) - _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/bzr_revinfo) + AS_IF([test -f ${srcdir}/config/pandora_vc_revinfo],[ + _PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/pandora_vc_revinfo) + _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/pandora_vc_revinfo) _PANDORA_READ_FROM_FILE([PANDORA_VC_BRANCH], - ${srcdir}/config/bzr_revinfo) + ${srcdir}/config/pandora_vc_revinfo) _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_DATE], - ${srcdir}/config/bzr_revinfo) + ${srcdir}/config/pandora_vc_revinfo) _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_NODOTS_DATE], - ${srcdir}/config/bzr_revinfo) - _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_COMMENT], - ${srcdir}/config/bzr_revinfo) + ${srcdir}/config/pandora_vc_revinfo) ]) - AS_IF([test "${ac_cv_building_from_bzr}" = "yes"],[ -dnl echo "Grabbing changelog and version information from bzr" -dnl bzr log --short > ChangeLog || touch ChangeLog - PANDORA_BZR_REVNO=`bzr revno` - AS_IF([test "x$PANDORA_BZR_REVNO" != "${PANDORA_VC_REVNO}"],[ - PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}" - PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | awk '{print $[]2}' | head -1` - PANDORA_VC_BRANCH=`bzr nick` - AS_IF([test "x${PANDORA_VC_BRANCH}" != "${PACKAGE}"],[ - PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}" - ],[ - PANDORA_RELEASE_COMMENT="trunk" - ]) - ]) + AS_IF([test "x${PANDORA_VC_BRANCH}" != x"${PACKAGE}"],[ + PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}" + ],[ + PANDORA_RELEASE_COMMENT="trunk" ]) - AS_IF([! test -d config],[mkdir -p config]) - cat > "config/bzr_revinfo" <() { AC_SUBST(NO_UNREACHED) AC_SUBST(NO_SHADOW) AC_SUBST(NO_STRICT_ALIASING) + AC_SUBST(NO_EFF_CXX) + AC_SUBST(NO_OLD_STYLE_CAST) AC_SUBST(PROTOSKIP_WARNINGS) AC_SUBST(INNOBASE_SKIP_WARNINGS) AC_SUBST(NO_WERROR) diff --git a/m4/pandora_with_gettext.m4 b/m4/pandora_with_gettext.m4 index 2b22d1b8..9b13e56f 100644 --- a/m4/pandora_with_gettext.m4 +++ b/m4/pandora_with_gettext.m4 @@ -11,10 +11,11 @@ dnl From Monty Taylor AC_DEFUN([PANDORA_WITH_GETTEXT],[ + m4_syscmd([if test -d po ; then echo "# This file is auto-generated from configure. Do not edit directly" > po/POTFILES.in.stamp - PACKAGE=`grep ^AC_INIT configure.ac | cut -f2-3 -d[ | cut -f1 -d]` - for f in `find . | grep -v "${PACKAGE}-" | egrep '\.(cc|c|h|yy)$' | cut -c3- | sort` + PACKAGE=$(grep ^AC_INIT configure.ac | cut -f2-3 -d[ | cut -f1 -d]) + for f in $(find . | grep -v "${PACKAGE}-" | egrep '\.(cc|c|h|yy)$' | cut -c3- | sort) do if grep gettext.h "$f" | grep include >/dev/null 2>&1 then @@ -29,13 +30,15 @@ AC_DEFUN([PANDORA_WITH_GETTEXT],[ fi fi]) - AM_GNU_GETTEXT(external, need-formatstring-macros) - AM_GNU_GETTEXT_VERSION([0.17]) - AS_IF([test "x$MSGMERGE" = "x" -o "x$MSGMERGE" = "x:"],[ - AM_PATH_PROG_WITH_TEST(GMSGMERGE, gmsgmerge, - [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) - MSGMERGE="${GMSGMERGE}" + m4_if(m4_substr(m4_esyscmd(test -d po && echo 0),0,1),0, [ + AM_GNU_GETTEXT(external, need-formatstring-macros) + AM_GNU_GETTEXT_VERSION([0.17]) + AS_IF([test "x$MSGMERGE" = "x" -o "x$MSGMERGE" = "x:"],[ + AM_PATH_PROG_WITH_TEST([GMSGMERGE], gmsgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) + MSGMERGE="${GMSGMERGE}" + ]) + AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"]) ]) - AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"]) ]) diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 00000000..0734762a --- /dev/null +++ b/m4/po.m4 @@ -0,0 +1,449 @@ +# po.m4 serial 15 (gettext-0.17) +dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can can be used in projects which are not available under +dnl the GNU General Public License or the GNU Library General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Library General Public License, and the rest of the GNU +dnl gettext package package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ(2.50) + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake + AC_REQUIRE([AM_NLS])dnl + + dnl Release version of the gettext macros. This is used to ensure that + dnl the gettext macros and po/Makefile.in.in are in sync. + AC_SUBST([GETTEXT_MACRO_VERSION], [0.17]) + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Test whether it is GNU msgfmt >= 0.15. +changequote(,)dnl + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([MSGFMT_015]) +changequote(,)dnl + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([GMSGFMT_015]) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Test whether it is GNU xgettext >= 0.15. +changequote(,)dnl + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac +changequote([,])dnl + AC_SUBST([XGETTEXT_015]) + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) + + dnl Installation directories. + dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we + dnl have to define it here, so that it can be used in po/Makefile. + test -n "$localedir" || localedir='${datadir}/locale' + AC_SUBST([localedir]) + + dnl Support for AM_XGETTEXT_OPTION. + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) + + AC_CONFIG_COMMANDS([po-directories], [[ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. + eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done]], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it + # from automake < 1.5. + eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1996. + +AC_PREREQ(2.50) + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in ifelse([$5], , $PATH, [$5]); do + IFS="$ac_save_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$ac_save_IFS" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +])