2 # Source file to generate "./configure" to prepare package for compilation
3 # Copyright (C) 2004 Jan Kratochvil <project-udpgate@jankratochvil.net>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; exactly version 2 of June 1991 is required
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 dnl 2.53 for AM_GLIB_GNU_GETTEXT:
22 dnl Not yet present in: Red Hat autoconf-2.57-3
23 dnl AC_CONFIG_MACRO_DIR(macros)
24 AM_INIT_AUTOMAKE(udpgate,1.0cvs)
25 AM_CONFIG_HEADER(config.h)
27 dnl Prevent "AC_TRY_COMPILE was called before AC_ISC_POSIX":
33 dnl Workaround for autoconf-2.57:
34 m4_pattern_allow([AC_MSG_WARN])
35 m4_pattern_allow([AC_CHECK_LIB])
36 m4_pattern_allow([AC_CHECK_HEADERS])
38 dnl gettext localization.
39 dnl Use simpler AM_GLIB_GNU_GETTEXT instead of AM_GNU_GETTEXT
40 dnl as we depend on glib and glib requires system installed gettext anyway.
41 dnl http://lists.gnome.org/archives/gtk-devel-list/2003-April/msg00066.html
42 dnl Special 'GETTEXT_PACKAGE' is required by glib gettext.
44 GETTEXT_PACKAGE="$PACKAGE"
45 AC_SUBST(GETTEXT_PACKAGE)
48 dnl Do not discard 'CFLAGS' settings as they may have been passed us by rpmbuild(8)
50 dnl Define MAINTAINER_MODE in config.h.
51 if test "$USE_MAINTAINER_MODE" = "yes";then
52 AC_DEFINE(MAINTAINER_MODE,,[Turn even some software behaviour according to MAINTAINER_MODE.])
53 CFLAGS="$CFLAGS -ggdb3 -Wall -Wstrict-prototypes -Wsign-compare"
55 dnl Some Makefiles use additional tests etc.
56 AM_CONDITIONAL(MAINTAINER_MODE,[test "$USE_MAINTAINER_MODE" = "yes"])
59 AC_ARG_ENABLE(man-pages,
60 [ --enable-man-pages=no/yes/auto pod2man(1) required for man pages (def.=yes)],,enable_man_pages=yes)
62 [ --enable-bundle Build single binary containing locale and init.d files (def.=no)],,enable_bundle=no)
66 AC_PATH_PROGS(PERL,perl5 perl)
67 AM_CONDITIONAL(HAVE_PERL,test -n "$PERL")
69 AM_CONDITIONAL(ENABLE_BUNDLE,[ test "x$enable_bundle" = "xyes" ])
70 if test "x$enable_bundle" = "xyes"
72 if test -f src/bundle.c
74 AC_DEFINE(ENABLE_BUNDLE,,[Build single binary containing locale and init.d files.])
77 AC_MSG_WARN([Perl not found (see above). The --enable-bundle files cannot be updated yourself.])
82 AC_MSG_ERROR([Perl not found (see above). --enable-bundle is not possible as src/bundle.c is missing.])
88 AC_PATH_PROGS(POD2MAN,pod2man)
89 AM_CONDITIONAL(HAVE_POD2MAN,[ test -n "$POD2MAN" ])
90 if test x$enable_man_pages = xyes;then
91 if test -z "$POD2MAN";then
92 AC_MSG_ERROR([udpgate requires pod2man(1) for man pages; try --disable-man-pages.])
94 if test -z "$PERL";then
95 AC_MSG_ERROR([udpgate requires perl(1) for man pages; try --disable-man-pages.])
97 elif test x$enable_man_pages != xno;then
98 if test -z "$POD2MAN";then
99 AC_MSG_WARN([udpgate requires pod2man(1) for man pages by --enable-man-pages; mans will not be installed.])
101 if test -z "$PERL";then
102 AC_MSG_WARN([udpgate requires perl(1) for man pages by --enable-man-pages; mans will not be installed.])
105 AM_CONDITIONAL(ENABLE_MAN_PAGES,[ test x$enable_man_pages != xno -a -n "$POD2MAN" -a -n "$PERL" ])
107 dnl Separate 'acconfig.h' is no longer recommended by autoconf
109 #ifndef _UDPGATE_CONFIG_H
110 #define _UDPGATE_CONFIG_H 1
113 /* Do not place any stuff to AH_TOP as some of its includes
114 * would discard the effect of _FILE_OFFSET_BITS by AC_SYS_LARGEFILE.
118 /* <libintl.h> is taken from "$(top_srcdir)/intl" if system doesn't provide intl */
119 # include <libintl.h>
120 #define _(String) gettext (String)
122 # define N_(String) gettext_noop (String)
124 # define N_(String) (String)
126 #else /* !ENABLE_NLS */
127 /* Stubs that do something close enough. */
128 # define textdomain(String) (String)
129 # define gettext(String) (String)
130 # define dgettext(Domain,Message) (Message)
131 # define dcgettext(Domain,Message,Type) (Message)
132 # define bindtextdomain(Domain,Directory) (Domain)
133 # define _(String) (String)
134 # define N_(String) (String)
135 #endif /* !ENABLE_NLS */
137 #include <glib/gtypes.h> /* for 'gchar' */
138 #define G_LOG_DOMAIN ((const gchar *)"UDPGate")
142 * @objp: Variable with the pointer to the objects wished to be allocated.
143 * Original value is discarded.
144 * @n: Numbers of objects to be allocated. Value %0 is permitted (%NULL assignment effect).
146 * Macro to allocate @n objects of type *@objp and to assign the resulting pointer to @objp.
147 * Allocated memory may contain garbage.
149 * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp))*n.
150 * Value %NULL is returned iff @n==%0;
152 #define udpgate_newn(objp,n) ((objp)=g_new(typeof(*(objp)),(n)))
156 * @objp: Variable with the pointer to the object wished to be allocated.
157 * Original value is discarded.
159 * Macro to allocate one object of type *@objp and to assign the resulting pointer to @objp.
160 * Allocated memory may contain garbage. Equivalent to udpgate_newn(objp,1) call.
162 * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp)).
163 * Value %NULL is never returned.
165 #define udpgate_new(objp) (udpgate_newn((objp),1))
169 * @objp: Pointer to the variable to be cleared.
171 * Clears the sizeof(*@objp) bytes of the given pointer with memset().
172 * Pass _pointer_ to the object to be cleared.
174 #define UDPGATE_MEMZERO(objp) (memset((objp),0,sizeof(*(objp))))
177 * udpgate_printf_alloca:
178 * @format: Format string. See the sprintf() documentation.
179 * @args...: Arguments for @format. See the sprintf() documentation.
181 * Format the given format string @format as in sprintf().
182 * Output buffer is allocated automatically and it does not need to be deallocated
183 * manually as it is managed by g_alloca().
185 * @Returns: Formatted output string located in g_alloca() memory.
187 #include <glib/galloca.h>
188 #include <glib/gutils.h>
189 #define udpgate_printf_alloca(format,args...) ({ \
190 gsize _udpgate_printf_alloca_size=udpgate_nv_printf_string_upper_bound((format) , ## args); \
191 gchar *_udpgate_printf_alloca_r=g_alloca(_udpgate_printf_alloca_size); \
192 g_snprintf(_udpgate_printf_alloca_r,_udpgate_printf_alloca_size,(format) , ## args); \
193 (const gchar *)_udpgate_printf_alloca_r; \
196 #include <glib/gmessages.h> /* for g_printf_string_upper_bound() */
197 static inline gsize udpgate_nv_printf_string_upper_bound(const gchar *format,...) G_GNUC_PRINTF(1,0) G_GNUC_UNUSED;
198 static inline gsize udpgate_nv_printf_string_upper_bound(const gchar *format,...)
204 r=g_printf_string_upper_bound(format,ap);
209 #endif /* !_UDPGATE_CONFIG_H */
212 dnl Do not use PKG_CHECK_MODULES() as it would not set 'GLIB_GENMARSHAL' etc.
213 AM_PATH_GLIB_2_0(,,[AC_MSG_ERROR([UDPGate requires glib-2.0 library.])],[])
214 dnl Force glib for the whole package
215 CFLAGS="$CFLAGS $GLIB_CFLAGS"
216 LIBS="$LIBS $GLIB_LIBS"
219 AC_CHECK_LIB(popt,poptParseArgvString,[POPT_LIBS="-lpopt"],[AC_MSG_ERROR([UDPGate requires popt library.])])
223 ./src/ui-gnome-interface.c
224 ./src/ui-gnome-interface.h
225 ./src/ui-gnome-callbacks.h
226 ./src/ui-gnome-support.c
227 ./src/ui-gnome-support.h
229 AC_SUBST(GNOMEUI_CFLAGS)
230 AC_SUBST(GNOMEUI_LIBS)
233 AC_DEFINE(HAVE_GNOME,,[Compile Gnome support.])
235 AM_CONDITIONAL(HAVE_GNOME,[ $have_gnome ])
236 AM_CONDITIONAL(HAVE_GLADE_WRITESOURCE,[ test "x$PATH_GLADE" != "x" ])
237 dnl Do not: AM_CONDITIONAL(BUILD_GLADESRC,[ test "xyes" = "x$BUILD_GLADESRC" ])
238 dnl as we do not need it as we are conditioned by ENABLE_INSTALL_PKG
240 if test "x$BUILD_GLADESRC_TRUE" = "x"
242 AC_CHECK_LIB(Xi,XOpenDevice,GNOME_ADDON_LIBS="$GNOME_ADDON_LIBS -lXi")
244 AC_SUBST(GNOME_ADDON_LIBS)
249 dnl "Makefile" output files MUST have pathnames incl./excl. "./" prefix as specified!
250 dnl FIXME: Why the rule above was written here?
262 dnl FIXME: Why is "po/POTFILES" being substituted?
263 make -C src distfiles DISTFILES_PRINT=1 \
264 |sed -n 's/^:DISTFILES: *\(.*\)$/\1/p'|tr ' ' '\n'|grep . >po/POTFILES.in