Statistics
| Revision:

root / trunk / configure.in @ 1854

History | View | Annotate | Download (22.8 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
AM_CONDITIONAL(BUILD_TESTSUITE, $testsuite)
63

                
64
# Search for GLib
65
PKG_CHECK_MODULES(GLIB,
66
 glib-2.0 >= 2.10.0 gthread-2.0 gmodule-2.0 gobject-2.0,
67
 ,
68
 [AC_MSG_ERROR([* GLib 2.10.0 or higher could not be found (is the package glib2-devel installed?)])])
69

                
70
# Search for GIO
71
PKG_CHECK_MODULES(GIO,
72
 glib-2.0 >= 2.16.0 gio-2.0,
73
 have_gio=true; AC_DEFINE_UNQUOTED(HAVE_GIO, 1, [Do we have GIO]),
74
 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])])
75

                
76
# Search for socket support in GIO
77
AC_MSG_CHECKING(if GIO >= 2.22.0)
78
pkg-config --atleast-version=2.22.0 gio-2.0
79
if test `echo $?` = 0; then
80
 AC_MSG_RESULT([yes]);
81
 AC_DEFINE_UNQUOTED(HAVE_GIO_SOCKET, 1, [Do we have socket support in GIO])
82
else
83
 AC_MSG_RESULT([no])
84
fi
85

                
86
# Search for dbus-glib
87
if test "$dbus" = "true" ; then
88
 PKG_CHECK_MODULES(DBUS,
89
         dbus-glib-1 >= 0.60,
90
         have_dbus=true; AC_DEFINE_UNQUOTED(HAVE_DBUS, 1, [Do we have DBus-glib]),
91
         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?).])])
92
fi
93

                
94
# Search for libsoup
95
if test "$online_search" = "true" ; then
96
 PKG_CHECK_MODULES(SOUP,
97
         libsoup-2.4,
98
         have_soup=true; [AC_DEFINE_UNQUOTED(HAVE_SOUP, 1, [Do we have libsoup])],
99
         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])])
100

                
101
      PKG_CHECK_MODULES(SOUP_GZIP,
102
              libsoup-2.4 >= 2.28.2,
103
              [AC_DEFINE_UNQUOTED(HAVE_SOUP_GZIP, 1, [Do we have gzip support in libsoup])],
104
              [AC_MSG_RESULT([* libsoup 2.28.2 or higher could not be found. This is required to enable compression in the NZBCreator service])])
105
else
106
    have_soup="false"
107
fi
108

                
109
# Search for libproxy and libsoup-gnome
110
if test "$proxy" = "true" ; then
111
      PKG_CHECK_MODULES(SOUP_GNOME,
112
              libsoup-gnome-2.4,
113
              [AC_DEFINE_UNQUOTED(HAVE_SOUP_GNOME, 1, [Do we have libsoup-gnome])],
114
              [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])])
115

                
116
      PKG_CHECK_MODULES(LIBPROXY,
117
              libproxy-1.0,
118
              [AC_DEFINE_UNQUOTED(HAVE_LIBPROXY, 1, [Do we have libproxy])],
119
              [AC_MSG_RESULT([* libproxy could not be found (is the package libproxy-devel installed?). Without libproxy proxy settings won't be detected])])
120
fi
121

                
122
# Search for glib-networking
123
AC_MSG_CHECKING([for glib-networking (glib TLS implementation)])
124
save_CFLAGS="$CFLAGS"
125
save_LIBS="$LIBS"
126
CFLAGS="$CFLAGS $GIO_CFLAGS"
127
LIBS="$LIBS $GIO_LIBS"
128
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ],
129
                              [g_type_init (); return !g_tls_backend_supports_tls (g_tls_backend_get_default ());])],
130
      [have_glib_networking=yes]; [AC_DEFINE_UNQUOTED(HAVE_GLIB_NETWORKING, 1, [Do we have glib-networking])],
131
      [have_glib_networking=no],
132
      [have_glib_networking="unknown (cross-compiling)"])
