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
|
# Copyright (c) 2003-2005 FlashCode <flashcode@flashtux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT(WeeChat, 0.1.6-cvs, flashcode@flashtux.org)
AC_CONFIG_SRCDIR([src/common/weechat.c])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([weechat], [0.1.6-cvs])
# Checks for programs
AC_PROG_CC
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
# Add some flags for some OS
case "$host_os" in
freebsd* | openbsd*)
LDFLAGS="$LDFLAGS -L/usr/local/lib"
;;
netbsd*)
CFLAGS="$CFLAGS -I/usr/pkg/include"
LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
;;
*)
;;
esac
# Gettext
ALL_LINGUAS="fr es cs"
AM_GNU_GETTEXT
# Checks for libraries
AC_CHECK_LIB(ncurses, initscr, LIBNCURSES_FOUND=1, LIBNCURSES_FOUND=0)
AC_CHECK_LIB(ncursesw, initscr, LIBNCURSESW_FOUND=1, LIBNCURSESW_FOUND=0)
# Checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h libintl.h limits.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/types.h unistd.h pwd.h errno.h])
# Checks for typedefs, structures, and compiler characteristics
AC_HEADER_TIME
AC_STRUCT_TM
AC_MSG_CHECKING([for socklen_t])
AC_CACHE_VAL(ac_cv_type_socklen_t,
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>],
[socklen_t t;],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no,
)])
if test $ac_cv_type_socklen_t = no; then
AC_DEFINE(socklen_t, int, Define to 'int' if <sys/socket.h> doesn't define.)
fi
AC_MSG_RESULT($ac_cv_type_socklen_t)
# Checks for library functions.
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
# Variables in config.h
AH_VERBATIM([PREFIX], [#undef PREFIX])
AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR])
AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR])
AH_VERBATIM([PLUGINS], [#undef PLUGINS])
AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL])
AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON])
AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
AH_VERBATIM([DEBUG], [#undef DEBUG])
AH_VERBATIM([PERL_NOTHREAD], [#undef PERL_NOTHREAD])
# Arguments for ./configure
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no Gtk+)],enable_gtk=$enableval,enable_gtk=no)
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no)
AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes)
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl script plugin (default=no Perl plugin)],enable_perl=$enableval,enable_perl=no)
AC_ARG_ENABLE(perl_nothread, [ --enable-perl-nothread Turn on Perl script plugin with Perl compiled without threads support (like some *bsd)],enable_perl_nothread=$enableval,enable_perl_nothread=no)
AC_ARG_ENABLE(python, [ --enable-python Turn on Python script plugin (default=no Python plugin)],enable_python=$enableval,enable_python=no)
AC_ARG_ENABLE(ruby, [ --enable-ruby Turn on Ruby script plugin (default=no Ruby script)],enable_ruby=$enableval,enable_ruby=no)
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes")
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
AM_CONDITIONAL(PLUGINS, test "$enable_plugins" = "yes")
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
# ------------------------------------------------------------------------------
# GUI
# ------------------------------------------------------------------------------
if test "x$enable_ncurses" = "xyes" ; then
if test "$LIBNCURSESW_FOUND" = "0" ; then
if test "$LIBNCURSES_FOUND" = "0" ; then
AC_MSG_ERROR([
*** ncurses library not found!
*** Please install ncurses library or run ./configure with --disable-ncurses parameter.])
fi
AC_MSG_WARN([
*** ncursesw library not found! Falling back to "ncurses"
*** Be careful, UTF-8 display may not work properly if your locale is UTF-8.])
NCURSES_LIBS="-lncurses"
else
NCURSES_LIBS="-lncursesw"
AC_CHECK_HEADERS(ncursesw/curses.h)
fi
AC_SUBST(NCURSES_LIBS)
fi
#if test "x$enable_wxwidgets" = "xyes" ; then
# AM_OPTIONS_WXCONFIG
# AM_PATH_WXCONFIG(2.3.4, wxWin=1)
#
# if test "$wxWin" != 1; then
# AC_MSG_ERROR([
#*** wxWindows must be installed on your system
#*** but wx-config script couldn't be found.
#
#*** Please check that wx-config is in path, the directory
#*** where wxWindows libraries are installed (returned by
#*** 'wx-config --libs' command) is in LD_LIBRARY_PATH or
#*** equivalent variable and wxWindows version is 2.3.4 or above.
# ])
# fi
#
# CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
# CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
# CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
# LDFLAGS="$LDFLAGS $WX_LIBS"
#
# WXWIDGETS_CFLAGS=""
# WXWIDGETS_LIBS=""
#fi
if test "x$enable_gtk" = "xyes" ; then
#if test "$LIBGTK_FOUND" = "0" ; then
# AC_MSG_ERROR([Gtk+ library not found! Install Gtk+ (2.0 or higher) library or run ./configure without --enable-gtk parameter.])
#fi
GTK_CFLAGS=`pkg-config --cflags gtk+-2.0`
GTK_LIBS=`pkg-config --libs gtk+-2.0`
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
fi
# ------------------------------------------------------------------------------
# plugins
# ------------------------------------------------------------------------------
PLUGINS_LIBS=
if test "x$enable_perl_nothread" = "xyes" ; then
enable_perl="yes"
fi
if test "x$enable_perl" = "xyes" ; then
enable_plugins="yes"
AC_PATH_PROG(PERL, perl perl5)
if test -z $PERL ; then
AC_MSG_ERROR([
*** Perl must be installed on your system
*** but perl interpreter couldn't be found in path.
Please check that perl is in path, or install
it with your software package manager.])
fi
AC_MSG_CHECKING(for Perl headers files)
PERL_HEADER_TEST=`PT=perltest.c ; echo "#include <EXTERN.h>" > $PT; echo "#include <perl.h>" >> $PT; echo "#include <XSUB.h>" >> $PT ; echo "int main() { return 0; }" >> $PT ; $CC -Wall $PT -o $PT.out $($PERL -MExtUtils::Embed -e ccopts) 1>/dev/null 2>&1; echo $?; rm -f $PT $PT.out 1>/dev/null 2>&1`
if test "x$PERL_HEADER_TEST" = "x0" ; then
PERL_CFLAGS=`$PERL -MExtUtils::Embed -e ccopts`
else
AC_MSG_ERROR([
*** Perl headers couldn't be found in your system.
*** Try to install it with your software package manager.])
fi
AC_MSG_RESULT(found)
AC_MSG_CHECKING(for Perl library)
PERL_LIB_TEST=`PT=perltest.c ; echo "int main() { return 0; }" > $PT ; $CC -Wall $PT -o $PT.out $($PERL -MExtUtils::Embed -e ldopts) 1>/dev/null 2>&1; echo $?; rm -f $PT $PT.out 1>/dev/null 2>&1`
if test "x$PERL_LIB_TEST" = "x0" ; then
PERL_LFLAGS=`$PERL -MExtUtils::Embed -e ldopts`
else
AC_MSG_ERROR([
*** Perl library couldn't be found in your system.
*** Try to install it with your software package manager.])
fi
AC_MSG_RESULT(found)
AC_SUBST(PERL_CFLAGS)
AC_SUBST(PERL_LFLAGS)
AC_DEFINE(PLUGIN_PERL)
fi
if test "x$enable_python" = "xyes" ; then
enable_plugins="yes"
AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2)
if test -z $PYTHON ; then
AC_MSG_ERROR([
*** Python must be installed on your system
*** but python interpreter couldn't be found in path.
*** Please check that python is in path, or install
*** it with your software package manager.])
fi
PYTHON_SYSPREFIX=`$PYTHON -c 'import sys; print "%s" % sys.prefix'`
PYTHON_VERSION=`$PYTHON -c 'import sys ; print sys.version[[:3]]'`
PYTHON_INCLUDE=`$PYTHON -c "import distutils.sysconfig,string; print distutils.sysconfig.get_config_var('CONFINCLUDEPY')"`
AC_MSG_CHECKING(for Python header files)
if test -r "$PYTHON_INCLUDE/Python.h"; then
PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
else
AC_MSG_ERROR([
*** Python header files couldn't be found in your system.
*** Try to install them with your software package manager.])
fi
AC_MSG_RESULT(found)
PYTHON_LIB=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBPL')"`
PYTHON_LFLAGS="-lpython$PYTHON_VERSION "`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LIBS')+' '+distutils.sysconfig.get_config_var('LINKFORSHARED')"`
AC_MSG_CHECKING(for Python library)
if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so"; then
PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
elif test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.a"; then
PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
elif test -r "$PYTHON_SYSPREFIX/lib/libpython$PYTHON_VERSION.so"; then
PYTHON_LFLAGS="-L$PYTHON_SYSPREFIX/lib/ $PYTHON_LFLAGS"
else
AC_MSG_ERROR([
*** Python library couldn't be found in your system.
*** Try to install it with your software package manager.])
fi
AC_MSG_RESULT(found)
AC_SUBST(PYTHON_CFLAGS)
AC_SUBST(PYTHON_LFLAGS)
AC_DEFINE(PLUGIN_PYTHON)
fi
if test "x$enable_ruby" = "xyes" ; then
enable_plugins="yes"
# TODO: check that ruby lib and headers are installed
RUBY_CFLAGS=-I`ruby -rrbconfig -e "puts Config::CONFIG[['archdir']]"`
RUBY_LFLAGS=`ruby -rrbconfig -e "puts Config::CONFIG[['LIBRUBYARG_SHARED']]"`
AC_SUBST(RUBY_CFLAGS)
AC_SUBST(RUBY_LFLAGS)
AC_DEFINE(PLUGIN_RUBY)
fi
if test "x$enable_plugins" = "xyes" ; then
AC_CHECK_FUNCS(dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
if test "$LIBDL_FOUND" != "yes"; then
AC_CHECK_LIB(dl, dlopen, LIBDL_FOUND=yes, LIBDL_FOUND=no)
if test "$LIBDL_FOUND" = "yes"; then
PLUGINS_LIBS="-ldl"
else
AC_MSG_ERROR([
*** "dl" library (dynamic library loader) couldn't be found in your system.
*** Try to install it with your software package manager or disable plugins.])
fi
fi
AC_DEFINE(PLUGINS)
fi
AC_SUBST(PLUGINS_LIBS)
# ------------------------------------------------------------------------------
# gnutls
# ------------------------------------------------------------------------------
if test "x$enable_gnutls" = "xyes" ; then
found_gnutls="no"
AM_PATH_LIBGNUTLS( 1.0.0, found_gnutls=yes, AC_MSG_WARN([[
*** libgnutls was not found. You may want to get it from
*** ftp://ftp.gnutls.org/pub/gnutls/
*** WeeChat will be built without GnuTLS support.]]))
if test "x$found_gnutls" = "xyes" ; then
GNUTLS_CFLAGS=`libgnutls-config --cflags`
GNUTLS_LFLAGS=`libgnutls-config --libs`
AC_SUBST(GNUTLS_CFLAGS)
AC_SUBST(GNUTLS_LFLAGS)
AC_DEFINE(HAVE_GNUTLS)
else
enable_gnutls="no"
fi
fi
# ------------------------------------------------------------------------------
# general vars
# ------------------------------------------------------------------------------
if test "x$enable_perl_nothread" = "xyes" ; then
AC_DEFINE(PERL_NOTHREAD)
fi
if test "x$prefix" = "xNONE" ; then
prefix="$ac_default_prefix"
fi
if test "x$exec_prefix" = "xNONE" ; then
exec_prefix="$prefix"
fi
AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
WEECHAT_LIBDIR=`eval echo ${libdir}/weechat`
AC_DEFINE_UNQUOTED(WEECHAT_LIBDIR, "$WEECHAT_LIBDIR")
WEECHAT_SHAREDIR=`eval echo ${datadir}/weechat`
AC_DEFINE_UNQUOTED(WEECHAT_SHAREDIR, "$WEECHAT_SHAREDIR")
weechat_libdir=${libdir}/weechat
AC_SUBST(weechat_libdir)
CFLAGS=`echo $CFLAGS | sed s/-g//g`
if test "x$CFLAGS" = "x" ; then
CFLAGS="-O2"
fi
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
CFLAGS="-Wall -W $CFLAGS -pipe -g"
else
CFLAGS="-Wall -W $CFLAGS -pipe"
fi
if test "x$debug" = "x2" ; then
AC_DEFINE(DEBUG)
fi
LIBS="$LIBS $INTLLIBS"
case "$host_os" in
freebsd* | netbsd*)
if test "x$enable_perl" = "xyes" -o "x$enable_python" = "xyes" ; then
CFLAGS="$CFLAGS -pthread"
fi
CFLAGS="$CFLAGS $CPPFLAGS"
;;
openbsd*)
if test "x$enable_python" = "xyes" ; then
CFLAGS="$CFLAGS -pthread"
fi
;;
*)
;;
esac
# ------------------------------------------------------------------------------
# output Makefiles
# ------------------------------------------------------------------------------
AC_OUTPUT([Makefile
doc/Makefile
src/Makefile
src/common/Makefile
src/irc/Makefile
src/plugins/Makefile
src/plugins/scripts/Makefile
src/plugins/scripts/perl/Makefile
src/plugins/scripts/python/Makefile
src/plugins/scripts/ruby/Makefile
src/gui/Makefile
src/gui/curses/Makefile
src/gui/wxwidgets/Makefile
src/gui/gtk/Makefile
src/gui/qt/Makefile
intl/Makefile
po/Makefile.in])
# ------------------------------------------------------------------------------
# end message
# ------------------------------------------------------------------------------
listgui=
if test "x$enable_ncurses" = "xyes" ; then
listgui="$listgui ncurses"
fi
if test "x$enable_wxwidgets" = "xyes"; then
listgui="$listgui WxWidgets"
fi
if test "x$enable_gtk" = "xyes" ; then
listgui="$listgui Gtk+"
fi
if test "x$enable_qt" = "xyes" ; then
listgui="$listgui Qt"
fi
if test "x$listgui" = "x" ; then
AC_MSG_ERROR([
*** No interface specified...
*** Please specify at least ncurses, WxWidgets, Gtk or Qt.])
fi
msg_debug_compiler="no"
msg_debug_verbose="no"
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
msg_debug_compiler="yes"
fi
if test "x$debug" = "x2" ; then
msg_debug_verbose="yes"
fi
echo ""
echo "Interfaces.................................... :$listgui"
echo "Build with GNUtls support..................... : $enable_gnutls"
echo "Build with Plugin support..................... : $enable_plugins"
echo " Perl plugin..................... : $enable_perl"
echo " Perl plugin (without threads)... : $enable_perl_nothread"
echo " Python plugin................... : $enable_python"
echo " Ruby plugin..................... : $enable_ruby"
echo "Compile with debug info....................... : $msg_debug_compiler"
echo "Print debugging messages...................... : $msg_debug_verbose"
echo ""
eval echo "WeeChat will be installed in $bindir."
echo ""
echo "configure complete, now type 'make' to build WeeChat $VERSION"
echo ""
|