Statistics
| Revision:

root / trunk / configure.in @ 1863

History | View | Annotate | Download (23.4 KB)

1
AC_INIT(nntpgrab, 0.6.92)
2
AC_DEFINE(MAJOR_VERSION, 0, [Major version number])
3
AC_DEFINE(MINOR_VERSION, 6, [Minor version number])
4
AC_DEFINE(MICRO_VERSION, 92, [Micro version number])
5
AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2])
6
AC_PROG_CXX
7
AC_PROG_INSTALL
8
AC_LIBTOOL_DLOPEN
9
AC_LIBTOOL_WIN32_DLL
10
AC_DISABLE_STATIC
11
AC_CONFIG_HEADERS(config.h)
12
AC_SUBST(CPPFLAGS,$CPPFLAGS)
13
AC_PROG_LIBTOOL
14
AC_CHECK_SIZEOF(time_t)
15
AC_CHECK_SIZEOF(long)
16
AM_PROG_CC_C_O
17

                
18
GETTEXT_PACKAGE=NNTPGrab
19
AC_SUBST(GETTEXT_PACKAGE)
20
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Gettext package])
21

                
22
dnl Find pkg-config
23
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
24
if test "x$PKG_CONFIG" = "xno"; then
25
 AC_MSG_ERROR([You need to install pkg-config])
26
fi
27

                
28
AM_PATH_GLIB_2_0("2.10.0")
29

                
30
# Optional configure arguments
31
AC_ARG_ENABLE(dbus,
32
 [  --disable-dbus          Activate DBUS integration (enabled by default)],
33
 [case "x${enableval}" in
34
         xyes) dbus=true ;;
35
         xno) dbus=false ;;
36
         *) AC_MSG_ERROR(bad value ${enableval} for --disable-dbus) ;;
37
 esac],[dbus=true])
38

                
39
AC_ARG_ENABLE(online-search,
40
 [  --disable-online-search Activate support for the Online Search(enabled by default)],
41
 [case "x${enableval}" in
42
         xyes) online_search=true ;;
43
         xno) online_search=false ;;
44
         *) AC_MSG_ERROR(bad value ${enableval} for --disable-online-search) ;;
45
 esac],[online_search=true])
46

                
47
AC_ARG_ENABLE(proxy,
48
 [  --disable-proxy         Activate support for downloading using a proxy server (enabled by default)],
49
 [case "x${enableval}" in
50
         xyes) proxy=true ;;
51
         xno) proxy=false ;;
52
         *) AC_MSG_ERROR(bad value ${enableval} for --disable-proxy) ;;
53
 esac],[proxy=true])
54

                
55
AC_ARG_ENABLE(testsuite,
56
 [  --disable-testsuite     Build the testsuite (enabled by default)],
57
 [case "x${enableval}" in
58
         xyes) testsuite=true ;;
59
         xno) testsuite=false ;;
60
         *) AC_MSG_ERROR(bad value ${enableval} for --disable-testsuite) ;;
61
 esac],[testsuite=true])
62

                
63
AC_ARG_ENABLE(online-tests,
64
 [  --disable-online-tests  Disable the tests from the testsuite which require an internet connection (enabled by default)],
65
        [case "x${enableval}" in
66
                xyes) online_tests=true ;;
67
                xno) online_tests=false ;;
68
                *) AC_MSG_ERROR(bad value ${enableval} for --disable-online-tests) ;;
69
        esac],[online_tests=true])
70

                
71
# Search for GLib
72
PKG_CHECK_MODULES(GLIB,
73
 glib-2.0 >= 2.10.0 gthread-2.0 gmodule-2.0 gobject-2.0,
74
 ,
75
 [AC_MSG_ERROR([* GLib 2.10.0 or higher could not be found (is the package glib2-devel installed?)])])
