summaryrefslogtreecommitdiff
path: root/configure.ac.in
blob: 13092ca3d68ddaa25bbac42c55c92398e1bdadc6 (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
m4_define([intltool_minimum_version], [0.31])
m4_define([xfpm_version_major], [1])
m4_define([xfpm_version_minor], [4])
m4_define([xfpm_version_micro], [2])
m4_define([xfpm_version_build], [@REVISION@])
m4_define([xfpm_version_tag],   [git])
m4_define([xfpm_version], [xfpm_version_major().xfpm_version_minor().xfpm_version_micro()ifelse(xfpm_version_tag(), [git], [xfpm_version_tag()-xfpm_version_build()], [xfpm_version_tag()])])

AC_INIT([xfce4-power-manager],[xfpm_version],[http://bugzilla.xfce.org/])
AC_PREREQ([2.69])
AC_CONFIG_MACRO_DIR([m4])

# subdir-objects is currently broken, see
# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928
AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar no-dist-gzip])
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE()
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_USE_SYSTEM_EXTENSIONS()

# ===================================================== #
#               Basic compiler settings                 #
# ===================================================== #
AC_PROG_CC()
AM_PROG_CC_C_O()
LT_PATH_LD([])
AC_PROG_INSTALL()
IT_PROG_INTLTOOL([intltool_minimum_version],[no-xml])

# ===================================================== #
#               Initialize libtool                      #
# ===================================================== #
LT_PREREQ([2.2.6])
LT_INIT([disable-static])

# ==================================================== #
#   Check for headers needed for standard interfaces   #
# ==================================================== #
AC_HEADER_STDC()
AC_CHECK_HEADERS([errno.h signal.h stddef.h sys/types.h memory.h stdlib.h   \
                  string.h sys/stat.h sys/user.h sys/wait.h time.h math.h   \
                  unistd.h sys/resource.h sys/socket.h sys/sysctl.h fcntl.h \
                  sys/param.h procfs.h])

AC_CHECK_FUNCS([getpwuid setsid sigaction])

# ===================================================== #
# 		Check for libm	 			#
# ===================================================== #
AC_CHECK_LIB([m], [round])

# ===================================================== #
# 		Check for i18n support 			#
# ===================================================== #

XDT_I18N([@LINGUAS@])

#==================================================== #
#          Check for required packages 		      #
#=====================================================#
m4_define([gtk_minimum_version], [2.24.0])
m4_define([glib_minimum_version], [2.30.0])
m4_define([dbus_minimum_version], [1.1])
m4_define([dbus_glib_minimum_version], [0.84])

m4_define([xfconf_minimum_version], [4.10.0])
m4_define([libxfce4ui_minimum_version],[4.10.0])
m4_define([libxfce4util_minimum_version],[4.10.0])
m4_define([libxfce4panel_minimum_version],[4.10.0])
m4_define([lxdepanel_new_minimum_version],[0.7.0])
m4_define([lxdepanel_minimum_version],[0.5.6])

m4_define([libnotify_minimum_version], [0.4.1])
m4_define([upower_minimum_version], [0.9.7])
m4_define([xrandr_minimum_version], [1.2.0])
m4_define([x11_minimum_version], [1.0.0])

XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [gtk_minimum_version])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [glib_minimum_version])
XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [glib_minimum_version])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [glib_minimum_version])
XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [glib_minimum_version])
XDT_CHECK_PACKAGE([DBUS], [dbus-1], [dbus_minimum_version])
XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [dbus_glib_minimum_version])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0],[xfconf_minimum_version])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1],[libxfce4ui_minimum_version])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0],[libxfce4util_minimum_version])
XDT_CHECK_PACKAGE([LIBNOTIFY],[libnotify], [libnotify_minimum_version])
XDT_CHECK_PACKAGE([UPOWER],[upower-glib], [upower_minimum_version])
XDT_CHECK_PACKAGE([XRANDR],[xrandr], [xrandr_minimum_version])
XDT_CHECK_PACKAGE([X11], [x11], [x11_minimum_version])

