octave.m4 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. dnl Evaluate an expression in octave
  2. dnl
  3. dnl OCTAVE_EVAL(expr,var) -> var=expr
  4. dnl
  5. dnl Stolen from octave-forge
  6. AC_DEFUN([OCTAVE_EVAL],
  7. [
  8. AC_MSG_CHECKING([for $1 in $OCTAVE])
  9. $2=`TERM=;$OCTAVE -qfH --eval "disp($1)"`
  10. AC_MSG_RESULT($$2)
  11. AC_SUBST($2)
  12. ]) # OCTAVE_EVAL
  13. dnl @synopsis AC_OCTAVE_VERSION
  14. dnl
  15. dnl Find the version of Octave.
  16. dnl @version 1.0 Aug 23 2007
  17. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  18. dnl
  19. dnl Permission to use, copy, modify, distribute, and sell this file for any
  20. dnl purpose is hereby granted without fee, provided that the above copyright
  21. dnl and this permission notice appear in all copies. No representations are
  22. dnl made about the suitability of this software for any purpose. It is
  23. dnl provided "as is" without express or implied warranty.
  24. dnl
  25. AC_DEFUN([AC_OCTAVE_VERSION],
  26. [
  27. AC_ARG_WITH(octave,
  28. AS_HELP_STRING([--with-octave], [choose the octave version]),
  29. [ with_octave=$withval ])
  30. test -z "$with_octave" && with_octave=octave
  31. AC_CHECK_PROG(HAVE_OCTAVE,$with_octave,yes,no)
  32. if test "x$ac_cv_prog_HAVE_OCTAVE" = "xyes" ; then
  33. OCTAVE=$with_octave
  34. OCTAVE_EVAL(OCTAVE_VERSION,OCTAVE_VERSION)
  35. fi
  36. AC_SUBST(OCTAVE)
  37. AC_SUBST(OCTAVE_VERSION)
  38. ])# AC_OCTAVE_VERSION
  39. dnl @synopsis AC_OCTAVE_CONFIG_VERSION
  40. dnl
  41. dnl Find the version of Octave.
  42. dnl @version 1.0 Aug 23 2007
  43. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  44. dnl
  45. dnl Permission to use, copy, modify, distribute, and sell this file for any
  46. dnl purpose is hereby granted without fee, provided that the above copyright
  47. dnl and this permission notice appear in all copies. No representations are
  48. dnl made about the suitability of this software for any purpose. It is
  49. dnl provided "as is" without express or implied warranty.
  50. dnl
  51. AC_DEFUN([AC_OCTAVE_CONFIG_VERSION],
  52. [
  53. AC_ARG_WITH(octave-config,
  54. AS_HELP_STRING([--with-octave-config], [choose the octave-config version]),
  55. [ with_octave_config=$withval ])
  56. test -z "$with_octave_config" && with_octave_config=octave-config
  57. AC_CHECK_PROG(HAVE_OCTAVE_CONFIG,$with_octave_config,yes,no)
  58. if test "x$ac_cv_prog_HAVE_OCTAVE_CONFIG" = "xyes" ; then
  59. OCTAVE_CONFIG=$with_octave_config
  60. AC_MSG_CHECKING([for version of $OCTAVE_CONFIG])
  61. OCTAVE_CONFIG_VERSION=`$OCTAVE_CONFIG --version`
  62. AC_MSG_RESULT($OCTAVE_CONFIG_VERSION)
  63. fi
  64. AC_SUBST(OCTAVE_CONFIG)
  65. AC_SUBST(OCTAVE_CONFIG_VERSION)
  66. ])# AC_OCTAVE_CONFIG_VERSION
  67. dnl @synopsis AC_OCTAVE_BUILD
  68. dnl
  69. dnl Check programs and headers required for building octave plugins.
  70. dnl @version 1.0 Aug 23 2007
  71. dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
  72. dnl
  73. dnl Permission to use, copy, modify, distribute, and sell this file for any
  74. dnl purpose is hereby granted without fee, provided that the above copyright
  75. dnl and this permission notice appear in all copies. No representations are
  76. dnl made about the suitability of this software for any purpose. It is
  77. dnl provided "as is" without express or implied warranty.
  78. AC_DEFUN([AC_OCTAVE_BUILD],
  79. [
  80. dnl Default to no.
  81. OCTAVE_BUILD=no
  82. AC_OCTAVE_VERSION
  83. OCTAVE_MKOCTFILE_VERSION
  84. AC_OCTAVE_CONFIG_VERSION
  85. prog_concat="$ac_cv_prog_HAVE_OCTAVE$ac_cv_prog_HAVE_OCTAVE_CONFIG$ac_cv_prog_HAVE_MKOCTFILE"
  86. if test "x$prog_concat" = "xyesyesyes" ; then
  87. if test "x$OCTAVE_VERSION" != "x$MKOCTFILE_VERSION" ; then
  88. AC_MSG_WARN([** Mismatch between versions of octave and mkoctfile. **])
  89. AC_MSG_WARN([** Octave libsndfile modules will not be built. **])
  90. elif test "x$OCTAVE_VERSION" != "x$OCTAVE_CONFIG_VERSION" ; then
  91. AC_MSG_WARN([** Mismatch between versions of octave and octave-config. **])
  92. AC_MSG_WARN([** Octave libsndfile modules will not be built. **])
  93. else
  94. case "$MKOCTFILE_VERSION" in
  95. 2.*)
  96. AC_MSG_WARN([Octave version 2.X is not supported.])
  97. ;;
  98. 3.*)
  99. OCTAVE_DEST_ODIR=`$OCTAVE_CONFIG --oct-site-dir | sed 's%^/usr%${prefix}%'`
  100. OCTAVE_DEST_MDIR=`$OCTAVE_CONFIG --m-site-dir | sed 's%^/usr%${prefix}%'`
  101. OCTAVE_BUILD=yes
  102. ;;
  103. *)
  104. AC_MSG_WARN([Octave version $MKOCTFILE_VERSION is not supported.])
  105. ;;
  106. esac
  107. fi
  108. AC_MSG_RESULT([building octave libsndfile module... $OCTAVE_BUILD])
  109. fi
  110. AC_SUBST(OCTAVE_DEST_ODIR)
  111. AC_SUBST(OCTAVE_DEST_MDIR)
  112. AC_SUBST(MKOCTFILE)
  113. AM_CONDITIONAL(BUILD_OCTAVE_MOD, test "x$OCTAVE_BUILD" = xyes)
  114. ])# AC_OCTAVE_BUILD