133
CFLAGS="$save_CFLAGS"
134
LIBS="$save_LIBS"
135
AC_MSG_RESULT($have_glib_networking)
136

                
137
AC_SUBST(GLIB_LIBS)
138
AC_SUBST(GLIB_CFLAGS)
139
AC_SUBST(GIO_LIBS)
140
AC_SUBST(GIO_CFLAGS)
141
AM_CONDITIONAL(HAVE_GIO, $have_gio)
142
AC_SUBST(LIBXML2_LIBS)
143
AC_SUBST(LIBXML2_CFLAGS)
144
AC_SUBST(DBUS_LIBS)
145
AC_SUBST(DBUS_CFLAGS)
146
AM_CONDITIONAL(HAVE_DBUS, $have_dbus)
147
AC_SUBST(SOUP_LIBS)
148
AC_SUBST(SOUP_CFLAGS)
149
AC_SUBST(SOUP_GNOME_LIBS)
150
AC_SUBST(SOUP_GNOME_CFLAGS)
151
AC_SUBST(LIBPROXY_LIBS)
152
AC_SUBST(LIBPROXY_CFLAGS)
153

                
154
AC_ARG_ENABLE(ssl,
155
      [  --disable-ssl           Activate NNTP-over-SSL support (enabled by default)],
156
      [case "x${enableval}" in
157
              xyes) ssl=true ;;
158
              xno) ssl=false ;;
159
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-ssl) ;;
160
      esac],[ssl=true])
161

                
162
AC_ARG_ENABLE(php_module,
163
      [  --enable-php-module     Compile an PHP module which allows PHP scripts to call NNTPGrab methods (disabled by default)],
164
      [case "x${enableval}" in
165
              xyes) php_module=true ;;
166
              xno) php_module=false ;;
167
              *) AC_MSG_ERROR(bad value ${enableval} for --enable-php-module) ;;
168
      esac],[php_module=false])
169

                
170
AM_CONDITIONAL(ENABLE_PHP_MODULE, $php_module)
171

                
172
AC_ARG_ENABLE(networkmanager,
173
      [  --disable-networkmanager
174
                          Activate NetworkManager integration (enabled by default)],
175
      [case "x${enableval}" in
176
              xyes) networkmanager=true ;;
177
              xno) networkmanager=false ;;
178
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-networkmanager) ;;
179
      esac],[networkmanager=true])
180

                
181
if test "$networkmanager" = "true" ; then
182
      PKG_CHECK_MODULES(NETWORKMANAGER, libnm-glib, have_networkmanager=true,have_networkmanager=false)
183
      if test "$have_networkmanager" = "false" ; then
184
              PKG_CHECK_MODULES(NETWORKMANAGER,
185
                      libnm_glib > 0.7.0,
186
                      have_networkmanager=true,
187
                      [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)
188
      fi
189
else
190
    have_networkmanager=false
191
fi
192

                
193
AC_ARG_ENABLE(automatic_shutdown,
194
      [  --disable-automatic-shutdown
195
                          Activate support for automatic shutdown (enabled by default)],
196
      [case "x${enableval}" in
197
              xyes) automatic_shutdown=true ;;
198
              xno) automatic_shutdown=false ;;
199
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-automatic-shutdown) ;;
200
      esac],[automatic_shutdown=true])
201

                
202
AC_SUBST(NETWORKMANAGER_LIBS)
203
AC_SUBST(NETWORKMANAGER_CFLAGS)
204
AM_CONDITIONAL(HAVE_NETWORKMANAGER, $have_networkmanager)
205

                
206
AC_ARG_ENABLE(gui,
207
      [  --disable-gui           Turn on GUI client (enabled by default)],
208
      [case "x${enableval}" in
209
              xyes) gui=true ;;
210
              xno)  gui=false ;;
211
              x) gui=true ;;
212
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-gui) ;;
213
      esac],[gui=true])
214

                
215
AC_ARG_ENABLE(gtk3,
216
      [  --disable-gtk3          Build against GTK+ 3 if it's available (enabled by default)],
217
      [case "x${enableval}" in
218
              xyes) gtk3=true ;;
219
              xno) gtk3=false ;;
220
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-gtk3) ;;
221
      esac],[gtk3=true])
222

                
223
AC_ARG_ENABLE(notifications,
224
      [  --disable-notifications Activate support for showing notifications using libnotify (enabled by default)],
225
      [case "x${enableval}" in
226
              xyes) notifications=true ;;
227
              xno) notifications=false ;;
228
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-notifications) ;;
229
      esac],[notifications=true])
