summaryrefslogtreecommitdiffstats
path: root/kate/part/configure.in.in
blob: faf0717e9a9ea38ddf86f9dde7fec241a96e79ce (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
AC_DEFUN([AC_PATH_LUA], [

dnl	Based on the lua check used by yzis-M3

	HAVE_LUA=""

	AC_ARG_WITH([lua],
		AC_HELP_STRING([--without-lua], [Build without Lua libraries (default: check)]))

        AC_ARG_WITH(lua-dir,
                AC_HELP_STRING([--with-lua-dir=DIR],[where the root of Lua 5.x is installed]),
                [
                LUA="$withval"
                LUA_INCLUDES=-I"$withval"/include
                LUA_LIBS="-L$withval/lib" ])

        AC_ARG_WITH(lua-includes,
                AC_HELP_STRING([--with-lua-includes=DIR],[where the Lua includes are]),
                [ LUA_INCLUDES="-I$withval" ])

        AC_ARG_WITH(lua-libraries,
                AC_HELP_STRING([--with-lua-libraries=DIR],[where the Lua library is installed]),
                [
                LUA_LIBS="-L$withval" ])


    if test "x$with_lua" = "xno"; then
	AC_MSG_RESULT([Not using Lua])
    else
        if ! test "x$LUA" = "x"; then
                AC_MSG_RESULT(using Lua from $LUA)
        fi
        if ! test "x$LUA_LIBS" = "x"; then
                AC_MSG_RESULT(using Lua libraries in $LUA_LIBS)
        fi
        if ! test "x$LUA_INCLUDES" = "x"; then
                AC_MSG_RESULT(using Lua includes in $LUA_INCLUDES)
        fi

        dnl checking some headers first
        ac_save_CFLAGS="$CFLAGS"
        ac_save_CPPFLAGS="$CPPFLAGS"
        ac_save_LDFLAGS="$LDFLAGS"
        CFLAGS="$LUA_INCLUDES $CFLAGS"
        CPPFLAGS="$LUA_INCLUDES $CPPFLAGS"
        LDFLAGS="$LUA_LIBS $LDFLAGS"

        LUAH_FOUND=""
        AC_CHECK_HEADER(lua.h,LUAH_FOUND="true",
                        [ AC_MSG_RESULT([lua.h was not found or was not usable, Lua 5.0 headers are required !]) ]
                        )
	LUALIBH_FOUND=""
        AC_CHECK_HEADER(lualib.h,LUALIBH_FOUND="true",
                        [ AC_MSG_RESULT([lualib.h was not found or was not usable, Lua 5.0 headers are required !]) ]
                        )


        dnl find the libs name
	if test -z "$LUALIBH_FOUND" -o -z "$LUAH_FOUND"; then
		LUA_LIBS=""
	else
	        AC_CHECK_LIB(lua50,lua_version, LUA_LIBS="$LUA_LIBS -llua50 -llualib50",
	                        AC_CHECK_LIB(lua,lua_version, LUA_LIBS="$LUA_LIBS -llua -llualib",
	                                [LUA_LIBS=""
				 	AC_MSG_RESULT([Lua 5.0 libraries were not found !]) ]
        	                        )
                	)
	fi
        CFLAGS="$ac_save_CFLAGS"
        CPPFLAGS="$ac_save_CPPFLAGS"
        LDFLAGS="$ac_save_LDFLAGS"


	if test -z "$LUA_LIBS"; then
		LUA=""
		LUA_INCLUDES=""
		LUA_LIBS=""
	else
               AC_DEFINE_UNQUOTED(HAVE_LUA, 1, [Define if you have LUA > 5.0])
		HAVE_LUA="yes"
	fi
        AC_SUBST(LUA)
        AC_SUBST(LUA_INCLUDES)
        AC_SUBST(LUA_LIBS)
    fi

])

AC_PATH_LUA