summaryrefslogtreecommitdiff
path: root/configure.in
blob: 40213bc8396f9d59fc4159f20fb03a65cda3d1ae (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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
dnl ***************************************************************************
dnl *** configure.in for GNOME-APPLETS                                      ***
dnl ***************************************************************************
AC_INIT(gnome-applets, 2.21.92)
AC_PREREQ(2.59)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(1.8)
AC_CONFIG_MACRO_DIR(m4)

dnl ***************************************************************************
dnl *** Minimum library versions for GNOME-APPLETS                          ***
dnl ***************************************************************************
GTK_REQUIRED=2.11.0
GLIB_REQUIRED=2.13.0
GIO_REQUIRED=2.15.3
LIBGNOME_REQUIRED=2.8.0
LIBGNOMEUI_REQUIRED=2.8.0
GNOME_VFS_REQUIRED=2.15.4
GCONF_REQUIRED=2.8.0
SCROLLKEEPER_REQUIRED=0.1.4
LIBPANEL_REQUIRED=2.13.4
LIBGTOP_REQUIRED=2.11.92
LIBGLADE_REQUIRED=2.4.0
LIBGAIL_REQUIRED=1.1.0
LIBXKLAVIER_REQUIRED=2.91
LIBWNCK_REQUIRED=2.9.3
SYSTEM_TOOLS_BACKENDS_REQUIRED=1.1.3
LIBGNOME_DESKTOP_REQUIRED=2.11.1
LIBNOTIFY_REQUIRED=0.3.2
HAL_REQUIRED=0.5.3
DBUS_REQUIRED=0.92
DBUS_GLIB_REQUIRED=0.34
PYGTK_REQUIRED=2.6
PYGOBJECT_REQUIRED=2.6
GNOME_PYTHON_REQUIRED=2.10
GNOME_ICON_THEME_REQUIRED=2.15.91
LIBXML_REQUIRED=2.5.0
GWEATHER_REQUIRED=2.21.1
dnl ***************************************************************************

AM_MAINTAINER_MODE

IT_PROG_INTLTOOL([0.35.0])
PKG_PROG_PKG_CONFIG([0.19])

AC_PROG_CC
AC_ISC_POSIX
AC_STDC_HEADERS
AM_PROG_LIBTOOL
AC_PATH_XTRA
AM_PATH_PYTHON(2.4)
AM_CHECK_PYTHON_HEADERS(HAVE_PYHDRS="yes", HAVE_PYHDRS="no")

X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
AC_SUBST(X_LIBS)

GNOME_COMPILE_WARNINGS

dnl Check for non-portable headers
AC_CHECK_HEADERS([pty.h values.h])

dnl ***************************************************************************
dnl *** --enable-more-warnings turns on more compiler warnings              ***
dnl ***************************************************************************
AC_ARG_ENABLE(more-warnings,
[  --enable-more-warnings  Maximum compiler warnings],
set_more_warnings="$enableval",[
    set_more_warnings=no
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
    AC_MSG_RESULT(yes)
    CFLAGS="\
    -Wall \
    -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
    -Wnested-externs -Wpointer-arith \
    -Wcast-align -Wsign-compare \
    -std=gnu89 \
    $CFLAGS"

    for option in -Wno-strict-aliasing -Wno-sign-compare; do
        SAVE_CFLAGS="$CFLAGS"
        CFLAGS="$CFLAGS $option"
        AC_MSG_CHECKING([whether gcc understands $option])
        AC_TRY_COMPILE([], [],
            has_option=yes,
            has_option=no,)
        if test $has_option = no; then
            CFLAGS="$SAVE_CFLAGS"
        fi
        AC_MSG_RESULT($has_option)
        unset has_option
        unset SAVE_CFLAGS
    done
    unset option
else
    AC_MSG_RESULT(no)
fi
dnl ***************************************************************************

dnl ***************************************************************************
dnl *** Use pkg-config to check for dependancies                            ***
dnl ***************************************************************************

dnl -- Check for gnome-icon-theme (required) ----------------------------------
PKG_CHECK_MODULES(GIT, gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED)

dnl -- Check for libgail (required) -------------------------------------------
PKG_CHECK_MODULES(GAILUTIL, gail >= $LIBGAIL_REQUIRED)
AC_SUBST(GAILUTIL_CFLAGS)
AC_SUBST(GAILUTIL_LIBS)

dnl -- check for gio (required) ------------------------------------------
PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)

dnl -- Check for GTK+ 2.0 (required) ------------------------------------------
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
AC_SUBST(GTK_FLAGS)
AC_SUBST(GTK_LIBS)

dnl -- check for libpanelapplet (required) ------------------------------------
PKG_CHECK_MODULES(GNOME_APPLETS, libpanelapplet-2.0 >= $LIBPANEL_REQUIRED)
AC_SUBST(GNOME_APPLETS_CFLAGS)
AC_SUBST(GNOME_APPLETS_LIBS)

dnl -- check for libgnome (required) ------------------------------------------
PKG_CHECK_MODULES(GNOME_LIBS2, libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED)
AC_SUBST(GNOME_LIBS2_CFLAGS)
AC_SUBST(GNOME_LIBS2_LIBS)

dnl -- check for gnome-desktop (required) -------------------------------------
PKG_CHECK_MODULES(GNOMEDESKTOP, gnome-desktop-2.0 >= $LIBGNOME_DESKTOP_REQUIRED)
AC_SUBST(GNOMEDESKTOP_CFLAGS)
AC_SUBST(GNOMEDESKTOP_LIBS)

dnl -- check for gnome-vfs (optional) -----------------------------------------
build_gnome_vfs_applets=false
PKG_CHECK_MODULES(GNOME_VFS_APPLETS, 
		  [gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED],
		  build_gnome_vfs_applets=true,)
AC_SUBST(GNOME_VFS_APPLETS_CFLAGS)
AC_SUBST(GNOME_VFS_APPLETS_LIBS)
AM_CONDITIONAL(BUILD_GNOME_VFS_APPLETS, $build_gnome_vfs_applets)

dnl -- check for libglade (required) ------------------------------------------
PKG_CHECK_MODULES(LIBGLADE, libglade-2.0 >= $LIBGLADE_REQUIRED)
AC_SUBST(LIBGLADE_CFLAGS)
AC_SUBST(LIBGLADE_LIBS)

dnl -- check for libgtop (optional) -------------------------------------------
build_gtop_applets=false
PKG_CHECK_MODULES(GTOP_APPLETS,
                 [libgtop-2.0 >= $LIBGTOP_REQUIRED],
                 build_gtop_applets=true,
		 AC_MSG_WARN([libgtop not found. Not building gtop applets.]))
AC_SUBST(GTOP_APPLETS_CFLAGS)
AC_SUBST(GTOP_APPLETS_LIBS)
AM_CONDITIONAL(BUILD_GTOP_APPLETS, $build_gtop_applets)

dnl -- check for libgnomekbd (optional) ---------------------------------------
PKG_CHECK_MODULES(LIBGNOMEKBDUI, libgnomekbdui >= 2.21.4.1,
	HAVE_LIBGNOMEKBD=yes, HAVE_LIBGNOMEKBD=no)

AC_SUBST(LIBGNOMEKBDUI_CFLAGS)
AC_SUBST(LIBGNOMEKBDUI_LIBS)

if test "x$HAVE_LIBGNOMEKBD" = "xno"; then
   BUILD_KEYBOARD_APPLET=no
   AC_MSG_WARN(
       [libgnomekbd was not found and is required to build gnome-keyboard-applet.],
	1)
else
   BUILD_KEYBOARD_APPLET=yes
fi

AM_CONDITIONAL(BUILD_KEYBOARD_APPLET, test "x$BUILD_KEYBOARD_APPLET" = "xyes")

dnl -- check for gnome-settings-daemon (optional) -----------------------------
PKG_CHECK_MODULES(GNOME_SETTINGS_DAEMON, gnome-settings-daemon,
	HAVE_GNOME_SETTINGS_DAEMON=yes, HAVE_GNOME_SETTINGS_DAEMON=no)

if test "x$HAVE_GNOME_SETTINGS_DAEMON" = "xno"; then
	AC_MSG_WARN([gnome-settings-daemon DBUS API is required to build modem-applet.])
fi

AC_SUBST(GNOME_SETTINGS_DAEMON_CFLAGS)
AC_SUBST(GNOME_SETTINGS_DAEMON_LIBS)

dnl -- check for libwnck (required) -------------------------------------------
PKG_CHECK_MODULES(LIBWNCK, libwnck-1.0 >= $LIBWNCK_REQUIRED,,
	AC_MSG_ERROR([libwnck is required to build gnome-applets.], 1))

AC_SUBST(LIBWNCK_CFLAGS)
AC_SUBST(LIBWNCK_LIBS)

dnl -- check for libnotify (optional) -----------------------------------------
LIBNOTIFY_CFLAGS=
LIBNOTIFY_LIBS=
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

AC_SUBST(LIBNOTIFY_CFLAGS)
AC_SUBST(LIBNOTIFY_LIBS)

dnl -- check for glib/gobject (required) --------------------------------------
PKG_CHECK_MODULES(CPUFREQ_SELECTOR, glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED)
AC_SUBST(CPUFREQ_SELECTOR_CFLAGS)
AC_SUBST(CPUFREQ_SELECTOR_LIBS)

if test "x$BUILD_KEYBOARD_APPLET" = "xyes"; then
  dnl -- check for dbus
  PKG_CHECK_MODULES(DBUS, dbus-1 >= $DBUS_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED, HAVE_DBUS=yes, HAVE_DBUS=no)

  if test "x$HAVE_DBUS" = "xno"; then
    AC_MSG_ERROR(
        [dbus was not found and is required to build gnome-keyboard-applet.])
  fi
fi

AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)

dnl -- check for libhal (optional) --------------------------------------------
HAL_CFLAGS=
HAL_LIBS=
AC_ARG_WITH(hal,[  --without-hal           build without hal support])

if test "x$with_hal" != xno; then
	PKG_CHECK_MODULES(HAL, hal >= $HAL_REQUIRED dbus-glib-1 >= $DBUS_GLIB_REQUIRED,
		  HAVE_HAL="yes",
		  HAVE_HAL="no")

	if test "x$HAVE_HAL" = "xyes"; then
		AC_DEFINE(HAVE_HAL, 1, [HAL available])
	fi
else
	AC_MSG_WARN(["Hal support disabled"])
fi

AC_SUBST(HAL_CFLAGS)
AC_SUBST(HAL_LIBS)

dnl -- check for gucharmap (optional) -----------------------------------------
GUCHARMAP_CFLAGS=
GUCHARMAP_LIBS=
PKG_CHECK_MODULES(GUCHARMAP, gucharmap >= 1.4.0,
		  HAVE_GUCHARMAP="yes", HAVE_GUCHARMAP="no")

if test "x$HAVE_GUCHARMAP" = "xyes"; then
	AC_DEFINE(HAVE_GUCHARMAP, 1, [Gucharmap Available])
else
  AC_MSG_WARN([*** 'charpick' applet will not be built with gucharmap support ***])
fi
AC_SUBST(GUCHARMAP_CFLAGS)
AC_SUBST(GUCHARMAP_LIBS)

dnl -- check for Python/GNOME modules (optional) ------------------------------
PYGTK_CFLAGS=
PYGTK_LIBS=
PKG_CHECK_MODULES(PYGTK,
	pygtk-2.0	>= $PYGTK_REQUIRED
	pygobject-2.0	>= $PYGOBJECT_REQUIRED
	gnome-python-2.0 >= $GNOME_PYTHON_REQUIRED,
	HAVE_PYGTK="yes", HAVE_PYGTK="no")
AC_SUBST(PYGTK_LIBS)
AC_SUBST(PYGTK_CFLAGS)

dnl -- check for libxml2 (required) ------------------------------------------
PKG_CHECK_MODULES(XML2, libxml-2.0 >= $LIBXML_REQUIRED)
AC_SUBST(XML2_CFLAGS)
AC_SUBST(XML2_LIBS)

 dnl -- check for libgweather (required for gweather applet) ------------------
PKG_CHECK_MODULES(LIBGWEATHER, gweather >= $GWEATHER_REQUIRED)
AC_SUBST(LIBGWEATHER_CFLAGS)
AC_SUBST(LIBGWEATHER_LIBS)
LIBGWEATHER_LOCATIONS=`pkg-config --variable=locations_file gweather`
AC_SUBST(LIBGWEATHER_LOCATIONS)

dnl ***************************************************************************
dnl *** find paths to installed binaries                                    ***
dnl ***************************************************************************

dnl -- gdk-pixbuf-csource -----------------------------------------------------
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)

if test x"$GDK_PIXBUF_CSOURCE" = xno; then
  AC_MSG_ERROR([gdk-pixbuf-csource executable not found in your path - should be installed with GTK])
fi
AC_SUBST(GDK_PIXBUF_CSOURCE)

dnl -- glib-genmarshal --------------------------------------------------------
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)

dnl -- gconftool-2 ------------------------------------------------------------
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
if test x"$GCONFTOOL" = xno; then
  AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
fi

dnl -- xsltproc ---------------------------------------------------------------
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

dnl -- scrollkeeper -----------------------------------------------------------
AC_PATH_PROG(SCROLLKEEPER_CONFIG, scrollkeeper-config, no)
if test x$SCROLLKEEPER_CONFIG = xno; then
  AC_MSG_ERROR(Couldn't find scrollkeeper-config, please install the Scrollkeeper 0.1.4 package)
fi
AC_SUBST(SCROLLKEEPER_REQUIRED)

dnl -- jw ---------------------------------------------------------------------
AC_PATH_PROG(JW, jw, no)
if test x$JW = xno; then
  HAVE_JW="no"
else
  HAVE_JW="yes"
fi
AM_CONDITIONAL(HAVE_JW, test "x$HAVE_JW" = "xyes")
AC_SUBST(HAVE_JW)

dnl ***************************************************************************
dnl *** GConf                                                               ***
dnl ***************************************************************************
AM_GCONF_SOURCE_2

dnl ***************************************************************************
dnl *** Set up gettext                                                      ***
dnl ***************************************************************************

GETTEXT_PACKAGE=gnome-applets-2.0
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext Package])
AC_DEFINE_DIR(GNOMELOCALEDIR, "${datadir}/locale", [locale directory])
AM_GLIB_GNU_GETTEXT

# this is the directory where the *.{mo,gmo} files are installed
gnomelocaledir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(gnomelocaledir)

dnl ***************************************************************************
dnl *** gnome-doc-utils                                                     ***
dnl ***************************************************************************
GNOME_DOC_INIT

dnl ***************************************************************************
dnl *** gnome-keyboard-applet specific checks                                           ***
dnl ***************************************************************************

dnl -- check to enable flags with --enable-flags ------------------------------
AC_ARG_ENABLE(flags,
[  --enable-flags          Enable flags usage in the keyboard indicators],
, enable_flags=no)
AM_CONDITIONAL(ENABLE_FLAGS, test x$enable_flags != xno)

case "$host" in
	sparc-*-solaris*)	gkb_type_sun=true;;
	*)			gkb_type_sun=false;;
esac
AM_CONDITIONAL(GKB_SUN, $gkb_type_sun)

dnl ***************************************************************************
dnl *** battstat specific checks                                            ***
dnl ***************************************************************************

dnl --disable-battstat=(yes|no)
AC_ARG_ENABLE(battstat,
	      [  --disable-battstat=[[no/yes]]
                          don't build battery monitor applet [[default: no]]],,
	      disable_battstat=no)

HAVE_LIBAPM=no
NEED_LIBAPM=no
ACPIINC=
build_battstat_applet=no

if test x$disable_battstat = xno; then
   build_battstat_applet=yes
   AC_CHECK_HEADERS([err.h sys/sysctl.h])
   case "${host}" in
       powerpc-*-linux*)
           NEED_LIBAPM=yes
           AC_CHECK_LIB(apm,apm_read,[HAVE_LIBAPM=yes],[HAVE_LIBAPM=no])
	   ;;
       # list of supported OS cores that use libapm
       *-*-linux*)
	   NEED_LIBAPM=yes
	   AC_CHECK_LIB(apm,apm_read,[HAVE_LIBAPM=yes],[HAVE_LIBAPM=no])
	   ;;
       # list of supported OS cores that do not use libapm
       i386-*-freebsd*|*-*-netbsd*|*-*-openbsd*|*-*kfreebsd*-gnu)
          if [ -n "${OS_SYS}" ]; then
	       ACPIINC="-I${OS_SYS}"
	   else
	       ACPIINC="-I/usr/src/sys"
	   fi

	   savecppflags=$CPPFLAGS
	   CPPFLAGS="$CPPFLAGS $ACPIINC"
	   AC_CHECK_HEADER(dev/acpica/acpiio.h, have_acpiio=true, have_acpiio=false)
	   if test $have_acpiio = true; then
	     AC_DEFINE(HAVE_ACPIIO, 1, [Define if acpiio.h exists on the system])
	   fi

	   ;;
       *)
	   echo "warning: ${host} is not supported by battstat_applet, not building" >&2
	   build_battstat_applet=no
	   ;;
    esac