230

                
231
AM_CONDITIONAL(ENABLE_GUI, $gui)
232
if [ "$gui" = "true" ]; then
233
      if test "$gtk3" = "true" ; then
234
              PKG_CHECK_MODULES(GTK3,
235
                      gtk+-3.0 gdk-3.0 gthread-2.0,
236
                      have_gtk3=true; AC_DEFINE_UNQUOTED(HAVE_GTK3, 1, [Do we have GTK-3 available]),
237
                      have_gtk3=false; [AC_MSG_RESULT([* GTK+-3.0 or higher could not be found (is the package gtk3+-devel installed?)])])
238
      else
239
              have_gtk3="false"
240
      fi
241

                
242
      if test "$have_gtk3" = "false" ; then
243
              PKG_CHECK_MODULES(GTK,
244
                      gtk+-2.0 gdk-2.0 gthread-2.0,
245
                      ,
246
                      [AC_MSG_ERROR([* GTK+-2.2 or higher could not be found (is the package gtk2+-devel installed?)])])
247

                
248
              AC_MSG_CHECKING(if GTK >= 2.12.0)
249
              pkg-config --atleast-version=2.12.0 gtk+-2.0
250
              if test `echo $?` = 0; then
251
                      AC_MSG_RESULT([yes])
252
              else
253
                      AC_MSG_RESULT([no])
254
                      PKG_CHECK_MODULES(GLADE,
255
                              libglade-2.0,
256
                              ,
257
                              [AC_MSG_ERROR([* Glade 2.0 or higher could not be found (is the package libglade2-devel installed?)])])
258
              fi
259
      fi
260

                
261
      if test "$notifications" = "true" ; then
262
              PKG_CHECK_MODULES(LIBNOTIFY,
263
                      libnotify >= 0.4.1,
264
                      AC_DEFINE_UNQUOTED(HAVE_LIBNOTIFY, 1, [Do we have libnotify available]),
265
                      [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])])
266

                
267
              AC_MSG_CHECKING(if libnotify >= 0.7.0)
268
              pkg-config --atleast-version=0.7.0 libnotify
269
              if test `echo $?` = 0; then
270
                      AC_MSG_RESULT([yes])
271
                      AC_DEFINE_UNQUOTED(HAVE_LIBNOTIFY_0_7, 1, [Do we have libnotify 0.7 available])
272
              else
273
                      AC_MSG_RESULT([no])
274
              fi
275
      fi
276

                
277
      if test "$automatic_shutdown" = "true" ; then
278
              PKG_CHECK_MODULES(POLKIT,
279
                      polkit-gobject-1,
280
                      AC_DEFINE_UNQUOTED(HAVE_POLKIT1, 1, [Do we have PolicyKit 1.0 available]),
281
                      [PKG_CHECK_MODULES(POLKIT,
282
                              polkit-gnome,
283
                              AC_DEFINE_UNQUOTED(HAVE_POLKIT_OLD, 1, [Do we have PolicyKit 0.9 available]),
284
                              [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])])
285
                      ])
286
      fi
287

                
288
      PKG_CHECK_MODULES(LIBXML2,
289
              libxml-2.0,
290
              ,
291
              [AC_MSG_ERROR([* LibXML 2.0 or higher could not be found (is the package libxml2-devel installed?)])])
292
fi
293

                
294
AC_ARG_ENABLE(par2cmdline-check,
295
      [  --disable-par2cmdline-check
296
                          Check for the existance of the par2 binary (enabled by default)],
297
      [case "x${enableval}" in
298
              xyes) par2_check=true ;;
299
              xno) par2_check=false ;;
300
              *) AC_MSG_ERROR(bad value ${enableval} for --disable-par2cmdline-check) ;;
301
      esac],[par2_check=true])
302

                
303
if test "$par2_check" = "true" ; then
304
      AC_CHECK_PROGS([PAR2CMDLINE], [par2])
305
      if test "x$PAR2CMDLINE" = "x" ; then
306
              AC_MSG_ERROR([par2cmdline is not found. This is required for NNTPGrab])
307
      fi