76

                
77
# Search for GIO
78
PKG_CHECK_MODULES(GIO,
79
 glib-2.0 >= 2.16.0 gio-2.0,
80
 have_gio=true; AC_DEFINE_UNQUOTED(HAVE_GIO, 1, [Do we have GIO]),
81
 have_gio=false; [AC_MSG_RESULT([* GLib 2.16.0 or higher could not be found. Without GLib 2.16.0, automatic NZB import won't be possible])])
82

                
83
# Search for socket support in GIO
84
AC_MSG_CHECKING(if GIO >= 2.26.0)
85
pkg-config --atleast-version=2.26.0 gio-2.0
86
if test `echo $?` = 0; then
87
 AC_MSG_RESULT([yes]);
88
 AC_DEFINE_UNQUOTED(HAVE_GIO_SOCKET, 1, [Do we have socket support in GIO])
89
else
90
 AC_MSG_RESULT([no])
91
fi
92

                
93
# Search for GTest support in GLib
94
AC_MSG_CHECKING(if we need to enable the testsuite)
95
pkg-config --atleast-version=2.16.0 glib-2.0
96
if test `echo $?` != 0; then
97
 if test "$testsuite" = "true" ; then
98
         testsuite=false
99
 fi
100
fi
101
if test "$testsuite" = "true" ; then
102
      AC_MSG_RESULT([yes])
103
else
104
      AC_MSG_RESULT([no])
105
fi
106
AM_CONDITIONAL(BUILD_TESTSUITE, $testsuite)
107
AM_CONDITIONAL(ENABLE_ONLINE_TESTS, $online_tests)
108

                
109
# Search for dbus-glib
110
if test "$dbus" = "true" ; then
111
      PKG_CHECK_MODULES(DBUS,
112
              dbus-glib-1 >= 0.60,
113
              have_dbus=true; AC_DEFINE_UNQUOTED(HAVE_DBUS, 1, [Do we have DBus-glib]),
114
              have_dbus=false; [AC_MSG_RESULT([* DBUS-Glib 0.60 or higher could not be found (is the package dbus-devel and/or dbus-glib-devel installed?).])])
115
fi
116

                
117
# Search for libsoup
118
if test "$online_search" = "true" ; then
119
      PKG_CHECK_MODULES(SOUP,
120
              libsoup-2.4,
121
              have_soup=true; [AC_DEFINE_UNQUOTED(HAVE_SOUP, 1, [Do we have libsoup])],
122
              have_soup=false; [AC_MSG_RESULT([* libsoup 2.4 or higher could not be found (is the package libsoup-devel installed?). Without libsoup, the NZBCreator service can't be accessed])])
123

                
124
      PKG_CHECK_MODULES(SOUP_GZIP,
125
              libsoup-2.4 >= 2.28.2,
126
              [AC_DEFINE_UNQUOTED(HAVE_SOUP_GZIP, 1, [Do we have gzip support in libsoup])],
127
              [AC_MSG_RESULT([* libsoup 2.28.2 or higher could not be found. This is required to enable compression in the NZBCreator service])])
128
else
129
    have_soup="false"
130
fi
131

                
132
# Search for libproxy and libsoup-gnome
133
if test "$proxy" = "true" ; then
134
      PKG_CHECK_MODULES(SOUP_GNOME,
135
              libsoup-gnome-2.4,
136
              [AC_DEFINE_UNQUOTED(HAVE_SOUP_GNOME, 1, [Do we have libsoup-gnome])],
137
              [AC_MSG_RESULT([* libsoup-gnome 2.4 or higher could not be found (is the package libsoup-devel installed?). Without libsoup-gnome proxy settings won't be detected on Linux])])
138

                
139
      PKG_CHECK_MODULES(LIBPROXY,
140
              libproxy-1.0,
141
              [AC_DEFINE_UNQUOTED(HAVE_LIBPROXY, 1, [Do we have libproxy])],
142
              [AC_MSG_RESULT([* libproxy could not be found (is the package libproxy-devel installed?). Without libproxy proxy settings won't be detected])])
143
fi
144

                
145
# Search for glib-networking
146
AC_MSG_CHECKING([for glib-networking (glib TLS implementation)])
147
save_CFLAGS="$CFLAGS"
148
save_LIBS="$LIBS"
149
CFLAGS="$CFLAGS $GIO_CFLAGS"
150
LIBS="$LIBS $GIO_LIBS"
151
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ],
152
                              [g_type_init (); return !g_tls_backend_supports_tls (g_tls_backend_get_default ());])],
153
      [have_glib_networking=yes]; [AC_DEFINE_UNQUOTED(HAVE_GLIB_NETWORKING, 1, [Do we have glib-networking])],
154
      [have_glib_networking=no],
155
      [have_glib_networking="unknown (cross-compiling)"])
156
CFLAGS="$save_CFLAGS"
157
LIBS="$save_LIBS"
158
AC_MSG_RESULT($have_glib_networking)
159

                
160
AC_SUBST(GLIB_LIBS)
161
AC_SUBST(GLIB_CFLAGS)
162
AC_SUBST(GIO_LIBS)
163
AC_SUBST(GIO_CFLAGS)
164
AM_CONDITIONAL(HAVE_GIO, $have_gio)
165
AC_SUBST(LIBXML2_LIBS)
166
AC_SUBST(LIBXML2_CFLAGS)
167
AC_SUBST(DBUS_LIBS)
168
AC_SUBST(DBUS_CFLAGS)
169
AM_CONDITIONAL(HAVE_DBUS, $have_dbus)
170
AC_SUBST(SOUP_LIBS)
171
AC_SUBST(SOUP_CFLAGS)
172
AC_SUBST(SOUP_GNOME_LIBS)
173
AC_SUBST(SOUP_GNOME_CFLAGS)
174
AC_SUBST(LIBPROXY_LIBS)
175
AC_SUBST(LIBPROXY_CFLAGS)
176

                
177
AC_ARG_ENABLE(ssl,
178
      [  --disable-ssl           Activate NNTP-over-SSL support (enabled by default)],
179
      [case "x${enableval}" in
180
              xyes) ssl=true ;;
181
              xno) ssl=false ;;
182
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-ssl) ;;
183
      esac],[ssl=true])
184

                
185
AC_ARG_ENABLE(php_module,
186
      [  --enable-php-module     Compile an PHP module which allows PHP scripts to call NNTPGrab methods (disabled by default)],
187
      [case "x${enableval}" in
188
              xyes) php_module=true ;;
189
              xno) php_module=false ;;
190
              *) AC_MSG_ERROR(bad value ${enableval} for --enable-php-module) ;;
191
      esac],[php_module=false])
192

                
193
AM_CONDITIONAL(ENABLE_PHP_MODULE, $php_module)
194

                
195
AC_ARG_ENABLE(networkmanager,
196
      [  --disable-networkmanager
197
                          Activate NetworkManager integration (enabled by default)],
198
      [case "x${enableval}" in
199
              xyes) networkmanager=true ;;
200
              xno) networkmanager=false ;;
201
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-networkmanager) ;;
202
      esac],[networkmanager=true])
203

                
204
if test "$networkmanager" = "true" ; then
205
      PKG_CHECK_MODULES(NETWORKMANAGER, libnm-glib, have_networkmanager=true,have_networkmanager=false)
206
      if test "$have_networkmanager" = "false" ; then
207
              PKG_CHECK_MODULES(NETWORKMANAGER,
208
                      libnm_glib > 0.7.0,
209
                      have_networkmanager=true,
210
                      [AC_MSG_RESULT([* NetworkManager-glib could not be found (is the package NetworkManager-glib-devel installed?) Without NetworkManager-glib, NetworkManager integration won't be possible])]; have_networkmanager=false)
211
      fi
212
else
213
    have_networkmanager=false
214
fi
215

                
216
AC_ARG_ENABLE(automatic_shutdown,
217
      [  --disable-automatic-shutdown
218
                          Activate support for automatic shutdown (enabled by default)],
219
      [case "x${enableval}" in
220
              xyes) automatic_shutdown=true ;;
221
              xno) automatic_shutdown=false ;;
222
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-automatic-shutdown) ;;
223
      esac],[automatic_shutdown=true])
224

                
225
AC_SUBST(NETWORKMANAGER_LIBS)
226
AC_SUBST(NETWORKMANAGER_CFLAGS)
227
AM_CONDITIONAL(HAVE_NETWORKMANAGER, $have_networkmanager)
228

                
229
AC_ARG_ENABLE(gui,
230
      [  --disable-gui           Turn on GUI client (enabled by default)],
231
      [case "x${enableval}" in
232
              xyes) gui=true ;;
233
              xno)  gui=false ;;
234
              x) gui=true ;;
235
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-gui) ;;
236
      esac],[gui=true])
