1# -*- Autoconf -*- 2# 3# Copyright (C) 2015 Yann Pouillon 4# 5# This file is part of the Libvdwxc software package. For license information, 6# please see the COPYING file in the top-level directory of the Libvdwxc source 7# distribution. 8# 9 10 11 12# VDW_PFFT_DETECT() 13# ----------------- 14# 15# Check whether the PFFT library is working. 16# 17AC_DEFUN([VDW_PFFT_DETECT],[ 18 dnl Init 19 vdw_pfft_ok="unknown" 20 vdw_pfft_has_hdrs="unknown" 21 vdw_pfft_has_libs="unknown" 22 23 dnl Backup environment 24 vdw_saved_CPPFLAGS="${CPPFLAGS}" 25 vdw_saved_LIBS="${LIBS}" 26 27 dnl Prepare build parameters 28 CPPFLAGS="${CPPFLAGS} ${vdw_pfft_incs}" 29 LIBS="${vdw_pfft_libs} ${LIBS}" 30 31 dnl Look for C includes 32 AC_LANG_PUSH([C]) 33 AC_CHECK_HEADERS([pfft.h], 34 [vdw_pfft_has_hdrs="yes"], [vdw_pfft_has_hdrs="no"]) 35 AC_LANG_POP([C]) 36 37 dnl Look for C libraries and routines 38 if test "${vdw_pfft_has_hdrs}" = "yes"; then 39 AC_LANG_PUSH([C]) 40 AC_MSG_CHECKING([whether the PFFT libraries work]) 41 AC_LINK_IFELSE([AC_LANG_PROGRAM( 42 [[ 43#include <pfft.h> 44 ]], 45 [[ 46 pfft_init(); 47 ]])], [vdw_pfft_has_libs="yes"], [vdw_pfft_has_libs="no"]) 48 AC_MSG_RESULT([${vdw_pfft_has_libs}]) 49 AC_LANG_POP([C]) 50 fi 51 52 dnl Take final decision 53 AC_MSG_CHECKING([whether we have a full PFFT support]) 54 if test "${vdw_pfft_has_hdrs}" = "yes" -a \ 55 "${vdw_pfft_has_libs}" = "yes"; then 56 vdw_pfft_ok="yes" 57 else 58 vdw_pfft_ok="no" 59 fi 60 AC_MSG_RESULT([${vdw_pfft_ok}]) 61 62 dnl Restore environment 63 CPPFLAGS="${vdw_saved_CPPFLAGS}" 64 LIBS="${vdw_saved_LIBS}" 65]) # VDW_PFFT_DETECT 66