Skip to content

Commit

Permalink
Adding autotools files
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdavidsmith committed Mar 15, 2020
1 parent 8d7b339 commit ea421a5
Show file tree
Hide file tree
Showing 5 changed files with 1,247 additions and 0 deletions.
105 changes: 105 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# This file is part of epievo
#
# Copyright (C) 2020: University of Southern California
# Andrew D. Smith and Xiaojing Ji
#
# Authors: Andrew D. Smith
#
# This 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 software 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.

EXTRA_DIST = README.md

ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -I $(top_srcdir)/src/libepievo -I $(top_srcdir)/src/smithlab_cpp

CXXFLAGS = -O3 # default has optimization on

noinst_LIBRARIES = libepievo.a libsmithlab_cpp.a
libepievo_a_SOURCES = \
src/libepievo/ContinuousTimeMarkovModel.cpp \
src/libepievo/EndCondSampling.cpp \
src/libepievo/EpiEvoModel.cpp \
src/libepievo/GlobalJump.cpp \
src/libepievo/IndepSite.cpp \
src/libepievo/IntervalSampler.cpp \
src/libepievo/ParamEstimation.cpp \
src/libepievo/Path.cpp \
src/libepievo/PhyloTree.cpp \
src/libepievo/PhyloTreePreorder.cpp \
src/libepievo/Segment.cpp \
src/libepievo/SingleSiteSampler.cpp \
src/libepievo/TreeHelper.cpp \
src/libepievo/TripletSampler.cpp \
src/libepievo/epievo_utils.cpp

libepievo_a_SOURCES += \
src/libepievo/ContinuousTimeMarkovModel.hpp \
src/libepievo/EndCondSampling.hpp \
src/libepievo/EpiEvoModel.hpp \
src/libepievo/GlobalJump.hpp \
src/libepievo/IndepSite.hpp \
src/libepievo/IntervalSampler.hpp \
src/libepievo/ParamEstimation.hpp \
src/libepievo/Path.hpp \
src/libepievo/PhyloTree.hpp \
src/libepievo/PhyloTreePreorder.hpp \
src/libepievo/Segment.hpp \
src/libepievo/SingleSiteSampler.hpp \
src/libepievo/TreeHelper.hpp \
src/libepievo/TripletSampler.hpp \
src/libepievo/emission_utils.hpp \
src/libepievo/epievo_utils.hpp

libsmithlab_cpp_a_SOURCES = \
src/smithlab_cpp/GenomicRegion.cpp \
src/smithlab_cpp/MappedRead.cpp \
src/smithlab_cpp/OptionParser.cpp \
src/smithlab_cpp/QualityScore.cpp \
src/smithlab_cpp/bisulfite_utils.cpp \
src/smithlab_cpp/chromosome_utils.cpp \
src/smithlab_cpp/dna_four_bit.cpp \
src/smithlab_cpp/htslib_wrapper.cpp \
src/smithlab_cpp/sim_utils.cpp \
src/smithlab_cpp/smithlab_os.cpp \
src/smithlab_cpp/smithlab_utils.cpp \
src/smithlab_cpp/zlib_wrapper.cpp

libsmithlab_cpp_a_SOURCES += \
src/smithlab_cpp/GenomicRegion.hpp \
src/smithlab_cpp/MappedRead.hpp \
src/smithlab_cpp/OptionParser.hpp \
src/smithlab_cpp/QualityScore.hpp \
src/smithlab_cpp/bisulfite_utils.hpp \
src/smithlab_cpp/chromosome_utils.hpp \
src/smithlab_cpp/cigar_utils.hpp \
src/smithlab_cpp/dna_four_bit.hpp \
src/smithlab_cpp/htslib_wrapper.hpp \
src/smithlab_cpp/sim_utils.hpp \
src/smithlab_cpp/smithlab_os.hpp \
src/smithlab_cpp/smithlab_utils.hpp \
src/smithlab_cpp/zlib_wrapper.hpp

LDADD = libepievo.a libsmithlab_cpp.a

### PROG SUBDIR
bin_PROGRAMS = average_paths epievo_est_complete epievo_est_params_histories \
epievo_initialization epievo_sim epievo_sim_pairwise \
extract_state_sequences global_jumps_to_paths scale_tree

average_paths_SOURCES = src/prog/average_paths.cpp
epievo_est_complete_SOURCES = src/prog/epievo_est_complete.cpp
epievo_est_params_histories_SOURCES = src/prog/epievo_est_params_histories.cpp
epievo_initialization_SOURCES = src/prog/epievo_initialization.cpp
epievo_sim_SOURCES = src/prog/epievo_sim.cpp
epievo_sim_pairwise_SOURCES = src/prog/epievo_sim_pairwise.cpp
extract_state_sequences_SOURCES = src/prog/extract_state_sequences.cpp
global_jumps_to_paths_SOURCES = src/prog/global_jumps_to_paths.cpp
scale_tree_SOURCES = src/prog/scale_tree.cpp
42 changes: 42 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
dnl This file is part of epieov
dnl
dnl Copyright (C) 2020: University of Southern California
dnl Andrew D. Smith and Xiaojing Ji
dnl
dnl Authors: Andrew D. Smith
dnl
dnl This is free software: you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This software is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.