237

                
238
AC_ARG_ENABLE(gtk3,
239
      [  --disable-gtk3          Build against GTK+ 3 if it's available (enabled by default)],
240
      [case "x${enableval}" in
241
              xyes) gtk3=true ;;
242
              xno) gtk3=false ;;
243
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-gtk3) ;;
244
      esac],[gtk3=true])
245

                
246
AC_ARG_ENABLE(notifications,
247
      [  --disable-notifications Activate support for showing notifications using libnotify (enabled by default)],
248
      [case "x${enableval}" in
249
              xyes) notifications=true ;;
250
              xno) notifications=false ;;
251
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-notifications) ;;
252
      esac],[notifications=true])
253

                
254
AM_CONDITIONAL(ENABLE_GUI, $gui)
255
if [ "$gui" = "true" ]; then
256
      if test "$gtk3" = "true" ; then
257
              PKG_CHECK_MODULES(GTK3,
258
                      gtk+-3.0 gdk-3.0 gthread-2.0,
259
                      have_gtk3=true; AC_DEFINE_UNQUOTED(HAVE_GTK3, 1, [Do we have GTK-3 available]),
260
                      have_gtk3=false; [AC_MSG_RESULT([* GTK+-3.0 or higher could not be found (is the package gtk3+-devel installed?)])])
