summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: fe17e6bb8fd04c5d844cd8959b44c699f44d9b87 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
AC_PREREQ(2.59)

AC_INIT([json-dbus-bridge-examples], 1.0.0, [bugs@pengutronix.de])
AC_CONFIG_SRCDIR([services/python/hello-world.py])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST

AM_MAINTAINER_MODE
AM_SILENT_RULES([yes])

CFLAGS="${CFLAGS} -W -Wall"

#
# Checks for programs.
#
AC_CHECK_PROG([HAVE_PYTHON],[python],[yes],[no])
if test "x$HAVE_PYTHON" != "xyes"; then
	AC_MSG_ERROR([Python not found.])
fi

AC_PATH_PROG([LIGHTTPD],[lighttpd],,$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
if test -z "$LIGHTTPD"; then
	AC_MSG_ERROR([lighttpd not found. Define LIGHTTPD=/path/to/lighttpd or make sure lighttpd is in \$PATH])
fi
AC_ARG_VAR([LIGHTTPD], [lighttpd web server])
AC_SUBST(LIGHTTPD)

AC_PATH_PROG([JSON_DBUS_BRIDGE],[json-dbus-bridge],,)
if test -z "$JSON_DBUS_BRIDGE"; then
	AC_MSG_ERROR([json-dbus-bridge not found. Set JSON_DBUS_BRIDGE=/path/to/json-dbus-bridge or make sure json-dbus-bridge is in \$PATH])
fi
AC_ARG_VAR([JSON_DBUS_BRIDGE], [json-dbus-bridge FCGI application])
AC_SUBST(JSON_DBUS_BRIDGE)

AC_PATH_PROGS([QMAKE],[qmake-qt4 qmake],,)
if test -z "$QMAKE"; then
	AC_MSG_ERROR([qmake (Qt4) not found. Define QMAKE=/path/to/qmake or make sure qmake is in \$PATH])
fi
"$QMAKE" -v 2>&1 | grep -q "Using Qt version 4"
if test $? -ne 0 ; then
	AC_MSG_ERROR([$QMAKE is not qmake from Qt4. Define QMAKE=/path/to/qmake or make sure the correct qmake is found.])
fi
AC_ARG_VAR([QMAKE], [qmake from Qt4])
AC_SUBST(QMAKE)
export QMAKE

AC_ARG_WITH([qooxdoo-sdk],AS_HELP_STRING([--with-qooxdoo-sdk=PATH], [Path to qooxdoo sdk]),
	if test -x "$withval/tool/bin/generator.py"; then
		QOOXDOO_SDK="$withval"
	else
		AC_MSG_ERROR(["$withval" contains no valid qooxdoo sdk.])
	fi,
	AC_MSG_ERROR([qooxdoo sdk not found. Please use --with-qooxdoo-sdk=PATH])
)
AC_SUBST(QOOXDOO_SDK)

AC_ARG_WITH([admin-role],AS_HELP_STRING([--with-admin-role=NAME], [user name for admin role. Default: `whoami`.]),
	ADMIN_ROLE="$withval", ADMIN_ROLE=`whoami`)
AC_SUBST(ADMIN_ROLE)

AC_ARG_WITH([user-role],AS_HELP_STRING([--with-user-role=NAME], [user name for admin role. Default: `whoami`.]),
	USER_ROLE="$withval", USER_ROLE=`whoami`)
AC_SUBST(USER_ROLE)

LIGHTTPD_USER=`whoami`
AC_SUBST(LIGHTTPD_USER)

if test "x$USER_ROLE" = "x$ADMIN_ROLE"; then
	AC_MSG_ERROR([The user names for admin and user roles are the same. \
Use --with-admin-role=NAME and --with-user-role=NAME to provide different user names.])
fi

AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2])

AC_CONFIG_FILES([
	Makefile
	lighttpd/lighttpd.conf
	services/Makefile
	services/python/Makefile
	services/qt4/Makefile
	web-gui/Makefile
	web-gui/hello-world/Makefile
	web-gui/hello-world/config.json
	web-gui/calculator/Makefile
	web-gui/calculator/config.json
	web-gui/live/Makefile
	web-gui/live/config.json
	web-gui/logging/Makefile
	web-gui/logging/config.json
	web-gui/plot/Makefile
	web-gui/plot/config.json
	web-gui/login/Makefile
	web-gui/login/config.json
	web-gui/login/lighttpd.conf
	web-gui/login/dbus-session.conf
])
AC_CONFIG_FILES([run.sh],[chmod +x run.sh])
AC_CONFIG_FILES([web-gui/hello-world/generate.py],[chmod +x web-gui/hello-world/generate.py])
AC_CONFIG_FILES([web-gui/calculator/generate.py],[chmod +x web-gui/calculator/generate.py])
AC_CONFIG_FILES([web-gui/live/generate.py],[chmod +x web-gui/live/generate.py])
AC_CONFIG_FILES([web-gui/logging/generate.py],[chmod +x web-gui/logging/generate.py])
AC_CONFIG_FILES([web-gui/plot/generate.py],[chmod +x web-gui/plot/generate.py])
AC_CONFIG_FILES([web-gui/login/generate.py],[chmod +x web-gui/login/generate.py])
AC_CONFIG_FILES([web-gui/login/run.sh],[chmod +x web-gui/login/run.sh])
AC_CONFIG_COMMANDS([services/qt4/dbus-info-service/Makefile], [(cd services/qt4/dbus-info-service && $QMAKE ../../../${srcdir}/services/qt4/dbus-info-service/dbus-info-service.pro)])

AC_OUTPUT