1
#                                               -*- Autoconf -*-
2
# Process this file with autoconf to produce a configure script.
3
4
AC_PREREQ([2.63])
5
AC_INIT([dss11-websetup], [0.25.0], [jin@dev.digitalstrom.org])
6
AC_CONFIG_AUX_DIR(configure_aux)
7
AM_INIT_AUTOMAKE([1.10 -Wall])
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_ARG_ENABLE(
33
    [sdcard],
34
    [
35
        AC_HELP_STRING([--enable-sdcard],
36
                       [make UI SD-card aware (default: disabled)])
37
    ],
38
    [
39
        case "${enableval}" in
40
            yes) SDCARD="true" ;;
41
            no)  SDCARD="false" ;;
42
            *)   AC_MSG_ERROR([bad value ${enableval} for --enable-sdcard]) ;;
43
        esac
44
    ],
45
    [
46
        SDCARD="false"
47
    ]
48
)
49
AC_SUBST(SDCARD)
50
51
AC_ARG_ENABLE(
52
    [reboot-after-update],
53
    [
54
        AC_HELP_STRING([--enable-reboot-after-update],
55
                       [reboot after updating system (default: disabled)])
56
    ],
57
    [
58
        case "${enableval}" in
59
            yes) NEED_REBOOT=1 ;;
60
            no)  NEED_REBOOT=0 ;;
61
            *)   AC_MSG_ERROR([bad value ${enableval} for --enable-reboot-after-update]) ;;
62
        esac
63
    ],
64
    [
65
        NEED_REBOOT=0
66
    ]
67
)
68
AC_SUBST(NEED_REBOOT)
69
70
71
AC_LANG_C
72
AC_HEADER_STDC
73
74
JSMIN_TOOL=
75
if test "x$BUILD_TYPE" = "xrelease"; then
76
    AC_PATH_PROG(jsmin, jsmin, no)
77
    if (test "x$jsmin" = xno); then
78
        AC_MSG_NOTICE([jsmin utility not found in PATH, will build one myself])
79
    else
80
        AC_MSG_NOTICE([Will use $jsmin to minimize the js sources])
81
        JSMIN_TOOL="$jsmin"
82
    fi
83
    AC_SUBST(JSMIN_TOOL)
84
85
    if test -z "$JSMIN"; then
86
87
        AC_PROG_CC
88
89
        AC_CHECK_HEADERS([stdlib.h],
90
                         [],
91
                         [AC_MSG_ERROR(required header not found)])
92
    fi
93
else
94
    EXT_ALL="ext-all-debug"
95
    EXT_BASE="ext-base-debug"
96
97
    AC_PATH_PROG(cat, cat, no)
98
    if (test "x$cat" = xno); then
99
        AC_MSG_ERROR([Please install the cat command line utility])
100
    fi
101
    CAT="$cat"
102
    AC_SUBST(CAT)
103
fi
104
105
PO2JSON_TOOL=
106
AC_PATH_PROG(po2json, po2json, no)
107
if (test "x$po2json" = xno); then
108
    AC_MSG_NOTICE([po2json utility not found in PATH, will build one myself])
109
else
110
    AC_MSG_NOTICE([Will use $po2json to generate the JSON language files])
111
    PO2JSON_TOOL="$po2json"
112
fi
113
AC_SUBST(PO2JSON_TOOL)
114
115
if test -z "$PO2JSON"; then
116
117
    AC_PROG_CXX
118
    AC_LANG(C++)
119
120
    AC_CHECK_HEADERS([string fstream iostream],
121
                     [],
122
                     [AC_MSG_ERROR(required header not found)])
123
fi
124
125
AM_CONDITIONAL(MINIMIZE, test "x$BUILD_TYPE" = "xrelease")
126
127
AM_CONDITIONAL(COMPILE_JSMIN, test "x$JSMIN_TOOL" = "x")
128
129
AM_CONDITIONAL(COMPILE_PO2JSON, test "x$PO2JSON_TOOL" = "x")
130
131
AC_SUBST(EXT_ALL)
132
AC_SUBST(EXT_BASE)
133
134
AC_PATH_PROG(sprocketize, sprocketize, no)
135
AC_PATH_PROG(yoke, yoke, no)
136
137
if (test "x$sprocketize" = "xno") && (test "x$yoke" = "xno"); then
138
    AC_MSG_NOTICE([Could not find sprocketize or yoke utilities!])
139
    AC_MSG_NOTICE([Visit http://getsprockets.org/installation_and_usage])
140
    AC_MSG_NOTICE([Visit http://blog.angeloff.name/post/3465035915/yoke-a-drop-in-quick-and-dirty-alternative-to])
141
    AC_MSG_ERROR([Please install either the sprocketize or yoke command line utility, this is requierd to prepare the js sources!])
142
fi
143
144
JSUTILITY="$sprocketize"
145
JSPARAM="-C"
146
JSPATH=""
147
148
if (test "x$JSUTILITY" = "xno"); then
149
    JSUTILITY="$yoke"
150
    JSPARAM="-I"
151
    JSPATH="./www/js/dss11/separated_js/"
152
fi
153
AC_SUBST(JSUTILITY)
154
AC_SUBST(JSPARAM)
155
AC_SUBST(JSPATH)
156
157
AC_PATH_PROG(sed, sed, no)
158
if (test "x$sed" = xno); then
159
    AC_MSG_ERROR([Please install the sed command line utility])
160
fi
161
162
SED="$sed"
163
AC_SUBST(SED)
164
165
166
AC_CONFIG_FILES([
167
            Makefile
168
            www/index.html
169
            www/cgi-bin/prodinfo.hs
170
            www/js/dss11/separated_js/generated/config.js
171
            scripts/doupdate.sh
172
        ])
173
AC_OUTPUT