AC_INIT([epievo], [0.1.0], [andrewds@usc.edu],
[epievo], [https://github.com/smithlabcode/epievo])
dnl the config.h is not currently #included in the source, and only
dnl used to keep command lines short.
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([subdir-objects foreign])

dnl Less output to the terminal. Use "--disable-silent-rules" when
dnl running ./configure to reverse this.
AM_SILENT_RULES([yes])

AC_CONFIG_MACRO_DIR([m4])
AC_LANG(C++)
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
AC_PROG_RANLIB

dnl check for required libraries
AC_SEARCH_LIBS([cblas_dgemm], [gslcblas])
AC_SEARCH_LIBS([gsl_blas_dgemm], [gsl])

AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT
110 changes: 110 additions & 0 deletions m4/ax_cxx_check_lib.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
dnl @synopsis AX_CXX_CHECK_LIB(libname, functioname, action-if, action-if-not)
dnl
dnl The standard AC_CHECK_LIB can not test functions in namespaces.
dnl Therefore AC_CHECK_LIB(cgicc, cgicc::Cgicc::getVersion) will always
dnl fail. We need to decompose the functionname into a series of namespaces
dnl where it gets declared so that it can be used for a link test.
dnl
dnl In the first version I did allow namespace::functionname to be a
dnl reference to a void-argument global functionname (just wrapped in a
dnl namespace) like its C counterparts would be - but in reality such
dnl thing does not exist. The only global / static functions are always
dnl made const-functions which is an attribute mangled along into the
dnl library function export name.
dnl
dnl The normal usage will ask for a test of a class-member function which
dnl should be presented with a full function spec with arguments given in
dnl parentheses following the function name - if the function to test for
dnl does expect arguments then you should add default initial values in the
dnl prototype (even if they do not exist originally, these are used only
dnl locally to build a correct function call in the configure test script).
dnl
dnl In the current version if you do omit the parenthesis from the macro
dnl argument then the macro will assume that you want to check for the
dnl class name - which is really to check for default constructor being
dnl exported from the given library name.
dnl
dnl EXAMPLE:
dnl AX_CXX_CHECK_LIB(cgicc, [cgicc::HTTPCookie])
dnl AX_CXX_CHECK_LIB(cgicc, [cgicc::Cgicc::getVersion () const],
dnl AX_CXX_CHECK_LIB(boost_regex, [boost::RegEx::Position (int i = 0) const])
dnl
dnl Result:
dnl Just as the usual AX_CXX_CHECK_LIB - defines HAVE_LIBCGICC
dnl and adds the libraries to the default library path (and
dnl uses internally the normal ac_check_lib cache symbol
dnl like ac_cv_lib_cgicc_cgicc__Cgicc)
dnl
dnl Footnote: The C++ language is not good at creating stable library
dnl interfaces at the binary level - a lot of functionality is usually being
dnl given as inline functions plus there is hardly a chance to create opaque
dnl types. Therefore most C++ library tests will only do compile tests using
dnl the header files. Doing a check_lib is however good to check the link
dnl dependency before hitting it as an error in the build later.
dnl
dnl @category C++
dnl @author Guido U. Draheim
dnl @vesion 2006-12-18

AC_DEFUN([AX_CXX_CHECK_LIB],
[m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl
AS_LITERAL_IF([$1],
[AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
[AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl
AC_CACHE_CHECK([for $2 in -l$1], ac_Lib,
[ac_check_lib_save_LIBS=$LIBS
LIBS="-l$1 $5 $LIBS"
case "$2"
in *::*::*\(*)
AC_LINK_IFELSE([AC_LANG_PROGRAM([
namespace `echo "$2" | sed -e "s/::.*//"`
{ class `echo "$2" | sed -e "s/.*::\\(.*\\)::.*/\\1/" -e "s/(.*//"`
{ public: int `echo "$2" | sed -e "s/.*:://" -e "/(/!s/..*/&()/"`;
};
}
],[`echo "$2" | sed -e "s/(.*//" -e "s/\\(.*\\)::\\(.*\\)/((\\1*)(0))->\\2/g"`()])],
[AS_VAR_SET(ac_Lib, yes)],
[AS_VAR_SET(ac_Lib, no)])
;; *::*::*)
AC_LINK_IFELSE([AC_LANG_PROGRAM([
namespace `echo "$2" | sed -e "s/::.*//"`
{ namespace `echo "$2" | sed -e "s/.*::\\(.*\\)::.*/\\1/"`
{ class `echo "$2" | sed -e "s/.*:://"`
{ public: `echo "$2" | sed -e "s/.*:://"` ();
};
}
}
],[new $2()])],
[AS_VAR_SET(ac_Lib, yes)],
[AS_VAR_SET(ac_Lib, no)])
;; *::*\(*)
AC_LINK_IFELSE([AC_LANG_PROGRAM([
class `echo "$2" | sed -e "s/\\(.*\\)::.*/\\1/" -e "s/(.*//"`
{ public: int `echo "$2" | sed -e "s/.*:://" -e "/(/!s/..*/&()/"`;
};
],[`echo "$2" | sed -e "s/(.*//" -e "s/\\(.*\\)::\\(.*\\)/((\\1*)(0))->\\2/g"`()])],
[AS_VAR_SET(ac_Lib, yes)],
[AS_VAR_SET(ac_Lib, no)])
;; *::*)
AC_LINK_IFELSE([AC_LANG_PROGRAM([
namespace `echo "$2" | sed -e "s/::.*//"`
{ class `echo "$2" | sed -e "s/.*:://"`
{ public: `echo "$2" | sed -e "s/.*:://"` ();
};
}
],[new $2()])],
[AS_VAR_SET(ac_Lib, yes)],
[AS_VAR_SET(ac_Lib, no)])
;; *)
AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
[AS_VAR_SET(ac_Lib, yes)],
[AS_VAR_SET(ac_Lib, no)])
;; esac
LIBS=$ac_check_lib_save_LIBS])
AS_IF([test AS_VAR_GET(ac_Lib) = yes],
[m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
LIBS="-l$1 $LIBS"
])],
[$4])dnl
AS_VAR_POPDEF([ac_Lib])dnl
])# AC_CHECK_LIB
Loading

0 comments on commit ea421a5

Please sign in to comment.