1# gnubiff -- a mail notification program
2# Copyright (C) 2000-2010 Nicolas Rougier, 2004-2010 Robert Sowada
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
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 GNU
12# General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16#
17# Process this file with autoconf to produce a configure script.
18
19######################################################################
20#                           Initialization                           #
21######################################################################
22
23# gnubiff version numbering scheme:
24#  gnubiff uses the  "major level", "minor level" & "patch level"
25#  version numbering scheme
26#
27# - First number is the major number and it signifies major changes or
28#   rewrites.
29# - The second number is the minor number and it represents added or
30#    tweaked functionality on top of a largely coherent structure.
31# - The third number is the patch number and it usually will only
32#    refer to releases fixing bugs
33#
34# Current version is 2.2.13
35
36AC_PREREQ(2.59)
37AC_INIT([gnubiff],[2.2.13],[gnubiff-bugs@lists.sourceforge.net])
38AC_CONFIG_AUX_DIR(config)
39AC_CONFIG_HEADERS([config/config.h])
40AC_CONFIG_SRCDIR([src/gnubiff.cc])
41AM_INIT_AUTOMAKE
42AM_MAINTAINER_MODE
43
44######################################################################
45#                           Configure Options                        #
46######################################################################
47dnl syntaxt: AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
48dnl If the user gave configure the option `--with-package' or
49dnl `--without-package', run shell commands action-if-given. If neither
50dnl option was given, run shell commands action-if-not-given. The name
51dnl package indicates another software package that this program should
52dnl work with. It should consist only of alphanumeric characters and
53dnl dashes.
54AC_ARG_ENABLE(fam,
55              [  --disable-fam           disable the use of FAM (autodetect)],
56              OPT_USEFAM="$enableval", OPT_USEFAM="yes")
57AC_ARG_ENABLE(gnome,
58              [  --disable-gnome         disable the use of gnome (default: enable)],
59              OPT_USEGNOME="$enableval", OPT_USEGNOME="yes")
60
61
62
63######################################################################
64#                         Checks for programs                        #
65######################################################################
66AC_PROG_CXX
67AC_PROG_CC
68AC_PROG_CPP
69AC_PROG_INSTALL
70AC_PROG_LN_S
71AC_PROG_MAKE_SET
72
73######################################################################
74#                         Checks for libraries                       #
75######################################################################
76dnl LIBPOPT (for parsing options)
77AC_CHECK_LIB([popt],[main], ,
78	AC_MSG_ERROR([
79	Cannot find popt library
80	Please consider installing it before installing gnubiff
81	])
82)
83
84dnl From pkg.m4:
85dnl # Note that if there is a possibility the first call to
86dnl # PKG_CHECK_MODULES might not happen, you should be sure to
87dnl # include an explicit call to PKG_PROG_PKG_CONFIG in your
88dnl # configure.ac
89PKG_PROG_PKG_CONFIG
90
91dnl LIBFAM, LIBGAMIN (for monitoring files)
92if test "x$OPT_USEFAM" = "xyes"; then
93	AC_CHECK_LIB([fam], [main],
94                 [FAM_LIBS="-lfam"
95	              AC_DEFINE([HAVE_LIBFAM], [1], [libfam]) ])
96	if test -z "$FAM_LIBS" ; then
97		PKG_CHECK_MODULES(FAM, gamin >= 0.1.0)
98	fi
99	if test -z "$FAM_LIBS" ; then
100		AC_MSG_ERROR([Cannot find FAM library])
101	fi
102fi
103AC_SUBST(FAM_CFLAGS)
104AC_SUBST(FAM_LIBS)
105
106dnl LIBSSL (for network security)
107AC_CHECK_LIB([ssl],[main])
108
109dnl LIBCRYPTO, LIBSSL (for MD5 hash algorithm)
110AC_CHECK_LIB(crypto, MD5_Init, [
111	AC_DEFINE(HAVE_CRYPTO, 1, Define to 1 if you have crypto base functions)
112	LIBS="$LIBS -lcrypto"], [
113	AC_CHECK_LIB(ssl, MD5_init, AC_DEFINE(HAVE_CRYPTO, 1, Define to 1 if you have crypto base functions))])
114
115dnl LIBSSL (for AES encryption/decryption)
116AC_CHECK_LIB(ssl, AES_encrypt, AC_DEFINE_UNQUOTED(HAVE_AES, 1,
117			 Define to 1 if AES encryption is available), [
118	AC_CHECK_LIB(crypto, AES_encrypt, AC_DEFINE_UNQUOTED(HAVE_AES, 1))])
119
120dnl GLIB, GTK, ...
121GTK_REQUIRED="gtk+-2.0 >= 2.6"
122GDK_PIXBUF_REQUIRED="gdk-pixbuf-2.0 >= 2.4"
123GMODULE_REQUIRED="gmodule-2.0 >= 2.4"
124LIBGLADE_REQUIRED="libglade-2.0 >= 2.3"
125GTHREAD="gthread-2.0 >= 2.4"
126PKG_CHECK_MODULES(GNUBIFF_DEP,
127[
128	$GTK_REQUIRED
129	$GDK_PIXBUF_REQUIRED
130	$GMODULE_REQUIRED
131	$LIBGLADE_REQUIRED
132	$GTHREAD
133])
134AC_SUBST(GNUBIFF_DEP_CFLAGS)
135AC_SUBST(GNUBIFF_DEP_LIBS)
136
137
138######################################################################
139#                     Checks for header files                        #
140######################################################################
141AC_HEADER_STDC
142AC_HEADER_DIRENT
143AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h utime.h regex.h])
144if test "x$OPT_USEFAM" = "xyes"; then
145	AC_CHECK_HEADERS([fam.h], [],
146		[AC_MSG_ERROR([Cannot find fam (File Alteration Monitor) library header file fam.h])])
147fi
148
149
150######################################################################
151#   Checks for typedefs, structures, and compiler characteristics    #
152######################################################################
153AC_C_CONST
154
155
156
157######################################################################
158#                  Checks for library functions                      #
159######################################################################
160AC_FUNC_CLOSEDIR_VOID
161AC_FUNC_MALLOC
162AC_FUNC_STAT
163AC_FUNC_UTIME_NULL
164AC_CHECK_FUNCS([gethostbyname memset socket strchr strerror strrchr strstr utime bind_textdomain_codeset])
165
166
167
168######################################################################
169#                       Internationalization                         #
170######################################################################
171GETTEXT_PACKAGE=gnubiff
172AC_SUBST(GETTEXT_PACKAGE)
173AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
174	               [The prefix for our gettext translation domains.])
175AC_PROG_INTLTOOL
176#AM_GLIB_GNU_GETTEXT
177AM_GNU_GETTEXT([external])
178
179
180
181######################################################################
182#                           GNOME support                            #
183######################################################################
184if test "$OPT_USEGNOME" = "yes"; then
185	PKG_CHECK_MODULES(GNOME_DEP, [
186	    libpanelapplet-2.0
187    	libgnomeui-2.0
188    	], [
189		AC_SUBST(GNOME_DEP_CFLAGS)
190		AC_SUBST(GNOME_DEP_LIBS)
191		AH_TEMPLATE([USE_GNOME])
192		AC_DEFINE(USE_GNOME)
193		AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
194		])
195	if test "x$GCONFTOOL" = "xno"; then
196	   AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
197	fi
198fi
199AM_CONDITIONAL(USE_GNOME, test $OPT_USEGNOME = yes, Define to 1 if you want to have GNOME support)
200
201
202######################################################################
203#                        Save password option                        #
204######################################################################
205AC_ARG_WITH(password,
206[  --with-password         Save password within configuration file (UNSECURE)],
207        password=$withval, password=no)
208if test "$password" = yes; then
209	AH_TEMPLATE([USE_PASSWORD])
210	AC_DEFINE(USE_PASSWORD)
211
212    AC_ARG_WITH(password-string,
213    [  --with-password-string  String to use to encrypt password (HIGHLY RECOMMENDED)],
214        pstring=$withval, pstring="")
215	AH_TEMPLATE([PASSWORD_STRING])
216    if test "x$pstring" = "x"; then
217		AC_DEFINE_UNQUOTED(PASSWORD_STRING, "FEDCBA9876543210")
218    else
219		AC_DEFINE_UNQUOTED(PASSWORD_STRING, "$withval")
220    fi
221
222fi
223AM_CONDITIONAL(USE_PASSWORD, test "$password" = yes)
224AM_CONDITIONAL(PASSWORD_STRING, test "$password" = yes)
225
226
227
228######################################################################
229#                           expert tab default                       #
230######################################################################
231AC_ARG_ENABLE(expert,
232[  --disable-expert        disable showing expert tab as default, [default=yes]],
233	AC_DEFINE(EXPERT_SHOW_NO_TAB, 1, [Define to 1 to disable showing expert tab as default.])
234	expert="$enableval", expert="yes")
235
236
237
238######################################################################
239#                           debug support                            #
240######################################################################
241AC_ARG_ENABLE(debug,
242		[  --enable-debug          turn on debugging [default=no]],
243AC_DEFINE(DEBUG, 1, [Define to 1 to enable debugging code.]),)
244
245AC_CHECK_FILE("CVS",
246			  [AC_DEFINE(IS_CVS_VERSION, 1, [Is a CVS version being used?])],
247			  [AC_DEFINE(IS_CVS_VERSION, 0, [Is a CVS version being used?])])
248
249
250
251##################
252# configure output
253##################
254AC_CONFIG_FILES([
255Makefile
256src/Makefile
257po/Makefile.in
258ui/Makefile
259art/Makefile
260sound/Makefile
261doc/Makefile
262man1/Makefile
263config/gnubiff.spec
264])
265AC_OUTPUT
266dnl file permissions in config subdirectory
267chmod +x config/mkinstalldirs config/ltmain.sh config/depcomp config/missing config/config.guess config/config.sub config/install-sh config/mdate-sh
268
269
270echo "--------------------------------------------------------------------------------"
271
272if test "$password" = yes; then
273	echo " Password saving : yes"
274	echo " Password string : $pstring"
275	if test "x$pstring" = "x"; then
276		echo "  WARNING: You've not defined a string to encrypt passwords (this can be done"
277		echo "           (with the option --with-password-string). The default string will"
278		echo "           be used but it is less secure than using your own."
279	fi
280fi
281
282if test "$password" = no; then
283echo " Password saving : no"
284echo "  If you want gnubiff to save password within configuration file, use"
285echo "  ./configure --with-password [--with-password-string=\"any string you like...]\"."
286echo "  But be careful, it is highly unsecure, you've been warned!"
287fi
288
289echo " FAM support     : $OPT_USEFAM"
290
291echo " Gnome support   : $OPT_USEGNOME"
292if test "$OPT_USEGNOME" = "yes"; then
293  if test "$prefix" != "`pkg-config libpanelapplet-2.0 --variable=prefix`"; then
294    echo "  NOTE: The installation directory for gnubiff is currently set to"
295    echo "        \"$prefix\","
296    echo "        the default installation directory for gnome panel applications is"
297    echo "        \""`pkg-config libpanelapplet-2.0 --variable=prefix`"\"."
298    echo "        It may be necessary to add the path"
299    echo "        \"$prefix/lib/bonobo/servers/\""
300    echo "        to the file \"/etc/bonobo-activation/bonobo-activation-config.xml\""
301    echo "        (root privileges needed) or to execute"
302    echo "        \"activation-client --add-path=$prefix/lib/bonobo/servers/\""
303    echo "        (no root privileges needed) before gnubiff can be added to the panel."
304  fi
305fi
306
307echo " Expert tab      : $expert"
308
309echo ""
310echo " Just type 'make' and then 'make install' to install gnubiff"
311echo "--------------------------------------------------------------------------------"
312echo ""
313