2 dnl autoconf plugin for 'glade-2 --write-source' detection
3 dnl Copyright (C) 2000,2003 Jan Kratochvil <project-macros@jankratochvil.net>
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; exactly version 2 of June 1991 is required
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 dnl GLADE_W_INIT (glade-generated-files, user-option, add-on)
22 dnl glade-generated-files: All files that glade-w.sh.in would be able to
23 dnl generate. Depends on *.glade file options.
24 dnl user-option: User wish for the client (yes/no/[* for auto])
25 dnl add-on: Some additional requirements, set "glade_addon=yes"
26 dnl Use AC_SUBST(GNOMEUI_CFLAGS)
27 dnl AC_SUBST(GNOMEUI_LIBS)
31 AC_DEFUN([GLADE_W_INIT],
35 dnl Gnome is optional.
36 PKG_CHECK_MODULES(GNOMEUI,libgnomeui-2.0,[
37 AC_DEFINE(HAVE_GNOMEUI,,[Have libgnomeui-2.0 include files and libraries.])
39 ],[ have_gnome=false ])
41 AC_PATH_PROG(PATH_GLADE,glade-2,)
43 dnl FIXME: Gnome-enabled glade-2 will complain on $DISPLAY even if --invalid-option!
44 dnl Do we need to provide Xvnc $DISPLAY to it to check it for Gnome support?
45 dnl Currently we assume it is Gnome-enabled.
46 dnl if test "x$PATH_GLADE" != "x"
48 dnl AC_CACHE_CHECK([whether glade found has Gnome extensions],glade_cv_has_gnome,
50 dnl save_DISPLAY="$DISPLAY"
52 dnl gladeun="`$PATH_GLADE --disable-crash-dialog --invalid-option 2>&1|grep -- '--invalid-option:'`"
53 dnl export DISPLAY="$save_DISPLAY"
54 dnl if test "x$gladeun" != "x"
56 dnl glade_cv_has_gnome=yes
58 dnl glade_cv_has_gnome=no
61 dnl if test "x$glade_cv_has_gnome" = "xno"
64 dnl AC_MSG_WARN([GTK+/Gnome: Glade builder was found but it has no Gnome support, only GTK+,
65 dnl please install Gnome packages and then recompile your Glade.])
69 if test "x$PATH_GLADE" != "x"
71 AC_CACHE_CHECK([whether glade found is capable of write-source-ing],glade_cv_writesource,
73 save_DISPLAY="$DISPLAY"
75 gladeun="`$PATH_GLADE --disable-crash-dialog --write-source /dev/null 2>&1|grep -- '-w:'`"
76 export DISPLAY="$save_DISPLAY"
77 if test "x$gladeun" = "x"
79 glade_cv_writesource=yes
81 glade_cv_writesource=no
84 if test "x$glade_cv_writesource" = "xno"
87 AC_MSG_WARN([GTK+/Gnome: Glade builder was found but it is not capable of batch source builds,
88 please upgrade to Glade version 0.5.8 or higher.])
92 if test "x$PATH_GLADE" != "x"
94 AC_PATH_PROG(PATH_XVNC,Xvnc,)
95 AC_PATH_PROG(PATH_BC,bc,)
96 AC_CACHE_CHECK([whether it is possible to access any X server for Glade],glade_cv_can_xserver,
100 gladeun="`sh ./macros/glade-w.sh.in /dev/null 2>&1|grep -- 'Document is empty'`"
101 if test "x$gladeun" != "x"
103 glade_cv_can_xserver=yes
105 glade_cv_can_xserver=no
108 if test "x$glade_cv_can_xserver" = "xno"
111 if test "x$PATH_XVNC" = "x"
113 AC_MSG_WARN([GTK+/Gnome: Unable to access any valid X server, give DISPLAY or install Xvnc(1) (vnc-server package).])
115 AC_MSG_WARN([GTK+/Gnome: Unable to access any valid X server, DISPLAY and Xvnc(1) tried.])
120 AC_MSG_CHECKING(whether I need write-source-ing and runnable Glade for GTK+/Gnome client)
124 gnofis="./src/interface.c ./src/interface.h ./src/support.c ./src/support.h"
130 if test '!' -f "$gnofi"
135 AC_MSG_RESULT($NEED_GLADE)
138 ifelse([$3], ,glade_addon=yes,[$3])
141 if test "x$2" != "xno" -a "xtrue" = "x$have_gnome" -a '(' "x$NEED_GLADE" = "xno" -o "x$PATH_GLADE" != "x" ')' -a "x$glade_addon" = "xyes"
146 if test "x$2" = "xyes"
148 AC_MSG_ERROR([GTK+/Gnome: Requested client compilation impossible, see errors above.])
149 elif test "x$2" != "xno"
151 AC_MSG_WARN([GTK+/Gnome: Interface will not be build, see errors above for reason(s).])
154 AM_CONDITIONAL(HAVE_GLADE_WRITESOURCE,[ test "x$PATH_GLADE" != "x" ])
155 AM_CONDITIONAL(BUILD_GLADESRC,[ test "xyes" = "x$BUILD_GLADESRC" ])