fi

AC_SUBST(HAVE_LIBAPM)
AC_SUBST(NEED_LIBAPM)
AC_SUBST(ACPIINC)
AM_CONDITIONAL(HAVE_LIBAPM, test "x$HAVE_LIBAPM" = "xyes")
AM_CONDITIONAL(NEED_LIBAPM, test "x$NEED_LIBAPM" = "xyes")
AM_CONDITIONAL(BUILD_BATTSTAT_APPLET, test x$build_battstat_applet = xyes)

dnl ***************************************************************************
dnl *** Mini-Commander specific checks                                      ***
dnl ***************************************************************************
AC_ARG_ENABLE(mini-commander, [  --enable-mini-commander build mini-commander
                          [[default: no, transparent upgrade to deskbar-applet]]], enable_mini_commander="yes", enable_mini_commander="no")
AM_CONDITIONAL(BUILD_MINICOMMANDER_APPLET, test "x$enable_mini_commander" = "xyes")

dnl ***************************************************************************
dnl *** Stickynotes specific checks                                         ***
dnl ***************************************************************************
# AC_ARG_ENABLE(stickynotes, [  --enable-stickynotes build stickynotes
#                           [[default: no, transparent upgrade to Tomboy]]], enable_stickynotes="yes", enable_stickynotes="no")
enable_stickynotes="yes"
AM_CONDITIONAL(BUILD_STICKYNOTES_APPLET, test "x$enable_stickynotes" = "xyes")