308
fi
309

                
310
AC_SUBST(GTK3_LIBS)
311
AC_SUBST(GTK3_CFLAGS)
312
AC_SUBST(GTK_LIBS)
313
AC_SUBST(GTK_CFLAGS)
314
AC_SUBST(GLADE_CFLAGS)
315
AC_SUBST(GLADE_LIBS)
316
AC_SUBST(POLKIT_LIBS)
317
AC_SUBST(POLKIT_CFLAGS)
318
AC_SUBST(LIBNOTIFY_LIBS)
319
AC_SUBST(LIBNOTIFY_CFLAGS)
320

                
321
# check for gtk-doc
322
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
323

                
324
dnl Default search paths for headers and libs
325
dnl ----------------------------------------
326

                
327
ac_default_lib_searchpath="/sw/lib /usr/lib64 /usr/local/lib64 /usr/lib /usr/local/lib /opt/lib"
328
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/lib/openssl/lib /usr/X11R6/lib"
329
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/X11R6/lib/mozilla* /usr/lib/mozilla*"
330
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/local/mozilla* /usr/local/mozilla*/lib"
331
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/local/ssl*/lib /usr/local/lib/openssl"
332
ac_default_lib_searchpath="$ac_default_lib_searchpath /opt/gnome/lib/mozilla /opt/mozilla/lib"
333
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/lib/curl /usr/local/lib/curl /opt/curl/lib"
334
ac_default_lib_searchpath="$ac_default_lib_searchpath /opt/MozillaThunderbird/lib64 /opt/openssl/lib"
335
ac_default_lib_searchpath="$ac_default_lib_searchpath /sw/lib/mozilla /dist/lib"
336

                
337
ac_default_inc_searchpath="/sw/include /usr/include /usr/include/libxml2 /usr/local/include "
338
ac_default_inc_searchpath="$ac_default_inc_searchpath /opt/include /opt/openssl/include "
339
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/lib/openssl/include /usr/include/mozilla*"
340
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/local/mozilla* /usr/local/mozilla*/include"
341
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/local/ssl/include /usr/local/include/openssl"
342
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/include/mozilla*/gtkembedmoz /usr/local/include/mozilla*/gtkembedmoz"
343
ac_default_inc_searchpath="$ac_default_inc_searchpath /opt/gnome/include/mozilla /opt/mozilla/include"
344
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/include/curl /usr/local/include/curl /opt/curl/include"
345
ac_default_inc_searchpath="$ac_default_inc_searchpath /sw/include/mozilla /usr/include/pcre /dist/include"
346

                
347
dnl --------------------
348
dnl OS specific settings
349
dnl --------------------
350

                
351
case "$host_os" in
352
        mingw32)
353
                CPPFLAGS="$CPPFLAGS -mms-bitfields"
354
                CFLAGS="$CFLAGS -DOS=\"\\\"Windows\\\"\""
355
                AC_CHECK_TOOL(WINDRES, windres, no)
356
                if test "$WINDRES" = no; then 
357
                        AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.]) 
358
                fi
359
                AM_CONDITIONAL(WIN32, true)
360
                AC_DEFINE(WIN32, 1, [Is this a Win32 platform])
361
                AM_CONDITIONAL(DARWIN, false);;
362
       cygwin)
363
                CFLAGS="$CFLAGS -DOS=\"\\\"Windows\\\"\""
364
                AC_CHECK_TOOL(WINDRES, windres, no)
365
                if test "$WINDRES" = no; then
366
                        AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
367
                fi
368
                AM_CONDITIONAL(WIN32, true)
369
                AC_DEFINE(WIN32, 1, [Is this a Win32 platform])
370
                AM_CONDITIONAL(DARWIN, false)
371
                LDFLAGS="$LDFLAGS -mwindows";;
372
        darwin*)
373
                CFLAGS="$CFLAGS -DOS=\"\\\"Mac_OS_X/X86\\\"\""
374
                CPPFLAGS="$CPPFLAGS -DDARWIN"
375
                AM_CONDITIONAL(WIN32, false)
376
                AM_CONDITIONAL(DARWIN, true);;
377
        *)
378
                CFLAGS="$CFLAGS -DOS=\"\\\"`uname -s`\\\"\""
379
                AM_CONDITIONAL(WIN32, false)
380
                AM_CONDITIONAL(DARWIN, false);;
381
esac
382

                
383
dnl ---------------------
384
dnl Mac OS X integration
385
dnl ---------------------
386
if test "$host_os" = "darwin9" -o "$host_os" = "darwin10" -o "$host_os" = "darwin10.2.0" ; then
387
  if [ "$gui" = "true" ]; then
388
    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])])
389
  fi
390

                
391
  # Mac OS X doesn't like 'EXPORTS' mentioned in the .def files..strip them out
392
  grep -v EXPORTS plugins/nntpgrab_plugin.def > tmp
393
  unlink plugins/nntpgrab_plugin.def
394
  mv tmp plugins/nntpgrab_plugin.def
395

                
396
  grep -v EXPORTS base/nntpgrab_utils.def > tmp
397
  unlink base/nntpgrab_utils.def
398
  mv tmp base/nntpgrab_utils.def
399

                
400
  grep -v EXPORTS nntpgrab_core/nntpgrab.def > tmp
401
  unlink nntpgrab_core/nntpgrab.def
402
  mv tmp nntpgrab_core/nntpgrab.def
403

                
404
  grep -v EXPORTS automation/nntpgrab_automation.def > tmp
405
  unlink automation/nntpgrab_automation.def
406
  mv tmp automation/nntpgrab_automation.def
407

                
408
  grep -v EXPORTS glue/nntpgrab_glue.def > tmp
409
  unlink glue/nntpgrab_glue.def
410
  mv tmp glue/nntpgrab_glue.def
411

                
412
  grep -v EXPORTS gui_base/nntpgrab_gui_base.def > tmp
413
  unlink gui_base/nntpgrab_gui_base.def
414
  mv tmp gui_base/nntpgrab_gui_base.def
415
fi
416

                
417
AC_SUBST(MAC_INTEGRATION_CFLAGS)
418
AC_SUBST(MAC_INTEGRATION_LIBS)
419

                
420
dnl ---
421
dnl PCRE is only necessary when GLib 2.14.0 or higher is not found
422
dnl ---
423
AC_MSG_CHECKING(if GLIB >= 2.14.0)
424
pkg-config --atleast-version=2.14.0 glib-2.0
425
if test `echo $?` = 0; then
426
  AC_MSG_RESULT([yes])
427
else
428
  AC_MSG_RESULT([no])
429
  AC_FIND_LIB2(pcre, $ac_default_lib_searchpath, pcre_libraries, [PCRE libraries.], [PCRE libraries could not be found])
430
  AC_FIND_HEADER2(pcre.h, $ac_default_inc_searchpath, pcre_headers, [PCRE headers.], [PCRE headers could not be found])
431
fi
432

                
433
if test "$have_soup" = "false" -a "$gui" = "true"; then
434
  dnl ---------------
435
  dnl libCURL support
436
  dnl ---------------
437
  AC_FIND_LIB2(curl, $ac_default_lib_searchpath, libcurl_libraries,
438
    [Curl library],
439
    [Curl library couldn't be found])
440

                
441
  AC_FIND_HEADER2(curl/curl.h, $ac_default_inc_searchpath, libcurl_headers,
442
    [Curl headers],
443
    [Curl headers could not be found],
444
     curl)
445
fi
446

                
447
AM_CONDITIONAL(HAVE_SSL, $ssl)
448
if test "$ssl" = "true" ; then
449
      AC_DEFINE_UNQUOTED(HAVE_SSL, 1, [Do we have to build with SSL support])
450

                
451
      PKG_CHECK_MODULES(GNUTLS,
452
              gnutls,
453
              gnutls_found=true; AC_DEFINE_UNQUOTED(HAVE_GNUTLS, 1, [Do we have to build with GNUTLS support]),
454
              [AC_MSG_RESULT([* GNUTLS could not be found (is the package gnutls-devel installed?)])]; gnutls_found=false)
455

                
456
      if test "$gnutls_found" = "false" ; then
457
              PKG_CHECK_MODULES(NSS,
458
                      nss,
459
                      nss_found=true,
460
                      [AC_MSG_RESULT([* NSS could not be found (is the package nss-devel installed?)])]; nss_found=false)
461

                
462
              if test "$nss_found" = "true" ; then
463
                      AC_FIND_LIB(nss_compat_ossl, $ac_default_lib_searchpath, nss_compat_ossl_libraries,
464
                              [nss_compat_ossl libraries],
465
                              [nss_compat_ossl libraries could not be found])
466

                
467
                      AC_FIND_HEADER(nss_compat_ossl/nss_compat_ossl.h, $ac_default_inc_searchpath, nss_compat_ossl_headers,
468
                              [nss_compat_ossl headers],
469
                              [nss_compat_oss header could not be found],
470
                              nss_compat_ossl)
471
              fi
472

                
473
              if test "$nss_found" = "true" -a \
474
                      "$nss_compat_ossl_libraries_ok" = "true" -a \
475
                      "$nss_compat_ossl_headers_ok" = "true" ; then
476

                
477
                      have_nss_compat_ossl=true
478
                      AC_DEFINE_UNQUOTED(HAVE_NSS_COMPAT_OSSL, 1, [Do we have to build with nss-compat-openSSL support])
479
                      NSS_LIBS="$NSS_LIBS -lnss_compat_ossl"
480
              else
481
                      have_nss_compat_ossl=false
482
                      NSS_CFLAGS=""
483
                      NSS_LIBS=""
484
              fi
485

                
486
              if test "$have_nss_compat_ossl" = "false" ; then
487
                      AC_FIND_LIB2(ssl, $ac_default_lib_searchpath, openssl_libraries,
488
                              [OpenSSL libraries],
489
                              [OpenSSL library not found])
490
  
491
                      AC_FIND_HEADER2(openssl/md5.h, $ac_default_inc_searchpath, openssl_headers,
492
                              [OpenSSL headers],
493
                              [OpenSSL headers could not be found])
494
  
495
                      openssl_libraries_LIBS="$openssl_libraries_LIBS -lcrypto"
496
              fi
497
      fi
498
fi
499

                
500
AC_SUBST(PCRE_CFLAGS, $pcre_headers_CFLAGS)
501
AC_SUBST(PCRE_LIBS, $pcre_libraries_LIBS)
502
AC_SUBST(CURL_CFLAGS, $libcurl_headers_CFLAGS)
503
AC_SUBST(CURL_LIBS, $libcurl_libraries_LIBS)
504
AC_SUBST(GNUTLS_CFLAGS)
505
AC_SUBST(GNUTLS_LIBS)
506
AC_SUBST(NSS_CFLAGS)
507
AC_SUBST(NSS_LIBS)
508
AC_SUBST(OPENSSL_CFLAGS, $openssl_headers_CFLAGS)
509
AC_SUBST(OPENSSL_LIBS, $openssl_libraries_LIBS)
510

                
511
# Introspection support
512
GOBJECT_INTROSPECTION_CHECK([0.9.0])
513

                
514
# gettext
515
AC_PROG_INTLTOOL([0.21], [no-xml])
516
AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)
517

                
518
ALL_LINGUAS="nl fr"
519
AM_GLIB_GNU_GETTEXT
520

                
521
if test "x$WIN32_TRUE" = "x" ; then
522
    nntpgrablocaledir='../${DATADIRNAME}/locale'
523
else
524
    nntpgrablocaledir='${prefix}/${DATADIRNAME}/locale'
525
fi
526
AC_SUBST(nntpgrablocaledir)
527

                
528
AC_CHECK_FUNC(strptime,[ AC_DEFINE(HAVE_STRPTIME, 1, [strptime check]) AM_CONDITIONAL(HAVE_STRPTIME, true) ],[ AM_CONDITIONAL(HAVE_STRPTIME, false) ])
529
AC_CHECK_FUNC(backtrace_symbols, [AC_DEFINE(HAVE_BACKTRACE, 1, [backtrace_symbols check])])
530

                
531
dnl Checks for mkdtemp function
532

                
533
mkdtemp_missing=false
534
AC_CHECK_FUNC(mkdtemp,
535
    [AC_DEFINE([HAVE_MKDTEMP], 1, [Have GlibC function to make temp dirs])],
536
    mkdtemp_missing=true)
537
AM_CONDITIONAL(MKDTEMP_MISSING, test x$mkdtemp_missing = xtrue)
538

                
539
dnl Set PACKAGE SOURCE DIR in config.h.
540
packagesrcdir=`cd $srcdir && pwd`
541

                
542
dnl Set PACKAGE PREFIX
543
if test "x${prefix}" = "xNONE"; then
544
  packageprefix=${ac_default_prefix}
545
else
546
  packageprefix=${prefix}
547
fi
548

                
549
packagedatadir=share/${PACKAGE}
550
pkgdir=${packageprefix}/${packagedatadir}
551
plugindir=${libdir}/${PACKAGE}
552
wwwdir=${pkgdir}/web
553

                
554
AC_DEFINE_UNQUOTED(SHARE_DIR, "${pkgdir}", [Location of NNTPGrab icons])
555
AC_SUBST(PLUGINDIR, "${plugindir}")
556
AC_SUBST(WWWDIR, "${wwwdir}")
557
CPPFLAGS="$CPPFLAGS -DPLUGIN_DIR=\"\\\"\${PLUGINDIR}\\\"\" -DWWW_DIR=\"\\\"\${WWWDIR}\\\"\""
558

                
559
# -fstack-protector
560
AC_ARG_ENABLE([stack-protector],
561
    [AS_HELP_STRING([--disable-stack-protector],
562
        [Disable GCC's/libc's stack-smashing protection])],
563
    [case "${enableval}" in
564
         yes) enable_ssp=yes ;;
565
          no) enable_ssp=no ;;
566
           *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
567
     esac],
568
    [enable_ssp=yes])
569

                
570
if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
571
    AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
572
    enable_ssp=no
573
fi
574

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

                
581
    # Get -lssp if it exists
582
    GCC_STACK_PROTECT_LIB
583

                
584
    AC_MSG_CHECKING([whether stack-smashing protection is available])
585
    ssp_old_cflags="$CFLAGS"
586
    ssp_old_ldflags="$LDFLAGS"
587
    CFLAGS="$CFLAGS -fstack-protector-all -fPIC"
588
    LDFLAGS="$LDFLAGS -Wl,-z,defs"
589
    cat confdefs.h > conftest.c
590
    cat >>conftest.c <<_ACEOF
591
void test_broken_ssp(c)
592
    const char *c;
593
{
594
    char arr[[123]], *p; /* beware of possible double-braces if copying this */
595
    for (p = arr; *c; ++p) {
596
        *p = *c;
597
        ++c;
598
    }
599
}
600
_ACEOF
601
    rm -f conftest.o
602

                
603
    if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
604
        AC_MSG_RESULT([yes])
605
        AC_MSG_CHECKING([whether stack-smashing protection is buggy])
606
        if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
607
            AC_MSG_RESULT([no])
608
        else
609
            AC_MSG_RESULT([yes])
610
            enable_ssp=no
611
        fi
612
    else
613
        AC_MSG_RESULT([no])
614
    fi
615

                
616
    rm -f conftest.c conftest.o conftest.so
617

                
618
    CFLAGS="$ssp_old_cflags"
619
    LDFLAGS="$ssp_old_ldflags"
620
fi
621

                
622
if test x"$enable_ssp" = x"yes"; then
623
    # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
624
    GCC_STACK_PROTECT_CC
625

                
626
    AC_LANG_PUSH([C++])
627
    GCC_STACK_PROTECT_CXX
628
    AC_LANG_POP([C++])
629
    # XXX: Update the enable_ssp value now for output later?
630
fi
631

                
632
if test "$php_module" = "true" ; then
633
    AC_CONFIG_SUBDIRS(client/web/module)
634
fi
635

                
636
AC_OUTPUT([
637
Makefile
638
docs/Makefile
639
docs/reference/Makefile
640
docs/reference/version.xml
641
po/Makefile.in
642
base/Makefile
643
base/nntpgrab_utils.pc
644
gui_base/Makefile
645
automation/Makefile
646
automation/nntpgrab_automation.pc
647
nntpgrab_core/Makefile
648
nntpgrab_core/nntpgrab.pc
649
glue/Makefile
650
glue/nntpgrab_glue.pc
651
server/Makefile
652
plugins/Makefile
653
plugins/antisleep/Makefile
654
plugins/auto_import/Makefile
655
plugins/decoder/Makefile
656
plugins/example/Makefile
657
plugins/jsonrpc/Makefile
658
plugins/logger/Makefile
659
plugins/networkmanager/Makefile
660
plugins/par2/Makefile
661
plugins/unpack/Makefile
662
client/Makefile
663
client/web/Makefile
664
client/gui/Makefile
665
tests/Makefile
666
])