# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
### Copyright (C) 2015, 2016 Olaf Till
###
### 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
### .
AC_PREREQ(2.62)
AC_INIT(parallel, 3.0.3, address@hidden)
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile)
AC_CHECK_PROG(OCTAVE_CONFIG, octave-config, octave-config)
## If we are on a problematic platform, only the functions for local
## parallelism are installed by default.
AC_ARG_ENABLE([cluster],
[AS_HELP_STRING([--enable-cluster], [build functions for parallelism over clusters (default is platform dependent)])])
problem=no;
if test "$GXX" != yes; then
problem=yes;
else
machine=`$CXX $CXXFLAGS $LDFLAGS -dumpmachine`;
if echo $machine | grep -qi "mingw" ||
echo $machine | grep -qi "cygwin"; then
problem=yes;
fi
fi
if test "$problem" == "yes"; then
AC_MSG_WARN([This may be a platform at which this packages functions for local parallelism will work slower than on a system based on the Linux kernel.])
fi
if ( test "$problem" == "yes" && test "x$enable_cluster" != "xyes" ) ||
test "x$enable_cluster" = "xno"; then
AC_SUBST([REDUCED_BUILD], [yes])
if test "x$enable_cluster" != "xno"; then
AC_MSG_WARN([The functions for parallelism over clusters will not be built for this platform. Override with --enable-cluster.])
else
AC_MSG_WARN([As requested, the functions for parallelism over clusters will not be built.])
fi
else
AC_SUBST([REDUCED_BUILD], [no])
# Checks for gnutls libraries.
AC_CHECK_HEADER([gnutls/gnutls.h])
if test "x$ac_cv_header_gnutls_gnutls_h" = "xyes"; then
AC_CHECK_LIB([gnutls], [gnutls_global_init], [[echo -n ""]])
if test "x$ac_cv_lib_gnutls_gnutls_global_init" = "xyes"; then
LIBS="-lgnutls $LIBS"
AC_CHECK_PROG(PKG_CONFIG, pkg-config, pkg-config)
if test -z "$PKG_CONFIG"; then
AC_SUBST([HAVE_GNUTLS], [no])
AC_MSG_WARN([TLS disabled since pkg-config not found])
else
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include ]
[#include ]],
[[printf ("%u", gnutls_srp_2048_group_prime.size);]])],
[AC_DEFINE([HAVE_LIBGNUTLS], 1)
AC_SUBST([HAVE_GNUTLS], [yes])],
[AC_SUBST([HAVE_GNUTLS], [no])
AC_MSG_WARN([TLS disabled since symbol gnutls_srp_2048_group_prime not found in gnutls library - built with --disable-srp-authentication?])])
fi
AC_CHECK_LIB([gnutls-extra], [gnutls_global_init_extra], [[echo -n ""]])
if test "x$ac_cv_lib_gnutls_extra_gnutls_global_init_extra" = "xyes"; then
LIBS="-lgnutls-extra $LIBS"
AC_DEFINE([HAVE_LIBGNUTLS_EXTRA], 1)
AC_SUBST([HAVE_GNUTLS_EXTRA], [yes])
else
AC_SUBST([HAVE_GNUTLS_EXTRA], [no])
fi
else
AC_SUBST([HAVE_GNUTLS], [no])
AC_MSG_WARN([TLS disabled since no gnutls library found])
fi
else
AC_SUBST([HAVE_GNUTLS], [no])
AC_MSG_WARN([TLS disabled since gnutls/gnutls.h not found or not compilable])
fi
fi
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h malloc.h sys/malloc.h netdb.h netinet/in.h stdio_ext.h stdlib.h string.h sys/socket.h sys/time.h termios.h unistd.h])
if test "x$ac_cv_header_malloc_h" = "xno"; then
if test "x$ac_cv_header_sys_malloc_h" = "xno"; then
AC_MSG_ERROR([neither malloc.h nor sys/malloc.h found])
fi
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_INT32_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT32_T
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_FSEEKO
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([memset mkdir modf select socket strchr strdup uname])
AC_CHECK_FUNC([getpass])
if test "x$ac_cv_func_getpass" = "xyes"; then
AC_DEFINE([HAVE_GETPASS], 1)
AC_SUBST([HAVE_GETPASS], [yes])
else
AC_SUBST([HAVE_GETPASS], [no])
fi
# Start of checks for Octave features, preparations for checks.
OCTLIBDIR=${OCTLIBDIR:-`$OCTAVE_CONFIG -p OCTLIBDIR`}
OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$OCTAVE_CONFIG -p OCTINCLUDEDIR`}
AC_LANG_PUSH([C++])
TCXXFLAGS=$CXXFLAGS
TLDFLAGS=$LDFLAGS
TLIBS=$LIBS
LDFLAGS="-L$OCTLIBDIR $LDFLAGS"
LIBS="-loctinterp $LIBS"
CXXFLAGS="-I$OCTINCLUDEDIR $CXXFLAGS"
## Presence of 'error_state' -- does _not_ indicate no exceptions are
## used.
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include ]
[#include ]],
[[printf ("%i", error_state);]])],
[AC_DEFINE([HAVE_OCTAVE_ERROR_STATE], 1)])
## Presence of 'verror (octave_execution_exception&, const char *,
## va_list)'
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include ]],
[[octave_execution_exception e;]
[va_list args;]
[verror (e, "test", args);]])],
[AC_DEFINE([HAVE_OCTAVE_VERROR_ARG_EXC], 1)])
LIBS=$TLIBS
LDFLAGS=$TLDFLAGS
CXXFLAGS=$TCXXFLAGS
AC_LANG_POP([C++])
# End of checks for Octave features.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT