File: configure.ac

package info (click to toggle)
sensors-applet 1.7.10%2Bdfsg-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,372 kB
  • ctags: 552
  • sloc: ansic: 5,462; sh: 896; xml: 653; makefile: 128
file content (222 lines) | stat: -rw-r--r-- 6,866 bytes parent folder | download
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
# ================= initialization =================== #

# if doing version bump - make sure you update sensors-applet-gconf
# version checking to add old version if no changes to config
AC_INIT([GNOME Sensors Applet], [1.7.10], [pragmatine@gmail.com], 
[sensors-applet])

AC_CONFIG_SRCDIR([src/main.c])
AM_CONFIG_HEADER([src/config.h])
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE

# ============== basic compiler settings ============= #
AC_PROG_CC
AC_HEADER_STDC

# =========== take care of some localization ========= #
AH_TEMPLATE([GETTEXT_PACKAGE], [Package name for gettext])
GETTEXT_PACKAGE=sensors-applet
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE")
AC_SUBST(GETTEXT_PACKAGE)
ALL_LINGUAS="cs de es fi fr it pl ro ru sv"
AM_GLIB_GNU_GETTEXT
AC_PROG_INTLTOOL

# ========== export compiler / linker options ======== #
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

# ============== look for dependencies =============== #
# check for headers needed for standard interfaces
AC_CHECK_HEADERS(
	stdlib.h \
	string.h \ 
	stdio.h \
	sys/types.h \ 
	sys/socket.h \
	netinet/in.h \
	arpa/inet.h \
	fcntl.h \
	sys/ioctl.h \
	unistd.h
)   

GLIB_REQUIRED=2.6.0
GTK_REQUIRED=2.8.0
LIBPANEL_REQUIRED=2.0.0
LIBGNOME_REQUIRED=2.8.0
LIBGNOMEUI_REQUIRED=2.8.0
LIBNOTIFY_REQUIRED=0.3.0
LIBCAIRO_REQUIRED=1.0.4

PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

PKG_CHECK_MODULES(GNOME, libgnome-2.0 >= $LIBGNOME_REQUIRED
			 libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED
			 libpanelapplet-2.0 >= $LIBPANEL_REQUIRED)
AC_SUBST(GNOME_CFLAGS)
AC_SUBST(GNOME_LIBS)

PKG_CHECK_MODULES(CAIRO, cairo >= $LIBCAIRO_REQUIRED)
AC_SUBST(CAIRO_CFLAGS)
AC_SUBST(CAIRO_LIBS)

# support for libnotify
LIBNOTIFY_CFLAGS=
LIBNOTIFY_LIBS=

# enable support even if not specifically asked for
AC_ARG_ENABLE(libnotify, [  --enable-libnotify   enable libnotify support], [
			 enable_libnotify=$enableval], [
			 enable_libnotify="yes"
])

if test "$enable_libnotify" = "no"
then
   echo "Disabling libnotify support"
else
	PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED,
	HAVE_LIBNOTIFY="yes", HAVE_LIBNOTIFY="no")

	if test "x$HAVE_LIBNOTIFY" = "xyes"
	then
	   AC_DEFINE(HAVE_LIBNOTIFY, 1, [libnotify available])
	fi	
fi

AM_CONDITIONAL(LIBNOTIFY, test -n "$LIBNOTIFY_LIBS")

AC_SUBST(LIBNOTIFY_CFLAGS)
AC_SUBST(LIBNOTIFY_LIBS)


# allow user to specify libsensors support, but support it anyway if possible
AC_ARG_WITH(libsensors,
[  --with-libsensors[=DIR]   use libsensors in DIR],[
        if test "$withval" != "no" -a "$withval" != "yes"; then
                SENSORS_DIR=$withval
                CPPFLAGS="${CPPFLAGS} -I$withval/include/sensors"
                LDFLAGS="${LDFLAGS} -L$withval/lib"
        fi
	with_libsensors=$withval],[
	with_libsensors="yes"
])

if test "$with_libsensors" = "no"; then
        echo "Disabling lmsensors support"
else
	# check for specfic headers needed for libsensors-sensors-interface
	AC_CHECK_HEADERS(regex.h)
        AC_CHECK_HEADERS(sensors/sensors.h,
                AC_CHECK_LIB(sensors, sensors_init,[
                        AC_DEFINE(HAVE_LIBSENSORS,1,[libsensors is available])
                        if test "x${SENSORS_DIR}" != "x"; then
                                SENSORS_CFLAGS="-I${SENSORS_DIR}/include"
                                SENSORS_LIBS="-L${SENSORS_DIR}/lib -lsensors"
                                [case ${host} in
                                        *-*-solaris*)
                                                SENSORS_LIBS="-L${SENSORS_DIR}/lib -R${SENSORS_DIR}/lib -lsensors"
                                                ;;
                                esac]
                        else
                                SENSORS_LIBS="-lsensors"
                        fi]))