dnl ***************************************************************************
dnl *** mixer applet specific checks                                        ***
dnl ***************************************************************************

GST_MAJORMINOR=auto
AC_ARG_WITH(gstreamer,
            AC_HELP_STRING([--with-gstreamer],[use gstreamer version for mixer if available]),
            [case "${withval}" in
               0.8) GST_MAJORMINOR=0.8 ;;
               0.10) GST_MAJORMINOR=0.10 ;;
               *) AC_MSG_ERROR([
                                *** Bad value ${withval} for --with-gstreamer
                                *** Please use one of the following:
                                ***    --with-gstreamer=0.8
                                ***    --with-gstreamer=0.10
                              ]);;
             esac])

GST10_REQS=0.10.2
GST10_PKGS="gstreamer-0.10 >= $GST10_REQS gstreamer-plugins-base-0.10 >= $GST10_REQS"
GST8_REQS=0.8.0
GST8_PKGS="gstreamer-0.8 >= $GST8_REQS gstreamer-interfaces-0.8 >= $GST8_REQS"

if test "x$GST_MAJORMINOR" = "xauto" -o "x$GST_MAJORMINOR=x0.10"; then
   # try for GStreamer 0.10
   MIXER_CFLAGS=
   MIXER_LIBS=
   PKG_CHECK_MODULES(MIXER, $GST10_PKGS, HAVE_GST_VER=0.10, HAVE_GST_VER=none)
fi

if test "x$GST_MAJORMINOR x$HAVE_GST_VER" = "xauto xnone" -o "x$GST_MAJORMINOR" = "x0.8" ; then
   # try for GStreamer 0.8
   MIXER_CFLAGS=
   MIXER_LIBS=
   PKG_CHECK_MODULES(MIXER, $GST8_PKGS, HAVE_GST_VER=0.8, HAVE_GST_VER=none)
fi

case $HAVE_GST_VER in
	0.8|0.10)
		HAVE_GST="yes"
		AC_MSG_RESULT([    using GStreamer $HAVE_GST_VER backend])
		;;
	none)
		HAVE_GST="no"
		AC_MSG_RESULT([GStreamer not found])
		AC_MSG_WARN([GStreamer unavailable, mixer applet will not be build])
		;;
	*)
		AC_MSG_ERROR([Something bad happened when determining GStreamer version, aborting!])
		;;
esac

