3 # Copyright (C) 2012 Google Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 # AC_GHC_PKG_CHECK(modname, action_found, action_not_found, extended)
28 # Checks for a Haskell (GHC) module. If found, execute the second
29 # argument, if not found, the third one.
31 # If the fourth argument is non-empty, then the check will be some
32 # via 'ghc-pkg list' (which supports patterns), otherwise it will
33 # use just 'ghc-pkg latest'.
38 AC_DEFUN([AC_GHC_PKG_CHECK],[
39 if test -z $GHC_PKG; then
40 AC_MSG_ERROR([GHC_PKG not defined])
42 AC_MSG_CHECKING([haskell library $1])
44 GHC_PKG_RESULT=$($GHC_PKG --simple-output list '$1'|tail -n1)
46 GHC_PKG_RESULT=$($GHC_PKG latest '$1' 2>/dev/null)
48 if test -n "$GHC_PKG_RESULT"; then
49 AC_MSG_RESULT($GHC_PKG_RESULT)
61 # AC_GHC_PKG_REQUIRE(modname, extended)
65 # Checks for a Haskell (GHC) module, and abort if not found. If the
66 # second argument is non-empty, then the check will be some via
67 # 'ghc-pkg list' (which supports patterns), otherwise it will use
68 # just 'ghc-pkg latest'.
73 AC_DEFUN([AC_GHC_PKG_REQUIRE],[
74 AC_GHC_PKG_CHECK($1, [],
75 [AC_MSG_FAILURE([Required Haskell module $1 not found])],