packages: lal-inspiral/check_series_macros.h (NEW), lal-inspiral/generate_v...
uzsolt
uzsolt at pld-linux.org
Mon Sep 20 14:40:14 CEST 2010
Author: uzsolt Date: Mon Sep 20 12:40:14 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- initial
---- Files affected:
packages/lal-inspiral:
check_series_macros.h (NONE -> 1.1) (NEW), generate_vcs_info.py (NONE -> 1.1) (NEW), lalsuite_build.m4 (NONE -> 1.1) (NEW), lalsuite_c99.m4 (NONE -> 1.1) (NEW), lalsuite_gccflags.m4 (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/lal-inspiral/check_series_macros.h
diff -u /dev/null packages/lal-inspiral/check_series_macros.h:1.1
--- /dev/null Mon Sep 20 14:40:14 2010
+++ packages/lal-inspiral/check_series_macros.h Mon Sep 20 14:40:08 2010
@@ -0,0 +1,20 @@
+#include <math.h>
+#include <lal/LALConstants.h>
+#include <lal/XLALError.h>
+#include <lal/Date.h>
+#include <lal/Units.h>
+
+#define LAL_CHECK_VALID_SERIES(s,val) \
+ do { \
+ if ( !(s) ) XLAL_ERROR_VAL( func, XLAL_EFAULT, val ); \
+ if ( !(s)->data || !(s)->data->data || !(s)->data->length ) XLAL_ERROR_VAL( func, XLAL_EINVAL, val ); \
+ } while (0)
+
+#define LAL_CHECK_CONSISTENT_TIME_SERIES(s1,s2,val) \
+ do { \
+ if ( XLALGPSCmp( &(s1)->epoch, &(s2)->epoch ) != 0 ) XLAL_ERROR_VAL( func, XLAL_ETIME, val ); \
+ if ( fabs( (s1)->deltaT - (s2)->deltaT ) > LAL_REAL8_EPS ) XLAL_ERROR_VAL( func, XLAL_ETIME, val ); \
+ if ( fabs( (s1)->f0 - (s2)->f0 ) > LAL_REAL8_EPS ) XLAL_ERROR_VAL( func, XLAL_EFREQ, val ); \
+ if ( XLALUnitCompare( &(s1)->sampleUnits, &(s2)->sampleUnits ) ) XLAL_ERROR_VAL( func, XLAL_EUNIT, val ); \
+ if ( (s1)->data->length != (s1)->data->length ) XLAL_ERROR_VAL( func, XLAL_EBADLEN, val ); \
+ } while (0)
================================================================
Index: packages/lal-inspiral/generate_vcs_info.py
diff -u /dev/null packages/lal-inspiral/generate_vcs_info.py:1.1
--- /dev/null Mon Sep 20 14:40:14 2010
+++ packages/lal-inspiral/generate_vcs_info.py Mon Sep 20 14:40:08 2010
@@ -0,0 +1,287 @@
+# generate_vcs_info.py - determine git version info
+#
+# Based on generateGitID.sh by Reinhard Prix
+#
+# Copyright (C) 2009,2010, Adam Mercer <adam.mercer at ligo.org>
+# Copyright (C) 2009,2010, Nickolas Fotopoulos <nvf at gravity.phys.uwm.edu>
+# Copyright (C) 2008,2009, John T. Whelan <john.whelan at ligo.org>
+# Copyright (C) 2008, Reinhard Prix <reinhard.ligo.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+#
+# preamble
+#
+
+# metadata
+__author__ = 'Adam Mercer <adam.mercer at ligo.org>'
+
+# import required system modules
+import exceptions
+import os
+import sys
+import time
+import optparse
+import filecmp
+import shutil
+try:
+ import subprocess
+except ImportError:
+ sys.exit("Python-2.4, or higher is required")
+
+#
+# class definitions
+#
+
+# version info class
+class git_info:
+ def __init__(self):
+ id = None
+ date = None
+ branch = None
+ tag = None
+ author = None
+ committer = None
+ status = None
+
+# git invocation error exception handler
+class GitInvocationError(exceptions.LookupError):
+ pass
+
+#
+# helper methods
+#
+
+# command line option parsing
+def parse_args():
+ # usage information
+ usage = '%prog [options] project src_dir build_dir'
+
+ # define option parser
+ parser = optparse.OptionParser(usage=usage)
+ parser.add_option('--sed', action='store_true', default=False,
+ help='output sed commands for version replacement')
+ parser.add_option('--sed-file', action='store_true', default=False,
+ help='output sed file for version replacement')
+
+ # parse command line options
+ opts, args = parser.parse_args()
+
+ # check for positional arguments
+ if (len(args) != 3):
+ parser.error('incorrect number of command line options specified')
+
+ # check that both --sed and --file are not specified
+ if opts.sed and opts.sed_file:
+ parser.error('cannot specify both --sed and --sed-file')
+
+ return opts, args[0], args[1], args[2]
+
+#
+# process management methods
+#
+
+# return output from running given command
+def call_out(command):
+ """
+ Run the given command (with shell=False) and return a tuple of
+ (int returncode, str output). Strip the output of enclosing whitespace.
+ """
+ # start external command process
+ p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+ # get outputs
+ out, _ = p.communicate()
+
+ return p.returncode, out.strip()
+
+def check_call_out(command):
+ """
+ Run the given command (with shell=False) and return the output as a
+ string. Strip the output of enclosing whitespace.
+ If the return code is non-zero, throw GitInvocationError.
+ """
+ # start external command process
+ p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+ # get outputs
+ out, _ = p.communicate()
+
+ # throw exception if process failed
+ if p.returncode != 0:
+ raise GitInvocationError, 'failed to run "%s"' % " ".join(command)
+
+ return out.strip()
+
+#
+# git version method
+#
+
+def in_git_repository():
+ """
+ Return True if git is available and we are in a git repository; else
+ return False.
+
+ NB: Unfortunately there is a magic number without any documentation to back
+ it up. It turns out that git status returns non-zero exit codes for all sorts
+ of success conditions, but I cannot find any documentation of them. 128 was
+ determined empirically. I sure hope that it's portable.
+ """
+ ret_code, git_path = call_out(('which', 'git'))
+ return (ret_code != 1) and not git_path.startswith('no') \
+ and (call_out((git_path, 'status'))[0] != 128)
+
+# generate sed command file containing version info
+def generate_git_version_info():
+ # info object
+ info = git_info()
+
+ git_path = check_call_out(('which', 'git'))
+
+ # determine basic info about the commit
+ # %H -- full git hash id
+ # %ct -- commit time
+ # %an, %ae -- author name, email
+ # %cn, %ce -- committer name, email
+ git_id, git_udate, git_author_name, git_author_email, \
+ git_committer_name, git_committer_email = \
+ check_call_out((git_path, 'log', '-1',
+ '--pretty=format:%H,%ct,%an,%ae,%cn,%ce')).split(",")
+
+ git_date = time.strftime('%Y-%m-%d %H:%M:%S +0000',
+ time.gmtime(float(git_udate)))
+ git_author = '%s <%s>' % (git_author_name, git_author_email)
+ git_committer = '%s <%s>' % (git_committer_name, git_committer_email)
+
+ # determine branch
+ branch_match = check_call_out((git_path, 'rev-parse',
+ '--symbolic-full-name', 'HEAD'))
+ if branch_match == "HEAD":
+ git_branch = None
+ else:
+ git_branch = os.path.basename(branch_match)
+
+ # determine tag
+ status, git_tag = call_out((git_path, 'describe', '--exact-match',
+ '--tags', git_id))
+ if status != 0:
+ git_tag = None
+
+ # refresh index
+ check_call_out((git_path, 'update-index', '-q', '--refresh'))
+
+ # check working copy for changes
+ status_output = subprocess.call((git_path, 'diff-files', '--quiet'))
+ if status_output != 0:
+ git_status = 'UNCLEAN: Modified working tree'
+ else:
+ # check index for changes
+ status_output = subprocess.call((git_path, 'diff-index', '--cached',
+ '--quiet', 'HEAD'))
+ if status_output != 0:
+ git_status = 'UNCLEAN: Modified index'
+ else:
+ git_status = 'CLEAN: All modifications committed'
+
+ # determine version strings
+ info.id = git_id
+ info.date = git_date
+ info.branch = git_branch
+ info.tag = git_tag
+ info.author = git_author
+ info.committer = git_committer
+ info.status = git_status
+
+ return info
+
+#
+# main program entry point
+#
+
+if __name__ == "__main__":
+ # parse command line options
+ options, project, src_dir, build_dir = parse_args()
+
+ # filenames
+ basename = '%sVCSInfo.h' % project
+ infile = '%s.in' % basename # used after chdir to src_dir
+ tmpfile= '%s/%s.tmp' % (build_dir, basename)
+ srcfile = '%s/%s' % (src_dir, basename)
+ dstfile = '%s/%s' % (build_dir, basename)
+
+ # copy vcs header to build_dir, if appropriate
+ if os.access(srcfile, os.F_OK) and not os.access(dstfile, os.F_OK):
+ shutil.copy(srcfile, dstfile)
+
+ # change to src_dir
+ os.chdir(src_dir)
+
+ # generate version information output, if appropriate
+ # NB: First assume that git works and we are in a repository since
+ # checking it is expensive and rarely necessary.
+ try:
+ info = generate_git_version_info()
+ except GitInvocationError:
+ # We expect a failure if either git is not available or we are not
+ # in a repository. Any other failure is unexpected and should throw an
+ # error.
+ if not in_git_repository():
+ sys.exit(0)
+ else:
+ sys.exit("Unexpected failure in discovering the git version")
+
+ if options.sed_file:
+ # output sed command file to stdout
+ print 's/@ID@/%s/g' % info.id
+ print 's/@DATE@/%s/g' % info.date
+ print 's/@BRANCH@/%s/g' % info.branch
+ print 's/@TAG@/%s/g' % info.tag
+ print 's/@AUTHOR@/%s/g' % info.author
+ print 's/@COMMITTER@/%s/g' % info.committer
+ print 's/@STATUS@/%s/g' % info.status
+ elif options.sed:
+ # generate sed command line options
+ sed_cmd = ('sed',
+ '-e', 's/@ID@/%s/' % info.id,
+ '-e', 's/@DATE@/%s/' % info.date,
+ '-e', 's/@BRANCH@/%s/' % info.branch,
+ '-e', 's/@TAG@/%s/' % info.tag,
+ '-e', 's/@AUTHOR@/%s/' % info.author,
+ '-e', 's/@COMMITTER@/%s/' % info.committer,
+ '-e', 's/@STATUS@/%s/' % info.status,
+ infile)
+
+ # create tmp file
+ # FIXME: subprocess.check_call becomes available in Python 2.5
+ sed_retcode = subprocess.call(sed_cmd, stdout=open(tmpfile, "w"))
+ if sed_retcode:
+ raise GitInvocationError, "Failed call (modulo quoting): " \
+ + " ".join(sed_cmd) + " > " + tmpfile
+
+ # only update vcs header if appropriate
+ if os.access(dstfile, os.F_OK) and filecmp.cmp(dstfile, tmpfile):
+ os.remove(tmpfile)
+ else:
+ os.rename(tmpfile, dstfile)
+ else:
+ # output version info
+ print 'Id: %s' % info.id
+ print 'Date: %s' % info.date
+ print 'Branch: %s' % info.branch
+ print 'Tag: %s' % info.tag
+ print 'Author: %s' % info.author
+ print 'Committer: %s' % info.committer
+ print 'Status: %s' % info.status
+
+# vim: syntax=python tw=72 ts=2 et
================================================================
Index: packages/lal-inspiral/lalsuite_build.m4
diff -u /dev/null packages/lal-inspiral/lalsuite_build.m4:1.1
--- /dev/null Mon Sep 20 14:40:14 2010
+++ packages/lal-inspiral/lalsuite_build.m4 Mon Sep 20 14:40:08 2010
@@ -0,0 +1,242 @@
+# lalsuite_build.m4 - top level build macros
+#
+# serial 7
+
+AC_DEFUN([LALSUITE_ENABLE_MODULE],[
+AM_CONDITIONAL([$1],[test x$$2 = xtrue])
+eval $1_ENABLE_VAL="`eval test "$$2" = "true" && echo "ENABLED" || echo "DISABLED"`"
+])
+
+AC_DEFUN([LALSUITE_CHECK_LIB],[
+m4_pushdef([lowercase],translit([[$1]], [A-Z], [a-z]))
+m4_pushdef([uppercase],translit([[$1]], [a-z], [A-Z]))
+PKG_CHECK_MODULES(uppercase,[lowercase >= $2],[lowercase="true"],[lowercase="false"])
+if test "$lowercase" = "true"; then
+ CPPFLAGS="$CPPFLAGS $[]uppercase[]_CFLAGS"
+ LIBS="$LIBS $[]uppercase[]_LIBS"
+ if test "$LALSUITE_BUILD" = "true"; then
+ AC_DEFINE([HAVE_LIB]uppercase,[1],[Define to 1 if you have the $1 library])
+ lowercase="true"
+ else
+ AC_CHECK_LIB(lowercase,[$3],[lowercase="true"],[AC_MSG_ERROR([could not find the $1 library])])
+ AC_CHECK_HEADERS([$4],,[AC_MSG_ERROR([could not find the $4 header])])
+ if test "$1" != "LALSupport"; then
+ LALSUITE_HEADER_LIBRARY_MISMATCH_CHECK([$1])
+ fi
+ AC_DEFINE([HAVE_LIB]uppercase,[1],[Define to 1 if you have the $1 library])
+ fi
+else
+ AC_MSG_ERROR([could not find the $1 library])
+fi
+LALSUITE_ENABLE_MODULE(uppercase,lowercase)
+m4_popdef([lowercase])
+m4_popdef([uppercase])
+])
+
+AC_DEFUN([LALSUITE_CHECK_OPT_LIB],[
+m4_pushdef([lowercase],translit([[$1]], [A-Z], [a-z]))
+m4_pushdef([uppercase],translit([[$1]], [a-z], [A-Z]))
+if test "$lowercase" = "true"; then
+ PKG_CHECK_MODULES(uppercase,[lowercase >= $2],[lowercase="true"],[lowercase="false"])
+ if test "$lowercase" = "true"; then
+ if test "$LALSUITE_BUILD" = "true"; then
+ AC_DEFINE([HAVE_LIB]uppercase,[1],[Define to 1 if you have the $1 library])
+ lowercase="true"
+ CPPFLAGS="$CPPFLAGS $[]uppercase[]_CFLAGS"
+ LIBS="$LIBS $[]uppercase[]_LIBS"
+ else
+ CPPFLAGS="$CPPFLAGS $[]uppercase[]_CFLAGS"
+ LIBS="$LIBS $[]uppercase[]_LIBS"
+ AC_CHECK_LIB(lowercase,[$3],[lowercase="true"],[lowercase=false
+ AC_MSG_WARN([could not find the $1 library])])
+ if test "$lowercase" = true; then
+ AC_CHECK_HEADERS([$4],,[lowercase=false])
+ if test "$lowercase" = true; then
+ if test "$1" != "LALSupport"; then
+ LALSUITE_HEADER_LIBRARY_MISMATCH_CHECK([$1])
+ fi
+ if test "$lowercase" = true; then
+ AC_DEFINE([HAVE_LIB]uppercase,[1],[Define to 1 if you have the $1 library])
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+LALSUITE_ENABLE_MODULE(uppercase,lowercase)
+m4_popdef([lowercase])
+m4_popdef([uppercase])
+])
+
+AC_DEFUN([LALSUITE_HEADER_LIBRARY_MISMATCH_CHECK],[
+AC_MSG_CHECKING([whether $1 headers match the library])
+lib_structure=`echo $1 | sed 's/LAL/lal/'`VCSInfo
+header_structure=`echo $1 | sed 's/LAL/lal/'`HeaderVCSInfo
+AC_RUN_IFELSE(
+ [AC_LANG_SOURCE([[
+#include <string.h>
+#include <stdlib.h>
+#include <lal/$1VCSInfo.h>
+int main(void) { exit(XLALVCSInfoCompare(&$lib_structure, &$header_structure) ? 1 : 0); }
+ ]])],
+ [
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([Your $1 headers do not match your
+library. Check config.log for details.
+])
+ ],
+ [
+ AC_MSG_WARN([cross compiling: not checking])
+ ]
+)
+])
+
+AC_DEFUN([LALSUITE_ENABLE_NIGHTLY],
+[AC_ARG_ENABLE(
+ [nightly],
+ AC_HELP_STRING([--enable-nightly],[nightly build [default=no]]),
+ [ case "${enableval}" in
+ yes) NIGHTLY_VERSION=`date +"%Y%m%d"`
+ VERSION="${VERSION}.${NIGHTLY_VERSION}" ;;
+ no) NIGHTLY_VERSION="";;
+ *) NIGHTLY_VERSION="${enableval}"
+ VERSION="${VERSION}.${NIGHTLY_VERSION}" ;;
+ esac ],
+ [ NIGHTLY_VERSION="" ] )
+ AC_SUBST(NIGHTLY_VERSION)
+])
+
+AC_DEFUN([LALSUITE_ENABLE_LALFRAME],
+[AC_ARG_ENABLE(
+ [lalframe],
+ AC_HELP_STRING([--enable-lalframe],[compile code that requires lalframe library [default=yes]]),
+ [ case "${enableval}" in
+ yes) lalframe=true;;
+ no) lalframe=false;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-frame) ;;
+ esac
+ ], [ lalframe=true ] )
+if test "$frame" = "false"; then
+ lalframe=false
+fi
+])
+
+AC_DEFUN([LALSUITE_ENABLE_LALMETAIO],
+[AC_ARG_ENABLE(
+ [lalmetaio],
+ AC_HELP_STRING([--enable-lalmetaio],[compile code that requires lalmetaio library [default=yes]]),
+ [ case "${enableval}" in
+ yes) lalmetaio=true;;
+ no) lalmetaio=false;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-metaio) ;;
+ esac
+ ], [ lalmetaio=true ] )
+if test "$metaio" = "false"; then
+ lalmetaio=false
+fi
+])
+
+AC_DEFUN([LALSUITE_ENABLE_LALBURST],
+[AC_ARG_ENABLE(
+ [lalburst],
+ AC_HELP_STRING([--enable-lalburst],[compile code that requires lalburst library [default=yes]]),
+ [ case "${enableval}" in
+ yes) lalburst=true;;
+ no) lalburst=false;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-burst) ;;
+ esac
+ ], [ lalburst=true ] )
+if test "$lalmetaio" = "false"; then
+ lalburst=false
+fi])
+
+AC_DEFUN([LALSUITE_ENABLE_LALINSPIRAL],
+[AC_ARG_ENABLE(
+ [lalinspiral],
+ AC_HELP_STRING([--enable-lalinspiral],[compile code that requires lalinspiral library [default=yes]]),
+ [ case "${enableval}" in
+ yes) lalinspiral=true;;
+ no) lalinspiral=false;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-inspiral) ;;
+ esac
+ ], [ lalinspiral=true ] )
+if test "$lalmetaio" = "false"; then
+ lalinspiral=false
+fi
+])
+
+AC_DEFUN([LALSUITE_ENABLE_LALPULSAR],
+[AC_ARG_ENABLE(
+ [lalpulsar],
+ AC_HELP_STRING([--enable-lalpulsar],[compile code that requires lalpulsar library [default=yes]]),
+ [ case "${enableval}" in
+ yes) lalpulsar=true;;
+ no) lalpulsar=false;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-lalpulsar) ;;
+ esac
+ ], [ lalpulsar=true ] )
+])
+
+AC_DEFUN([LALSUITE_ENABLE_LALSTOCHASTIC],
+[AC_ARG_ENABLE(
+ [lalstochastic],
+ AC_HELP_STRING([--enable-lalstochastic],[compile code that requires lalstochastic library [default=yes]]),
+ [ case "${enableval}" in
+ yes) lalstochastic=true;;
+ no) lalstochastic=false;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-stochastic) ;;
+ esac
+ ], [ lalstochastic=true ] )
+if test "$lalmetaio" = "false"; then
+ lalstochastic=false
+fi
+])
+
+AC_DEFUN([LALSUITE_ENABLE_LALXML],
+[AC_ARG_ENABLE(
+ [lalxml],
+ AC_HELP_STRING([--enable-lalxml],[compile code that requires lalxml library [default=no]]),
+ [ case "${enableval}" in
+ yes) lalxml=true;;
+ no) lalxml=false;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-lalxml) ;;
+ esac
+ ], [ lalxml=false ] )
+if test "$lalpulsar" = "false"; then
+ lalxml=false
+fi
+])
+
+AC_DEFUN([LALSUITE_ENABLE_BOINC],
+[AC_ARG_ENABLE(
+ [boinc],
+ AC_HELP_STRING([--enable-boinc],[enable BOINC support [default=no]]),
+ [ case "${enableval}" in
+ yes) boinc=true;;
+ no) boinc=false;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-boinc);;
+ esac
+ ], [ boinc=false ] )
+AC_ARG_VAR([BOINC_PREFIX],[BOINC installation directory (optional)])
+])
+
+AC_DEFUN([LALSUITE_CHECK_BOINC],
+[AC_MSG_CHECKING([whether LAL has been compiled with BOINC support])
+AC_TRY_RUN([
+#include <lal/LALConfig.h>
+#ifdef LAL_BOINC_ENABLED
+int main( void ) { return 0; }
+#else
+int main( void ) { return 1; }
+#endif
+],
+AC_MSG_RESULT([yes])
+[boinc=true],
+AC_MSG_RESULT([no])
+[boinc=false],
+AC_MSG_RESULT([unknown])
+[boinc=false])
+])
================================================================
Index: packages/lal-inspiral/lalsuite_c99.m4
diff -u /dev/null packages/lal-inspiral/lalsuite_c99.m4:1.1
--- /dev/null Mon Sep 20 14:40:14 2010
+++ packages/lal-inspiral/lalsuite_c99.m4 Mon Sep 20 14:40:08 2010
@@ -0,0 +1,255 @@
+# lalsuite_c99.m4 - c99 detection macro taken from autoconf-2.63
+#
+# serial 1
+
+# This file is part of Autoconf. -*- Autoconf -*-
+# Programming languages support.
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
+# Software Foundation, Inc.
+#
+# 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, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list