AM_CONDITIONAL(APPLET_MIXER, test "x$HAVE_GST" = "xyes")
AM_CONDITIONAL(HAVE_GST10, test "x$HAVE_GST_VER" = "x0.10")
if test "x$HAVE_GST_VER" = "x0.10" ; then
	AC_DEFINE(HAVE_GST10, 1, [Using Gstreamer 0.10])
	# these don't seem to come from any pkg-config file
	MIXER_LIBS="$MIXER_LIBS -lgstinterfaces-0.10 -lgstaudio-0.10"
fi

AC_SUBST(MIXER_CFLAGS)
AC_SUBST(MIXER_LIBS)

dnl ***************************************************************************
dnl *** keyboard accessibility status applet check                          ***
dnl ***************************************************************************

savecppflags=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_HEADER(X11/extensions/XKB.h, HAVE_XKB=true, HAVE_XKB=false)
AC_SUBST(HAVE_XKB)

AM_CONDITIONAL(APPLET_ACCESSX, $HAVE_XKB)
if test "x$APPLET_ACCESSX" = "xtrue"; then
  AC_MSG_WARN([*** keyboard accessibility status applet will not be built ***])
fi
CPPFLAGS=$savecppflags

dnl ***************************************************************************
dnl *** modemlights applet check                                            ***
dnl ***************************************************************************

SU_TOOL=
P_MODEMLIGHTS=
HAVE_LIBUTIL=

AC_PATH_PROG(SU_TOOL, su)
AC_CHECK_LIB(util, forkpty, HAVE_LIBUTIL=true, HAVE_LIBUTIL=false)
AM_PATH_SYSTEM_TOOLS_BACKENDS($SYSTEM_TOOLS_BACKENDS_REQUIRED, P_MODEMLIGHTS=modemlights)

if test "x$HAVE_LIBUTIL" = "xtrue" -a "x$P_MODEMLIGHTS" = "xmodemlights" -a "x$HAVE_GNOME_SETTINGS_DAEMON" = "xyes"; then
  MODEMLIGHTS_LIBS=" -lutil"
  AC_SUBST(MODEMLIGHTS_LIBS)
  AC_DEFINE_UNQUOTED(STB_SCRIPTS_DIR, "$STB_SCRIPTS_DIR", [System tools backends])
  AC_DEFINE_UNQUOTED(SU_PATH, "${SU_TOOL}", [su executable path])
  BUILD_MODEM_LIGHTS=yes
else
  AC_MSG_WARN([*** modemlights applet will not be built ***])
  BUILD_MODEM_LIGHTS=no
fi

AM_CONDITIONAL(APPLET_MODEMLIGHTS, test "x$BUILD_MODEM_LIGHTS" = "xyes")

dnl ***************************************************************************
dnl *** cpufreq applet check                                                ***
dnl ***************************************************************************

dnl --disable-cpufreq=(yes|no)
AC_ARG_ENABLE(cpufreq,
	      [  --disable-cpufreq[[=no/yes]]            
                          don't build cpu frequency scaling monitor applet
			  [[default: no]]],,
	      disable_cpufreq=no)

dnl --enable-frequency-selector=(yes/no)
AC_ARG_ENABLE(frequency-selector,
	      [  --enable-frequency-selector[[=yes/no]]
	                  build frequency selector [[default: yes]]], ,
	      enable_selector=yes)

dnl --enable-suid=(yes/no)
AC_ARG_ENABLE(suid,
	      [  --enable-suid[[=yes/no]]  suid root the frequency selector executable
	                  [[default: yes]]], ,
	      suid=yes)

AC_CHECK_HEADER(cpufreq.h, have_libcpufreq=yes, have_libcpufreq=no)
LIBCPUFREQ_LIBS=
if test "x$have_libcpufreq" = "xyes"; then
   AC_DEFINE([HAVE_LIBCPUFREQ], [1], [Have libcpufreq.])
   LIBCPUFREQ_LIBS=-lcpufreq
fi
AM_CONDITIONAL(HAVE_LIBCPUFREQ, test x$have_libcpufreq = xyes)
AC_SUBST(LIBCPUFREQ_LIBS)

build_cpufreq_applet=no

if test x$disable_cpufreq = xno; then
   case "${host}" in
      *linux*)
         build_cpufreq_applet=yes
	 ;;
      *)
         AC_MSG_WARN([${host} is not supported by cpufreq applet, not building])
	 build_cpufreq_applet=no
	 ;;
   esac
