Skip to content

Commit

Permalink
Static compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarcais committed Feb 6, 2020
1 parent 6b53c7d commit cfca395
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I m4

AM_CPPFLAGS = -std=c++11 $(BOOST_CPPFLAGS) $(EIGEN_CFLAGS) $(JELLYFISH_CFLAGS) $(HTSLIB_CFLAGS) $(GSL_CFLAGS) $(GUROBI_CFLAGS) $(CLP_CFLAGS) -fopenmp
AM_LDFLAGS = $(BOOST_IOSTREAMS_LDFLAGS) $(HTSLIB_LDFLAGS) $(JELLYFISH_LDFLAGS) $(GSL_LDFLAGS) $(GUROBI_LDFLAGS) $(CLP_CFLAGS) -fopenmp
AM_LDFLAGS = $(BOOST_IOSTREAMS_LDFLAGS) $(HTSLIB_LDFLAGS) $(JELLYFISH_LDFLAGS) $(GSL_LDFLAGS) $(GUROBI_LDFLAGS) $(CLP_LDFLAGS) $(STATIC_FLAGS) -fopenmp
LIBS = $(BOOST_IOSTREAMS_LIBS) $(HTSLIB_LIBS) $(GSL_LIBS) $(GUROBI_LIBS) $(CLP_LIBS) -lz -lm -fopenmp

EXTRA_DIST = src/spline.h src/logtime.hpp src/massert.hpp install-dependencies.sh
Expand Down
21 changes: 16 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ PKG_PROG_PKG_CONFIG
AC_LANG(C++)
AC_PROG_CXX

# --enable-all-static
# Do not use libtool if building all static
AC_ARG_ENABLE([all-static],
[AC_HELP_STRING([--enable-all-static], [create statically linked executable])])
STATIC_FLAGS=
AS_IF([test x$enable_all_static = xyes],
[AC_SUBST([STATIC_FLAGS], [-all-static])]
[PKG_CONFIG="$PKG_CONFIG --static"])

# Boost
BOOST_REQUIRE
BOOST_STATIC
Expand All @@ -38,12 +47,14 @@ PKG_CHECK_MODULES([JELLYFISH], [jellyfish-2.0])
PKG_CHECK_MODULES([HTSLIB], [htslib])
PKG_CHECK_MODULES([GSL], [gsl])


# Extra RPATH stuff?
AC_LIB_LINKFLAGS_FROM_LIBS([JELLYFISH_LDFLAGS], [$JELLYFISH_LIBS])
AC_LIB_LINKFLAGS_FROM_LIBS([HTSLIB_LDFLAGS], [$HTSLIB_LIBS])
AC_LIB_LINKFLAGS_FROM_LIBS([GSL_LDFLAGS], [$GSL_LIBS])
AC_LIB_LINKFLAGS_FROM_LIBS([GUROBI_LDFLAGS], [$GUROBI_LIBS])
AC_LIB_LINKFLAGS_FROM_LIBS([CLP_LDFLAGS], [$CLP_LIBS])
AS_IF([test x$enable_all_static != xyes],
[AC_LIB_LINKFLAGS_FROM_LIBS([JELLYFISH_LDFLAGS], [$JELLYFISH_LIBS])]
[AC_LIB_LINKFLAGS_FROM_LIBS([HTSLIB_LDFLAGS], [$HTSLIB_LIBS])]
[AC_LIB_LINKFLAGS_FROM_LIBS([GSL_LDFLAGS], [$GSL_LIBS])]
[AC_LIB_LINKFLAGS_FROM_LIBS([GUROBI_LDFLAGS], [$GUROBI_LIBS])]
[AC_LIB_LINKFLAGS_FROM_LIBS([CLP_LDFLAGS], [$CLP_LIBS])])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
6 changes: 3 additions & 3 deletions install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ else
tar -xjvf htslib-1.9.tar.bz2
cd ${Dir}/external/htslib-1.9/
mkdir -p Installation
./configure --prefix=${Dir}/external/htslib-1.9/Installation
./configure --prefix=${Dir}/external/htslib-1.9/Installation --enable-plugins=no --enable-libcurl=no --enable-s3=no
make
make install
cp $(find ${Dir}/external/htslib-1.9/Installation -name *.pc) ${Dir}/external/pkgconfig/
Expand Down Expand Up @@ -102,7 +102,7 @@ else
tar -zxf Clp-1.17.5.tgz
cd Clp-1.17.5/
mkdir -p Installation
./configure -C --prefix=${Dir}/external/Clp-1.17.5/Installation
./configure -C --prefix=${Dir}/external/Clp-1.17.5/Installation --enable-static
make
make install
cp $(find ${Dir}/external/Clp-1.17.5/Installation -name *.pc) ${Dir}/external/pkgconfig/
Expand All @@ -117,4 +117,4 @@ echo
echo "To configure with CLP, run: ./configure PKG_CONFIG_PATH=${PKG_CONFIG_PATH} BOOST_ROOT=${Dir}/external/boost_1_69_0/Installation"
echo "To configure with gurobi, run: ./configure PKG_CONFIG_PATH=${PKG_CONFIG_PATH} --with-gurobi=<path to gurobi linux64 folder> BOOST_ROOT=${Dir}/external/boost_1_69_0/Installation"
echo
echo "Then compile and install with: make install
echo "Then compile and install with: make install"

0 comments on commit cfca395

Please sign in to comment.