summaryrefslogtreecommitdiff
path: root/m4/ax_luarocks_rock.m4
blob: b6099b33000c2350523d6fcfabeb2827b5e85492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ===========================================================================
#     https://www.gnu.org/software/autoconf-archive/ax_luarocks_rock.html
# ===========================================================================
#
# SYNOPSIS
#
#   AX_LUAROCKS_ROCK([ROCK])
#
# DESCRIPTION
#
#   Checks for a rock, and fails if it is not installed.
#
#   Example usage:
#
#     AX_LUAROCKS_ROCK(stdlib)
#
#   Note: use of this macro is not normally recommended. Normally, LuaRocks
#   should be used to drive the build system, and it takes care of rock
#   dependencies. Use this macro only if LuaRocks cannot be used at the top
#   level, for example, in a build system that uses Lua only incidentally.
#
# LICENSE
#
#   Copyright (c) 2016 Reuben Thomas <rrt@sc3d.org>
#
#   Copying and distribution of this file, with or without modification, are
#   permitted in any medium without royalty provided the copyright notice
#   and this notice are preserved. This file is offered as-is, without any
#   warranty.

#serial 2

AC_DEFUN([AX_LUAROCKS_ROCK],[
    # Make sure we have luarocks
    if test -z "$LUAROCKS"; then
       AX_WITH_PROG(LUAROCKS,luarocks)
       if test -z "$LUAROCKS"; then
           AC_MSG_ERROR([can't find luarocks])
       fi
    fi

    AC_PREREQ([2.61])

    pushdef([ROCK],$1)
    AC_MSG_CHECKING(whether LuaRock ROCK is installed)
    AS_IF(["$LUAROCKS" show ROCK > /dev/null],[
        AC_MSG_RESULT(yes)
    ],[
        AC_MSG_FAILURE([LuaRock ROCK not found])
    ])

    popdef([ROCK])
])