fi

AM_CONDITIONAL(BUILD_CPUFREQ_APPLET, test x$build_cpufreq_applet = xyes)
AM_CONDITIONAL(BUILD_CPUFREQ_SELECTOR, test x$enable_selector = xyes)
AM_CONDITIONAL(CPUFREQ_SELECTOR_SUID, test x$suid = xyes)

dnl ***************************************************************************
dnl *** invest-applet specific checks                                       ***
dnl ***************************************************************************

if test "x$HAVE_PYGTK" = "xyes" -a "x$HAVE_PYHDRS" = "xyes"; then
	AM_CHECK_PYMOD(gnomeapplet,,
			BUILD_INVEST_APPLET="yes", BUILD_INVEST_APPLET="no")
else
	BUILD_INVEST_APPLET="no"
fi

AM_CONDITIONAL(BUILD_INVEST_APPLET, test "x$BUILD_INVEST_APPLET" = "xyes")

dnl ***************************************************************************
dnl *** Check if IPv6 is available                                          ***
dnl ***************************************************************************
AC_MSG_CHECKING([whether to enable ipv6])
AC_ARG_ENABLE(ipv6, [  --enable-ipv6 enable IPv6 extensions], ,enable_ipv6=yes)
if test $enable_ipv6 = yes; then

  dnl Code for checking presence of AF_INET6 on the system.
  AC_TRY_COMPILE([
    #include <sys/types.h>
    #include <sys/socket.h>], [
    socket(AF_INET6, SOCK_STREAM, 0)
    ],
    have_ipv6=yes,
    have_ipv6=no
  )
  AC_MSG_RESULT($have_ipv6)
  if test $have_ipv6 = yes; then
      AC_DEFINE(ENABLE_IPV6, 1, [Define if system is IPv6 enabled])
  fi
fi

dnl ***************************************************************************
dnl *** Check for getaddrinfo                                               ***
dnl ***************************************************************************
have_getaddrinfo=no
AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes)
if test $have_getaddrinfo != yes; then
  # getaddrinfo is not in the default libraries.  See if it's in some other.
  for lib in bsd socket inet; do
    AC_CHECK_LIB($lib, getaddrinfo, [LIBS="$LIBS -l$lib";have_getaddrinfo=yes; break])
  done
fi
if test $have_getaddrinfo = yes; then
  AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo() exists on the system])
fi

dnl ***************************************************************************
dnl *** Check for presence of tm.tm_gmtoff on the system                    ***
dnl ***************************************************************************
AC_CHECK_MEMBER([struct tm.tm_gmtoff],[struct_tm_tm_gmtoff=true],[struct_tm_tm_gmtoff=false],[#include <time.h>])
case $struct_tm_tm_gmtoff in
        true)
                AC_DEFINE_UNQUOTED(HAVE_TM_TM_GMOFF, 1, Have the tm.tm_gmtoff member.)
                ;;
        *)
                AC_CHECK_DECL(timezone,AC_DEFINE(HAVE_TIMEZONE,1,Have timezone),,
[
#include <time.h>
])
                ;;
esac

dnl ***************************************************************************
dnl *** _NL_MEASUREMENT_MEASUREMENT is an enum and not a define             ***
dnl ***************************************************************************
AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
AC_TRY_LINK([#include <langinfo.h>], [
char c;
c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
], gtk_ok=yes, gtk_ok=no)
AC_MSG_RESULT($gtk_ok)
if test "$gtk_ok" = "yes"; then
  AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT], [1],
            [Define if _NL_MEASUREMENT_MEASUREMENT is available])
fi

dnl ***************************************************************************
dnl *** Honour aclocal flags                                                ***
dnl ***************************************************************************
ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
AC_SUBST(ACLOCAL_AMFLAGS)

dnl ***************************************************************************
dnl *** Set install directories                                             ***
dnl ***************************************************************************
iconsdir="${datadir}/icons"
AC_SUBST(iconsdir)
pixmapsdir="${datadir}/pixmaps"
AC_SUBST(pixmapsdir)
pkgdatadir="${datadir}/gnome-applets"
AC_SUBST(pkgdatadir)
gladedir="${pkgdatadir}/glade"
AC_SUBST(gladedir)