#=======================================================#
#              Polkit?			                #
#=======================================================#
AC_ARG_ENABLE([polkit],
        [AS_HELP_STRING([--disable-polkit],[Do not enable PolicyKit support (default=enabled)])],
        [ac_cv_enable_polkit=$enableval],
        [ac_cv_enable_polkit=polkit])
    AC_MSG_CHECKING([whether to build with polkit support])
if test "x$ac_cv_enable_polkit" = "xno"; then
    AC_MSG_RESULT([no])
    polkit="no"
else
    AC_MSG_RESULT([yes])
    AC_DEFINE(ENABLE_POLKIT, 1 , [PolicyKit support])
    polkit="yes"
fi
AM_CONDITIONAL([ENABLE_POLKIT], [test "x$polkit" = "xyes"])

#=======================================================#
#           Check for DPMS support                      #
#=======================================================#
AC_CHECK_LIB([Xext], [DPMSQueryExtension], [DPMS_LIBS=" -lXext -lX11"],[])
AC_SUBST([DPMS_LIBS])

#=======================================================#
#      Check for XF86_XK_Suspend && Hibernate           #
#=======================================================#

AC_CHECK_DECL(XF86XK_Suspend,have_XF86XK_Suspend=1,have_XF86XK_Suspend=0,[#include <X11/XF86keysym.h>])
if test "x${ac_cv_have_decl_XF86XK_Suspend}" != "xno"; then
  AC_DEFINE(HAVE_XF86XK_SUSPEND, 1, [Define if XF86XK_Suspend is available])
fi
AC_CHECK_DECL(XF86XK_Hibernate,have_XF86XK_Hibernate=1,have_XF86XK_Hibernate=0,[#include <X11/XF86keysym.h>])
if test "x${ac_cv_have_decl_XF86XK_Hibernate}" != "xno"; then
  AC_DEFINE(HAVE_XF86XK_HIBERNATE, 1, [Define if XF86XK_Hibernate is available])
fi

#=======================================================#
#              Network Manager support                  #
#=======================================================#
AC_ARG_ENABLE([network-manager], AS_HELP_STRING([--disable-network-manager],[Disable network manager support]),
  [ac_network_manager=$enableval], [ac_network_manager=yes])
AC_MSG_CHECKING([whether to build with network manager support.])
if test "x$ac_network_manager" = "xyes"; then
    AC_DEFINE(WITH_NETWORK_MANAGER, 1 , [Network Manager support])
fi
AC_MSG_RESULT([$ac_network_manager])

#=======================================================#
#                 Panel plugins ?                       #
#=======================================================#
AC_ARG_ENABLE([panel_plugins],
	[AS_HELP_STRING([--disable-panel-plugins],[Do not build panel plugins (default=enabled)])],
	[ac_cv_enable_panel_plugins=$enableval],
	[ac_cv_enable_panel_plugins=yes])
if test "x$ac_cv_enable_panel_plugins" = "xno"; then
	build_panel_plugins="no"
else
	build_panel_plugins="yes"
fi

XDT_CHECK_OPTIONAL_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [libxfce4panel_minimum_version],
[xfce4panel], [To build plugin support for Xfce's panel])

XDT_CHECK_OPTIONAL_PACKAGE([LXDEPANEL_NEW], [lxpanel], [lxdepanel_new_minimum_version],
[lxdepanel],[To build plugin support for LXDE's panel])

XDT_CHECK_OPTIONAL_PACKAGE([LXDEPANEL], [lxpanel], [lxdepanel_minimum_version],
[lxdepanel],[To build plugin support for LXDE's panel])

AM_CONDITIONAL([BUILD_PANEL_PLUGINS], [test "x$build_panel_plugins" = "xyes"])
AM_CONDITIONAL([BUILD_XFCE_PLUGIN], [test "x$LIBXFCE4PANEL_FOUND" = "xyes" && test "x$build_panel_plugins" = "xyes"])
AM_CONDITIONAL([BUILD_LXDE_NEW_PLUGIN], [test "x$LXDEPANEL_NEW_FOUND" = "xyes" && test "x$build_panel_plugins" = "xyes"])
AM_CONDITIONAL([BUILD_LXDE_OLD_PLUGIN], [test "x$LXDEPANEL_NEW_FOUND" != "xyes" && test "x$LXDEPANEL_FOUND" = "xyes" && test "x$build_panel_plugins" = "xyes"])


#=======================================================#
#     Compile time default choice of backend            #
#=======================================================#
AC_ARG_WITH([backend],
	    AS_HELP_STRING([--with-backend=<option>],
			   [Default backend to use linux, freebsd, openbsd]))
# default to a sane option
AC_CANONICAL_HOST
if test x$with_backend = x; then
	AS_CASE([$host],
		[*-linux*],   [with_backend=linux],
		[*-*freebsd*], [with_backend=freebsd],
		[*-*dragonfly*], [with_backend=freebsd],
		[*-openbsd*], [with_backend=openbsd])
fi
AC_DEFINE_UNQUOTED(BACKEND, "$with_backend", [backend])
AC_SUBST(BACKEND, "$with_backend")

if test x$with_backend = xlinux; then
    AC_DEFINE(BACKEND_TYPE_LINUX, 1, [Linux suspend/hibernate backend])
fi
if test x$with_backend = xfreebsd; then
    AC_DEFINE(BACKEND_TYPE_FREEBSD, 1, [FreeBSD suspend/hibernate backend])
fi
if test x$with_backend = xopenbsd; then
    AC_DEFINE(BACKEND_TYPE_OPENBSD, 1, [OpenBSD suspend/hibernate backend])
fi

dnl define a short version string for xfce4-power-manager
m4_append([xfpm_version_short], ["])
m4_append([xfpm_version_short], [xfpm_version_major])
m4_append([xfpm_version_short], [.])
m4_append([xfpm_version_short], [xfpm_version_minor])
m4_append([xfpm_version_short], ["])

dnl define xfpm's short version (major.minor)
AC_DEFINE([XFPM_VERSION_SHORT], [xfpm_version_short], [Short version string of xfce4-power-manager])

#=======================================================#
#              Check for debugging support              #
#=======================================================#
XDT_FEATURE_DEBUG

#=======================================================#
#              Substitute platform flags                #
#=======================================================#
AC_MSG_CHECKING([PLATFORM_CPPFLAGS])
AC_MSG_RESULT([$PLATFORM_CPPFLAGS])
AC_SUBST([PLATFORM_CPPFLAGS])
AC_MSG_CHECKING([PLATFORM_CFLAGS])
AC_MSG_RESULT([$PLATFORM_CFLAGS])
AC_SUBST([PLATFORM_CFLAGS])
AC_MSG_CHECKING([PLATFORM_LDFLAGS])
AC_MSG_RESULT([$PLATFORM_LDFLAGS])
AC_SUBST([PLATFORM_LDFLAGS])

AC_CONFIG_FILES([
Makefile
libdbus/Makefile
common/Makefile
src/Makefile
settings/Makefile
panel-plugins/Makefile
panel-plugins/power-manager-plugin/Makefile
panel-plugins/power-manager-plugin/lxde-0.7/Makefile
panel-plugins/power-manager-plugin/lxde/Makefile
panel-plugins/power-manager-plugin/xfce/Makefile
data/Makefile
data/icons/Makefile
data/icons/16x16/Makefile
data/icons/22x22/Makefile
data/icons/24x24/Makefile
data/icons/32x32/Makefile
data/icons/48x48/Makefile
data/icons/scalable/Makefile
data/interfaces/Makefile
data/appdata/Makefile
po/Makefile.in
])
AC_OUTPUT

echo "prefix:			${prefix}"
echo "xdg autostart:		${sysconfdir}/xdg/autostart"
echo "POLKIT:			${polkit}"
echo "Network manager:	${ac_network_manager}"
echo "Build panel plugins:	${build_panel_plugins}"
if test "x$build_panel_plugins" = "xyes"; then
    if test "x$LIBXFCE4PANEL_FOUND" = "xyes"; then
        echo " Xfce plugins:          yes"
    fi
    if test "x$LXDEPANEL_FOUND" = "xyes"; then
        echo " LXDE plugins:          yes"
    fi
fi
echo "Backend:		${with_backend}"
echo "Debug:			${enable_debug}"
echo "Configuration finished, type make to compile"