Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

98 linhas
3.2KB

  1. ## fth.m4 -- Autoconf macros for configuring FTH -*- Autoconf -*-
  2. ## Copyright (C) 2006 Michael Scholz
  3. ## Author: Michael Scholz <scholz-micha@gmx.de>
  4. ## Created: Mon Mar 13 17:14:46 CET 2006
  5. ## Changed: Thu Mar 23 13:46:43 CET 2006
  6. ## Ident: $Id: fth.m4,v 1.1.1.1 2006/03/25 21:29:50 mi-scholz Exp $
  7. ## This file is part of FTH.
  8. ## This program is free software; you can redistribute it and/or modify
  9. ## it under the terms of the GNU General Public License as published by
  10. ## the Free Software Foundation; either version 2 of the License, or
  11. ## (at your option) any later version.
  12. ## This program is distributed in the hope that it will be useful,
  13. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ## GNU General Public License for more details.
  16. ## You should have received a copy of the GNU General Public License
  17. ## along with this program; if not, write to the Free Software
  18. ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. ## Commentary:
  20. # FTH_CHECK_LIB(action-if-found, [action-if-not-found])
  21. #
  22. # Usage: FTH_CHECK_LIB([AC_DEFINE([HAVE_FORTH])])
  23. #
  24. # Don't quote this macro: [FTH_CHECK_LIB(...)] isn't correct.
  25. # Instead call it FTH_CHECK_LIB(...).
  26. #
  27. # Six variables will be substituted:
  28. #
  29. # FTH fth program path or no
  30. # FTH_VERSION version string or ""
  31. # FTH_CFLAGS -I${prefix}/include/fth or ""
  32. # FTH_LIBS -L${prefix}/lib -lfth or ""
  33. # FTH_HAVE_COMPLEX yes or no
  34. # FTH_HAVE_RATIO yes or no
  35. ## Code:
  36. # AC_CHECK_LIB was written by David MacKenzie.
  37. # This version is slightly changed to fit to FTH_CHECK_LIB.
  38. AC_DEFUN([fth_AC_CHECK_LIB],
  39. [
  40. m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl
  41. AS_LITERAL_IF([$1],
  42. [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
  43. [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl
  44. AC_CACHE_CHECK([m4_default([$4], [for $2 in -l$1])], ac_Lib,
  45. [fth_check_lib_save_LIBS=$LIBS
  46. LIBS="-l$1 $5 $LIBS"
  47. AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
  48. [AS_VAR_SET(ac_Lib, yes)],
  49. [AS_VAR_SET(ac_Lib, no)])
  50. LIBS=$fth_check_lib_save_LIBS])
  51. AS_IF([test AS_VAR_GET(ac_Lib) = yes],
  52. [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1)) LIBS="-l$1 $LIBS"])])dnl
  53. AS_VAR_POPDEF([ac_Lib])dnl
  54. ])# fth_AC_CHECK_LIB
  55. AC_DEFUN([FTH_CHECK_LIB],
  56. [
  57. [AC_PATH_PROG([FTH], [fth], [no])]
  58. FTH_VERSION=""
  59. FTH_CFLAGS=""
  60. FTH_LIBS=""
  61. FTH_HAVE_COMPLEX=no
  62. FTH_HAVE_RATIO=no
  63. AC_MSG_CHECKING([for Forth])
  64. if test "${FTH}" != no ; then
  65. FTH_VERSION=`${FTH} --no-init-file --eval .version`
  66. FTH_CFLAGS=`${FTH} --no-init-file --eval .cflags`
  67. FTH_LIBS=`${FTH} --no-init-file --eval .libs`
  68. AC_MSG_RESULT([FTH version ${FTH_VERSION}])
  69. fth_AC_CHECK_LIB([fth], [fth_make_complex], [FTH_HAVE_COMPLEX=yes],
  70. [whether FTH supports complex numbers], [${FTH_LIBS}])
  71. fth_AC_CHECK_LIB([fth], [fth_ratio_floor], [FTH_HAVE_RATIO=yes],
  72. [whether FTH supports rational numbers], [${FTH_LIBS}])
  73. [$1]
  74. else
  75. AC_MSG_RESULT([no])
  76. [$2]
  77. fi
  78. AC_SUBST([FTH_VERSION])
  79. AC_SUBST([FTH_CFLAGS])
  80. AC_SUBST([FTH_LIBS])
  81. AC_SUBST([FTH_HAVE_COMPLEX])
  82. AC_SUBST([FTH_HAVE_RATIO])
  83. ])# FTH_CHECK_LIB
  84. ## fth.m4 ends here