Skip to content

Commit

Permalink
Initial version.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitwham committed Dec 1, 2015
1 parent 289f835 commit 7d14134
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2015 Genome Research Ltd.
# Author: Andrew Whitwham <[email protected]>
#
# This file is part of tears.
#
# tears 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>

bin_PROGRAMS = tears

tears_SOURCES = tears.c
136 changes: 136 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
dnl -*- Autoconf -*-
AC_COPYRIGHT([
Copyright (c) 2015 Genome Research Ltd.
Author: Andrew Whitwham <[email protected]>
This file is part of tears.
tears 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>])

dnl Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT([tears], [1.0], [[email protected]])

AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CC_C_O
AC_LANG([C])

# Checks for header files
AC_CHECK_HEADERS([stdio.h stdlib.h string.h unistd.h stdarg.h], [], [
echo "Missing required header file, giving up."
exit 1
])dnl

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T

# Checks for library functions.
AC_CHECK_FUNCS([memset strchr strdup strndup strstr], [], [
echo "Required function not found, giving up."
exit 1
])dnl

AC_CHECK_LIB([gssapi_krb5], [gss_acquire_cred])
AC_CHECK_LIB([pthread], [pthread_kill])

dnl Save the original values to restore between tests
CPPFLAGS_ORIG=${CPPFLAGS}
LDFLAGS_ORIG=${LDFLAGS}
LIBS_ORIG=${LIBS}

dnl Look for iRODS
IRODS_HOME=
AC_ARG_WITH([irods],
[AS_HELP_STRING([--with-irods],
[Specify the location of a run-in-place iRODS installation (default: /usr/local/lib/irods)])],
[AS_IF(
[test "x$with_irods" = "xno"],
[AC_MSG_FAILURE([iRODS is required to build baton])],
[test "x$with_irods" = "xyes"],
[AC_MSG_NOTICE([using default iRODS location])
IRODS_HOME="/usr/local/lib/irods"
IS_PACKAGED_INSTALL="no"],
[IRODS_HOME="$with_irods"
IS_PACKAGED_INSTALL="no"])],
[IS_PACKAGED_INSTALL="yes"])

AC_SUBST(IRODS_HOME)

dnl Begin iRODS 3.3.x

dnl iRODS 3.3.x supports only run-in-place (RIP) installation. Its
dnl headers and shared libraries are in non-standard places, which may
dnl be determined relative to IRODS_HOME.
IRODS3_CPPFLAGS=\
"-I${IRODS_HOME}/lib/api/include \
-I${IRODS_HOME}/lib/core/include \
-I${IRODS_HOME}/lib/md5/include \
-I${IRODS_HOME}/lib/sha1/include \
-I${IRODS_HOME}/server/core/include \
-I${IRODS_HOME}/server/drivers/include \
-I${IRODS_HOME}/server/icat/include \
-I${IRODS_HOME}/server/re/include"
IRODS3_LDFLAGS="-L${IRODS_HOME}/lib/core/obj"

CPPFLAGS="$CPPFLAGS_ORIG ${IRODS3_CPPFLAGS}"
LDFLAGS="$LDFLAGS_ORIG ${IRODS3_LDFLAGS}"
LIBS="${LIBS_ORIG}"

HAVE_IRODS3=no

AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
#include <string.h>
#include <rodsVersion.h>
], [
#if defined (RODS_REL_VERSION)
return strncmp("rods3.3", RODS_REL_VERSION, 7);
#else
exit(-1);
#endif
])],
[ dnl AC_DEFINE([HAVE_IRODS3], [], [iRODS 3.3.x])
AC_MSG_NOTICE([detected iRODS 3.3.x])
[HAVE_IRODS3=yes]
AC_CHECK_LIB([RodsAPIs], [getRodsEnvFileName], [],
[AC_MSG_ERROR([unable to find the iRODS library libRodsAPIs])])])

AM_CONDITIONAL(HAVE_IRODS3, test "x$HAVE_IRODS3" = "xyes")

IRODS3_CPPFLAGS="${CPPFLAGS}"
IRODS3_LDFLAGS="${LDFLAGS}"
IRODS3_LIBS="${LIBS}"

CPPFLAGS="${CPPFLAGS_ORIG}"
LDFLAGS="${LDFLAGS_ORIG}"
LIBS="${LIBS_ORIG}"
dnl End iRODS 3.3.x

dnl Examine the test results
AS_IF(
[test "x$HAVE_IRODS3" = "xyes"],
[AC_MSG_NOTICE([detected an iRODS 3.3.x installation in ${IRODS_HOME}])
AC_DEFINE([HAVE_IRODS3], [1], [iRODS 3.3.x])
CPPFLAGS="${IRODS3_CPPFLAGS}"
LDFLAGS="${IRODS3_LDFLAGS}"
LDLIBS="${IRODS3_LIBS}"
LIBS="${IRODS3_LIBS}"],
[AC_MSG_ERROR([failed to detect iRODS 3.3.x installation])])

AC_CONFIG_SRCDIR([tears.c])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

0 comments on commit 7d14134

Please sign in to comment.