Commit 2165653e by Maarten L. Hekkelman

refactored configure

parent 56adb0fd
......@@ -27,15 +27,18 @@ empty =
space = $(empty) $(empty)
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@ \
CXXFLAGS = @BOOST_CPPFLAGS@ \
@CXXFLAGS@ \
@CPPFLAGS@ \
@PTHREAD_CFLAGS@ \
@CIFPP_CFLAGS@
LDFLAGS = @LDFLAGS@ \
LDFLAGS = @BOOST_LDFLAGS@ \
@LDFLAGS@ \
@PTHREAD_CFLAGS@
LIBS = @CIFPP_LIBS@ \
@BOOST_IOSTREAMS_LIB@ \
LIBS = @PTHREAD_LIBS@ \
@CIFPP_LIBS@ \
@BOOST_PROGRAM_OPTIONS_LIB@ \
@BOOST_IOSTREAMS_LIB@ \
@BOOST_DATE_TIME_LIB@ \
@BOOST_REGEX_LIB@ \
@LIBS@
......@@ -128,6 +131,10 @@ ifneq "$(USE_RSRC)" "0"
OBJECTS += $(PROGRAM)_rsrc.o
# dictionaries may be found compressed
%.dic: %.dic.gz
gunzip -c $^ > $@
$(OBJDIR)/$(PROGRAM)_rsrc.o: $(RESOURCES)
$(MRC) -o $@ $^
......
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2020 NKI/AVL, Netherlands Cancer Institute
#
# 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.
#
# 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.
#
# Description: m4 macro to detect std::filesystem and optionally the linker flags to use it
AC_DEFUN([AX_FILESYSTEM],
[
AC_CHECK_HEADER([filesystem], [], [AC_MSG_ERROR([The file <filesystem> is missing, perhaps you should install a more recent libstdc++ implementation.])])
dnl check if we need stdc++fs as library
AC_TRY_LINK(
[#include <filesystem>],
[(void)std::filesystem::current_path();],
[],
[
LIBS="$LIBS -lstdc++fs"
AC_TRY_LINK(
[#include <filesystem>],
[(void)std::filesystem::current_path();],
[],
[
AC_MSG_ERROR([Could not link filesystem])
]
)
]
)
])
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2020 NKI/AVL, Netherlands Cancer Institute
#
# 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.
#
# 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.
#
# Description: m4 macro to detect std::filesystem and optionally the linker flags to use it
#
# Description: Check for libcifpp
AC_DEFUN([AX_LIBCIFPP],
[
AC_ARG_WITH([cif++],
AS_HELP_STRING([--with-cif++=@<:@location@:>@],
[Use the cif++ library as specified.]),
[
AS_IF([test -d ${withval}/include], [], [
AC_MSG_ERROR(['${withval}'' is not a valid directory for --with-cif++])
])
CIFPP_CFLAGS="-I ${withval}/include"
CIFPP_LIBS="-L${withval}/.libs -lcifpp"
LIBCIFPP_DATA_DIR="${withval}/rsrc"
AC_SUBST([CIFPP_CFLAGS], [$CIFPP_CFLAGS])
AC_SUBST([CIFPP_LIBS], [$CIFPP_LIBS])
])
AS_IF([test "x$CIFPP_LIBS" = "x"], [
if test -x "$PKG_CONFIG"
then
AX_PKG_CHECK_MODULES([CIFPP], [libcifpp], [], [], [AC_MSG_ERROR([the required package libcif++ is not installed])])
LIBCIFPP_DATA_DIR=$(pkg-config --variable=datalibdir libcifpp)
else
AC_CHECK_HEADER(
[cif++/Cif++.hpp],
[
dnl CIFPP_CFLAGS="-I ${withval}/include"
],
[AC_MSG_ERROR([
Can't find the libcif++ header, Config.hpp. Make sure that it
is installed, and either use the --with-cif++ option or install
pkg-config.])])
AX_CHECK_LIBRARY([CIFPP], [cif++/Cif++.hpp], [cifpp],
[
LIBS="-lcifpp $LIBS"
],
[AC_MSG_ERROR([libcif++ not found])])
AS_IF([ test -f /usr/local/share/libcifpp/mmcif_pdbx_v50.dic.gz ], [LIBCIFPP_DATA_DIR=/usr/local/share/libcifpp/ ])
AS_IF([ test -f /var/cache/libcifpp/mmcif_pdbx_v50.dic.gz ], [LIBCIFPP_DATA_DIR=/var/cache/libcifpp ])
fi
])
AC_ARG_VAR([LIBCIFPP_DATA_DIR], [Directory containing mmcif_pdbx_v50.dic file])
AC_SUBST([LIBCIFPP_DATA_DIR], [$LIBCIFPP_DATA_DIR])
])
\ No newline at end of file
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2020 NKI/AVL, Netherlands Cancer Institute
#
# 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.
#
# 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.
#
# Description: m4 macro to detect mrc, the resource compiler
AC_DEFUN([AX_MRC],
[
AC_ARG_VAR([MRC], [Specify a location for the mrc executable])
dnl using resources?
USE_RSRC=0
if test "x$MRC" = "x"; then
AC_PATH_PROG([MRC], [mrc])
fi
if test "x$MRC" = "x"; then
AC_MSG_WARN([The mrc application was not found, not using resources.])
else
AC_ARG_ENABLE(
resources,
[AS_HELP_STRING([--disable-resources], [Do not use mrc to store data in resources])])
AS_IF([test "x$enable_resources" != "xno" ], [
USE_RSRC=1
])
fi
AC_SUBST([USE_RSRC], [$USE_RSRC])
AC_DEFINE_UNQUOTED([USE_RSRC], [$USE_RSRC], [Use mrc to store resources])
])
\ No newline at end of file
......@@ -585,7 +585,7 @@ PACKAGE_STRING='mkdssp 4.0.0'
PACKAGE_BUGREPORT='m.hekkelman@nki.nl'
PACKAGE_URL=''
ac_unique_file="src/dssp.cpp"
ac_unique_file="src/mkdssp.cpp"
ac_default_prefix=/usr/local
# Factoring default headers for most tests.
ac_includes_default="\
......@@ -3733,6 +3733,7 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
ac_config_headers="$ac_config_headers src/config.hpp"
......@@ -5546,10 +5547,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
USE_RSRC=0
if test "x$MRC" = "x"; then
# Extract the first word of "mrc", so it can be a program name with args.
USE_RSRC=0
if test "x$MRC" = "x"; then
# Extract the first word of "mrc", so it can be a program name with args.
set dummy mrc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
......@@ -5589,26 +5591,26 @@ $as_echo "no" >&6; }
fi
fi
fi
if test "x$MRC" = "x"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The mrc application was not found, not using resources." >&5
if test "x$MRC" = "x"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The mrc application was not found, not using resources." >&5
$as_echo "$as_me: WARNING: The mrc application was not found, not using resources." >&2;}
else
# Check whether --enable-resources was given.
else
# Check whether --enable-resources was given.
if test "${enable_resources+set}" = set; then :
enableval=$enable_resources;
fi
if test "x$enable_resources" != "xno" ; then :
if test "x$enable_resources" != "xno" ; then :
USE_RSRC=1
USE_RSRC=1
fi
fi
fi
USE_RSRC=$USE_RSRC
USE_RSRC=$USE_RSRC
......@@ -5617,6 +5619,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
# Check whether --enable-revision was given.
if test "${enable_revision+set}" = set; then :
enableval=$enable_revision;
......@@ -5895,7 +5898,8 @@ fi
done
ac_fn_cxx_check_header_mongrel "$LINENO" "filesystem" "ac_cv_header_filesystem" "$ac_includes_default"
ac_fn_cxx_check_header_mongrel "$LINENO" "filesystem" "ac_cv_header_filesystem" "$ac_includes_default"
if test "x$ac_cv_header_filesystem" = xyes; then :
else
......@@ -5904,7 +5908,7 @@ fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <filesystem>
int
......@@ -5919,9 +5923,9 @@ if ac_fn_cxx_try_link "$LINENO"; then :
else
LIBS="$LIBS -lstdc++fs"
LIBS="$LIBS -lstdc++fs"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <filesystem>
int
......@@ -5936,7 +5940,7 @@ if ac_fn_cxx_try_link "$LINENO"; then :
else
as_fn_error $? "Could not link filesystem" "$LINENO" 5
as_fn_error $? "Could not link filesystem" "$LINENO" 5
fi
......@@ -5950,6 +5954,7 @@ rm -f core conftest.err conftest.$ac_objext \
# Check whether --with-boost was given.
if test "${with_boost+set}" = set; then :
withval=$with_boost;
......@@ -7194,38 +7199,34 @@ fi
fi
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
# Check whether --with-cif++ was given.
if test "${with_cif__+set}" = set; then :
withval=$with_cif__;
if test -d ${withval}/include; then :
if test -d ${withval}/include; then :
else
as_fn_error $? "'${withval}'' is not a valid directory for --with-cif++" "$LINENO" 5
as_fn_error $? "'${withval}'' is not a valid directory for --with-cif++" "$LINENO" 5
fi
CIFPP_CFLAGS="-I ${withval}/include"
CIFPP_LIBS="-L${withval}/.libs -lcifpp"
LIBCIFPP_DATA_DIR="${withval}/rsrc"
CIFPP_CFLAGS="-I ${withval}/include"
CIFPP_LIBS="-L${withval}/.libs -lcifpp"
LIBCIFPP_DATA_DIR="${withval}/rsrc"
CIFPP_CFLAGS=$CIFPP_CFLAGS
CIFPP_CFLAGS=$CIFPP_CFLAGS
CIFPP_LIBS=$CIFPP_LIBS
CIFPP_LIBS=$CIFPP_LIBS
fi
if test "x$CIFPP_LIBS" = "x"; then :
if test "x$CIFPP_LIBS" = "x"; then :
if test -x "$PKG_CONFIG"
then
if test -x "$PKG_CONFIG"
then
......@@ -7309,17 +7310,17 @@ fi
LIBCIFPP_DATA_DIR=$(pkg-config --variable=datalibdir libcifpp)
else
ac_fn_cxx_check_header_mongrel "$LINENO" "cif++/Cif++.hpp" "ac_cv_header_cifpp_Cifpp_hpp" "$ac_includes_default"
LIBCIFPP_DATA_DIR=$(pkg-config --variable=datalibdir libcifpp)
else
ac_fn_cxx_check_header_mongrel "$LINENO" "cif++/Cif++.hpp" "ac_cv_header_cifpp_Cifpp_hpp" "$ac_includes_default"
if test "x$ac_cv_header_cifpp_Cifpp_hpp" = xyes; then :
else
as_fn_error $? "
Can't find the libcif++ header, Config.hpp. Make sure that it
is installed, and either use the --with-cif++ option or install
pkg-config." "$LINENO" 5
Can't find the libcif++ header, Config.hpp. Make sure that it
is installed, and either use the --with-cif++ option or install
pkg-config." "$LINENO" 5
fi
......@@ -7401,24 +7402,25 @@ fi
$as_echo "#define HAVE_CIFPP 1" >>confdefs.h
LIBS="-lcifpp $LIBS"
LIBS="-lcifpp $LIBS"
else
as_fn_error $? "libcif++ not found" "$LINENO" 5
fi
if test -f /usr/local/share/libcifpp/mmcif_pdbx_v50.dic.gz ; then :
if test -f /usr/local/share/libcifpp/mmcif_pdbx_v50.dic.gz ; then :
LIBCIFPP_DATA_DIR=/usr/local/share/libcifpp/
fi
if test -f /var/cache/libcifpp/mmcif_pdbx_v50.dic.gz ; then :
if test -f /var/cache/libcifpp/mmcif_pdbx_v50.dic.gz ; then :
LIBCIFPP_DATA_DIR=/var/cache/libcifpp
fi
fi
fi
fi
LIBCIFPP_DATA_DIR=$LIBCIFPP_DATA_DIR
LIBCIFPP_DATA_DIR=$LIBCIFPP_DATA_DIR
......
......@@ -8,7 +8,7 @@ m4_define([dssp_version],[dssp_version_major().dssp_version_minor().dssp_version
AC_INIT([mkdssp], [dssp_version], [m.hekkelman@nki.nl])
dnl Switch to a C++ compiler, and check if it works.
dnl Switch to a decent C++ compiler, and check if it works.
AC_LANG(C++)
AX_CXX_COMPILE_STDCXX_17([noext])
......@@ -17,8 +17,9 @@ AX_CHECK_COMPILE_FLAG([-fstandalone-debug],
CXXFLAGS="$CXXFLAGS -fstandalone-debug"
] , , [-Werror])
AC_CONFIG_SRCDIR([src/dssp.cpp])
AC_CONFIG_SRCDIR([src/mkdssp.cpp])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([config/m4])
AC_CONFIG_HEADERS([src/config.hpp])
AC_PREFIX_DEFAULT(/usr/local)
......@@ -30,30 +31,7 @@ AX_PTHREAD
AC_ARG_VAR([DEBUG], [Build a debug version of the application])
AC_ARG_VAR([MRC], [Specify a location for the mrc executable])
dnl using resources?
USE_RSRC=0
if test "x$MRC" = "x"; then
AC_PATH_PROG([MRC], [mrc])
fi
if test "x$MRC" = "x"; then
AC_MSG_WARN([The mrc application was not found, not using resources.])
else
AC_ARG_ENABLE(
resources,
[AS_HELP_STRING([--disable-resources], [Do not use mrc to store data in resources])])
AS_IF([test "x$enable_resources" != "xno" ], [
USE_RSRC=1
])
fi
AC_SUBST([USE_RSRC], [$USE_RSRC])
AC_DEFINE_UNQUOTED([USE_RSRC], [$USE_RSRC], [Use mrc to store resources])
AX_MRC
dnl revision numbering is something used internally at the NKI
AC_ARG_ENABLE(
......@@ -66,84 +44,14 @@ AS_IF([test "x$enable_revision" != "xno" ], [
AC_SUBST([UPDATE_REVISION], [$UPDATE_REVISION])
AC_CHECK_HEADER([filesystem], [], [AC_MSG_ERROR([The file <filesystem> is missing, perhaps you should install a more recent libstdc++ implementation.])])
dnl check if we need stdc++fs as library
AC_TRY_LINK(
[#include <filesystem>],
[(void)std::filesystem::current_path();],
[],
[
LIBS="$LIBS -lstdc++fs"
AC_TRY_LINK(
[#include <filesystem>],
[(void)std::filesystem::current_path();],
[],
[
AC_MSG_ERROR([Could not link filesystem])
]
)
]
)
AX_FILESYSTEM
AX_BOOST_BASE([1.65.1], [], [AC_MSG_ERROR([Could not find a recent version of boost])])
AX_BOOST_IOSTREAMS
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_DATE_TIME
AX_BOOST_REGEX
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
dnl Check for libcifpp
AC_ARG_WITH([cif++],
AS_HELP_STRING([--with-cif++=@<:@location@:>@],
[Use the cif++ library as specified.]),
[
AS_IF([test -d ${withval}/include], [], [
AC_MSG_ERROR(['${withval}'' is not a valid directory for --with-cif++])
])
dnl AC_SUBST([CIFPP_CFLAGS], ["-I ${withval}/include"])
dnl AC_SUBST([CIFPP_LIBS], ["-L${withval}/.libs -lcif++"])
CIFPP_CFLAGS="-I ${withval}/include"
CIFPP_LIBS="-L${withval}/.libs -lcifpp"
LIBCIFPP_DATA_DIR="${withval}/rsrc"
AC_SUBST([CIFPP_CFLAGS], [$CIFPP_CFLAGS])
AC_SUBST([CIFPP_LIBS], [$CIFPP_LIBS])
])
AS_IF([test "x$CIFPP_LIBS" = "x"], [
if test -x "$PKG_CONFIG"
then
AX_PKG_CHECK_MODULES([CIFPP], [libcifpp], [], [], [AC_MSG_ERROR([the required package libcif++ is not installed])])
LIBCIFPP_DATA_DIR=$(pkg-config --variable=datalibdir libcifpp)
else
AC_CHECK_HEADER(
[cif++/Cif++.hpp],
[
dnl CIFPP_CFLAGS="-I ${withval}/include"
],
[AC_MSG_ERROR([
Can't find the libcif++ header, Config.hpp. Make sure that it
is installed, and either use the --with-cif++ option or install
pkg-config.])])
AX_CHECK_LIBRARY([CIFPP], [cif++/Cif++.hpp], [cifpp],
[
LIBS="-lcifpp $LIBS"
],
[AC_MSG_ERROR([libcif++ not found])])
AS_IF([ test -f /usr/local/share/libcifpp/mmcif_pdbx_v50.dic.gz ], [LIBCIFPP_DATA_DIR=/usr/local/share/libcifpp/ ])
AS_IF([ test -f /var/cache/libcifpp/mmcif_pdbx_v50.dic.gz ], [LIBCIFPP_DATA_DIR=/var/cache/libcifpp ])
fi
])
AC_ARG_VAR([LIBCIFPP_DATA_DIR], [Directory containing mmcif_pdbx_v50.dic file])
AC_SUBST([LIBCIFPP_DATA_DIR], [$LIBCIFPP_DATA_DIR])
AX_LIBCIFPP
dnl These are still needed outside the Debian environment
AX_CHECK_LIBRARY([LIBZ], [zlib.h], [z],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment