summaryrefslogtreecommitdiff
path: root/configure.in
blob: 4ceb25860f8139e74dce60284adfaa831d08ec65 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
AC_PREREQ(2.52)
dnl ==============================================================
dnl Process this file with autoconf to produce a configure script.
dnl ==============================================================
AC_INIT(system-tools-backends,2.1.3)
AC_CONFIG_AUX_DIR(.)
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AC_PROG_LIBTOOL

DBUS_REQUIRED=0.35
GLIB_REQUIRED=2.4.0

dnl get prefix in $prefix, yes, this sucks
if test "x$prefix" = "xNONE"; then
   prefix=$ac_default_prefix;
fi

# This macro expands DIR and assigns it to RET.
# If DIR is NONE, then it's replaced by DEFAULT.
#
# Based on AC_DEFINE_DIR
#
# Examples:
#
#  AC_EXPAND(prefix, "/usr/local", expanded_prefix)

AC_DEFUN([AC_EXPAND], [
  test "x$prefix" = xNONE && prefix="$ac_default_prefix"
  test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
  ac_expand=[$]$1
  test "x$ac_expand" = xNONE && ac_expand="[$]$2"
  ac_expand=`eval echo [$]ac_expand`
  $3=`eval echo [$]ac_expand`
])

dnl get expanded paths
AC_EXPAND(datadir,"NONE",EXPANDED_DATADIR)
AC_SUBST(EXPANDED_DATADIR)

AC_EXPAND(sysconfdir,"NONE",EXPANDED_SYSCONFDIR)
AC_SUBST(EXPANDED_SYSCONFDIR)

AC_EXPAND(bindir,"NONE",bindir)
AC_SUBST(bindir)

AC_EXPAND(localstatedir, "NONE", localstatedir)
AC_DEFINE_UNQUOTED(LOCALSTATEDIR, "${localstatedir}", [localstatedir])
AC_SUBST(localstatedir)

dnl scriptsdir & filesdir
scriptsdir="${EXPANDED_DATADIR}/system-tools-backends-2.0/scripts"
filesdir="${EXPANDED_DATADIR}/system-tools-backends-2.0/files"
modulesdir="${EXPANDED_DATADIR}/system-tools-backends-2.0/modules"
AC_SUBST(scriptsdir)
AC_SUBST(filesdir)
AC_SUBST(modulesdir)


dnl DBus services dir
DBUS_SERVICES_DIR="${prefix}/share/dbus-1/services"
AC_SUBST(DBUS_SERVICES_DIR)


dnl where is DBus system.d directory?
AC_ARG_WITH(dbus_sys, [  --with-dbus-sys=<dir>   where D-BUS system.d directory is])

if ! test -z "$with_dbus_sys" ; then
    DBUS_SYSTEMD_DIR="$with_dbus_sys"
else
    DBUS_SYSTEMD_DIR="${EXPANDED_SYSCONFDIR}/dbus-1/system.d"
fi
AC_SUBST(DBUS_SYSTEMD_DIR)


dnl where is Net::DBus?
AC_ARG_WITH(net_dbus, [  --with-net-dbus=<dir>   where Net::DBus perl library is (/usr/lib/perl)])

if ! test -z "$with_net_dbus" ; then
    netdbusdir="$with_net_dbus"
else
dnl hack to avoid an empty path in netdbusdir
    netdbusdir=$scriptsdir
fi

AC_SUBST(netdbusdir)

dnl system-tools-backends admin group
AC_ARG_WITH(stb_group,[  --with-stb-group=<grp>  Group for system-tools-backends (stb-admin)])
if test -z "$with_stb_group" ; then
    STB_GROUP=stb-admin
else
    STB_GROUP=$with_stb_group
fi
AC_SUBST(STB_GROUP)


dnl check for perl
AC_PATH_PROG(PERL_PATH, perl)
if test -z "$PERL_PATH"; then
   AC_MSG_ERROR([perl not found, required for SystemToolsBackends])
fi

dnl check for DBus
PKG_CHECK_MODULES([DBUS], [dbus-1 >= $DBUS_REQUIRED])
AC_SUBST([DBUS_CFLAGS])
AC_SUBST([DBUS_LIBS])

dnl check for the dispatcher deps
PKG_CHECK_MODULES(DISPATCHER, [
			   dbus-glib-1 >= $DBUS_REQUIRED
			   glib-2.0    >= $GLIB_REQUIRED
			   ])
DISPATCHER_CFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE $DISPATCHER_CFLAGS"
AC_SUBST(DISPATCHER_LIBS)
AC_SUBST(DISPATCHER_CFLAGS)

dnl check for Net::DBus
AC_MSG_CHECKING([for Net::DBus])
if `$PERL_PATH -e "use lib '$netdbusdir'; require Net::DBus" 2>/dev/null`; then
   AC_MSG_RESULT([ok])
   internalnetdbus=no
else
   AC_MSG_RESULT([missing, going for internal copy])
   netdbusdir="${modulesdir}/lib/perl"
   AC_SUBST(netdbusdir)
   internalnetdbus=yes
fi

AM_CONDITIONAL(INTERNAL_NET_DBUS, test x$internalnetdbus = xyes)

AC_OUTPUT([
Makefile
system-tools-backends-2.0.pc
dispatcher/Makefile
files/Makefile
Init/Makefile
Network/Makefile
Shares/Makefile
Time/Makefile
Users/Makefile
Utils/Makefile
SystemToolsBackends.pl
test-backends
services/Makefile
services/org.freedesktop.SystemToolsBackends.GroupsConfig.service
services/org.freedesktop.SystemToolsBackends.HostsConfig.service
services/org.freedesktop.SystemToolsBackends.IfacesConfig.service
services/org.freedesktop.SystemToolsBackends.NFSConfig.service
services/org.freedesktop.SystemToolsBackends.NTPConfig.service
services/org.freedesktop.SystemToolsBackends.Platform.service
services/org.freedesktop.SystemToolsBackends.ServicesConfig.service
services/org.freedesktop.SystemToolsBackends.SMBConfig.service
services/org.freedesktop.SystemToolsBackends.TimeConfig.service
services/org.freedesktop.SystemToolsBackends.UsersConfig.service
org.freedesktop.SystemToolsBackends.service
system-tools-backends.conf
Net-DBus/Makefile
Net-DBus/lib/Makefile
Net-DBus/lib/Net/Makefile
Net-DBus/lib/Net/DBus/Makefile
Net-DBus/lib/Net/DBus/Binding/Makefile
Net-DBus/lib/Net/DBus/Binding/Message/Makefile
])

echo "

Configuration (BACKENDS):

  Prefix                            : ${prefix}
  The backends will be installed in : ${scriptsdir}
  The files will be installed in    : ${filesdir}
  Using internal copy of Net::Dbus  : ${internalnetdbus}

  DBus system.d directory           : ${DBUS_SYSTEMD_DIR}
  System tools backends admin group : ${STB_GROUP}
"