https://github.com/cran/rsprng
Raw File
Tip revision: 907d5ffcbab7d2e39869a548955d28928b9489bc authored by Na (Michael) Li on 06 June 2008, 00:00:00 UTC
version 0.4
Tip revision: 907d5ff
configure.in
# Process this file with autoconf to produce a configure script.

AC_INIT(DESCRIPTION)

AC_PROG_CC()

AC_ARG_WITH(sprng,
            AC_HELP_STRING([--with-sprng=/path/to/sprng],
                           [Location of SPRNG library]),
           [SPRNG_ROOT=${withval}],) 

echo "Try to find sprng.h ..."
if test -f ${SPRNG_ROOT}/include/sprng.h; then
    echo "Found in ${SPRNG_ROOT}/include"
    SPRNG_INCLUDE="-I${SPRNG_ROOT}/include"
elif test -f "/usr/include/sprng/sprng.h"; then
    # Latest Debian puts the header files there
    echo "Found in /usr/include/sprng"
    SPRNG_INCLUDE="-I/usr/include/sprng"
elif test -f "/usr/local/include/sprng.h"; then
    echo "Found in /usr/local/include";
    SPRNG_INCLUDE="-I/usr/local/include";
else 
    AC_CHECK_HEADER(sprng.h,SPRNG_INCLUDE="",
                    [ echo "Cannot find sprng 2.0 header file."; exit 1 ])
fi

echo "Try to find libsprng.a ..."
if test -f ${SPRNG_ROOT}/lib/libsprng.a; then
    echo "Found in ${SPRNG_ROOT}/lib"
    SPRNG_LIBS="-L${SPRNG_ROOT}/lib -lsprng"
else
    AC_CHECK_LIB(sprng,main,SPRNG_LIBS="-lsprng",
                 [ echo "Cannot find libsprng"; exit 1 ])
fi

echo "Try to find libgmp.a if we need it ..."
AC_ARG_WITH(gmp,
            AC_HELP_STRING([--with-gmp=yes], 
                           [whether sprng was built with gmp (default=yes)]),
            [ use_gmp=${withval} ],
            [ use_gmp="yes" ])

if test "${use_gmp}" = "no"; then
    echo "OK, don't need it." 
elif test -f ${GMP_ROOT}/lib/libgmp.a; then
    echo "Found libgmp.a at ${GMP_ROOT}."
    SPRNG_LIBS="$SPRNG_LIBS -L${GMP_ROOT}/lib -lgmp"
elif test "${use_gmp}" = "yes"; then
    AC_CHECK_LIB(gmp,main,SPRNG_LIBS="$SPRNG_LIBS -lgmp",
                 [ echo "libgmp not found. exiting..."; exit 1 ])
elif test -f "${use_gmp}/libgmp.a"; then
    echo "Found libgmp.a at ${use_gmp}."
    SPRNG_LIBS="$SPRNG_LIBS -L${use_gmp} -lgmp"
else
    echo "libgmp is needed but not found in specified directory ${withval}."
    exit 1
fi

AC_ARG_ENABLE(check-pointers,
              AC_HELP_STRING([--enable-check-pointers=yes],
                             [Enable pointer checking in sprng (default=yes)]),
              [ if test "${enableval}" = "yes"; then
                    AC_DEFINE(CHECK_POINTERS)
                fi ],
              AC_DEFINE(CHECK_POINTERS),)

PKG_LIBS="${SPRNG_LIBS}"
PKG_CPPFLAGS="${SPRNG_INCLUDE}"

AC_SUBST(PKG_LIBS)
AC_SUBST(PKG_CPPFLAGS)
AC_SUBST(DEFS)

AC_OUTPUT(src/Makevars)
back to top