261
      else
262
              have_gtk3="false"
263
      fi
264

                
265
      if test "$have_gtk3" = "false" ; then
266
              PKG_CHECK_MODULES(GTK,
267
                      gtk+-2.0 gdk-2.0 gthread-2.0,
268
                      ,
269
                      [AC_MSG_ERROR([* GTK+-2.2 or higher could not be found (is the package gtk2+-devel installed?)])])
270

                
271
              AC_MSG_CHECKING(if GTK >= 2.12.0)
272
              pkg-config --atleast-version=2.12.0 gtk+-2.0
273
              if test `echo $?` = 0; then
274
                      AC_MSG_RESULT([yes])
275
              else
276
                      AC_MSG_RESULT([no])
277
                      PKG_CHECK_MODULES(GLADE,
278
                              libglade-2.0,
279
                              ,
280
                              [AC_MSG_ERROR([* Glade 2.0 or higher could not be found (is the package libglade2-devel installed?)])])
281
              fi
282
      fi
283

                
284
      if test "$notifications" = "true" ; then
285
              PKG_CHECK_MODULES(LIBNOTIFY,
286
                      libnotify >= 0.4.1,
287
                      AC_DEFINE_UNQUOTED(HAVE_LIBNOTIFY, 1, [Do we have libnotify available]),
288
                      [AC_MSG_RESULT([* libnotify 0.4.1 or higher could not be found (is the package libnotify-devel installed?). Without libnotify, notification balloons aren't possible])])
289

                
290
              AC_MSG_CHECKING(if libnotify >= 0.7.0)
291
              pkg-config --atleast-version=0.7.0 libnotify
292
              if test `echo $?` = 0; then
293
                      AC_MSG_RESULT([yes])
294
                      AC_DEFINE_UNQUOTED(HAVE_LIBNOTIFY_0_7, 1, [Do we have libnotify 0.7 available])
295
              else
296
                      AC_MSG_RESULT([no])
297
              fi
298
      fi
299

                
300
      if test "$automatic_shutdown" = "true" ; then
301
              PKG_CHECK_MODULES(POLKIT,
302
                      polkit-gobject-1,
303
                      AC_DEFINE_UNQUOTED(HAVE_POLKIT1, 1, [Do we have PolicyKit 1.0 available]),
304
                      [PKG_CHECK_MODULES(POLKIT,
305
                              polkit-gnome,
306
                              AC_DEFINE_UNQUOTED(HAVE_POLKIT_OLD, 1, [Do we have PolicyKit 0.9 available]),
307
                              [AC_MSG_RESULT([* PolicyKit could not be found (is the package polkit-devel or PolicyKit-gnome-devel installed?). Without PolicyKit, automatic shutdown won't be possible])])
308
                      ])
309
      fi
310

                
311
      PKG_CHECK_MODULES(LIBXML2,
312
              libxml-2.0,
313
              ,
314
              [AC_MSG_ERROR([* LibXML 2.0 or higher could not be found (is the package libxml2-devel installed?)])])
315
fi
316

                
317
AC_ARG_ENABLE(par2cmdline-check,
318
      [  --disable-par2cmdline-check
319
                          Check for the existance of the par2 binary (enabled by default)],
320
      [case "x${enableval}" in
321
              xyes) par2_check=true ;;
322
              xno) par2_check=false ;;
323
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-par2cmdline-check) ;;
324
      esac],[par2_check=true])
325

                
326
if test "$par2_check" = "true" ; then
327
      AC_CHECK_PROGS([PAR2CMDLINE], [par2])
328
      if test "x$PAR2CMDLINE" = "x" ; then
329
              AC_MSG_ERROR([par2cmdline is not found. This is required for NNTPGrab])
330
      fi
331
fi
332

                
333
AC_SUBST(GTK3_LIBS)
334
AC_SUBST(GTK3_CFLAGS)
335
AC_SUBST(GTK_LIBS)
336
AC_SUBST(GTK_CFLAGS)
337
AC_SUBST(GLADE_CFLAGS)
338
AC_SUBST(GLADE_LIBS)
339
AC_SUBST(POLKIT_LIBS)
340
AC_SUBST(POLKIT_CFLAGS)
341
AC_SUBST(LIBNOTIFY_LIBS)
342
AC_SUBST(LIBNOTIFY_CFLAGS)
343

                
344
# check for gtk-doc
345
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
346

                
347
dnl Default search paths for headers and libs
348
dnl ----------------------------------------
349

                
350
ac_default_lib_searchpath="/sw/lib /usr/lib64 /usr/local/lib64 /usr/lib /usr/local/lib /opt/lib"
351
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/lib/openssl/lib /usr/X11R6/lib"
352
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/X11R6/lib/mozilla* /usr/lib/mozilla*"
353
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/local/mozilla* /usr/local/mozilla*/lib"
354
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/local/ssl*/lib /usr/local/lib/openssl"
355
ac_default_lib_searchpath="$ac_default_lib_searchpath /opt/gnome/lib/mozilla /opt/mozilla/lib"
356
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/lib/curl /usr/local/lib/curl /opt/curl/lib"
357
ac_default_lib_searchpath="$ac_default_lib_searchpath /opt/MozillaThunderbird/lib64 /opt/openssl/lib"
358
ac_default_lib_searchpath="$ac_default_lib_searchpath /sw/lib/mozilla /dist/lib"
359

                
360
ac_default_inc_searchpath="/sw/include /usr/include /usr/include/libxml2 /usr/local/include "
361
ac_default_inc_searchpath="$ac_default_inc_searchpath /opt/include /opt/openssl/include "
362
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/lib/openssl/include /usr/include/mozilla*"
363
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/local/mozilla* /usr/local/mozilla*/include"
364
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/local/ssl/include /usr/local/include/openssl"
365
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/include/mozilla*/gtkembedmoz /usr/local/include/mozilla*/gtkembedmoz"
366
ac_default_inc_searchpath="$ac_default_inc_searchpath /opt/gnome/include/mozilla /opt/mozilla/include"
367
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/include/curl /usr/local/include/curl /opt/curl/include"
368
ac_default_inc_searchpath="$ac_default_inc_searchpath /sw/include/mozilla /usr/include/pcre /dist/include"
369

                
370
dnl --------------------
371
dnl OS specific settings
372
dnl --------------------
373

                
374
case "$host_os" in
375
        mingw32)
376
                CPPFLAGS="$CPPFLAGS -mms-bitfields"
377
                CFLAGS="$CFLAGS -DOS=\"\\\"Windows\\\"\""
378
                AC_CHECK_TOOL(WINDRES, windres, no)
379
                if test "$WINDRES" = no; then 
380
                        AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.]) 
381
                fi
382
                AM_CONDITIONAL(WIN32, true)
383
                AC_DEFINE(WIN32, 1, [Is this a Win32 platform])
384
                AM_CONDITIONAL(DARWIN, false);;
385
       cygwin)
386
                CFLAGS="$CFLAGS -DOS=\"\\\"Windows\\\"\""
387
                AC_CHECK_TOOL(WINDRES, windres, no)
388
                if test "$WINDRES" = no; then
389
                        AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
390
                fi
391
                AM_CONDITIONAL(WIN32, true)
392
                AC_DEFINE(WIN32, 1, [Is this a Win32 platform])
393
                AM_CONDITIONAL(DARWIN, false)
394
                LDFLAGS="$LDFLAGS -mwindows";;
395
        darwin*)