AC_DEFINE_DIR(GNOME_ICONDIR, "${iconsdir}", [Gnome Icon Directory])
AC_DEFINE_DIR(GNOME_PIXMAPSDIR, "${pixmapsdir}", [Gnome Pixmaps Directory])
AC_DEFINE_DIR(GNOME_GLADEDIR, "${gladedir}", [Glade Resources Directory])
AC_DEFINE_DIR(DATADIR, "${datadir}", [datadir])
AC_DEFINE_DIR(SYSCONFDIR, "${sysconfdir}", [sysconfdir])
AC_DEFINE_DIR(LIBDIR, "${libdir}", [libdir])
AC_DEFINE_DIR(PREFIX, "$prefix", [install prefix])

AS_AC_EXPAND(DATADIR, "${datadir}")
AS_AC_EXPAND(PYTHONDIR, $pythondir)
AS_AC_EXPAND(GLADEDIR, $gladedir)

AC_SUBST(VERSION)
AC_SUBST(PACKAGE)
AC_SUBST(DATADIR)
AC_SUBST(LIBDIR)
AC_SUBST(PYTHONDIR)
AC_SUBST(GLADEDIR)

dnl ***************************************************************************
dnl *** Output Makefiles et al                                              ***
dnl ***************************************************************************
AC_OUTPUT([
gnome-applets.spec
Makefile
po/Makefile.in
accessx-status/Makefile
accessx-status/docs/Makefile
accessx-status/pixmaps/Makefile
mini-commander/Makefile
mini-commander/src/Makefile
mini-commander/help/Makefile
mixer/Makefile
mixer/docs/Makefile
drivemount/Makefile
drivemount/help/Makefile
modemlights/Makefile
multiload/Makefile
multiload/docs/Makefile
gkb-new/Makefile
gkb-new/xmodmap/Makefile
gkb-new/xmodmap.sun/Makefile
charpick/Makefile
charpick/help/Makefile
invest-applet/Makefile
invest-applet/invest/Makefile
invest-applet/invest/defs.py
invest-applet/data/Makefile
invest-applet/data/art/Makefile
gweather/Makefile
gweather/docs/Makefile
geyes/Makefile
geyes/themes/Makefile
geyes/docs/Makefile
battstat/Makefile
battstat/apmlib/Makefile
battstat/sounds/Makefile
battstat/docs/Makefile
man/Makefile
stickynotes/Makefile
stickynotes/pixmaps/Makefile
stickynotes/docs/Makefile
stickynotes/data/Makefile
gswitchit/Makefile
gswitchit/help/Makefile
trashapplet/Makefile
trashapplet/src/Makefile
trashapplet/docs/Makefile
cpufreq/Makefile
cpufreq/src/Makefile
cpufreq/src/cpufreq-selector/Makefile
cpufreq/pixmaps/Makefile
cpufreq/help/Makefile
null_applet/Makefile
])

dnl ***************************************************************************
dnl *** Display Summary                                                     ***
dnl ***************************************************************************
echo "
gnome-applets-$VERSION configure summary:

	Prefix:				${prefix}
	Source code location:		${srcdir}
	Compiler:			${CC}

	Building:
	 - accessx-status		$HAVE_XKB
	 - battstat			$build_battstat_applet
	 - charpick			always
	 	- gucharmap support	$HAVE_GUCHARMAP
	 - cpufreq			$build_cpufreq_applet
	 	- building selector	$enable_selector
		- enabling suid bit	$suid
	 - drivemount			$build_gnome_vfs_applets
	 - geyes			always
	 - keyboard-applet		$BUILD_KEYBOARD_APPLET
	 - gweather			$build_gnome_vfs_applets
	 - invest-applet		$BUILD_INVEST_APPLET
	 - mini-commander		$enable_mini_commander
	 - mixer			$HAVE_GST
	 - modemlights			$BUILD_MODEM_LIGHTS
	 - multiload			$build_gtop_applets
	 - stickynotes			$enable_stickynotes
	 - trashapplet			$build_gnome_vfs_applets
	
	Using DBUS:			$HAVE_DBUS
	Using HAL:			$HAVE_HAL
	Using GStreamer version:	$HAVE_GST_VER
	Enabling IPv6:			$have_ipv6
" >&2