autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFC: Macros for libs


From: Akim Demaille
Subject: RFC: Macros for libs
Date: 21 Sep 2001 18:48:05 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Hi!

I think we need some documentation on writing macros for using
libraries.  In the case of GNU M4, we can use GMP, and we use the
following macro.  I think it is the right way to write things, but I
would like to hear comments about it.  Then I'll write the doc.


m4_define([_AC_LIB_GMP],
[AC_ARG_WITH(gmp,
[  --without-gmp           don't use GNU multiple precision arithmetic library],
[use_gmp=$withval], [use_gmp=yes])

case $use_gmp:$GMP_LIB:$ac_cv_header_gmp_h in
  *::yes)
    AC_MSG_WARN([gmp library not found or does not appear to work
                 but `gmp.h' is present])
    ac_cv_using_lib_gmp=no
    ;;
  *:-lgmp:no)
    AC_MSG_WARN([gmp works but `gmp.h' is missing])
    ac_cv_using_lib_gmp=no
    ;;
  yes:*:yes)
    ac_cv_using_lib_gmp=yes
    ;;
  no:*)
    ac_cv_using_lib_gmp=no
    ;;
esac

if test "$ac_cv_using_lib_gmp" = yes; then
  AC_DEFINE(WITH_GMP, 1,
    [Define to 1 if the GNU multiple precision library should be used.])
fi
])# _AC_LIB_GMP

AC_DEFUN([AC_LIB_GMP],
[AC_CHECK_HEADERS([gmp.h])
AC_CHECK_LIB([gmp], [mpq_init], [GMP_LIB=-lgmp])
AC_SUBST([GMP_LIB])dnl

AC_CACHE_CHECK([if using GNU multiple precision arithmetic library],
                [ac_cv_using_lib_gmp],
                [_AC_LIB_GMP])
AC_SUBST([USE_GMP], [$ac_cv_using_lib_gmp])dnl
])# AC_LIB_GMP



reply via email to

[Prev in Thread] Current Thread [Next in Thread]