1
#                                               -*- Autoconf -*-
2
# Process this file with autoconf to produce a configure script.
3
4
AC_PREREQ([2.63])
5
AC_INIT([dss-web], [1.7.0], [jin@dev.digitalstrom.org])
6
AC_CONFIG_AUX_DIR(configure_aux)
7
AM_INIT_AUTOMAKE([1.10 -Wall tar-ustar])
8
9
BUILD_TYPE="release"
10
11
EXT_ALL="ext-all"
12
EXT_BASE="ext-base"
13
14
AC_ARG_ENABLE(
15
    [debug],
16
    [ 
17
        AC_HELP_STRING([--enable-debug], 
18
                       [build debug version (default: release)])
19
    ],
20
    [
21
        case "${enableval}" in
22
            yes) BUILD_TYPE="debug" ;;
23
            no)  BUILD_TYPE="release" ;;
24
            *)   AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
25
        esac
26
    ],
27
    [
28
        BUILD_TYPE="release"
29
    ]
30
)
31
32
AC_LANG_C
33
AC_HEADER_STDC
34
35
JSMIN_TOOL=
36
if test "x$BUILD_TYPE" = "xrelease"; then
37
    AC_PATH_PROG(jsmin, jsmin, no)
38
    if (test "x$jsmin" = xno); then
39
        AC_MSG_NOTICE([jsmin utility not found in PATH, will build one myself])
40
    else
41
        AC_MSG_NOTICE([Will use $jsmin to minimize the js sources])
42
        JSMIN_TOOL="$jsmin"
43
    fi
44
    AC_SUBST(JSMIN_TOOL)
45
46
    if test -z "$JSMIN"; then
47
48
        AC_PROG_CC
49
50
        AC_CHECK_HEADERS([stdlib.h],
51
                         [],
52
                         [AC_MSG_ERROR(required header not found)])
53
    fi
54
else
55
    EXT_ALL="ext-all-debug"
56
    EXT_BASE="ext-base-debug"
57
58
    AC_PATH_PROG(cat, cat, no)
59
    if (test "x$cat" = xno); then
60
        AC_MSG_ERROR([Please install the cat command line utility])
61
    fi
62
    CAT="$cat"
63
    AC_SUBST(CAT)
64
fi
65
66
PO2JSON_TOOL=
67
AC_PATH_PROG(po2json, po2json, no)
68
if (test "x$po2json" = xno); then
69
    AC_MSG_NOTICE([po2json utility not found in PATH, will build one myself])
70
else
71
    AC_MSG_NOTICE([Will use $po2json to generate the JSON language files])
72
    PO2JSON_TOOL="$po2json"
73
fi
74
AC_SUBST(PO2JSON_TOOL)
75
76
if test -z "$PO2JSON"; then
77
78
    AC_PROG_CXX
79
    AC_LANG(C++)
80
81
    AC_CHECK_HEADERS([string fstream iostream],
82
                     [],
83
                     [AC_MSG_ERROR(required header not found)])
84
fi
85
86
AM_CONDITIONAL(MINIMIZE, test "x$BUILD_TYPE" = "xrelease")
87
88
AM_CONDITIONAL(COMPILE_JSMIN, test "x$JSMIN_TOOL" = "x")
89
90
AM_CONDITIONAL(COMPILE_PO2JSON, test "x$PO2JSON_TOOL" = "x")
91
92
AC_SUBST(EXT_ALL)
93
AC_SUBST(EXT_BASE)
94
95
AC_PATH_PROG(sprocketize, sprocketize, no)
96
AC_PATH_PROG(yoke, yoke, no)
97
98
if (test "x$sprocketize" = "xno") && (test "x$yoke" = "xno"); then
99
    AC_MSG_NOTICE([Could not find sprocketize or yoke utilities!])
100
    AC_MSG_NOTICE([Visit http://getsprockets.org/installation_and_usage])
101
    AC_MSG_NOTICE([Visit http://blog.angeloff.name/post/3465035915/yoke-a-drop-in-quick-and-dirty-alternative-to])
102
    AC_MSG_ERROR([Please install either the sprocketize or yoke command line utility, this is requierd to prepare the js sources!])
103
fi
104
105
JSUTILITY="$sprocketize"
106
JSPARAM="-C"
107
JSPATH=""
108
109
if (test "x$JSUTILITY" = "xno"); then
110
    JSUTILITY="$yoke"
111
    JSPARAM="-I"
112
    JSPATH="./webroot/js/dss/dss-setup-interface/"
113
fi
114
AC_SUBST(JSUTILITY)
115
AC_SUBST(JSPARAM)
116
AC_SUBST(JSPATH)
117
118
AC_CONFIG_FILES([
119
            Makefile
120
            webroot/index.html
121
            webroot/setup.html
122
        ])
123
AC_OUTPUT