396
                CFLAGS="$CFLAGS -DOS=\"\\\"Mac_OS_X/X86\\\"\""
397
                CPPFLAGS="$CPPFLAGS -DDARWIN"
398
                AM_CONDITIONAL(WIN32, false)
399
                AM_CONDITIONAL(DARWIN, true);;
400
        *)
401
                CFLAGS="$CFLAGS -DOS=\"\\\"`uname -s`\\\"\""
402
                AM_CONDITIONAL(WIN32, false)
403
                AM_CONDITIONAL(DARWIN, false);;
404
esac
405

                
406
dnl ---------------------
407
dnl Mac OS X integration
408
dnl ---------------------
409
if test "$host_os" = "darwin9" -o "$host_os" = "darwin10" -o "$host_os" = "darwin10.2.0" ; then
410
  if [ "$gui" = "true" ]; then
411
    PKG_CHECK_MODULES(MAC_INTEGRATION, ige-mac-integration,, [AC_MSG_ERROR([* ige-mac-integration could not be found. Please install it from https://developer.imendio.com/projects/gtk-macosx/integration])])
412
  fi
413

                
414
  # Mac OS X doesn't like 'EXPORTS' mentioned in the .def files..strip them out
415
  grep -v EXPORTS plugins/nntpgrab_plugin.def > tmp
416
  unlink plugins/nntpgrab_plugin.def
417
  mv tmp plugins/nntpgrab_plugin.def
418

                
419
  grep -v EXPORTS base/nntpgrab_utils.def > tmp
420
  unlink base/nntpgrab_utils.def
421
  mv tmp base/nntpgrab_utils.def
422

                
423
  grep -v EXPORTS nntpgrab_core/nntpgrab.def > tmp
424
  unlink nntpgrab_core/nntpgrab.def
425
  mv tmp nntpgrab_core/nntpgrab.def
426

                
427
  grep -v EXPORTS automation/nntpgrab_automation.def > tmp
428
  unlink automation/nntpgrab_automation.def
429
  mv tmp automation/nntpgrab_automation.def
430

                
431
  grep -v EXPORTS glue/nntpgrab_glue.def > tmp
432
  unlink glue/nntpgrab_glue.def
433
  mv tmp glue/nntpgrab_glue.def
434

                
435
  grep -v EXPORTS gui_base/nntpgrab_gui_base.def > tmp
436
  unlink gui_base/nntpgrab_gui_base.def
437
  mv tmp gui_base/nntpgrab_gui_base.def
438
fi
439

                
440
AC_SUBST(MAC_INTEGRATION_CFLAGS)
441
AC_SUBST(MAC_INTEGRATION_LIBS)
442

                
443
dnl ---
444
dnl PCRE is only necessary when GLib 2.14.0 or higher is not found
445
dnl ---
446
AC_MSG_CHECKING(if GLIB >= 2.14.0)
447
pkg-config --atleast-version=2.14.0 glib-2.0
448
if test `echo $?` = 0; then
449
  AC_MSG_RESULT([yes])
450
else
451
  AC_MSG_RESULT([no])
452
  AC_FIND_LIB2(pcre, $ac_default_lib_searchpath, pcre_libraries, [PCRE libraries.], [PCRE libraries could not be found])
453
  AC_FIND_HEADER2(pcre.h, $ac_default_inc_searchpath, pcre_headers, [PCRE headers.], [PCRE headers could not be found])
454
fi
455

                
456
if test "$have_soup" = "false" -a "$gui" = "true"; then
457
  dnl ---------------
458
  dnl libCURL support
459
  dnl ---------------
460
  AC_FIND_LIB2(curl, $ac_default_lib_searchpath, libcurl_libraries,
461
    [Curl library],
462
    [Curl library couldn't be found])
463

                
464
  AC_FIND_HEADER2(curl/curl.h, $ac_default_inc_searchpath, libcurl_headers,
465
    [Curl headers],
466
    [Curl headers could not be found],
467
     curl)
468
fi
469

                
470
AM_CONDITIONAL(HAVE_SSL, $ssl)
471
if test "$ssl" = "true" ; then
472
      AC_DEFINE_UNQUOTED(HAVE_SSL, 1, [Do we have to build with SSL support])
473

                
474
      PKG_CHECK_MODULES(GNUTLS,
475
              gnutls,
476
              gnutls_found=true; AC_DEFINE_UNQUOTED(HAVE_GNUTLS, 1, [Do we have to build with GNUTLS support]),
477
              [AC_MSG_RESULT([* GNUTLS could not be found (is the package gnutls-devel installed?)])]; gnutls_found=false)
478

                
479
      if test "$gnutls_found" = "false" ; then
480
              PKG_CHECK_MODULES(NSS,
481
                      nss,
482
                      nss_found=true,
483
                      [AC_MSG_RESULT([* NSS could not be found (is the package nss-devel installed?)])]; nss_found=false)
484

                
485
              if test "$nss_found" = "true" ; then
486
                      AC_FIND_LIB(nss_compat_ossl, $ac_default_lib_searchpath, nss_compat_ossl_libraries,
487
                              [nss_compat_ossl libraries],
488
                              [nss_compat_ossl libraries could not be found])
489

                
490
                      AC_FIND_HEADER(nss_compat_ossl/nss_compat_ossl.h, $ac_default_inc_searchpath, nss_compat_ossl_headers,
491
                              [nss_compat_ossl headers],
492
                              [nss_compat_oss header could not be found],
493
                              nss_compat_ossl)
494
              fi
495

                
496
              if test "$nss_found" = "true" -a \
497
                      "$nss_compat_ossl_libraries_ok" = "true" -a \
498
                      "$nss_compat_ossl_headers_ok" = "true" ; then
499

                
500
                      have_nss_compat_ossl=true
501
                      AC_DEFINE_UNQUOTED(HAVE_NSS_COMPAT_OSSL, 1, [Do we have to build with nss-compat-openSSL support])
502
                      NSS_LIBS="$NSS_LIBS -lnss_compat_ossl"
503
              else
504
                      have_nss_compat_ossl=false
505
                      NSS_CFLAGS=""
506
                      NSS_LIBS=""
507
              fi
508

                
509
              if test "$have_nss_compat_ossl" = "false" ; then
510
                      AC_FIND_LIB2(ssl, $ac_default_lib_searchpath, openssl_libraries,
511
                              [OpenSSL libraries],
512
                              [OpenSSL library not found])
513
  
514
                      AC_FIND_HEADER2(openssl/md5.h, $ac_default_inc_searchpath, openssl_headers,
515
                              [OpenSSL headers],
516
                              [OpenSSL headers could not be found])
517
  
518
                      openssl_libraries_LIBS="$openssl_libraries_LIBS -lcrypto"
519
              fi
520
      fi
521
fi
522

                
523
AC_SUBST(PCRE_CFLAGS, $pcre_headers_CFLAGS)
524
AC_SUBST(PCRE_LIBS, $pcre_libraries_LIBS)
525
AC_SUBST(CURL_CFLAGS, $libcurl_headers_CFLAGS)
526
AC_SUBST(CURL_LIBS, $libcurl_libraries_LIBS)
527
AC_SUBST(GNUTLS_CFLAGS)
528
AC_SUBST(GNUTLS_LIBS)
529
AC_SUBST(NSS_CFLAGS)
530
AC_SUBST(NSS_LIBS)
531
AC_SUBST(OPENSSL_CFLAGS, $openssl_headers_CFLAGS)
532
AC_SUBST(OPENSSL_LIBS, $openssl_libraries_LIBS)
533

                
534
# Introspection support
535
GOBJECT_INTROSPECTION_CHECK([0.9.0])
536

                
537
# gettext
538
AC_PROG_INTLTOOL([0.21], [no-xml])
539
AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)
540

                
541
ALL_LINGUAS="nl fr"
542
AM_GLIB_GNU_GETTEXT
543

                
544
if test "x$WIN32_TRUE" = "x" ; then
545
    nntpgrablocaledir='../${DATADIRNAME}/locale'
546
else
547
    nntpgrablocaledir='${prefix}/${DATADIRNAME}/locale'
548
fi
549
AC_SUBST(nntpgrablocaledir)
550

                
551
AC_CHECK_FUNC(strptime,[ AC_DEFINE(HAVE_STRPTIME, 1, [strptime check]) AM_CONDITIONAL(HAVE_STRPTIME, true) ],[ AM_CONDITIONAL(HAVE_STRPTIME, false) ])
552
AC_CHECK_FUNC(backtrace_symbols, [AC_DEFINE(HAVE_BACKTRACE, 1, [backtrace_symbols check])])
553

                
554
dnl Checks for mkdtemp function
555

                
556
mkdtemp_missing=false
557
AC_CHECK_FUNC(mkdtemp,
558
    [AC_DEFINE([HAVE_MKDTEMP], 1, [Have GlibC function to make temp dirs])],
559
    mkdtemp_missing=true)
560
AM_CONDITIONAL(MKDTEMP_MISSING, test x$mkdtemp_missing = xtrue)
561

                
562
dnl Set PACKAGE SOURCE DIR in config.h.
563
packagesrcdir=`cd $srcdir && pwd`
564

                
565
dnl Set PACKAGE PREFIX
566
if test "x${prefix}" = "xNONE"; then
567
  packageprefix=${ac_default_prefix}
568
else
569
  packageprefix=${prefix}
570
fi
571

                
572
packagedatadir=share/${PACKAGE}
573
pkgdir=${packageprefix}/${packagedatadir}
574
plugindir=${libdir}/${PACKAGE}
575
wwwdir=${pkgdir}/web
576

                
577
AC_DEFINE_UNQUOTED(SHARE_DIR, "${pkgdir}", [Location of NNTPGrab icons])
578
AC_SUBST(PLUGINDIR, "${plugindir}")
579
AC_SUBST(WWWDIR, "${wwwdir}")
580
CPPFLAGS="$CPPFLAGS -DPLUGIN_DIR=\"\\\"\${PLUGINDIR}\\\"\" -DWWW_DIR=\"\\\"\${WWWDIR}\\\"\""
581

                
582
# -fstack-protector
583
AC_ARG_ENABLE([stack-protector],
584
    [AS_HELP_STRING([--disable-stack-protector],
585
        [Disable GCC's/libc's stack-smashing protection])],
586
    [case "${enableval}" in
587
         yes) enable_ssp=yes ;;
588
          no) enable_ssp=no ;;
589
           *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
590
     esac],
591
    [enable_ssp=yes])
592

                
593
if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
594
    AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
595
    enable_ssp=no
596
fi
597

                
598
if test x"$enable_ssp" = x"yes"; then
599
    # Check for broken ssp in libc: https://www.avahi.org/ticket/105
600
    # libc's brokenness will get in the way regardless of whether -lssp is
601
    # provided, but provide it anyway (otherwise non-libc ssp would wrongly
602
    # break here)
603

                
604
    # Get -lssp if it exists
605
    GCC_STACK_PROTECT_LIB
606

                
607
    AC_MSG_CHECKING([whether stack-smashing protection is available])
608
    ssp_old_cflags="$CFLAGS"
609
    ssp_old_ldflags="$LDFLAGS"
610
    CFLAGS="$CFLAGS -fstack-protector-all -fPIC"
611
    LDFLAGS="$LDFLAGS -Wl,-z,defs"
612
    cat confdefs.h > conftest.c
613
    cat >>conftest.c <<_ACEOF
614
void test_broken_ssp(c)
615
    const char *c;
616
{
617
    char arr[[123]], *p; /* beware of possible double-braces if copying this */
618
    for (p = arr; *c; ++p) {
619
        *p = *c;
620
        ++c;
621
    }
622
}
623
_ACEOF
624
    rm -f conftest.o
625

                
626
    if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
627
        AC_MSG_RESULT([yes])
628
        AC_MSG_CHECKING([whether stack-smashing protection is buggy])
629
        if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
630
            AC_MSG_RESULT([no])
631
        else
632
            AC_MSG_RESULT([yes])
633
            enable_ssp=no
634
        fi
635
    else
636
        AC_MSG_RESULT([no])
637
    fi
638

                
639
    rm -f conftest.c conftest.o conftest.so
640

                
641
    CFLAGS="$ssp_old_cflags"
642
    LDFLAGS="$ssp_old_ldflags"
643
fi
644

                
645
if test x"$enable_ssp" = x"yes"; then
646
    # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
647
    GCC_STACK_PROTECT_CC
648

                
649
    AC_LANG_PUSH([C++])
650
    GCC_STACK_PROTECT_CXX
651
    AC_LANG_POP([C++])
652
    # XXX: Update the enable_ssp value now for output later?
653
fi
654

                
655
if test "$php_module" = "true" ; then
656
    AC_CONFIG_SUBDIRS(client/web/module)
657
fi
658

                
659
AC_OUTPUT([
660
Makefile
661
docs/Makefile
662
docs/reference/Makefile
663
docs/reference/version.xml
664
po/Makefile.in
665
base/Makefile
666
base/nntpgrab_utils.pc
667
gui_base/Makefile
668
automation/Makefile
669
automation/nntpgrab_automation.pc
670
nntpgrab_core/Makefile
671
nntpgrab_core/nntpgrab.pc
672
glue/Makefile
673
glue/nntpgrab_glue.pc
674
server/Makefile
675
plugins/Makefile
676
plugins/antisleep/Makefile
677
plugins/auto_import/Makefile
678
plugins/decoder/Makefile
679
plugins/example/Makefile
680
plugins/jsonrpc/Makefile
681
plugins/logger/Makefile
682
plugins/networkmanager/Makefile
683
plugins/par2/Makefile
684
plugins/unpack/Makefile
685
client/Makefile
686
client/web/Makefile
687
client/gui/Makefile
688
tests/Makefile
689
])