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)
65 AM_CONDITIONAL(ENABLE_BUNDLE,[ test "x$enable_bundle" = "xyes" ])
66 if test "x$enable_bundle" = "xyes"
68 AC_DEFINE(ENABLE_BUNDLE,,[Build single binary containing locale and init.d files.])
72 AC_PATH_PROGS(PERL,perl5 perl)
73 AM_CONDITIONAL(HAVE_PERL,test -n "$PERL")
76 AC_PATH_PROGS(POD2MAN,pod2man)
77 AM_CONDITIONAL(HAVE_POD2MAN,[ test -n "$POD2MAN" ])
78 if test x$enable_man_pages = xyes;then
79 if test -z "$POD2MAN";then
80 AC_MSG_ERROR([udpgate requires pod2man(1) for man pages; try --disable-man-pages.])
82 if test -z "$PERL";then
83 AC_MSG_ERROR([udpgate requires perl(1) for man pages; try --disable-man-pages.])
85 elif test x$enable_man_pages != xno;then
86 if test -z "$POD2MAN";then
87 AC_MSG_WARN([udpgate requires pod2man(1) for man pages by --enable-man-pages; mans will not be installed.])
89 if test -z "$PERL";then
90 AC_MSG_WARN([udpgate requires perl(1) for man pages by --enable-man-pages; mans will not be installed.])
93 AM_CONDITIONAL(ENABLE_MAN_PAGES,[ test x$enable_man_pages != xno -a -n "$POD2MAN" -a -n "$PERL" ])
95 dnl Separate 'acconfig.h' is no longer recommended by autoconf
97 #ifndef _UDPGATE_CONFIG_H
98 #define _UDPGATE_CONFIG_H 1
101 /* Do not place any stuff to AH_TOP as some of its includes
102 * would discard the effect of _FILE_OFFSET_BITS by AC_SYS_LARGEFILE.
106 /* <libintl.h> is taken from "$(top_srcdir)/intl" if system doesn't provide intl */
107 # include <libintl.h>
108 #define _(String) gettext (String)
110 # define N_(String) gettext_noop (String)
112 # define N_(String) (String)
114 #else /* !ENABLE_NLS */
115 /* Stubs that do something close enough. */
116 # define textdomain(String) (String)
117 # define gettext(String) (String)
118 # define dgettext(Domain,Message) (Message)
119 # define dcgettext(Domain,Message,Type) (Message)
120 # define bindtextdomain(Domain,Directory) (Domain)
121 # define _(String) (String)
122 # define N_(String) (String)
123 #endif /* !ENABLE_NLS */
125 #include <glib/gtypes.h> /* for 'gchar' */
126 #define G_LOG_DOMAIN ((const gchar *)"UDPGate")
130 * @objp: Variable with the pointer to the objects wished to be allocated.
131 * Original value is discarded.
132 * @n: Numbers of objects to be allocated. Value %0 is permitted (%NULL assignment effect).
134 * Macro to allocate @n objects of type *@objp and to assign the resulting pointer to @objp.
135 * Allocated memory may contain garbage.
137 * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp))*n.
138 * Value %NULL is returned iff @n==%0;
140 #define udpgate_newn(objp,n) ((objp)=g_new(typeof(*(objp)),(n)))
144 * @objp: Variable with the pointer to the object wished to be allocated.
145 * Original value is discarded.
147 * Macro to allocate one object of type *@objp and to assign the resulting pointer to @objp.
148 * Allocated memory may contain garbage. Equivalent to udpgate_newn(objp,1) call.
150 * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp)).
151 * Value %NULL is never returned.
153 #define udpgate_new(objp) (udpgate_newn((objp),1))
157 * @objp: Pointer to the variable to be cleared.
159 * Clears the sizeof(*@objp) bytes of the given pointer with memset().
160 * Pass _pointer_ to the object to be cleared.
162 #define UDPGATE_MEMZERO(objp) (memset((objp),0,sizeof(*(objp))))
165 * udpgate_printf_alloca:
166 * @format: Format string. See the sprintf() documentation.
167 * @args...: Arguments for @format. See the sprintf() documentation.
169 * Format the given format string @format as in sprintf().
170 * Output buffer is allocated automatically and it does not need to be deallocated
171 * manually as it is managed by g_alloca().
173 * @Returns: Formatted output string located in g_alloca() memory.
175 #include <glib/galloca.h>
176 #include <glib/gutils.h>
177 #define udpgate_printf_alloca(format,args...) ({ \
178 gsize _udpgate_printf_alloca_size=udpgate_nv_printf_string_upper_bound((format) , ## args); \
179 gchar *_udpgate_printf_alloca_r=g_alloca(_udpgate_printf_alloca_size); \
180 g_snprintf(_udpgate_printf_alloca_r,_udpgate_printf_alloca_size,(format) , ## args); \
181 (const gchar *)_udpgate_printf_alloca_r; \
184 #include <glib/gmessages.h> /* for g_printf_string_upper_bound() */
185 static inline gsize udpgate_nv_printf_string_upper_bound(const gchar *format,...) G_GNUC_PRINTF(1,0) G_GNUC_UNUSED;
186 static inline gsize udpgate_nv_printf_string_upper_bound(const gchar *format,...)
192 r=g_printf_string_upper_bound(format,ap);
197 #endif /* !_UDPGATE_CONFIG_H */
200 dnl Do not use PKG_CHECK_MODULES() as it would not set 'GLIB_GENMARSHAL' etc.
201 AM_PATH_GLIB_2_0(,,[AC_MSG_ERROR([UDPGate requires glib-2.0 library.])],[])
202 dnl Force glib for the whole package
203 CFLAGS="$CFLAGS $GLIB_CFLAGS"
204 LIBS="$LIBS $GLIB_LIBS"
207 AC_CHECK_LIB(popt,poptParseArgvString,[POPT_LIBS="-lpopt"],[AC_MSG_ERROR([UDPGate requires popt library.])])
211 ./src/ui-gnome-interface.c
212 ./src/ui-gnome-interface.h
213 ./src/ui-gnome-callbacks.h
214 ./src/ui-gnome-support.c
215 ./src/ui-gnome-support.h
217 AC_SUBST(GNOMEUI_CFLAGS)
218 AC_SUBST(GNOMEUI_LIBS)
221 AC_DEFINE(HAVE_GNOME,,[Compile Gnome support.])
223 AM_CONDITIONAL(HAVE_GNOME,[ $have_gnome ])
224 AM_CONDITIONAL(HAVE_GLADE_WRITESOURCE,[ test "x$PATH_GLADE" != "x" ])
225 dnl Do not: AM_CONDITIONAL(BUILD_GLADESRC,[ test "xyes" = "x$BUILD_GLADESRC" ])
226 dnl as we do not need it as we are conditioned by ENABLE_INSTALL_PKG
228 if test "x$BUILD_GLADESRC_TRUE" = "x"
230 AC_CHECK_LIB(Xi,XOpenDevice,GNOME_ADDON_LIBS="$GNOME_ADDON_LIBS -lXi")
232 AC_SUBST(GNOME_ADDON_LIBS)
237 dnl "Makefile" output files MUST have pathnames incl./excl. "./" prefix as specified!
238 dnl FIXME: Why the rule above was written here?
250 dnl FIXME: Why is "po/POTFILES" being substituted?
251 make -C src distfiles DISTFILES_PRINT=1 \
252 |sed -n 's/^:DISTFILES: *\(.*\)$/\1/p'|tr ' ' '\n'|grep . >po/POTFILES.in