1# -*- Autoconf -*- 2 3AU_ALIAS([ACX_SPGLIB], [AX_SPGLIB]) 4AC_DEFUN([ACX_SPGLIB], 5 [ 6 have_spglib=no 7 AC_ARG_WITH(spglib, 8 [AC_HELP_STRING([--with-spglib=yes/no/PATH], 9 [check for spglib support (default yes)])], 10 [spglib_prefix=$withval], 11 [spglib_prefix=/usr/local]) 12 13 AS_IF([test "$with_spglib" != "no"], 14 [ 15 __ac_cppflags_=$CPPFLAGS 16 CPPFLAGS="-I$spglib_prefix/include" 17 #check for the header file 18 AC_CHECK_HEADER([spglib.h], 19 [SPGLIB_CFLAGS=-I$spglib_prefix/include 20 spglib_header_found=yes], 21 [AC_CHECK_HEADER([spglib/spglib.h], 22 [SPGLIB_CFLAGS="-I$spglib_prefix/include -I$spglib_prefix/include/spglib" 23 spglib_header_found=yes], 24 [spglib_header_found=no]) 25 ]) 26 CPPFLAGS=$__ac_cppflags_ 27 AS_IF([test "$spglib_header_found" == "yes"], [ 28 # strickly speaking we should also check for the library, but if the header file 29 # is not present no point for checking the library 30 SPGLIB_LIBS="-lsymspg" 31 SPGLIB_LDFLAGS="-L$spglib_prefix/lib" 32 have_spglib="yes"]) 33 ]) 34 AC_SUBST(SPGLIB_CFLAGS) 35 AC_SUBST(SPGLIB_LDFLAGS) 36 AC_SUBST(SPGLIB_LIBS) 37 38 AS_IF([test "$spglib_header_found" = "yes"], 39 [AC_DEFINE(HAVE_SPGLIB, 1, [spglib is present])]) 40 AS_IF([test "$have_spglib" = "yes"], [$1], [$2]) 41 ]) 42