fi			

AM_CONDITIONAL(LIBSENSORS, test -n "$SENSORS_LIBS")

AC_SUBST(SENSORS_CFLAGS)
AC_SUBST(SENSORS_LIBS)

# check if we are buildings with nvidia sensors support - is
# complicated so don't try and include it by default
AC_ARG_WITH(nvidia, [  --with-nvidia            enable support for nvidia sensors], test "$withval" = no || with_nvidia=yes, with_nvidia=no)
AC_ARG_WITH(x11, [  --with-x11=DIR            path to your X11 directory \(only needed when compiling with nvidia-sensors support\)])

AC_MSG_CHECKING([whether to include nvidia sensors support])
if test "$with_nvidia" == "yes"; then
	AC_MSG_RESULT([yes])

	OLD_CFLAGS="${CFLAGS}"
	OLD_LDFLAGS="${LDFLAGS}"

	# check X11 headers and libs
	if test "$with_x11" != "yes" && test "$with_x11" != "no" && test "$with_x11" != ""; then
		X11DIR=$with_x11
		NVSENSORS_CFLAGS="-I${X11DIR}/include"
		NVSENSORS_LIBS="-L${X11DIR}/lib"
	else
		NVSENSORS_CFLAGS=""
		NVSENSORS_LIBS=""
	fi
	CFLAGS="${NVSENSORS_CFLAGS}"
	LDFLAGS="${NVSENSORS_LIBS}"
	AC_CHECK_HEADERS(X11/Xlib.h, [a=1], [a=0])
	if test $a == 0; then
		AC_MSG_ERROR([The Xlib.h header file cannot be found! Please make sure you specified the correct path to your X11 directory with --with-x11])
	fi
	AC_CHECK_LIB(X11, XOpenDisplay, [a=1], [a=0])
	if test $a == 0; then
		AC_MSG_ERROR([The X11 library cannot be found! Please make sure you specified the correct path to your X11 directory with --with-x11])
	fi

	# check for NV-CONTROL header and libs
	if test "$with_nvidia" != "yes" && test "$with_x11" != ""; then
		NVDIR=$with_nvidia
		NVSENSORS_CFLAGS="${NVSENSORS_CFLAGS} -I${NVDIR}/include"
		NVSENSORS_LIBS="${NVSENSORS_LIBS} -L${NVDIR}/lib"
	fi
	CFLAGS="${NVSENSORS_CFLAGS}"
	LDFLAGS="${NVSENSORS_LIBS} -lX11 -lXext"
	AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h, [a=1], [a=0], [#include <X11/Xlib.h>])
	if test $a == 0; then
		AC_MSG_ERROR([The NV-CONTROL header files cannot be found! make sure you have installed nvidia-settings.])
	fi
	AC_CHECK_LIB(XNVCtrl, XNVCTRLQueryExtension, [a=1], [a=0])
	if test $a == 0; then
		AC_MSG_ERROR([The NV-CONTROL library file cannot be used! make sure you have installed nvidia-settings.])
	fi

	NVSENSORS_LIBS="${NVSENSORS_LIBS} -lX11 -lXext -lXNVCtrl"
	AC_DEFINE(HAVE_NVSENSORS,1,[build with support for nvidia sensors])

	# reset old CFLAGS and LDFLAGS
	CFLAGS="${OLD_CFLAGS}"
	LDFLAGS="${OLD_LDFLAGS}"

else
	AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(NVSENSORS, test -n "$NVSENSORS_LIBS")

AC_SUBST(NVSENSORS_CFLAGS)
AC_SUBST(NVSENSORS_LIBS)

# for help docs stuff
AC_PATH_PROG(XSLTPROC, xsltproc, no)
if test x"$XSLTPROC" = xno; then
  AC_MSG_ERROR([xsltproc executable not found in your path - should be installed with libxslt])
fi

GNOME_COMPILE_WARNINGS(maximum)

# ================ gnome-doc-utils stuff ============= #
GNOME_DOC_INIT

# ================= generate files =================== #
AC_CONFIG_FILES([
	Makefile
	src/Makefile
	pixmaps/Makefile
	po/Makefile.in
	help/Makefile
])
AC_OUTPUT