Statistics
| Revision:

root / branches / nntpgrab-0.6 / configure.in @ 1640

History | View | Annotate | Download (20.9 KB)

1
AC_INIT(nntpgrab, 0.6.2)
2
AC_DEFINE(MAJOR_VERSION, 0, [Major version number])
3
AC_DEFINE(MINOR_VERSION, 6, [Minor version number])
4
AC_DEFINE(MICRO_VERSION, 2, [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
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.10.0 gthread-2.0 gmodule-2.0 gobject-2.0,,[AC_MSG_ERROR([* GLib 2.10.0 or higher could not be found (is the package glib2-devel installed?)])])
31
PKG_CHECK_MODULES(GIO, glib-2.0 >= 2.16.0 gio-2.0,have_gio=true,[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])]; have_gio=false)
32
PKG_CHECK_MODULES(LIBXML2, libxml-2.0,,[AC_MSG_ERROR([* LibXML 2.0 or higher could not be found (is the package libxml2-devel installed?)])])
33
PKG_CHECK_MODULES(SQLITE3, sqlite3,,[AC_MSG_ERROR([* SQLite 3.0 or higher could not be found (is the package sqlite-devel installed?)])])
34
PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.60,have_dbus=true,[AC_MSG_RESULT([* DBUS-Glib 0.60 or higher could not be found (is the package dbus-devel and/or dbus-glib-devel installed?).])]; have_dbus=false)
35
PKG_CHECK_MODULES(SOUP, libsoup-2.4, have_soup=true,[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])]; have_soup=false)
36
PKG_CHECK_MODULES(SOUP_GZIP, libsoup-2.4 >= 2.28.2, have_soup_gzip=true,[AC_MSG_RESULT([* libsoup 2.28.2 or higher could not be found. This is required to enable compression in the NZBCreator service])]; have_soup_gzip=false)
37
PKG_CHECK_MODULES(SOUP_GNOME, libsoup-gnome-2.4, have_soup_gnome=true,[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])]; have_soup_gnome=false)
38
PKG_CHECK_MODULES(LIBPROXY, libproxy-1.0, have_libproxy=true,[AC_MSG_RESULT([* libproxy could not be found (is the package libproxy-devel installed?). Without libproxy proxy settings won't be detected])]; have_libproxy=false)
39
#PKG_CHECK_MODULES(GLIB_SHARP, glib-sharp-2.0,,[AC_MSG_ERROR([* GLib-sharp 2.0 or higher could not be found (is the package glib-sharp2-devel installed?)])])
40
AC_SUBST(GLIB_LIBS)
41
AC_SUBST(GLIB_CFLAGS)
42
AC_SUBST(GIO_LIBS)
43
AC_SUBST(GIO_CFLAGS)
44
AM_CONDITIONAL(HAVE_GIO, $have_gio)
45
AC_SUBST(LIBXML2_LIBS)
46
AC_SUBST(LIBXML2_CFLAGS)
47
AC_SUBST(SQLITE3_LIBS)
48
AC_SUBST(SQLITE3_CFLAGS)
49
AC_SUBST(DBUS_LIBS)
50
AC_SUBST(DBUS_CFLAGS)
51
AM_CONDITIONAL(HAVE_DBUS, $have_dbus)
52
AC_SUBST(SOUP_LIBS)
53
AC_SUBST(SOUP_CFLAGS)
54
AM_CONDITIONAL(HAVE_SOUP, $have_soup)
55
AM_CONDITIONAL(HAVE_SOUP_GZIP, $have_soup_gzip)
56
AC_SUBST(SOUP_GNOME_LIBS)
57
AC_SUBST(SOUP_GNOME_CFLAGS)
58
AM_CONDITIONAL(HAVE_SOUP_GNOME, $have_soup_gnome)
59
AC_SUBST(LIBPROXY_LIBS)
60
AC_SUBST(LIBPROXY_CFLAGS)
61
AM_CONDITIONAL(HAVE_LIBPROXY, $have_libproxy)
62
#AC_SUBST(GLIB_SHARP_LIBS)
63
#AC_SUBST(GLIB_SHARP_CFLAGS)
64

                
65
AC_ARG_ENABLE(ssl,
66
    [  --disable-ssl               Activate NNTP-over-SSL support (enabled by default)],
67
    [case "x${enableval}" in
68
        xyes) ssl=true ;;
69
        xno) ssl=false ;;
70
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-ssl) ;;
71
    esac],[ssl=true])
72

                
73
AC_ARG_ENABLE(php_module,
74
    [  --enable-php-module      Compile an PHP module which allows PHP scripts to call NNTPGrab methods (disabled by default)],
75
    [case "x${enableval}" in
76
        xyes) php_module=true ;;
77
        xno) php_module=false ;;
78
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-php-module) ;;
79
    esac],[php_module=false])
80

                
81
AM_CONDITIONAL(ENABLE_PHP_MODULE, $php_module)
82

                
83
PKG_CHECK_MODULES(NETWORKMANAGER, libnm-glib, have_networkmanager=true,have_networkmanager=false)
84
if test "$have_networkmanager" = "false" ; then
85
    PKG_CHECK_MODULES(NETWORKMANAGER, libnm_glib > 0.7.0, have_networkmanager=true,[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)
86
fi
87

                
88
AC_SUBST(NETWORKMANAGER_LIBS)
89
AC_SUBST(NETWORKMANAGER_CFLAGS)
90
AM_CONDITIONAL(HAVE_NETWORKMANAGER, $have_networkmanager)
91

                
92
AC_ARG_ENABLE(gui,
93
    [  --disable-gui               Turn on GUI client (enabled by default)],
94
    [case "x${enableval}" in
95
        xyes) gui=true ;;
96
        xno)  gui=false ;;
97
        x) gui=true ;;
98
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-gui) ;;
99
    esac],[gui=true])
100

                
101
AM_CONDITIONAL(ENABLE_GUI, $gui)
102
if [ "$gui" = "true" ]; then
103
  PKG_CHECK_MODULES(GTK, gtk+-2.0 gdk-2.0 gthread-2.0,,[AC_MSG_ERROR([* GTK+-2.2 or higher could not be found (is the package gtk2+-devel installed?)])])
104

                
105
  AC_MSG_CHECKING(if GTK >= 2.12.0)
106
  pkg-config --atleast-version=2.12.0 gtk+-2.0
107
  if test `echo $?` = 0; then
108
    AC_MSG_RESULT([yes])
109
  else
110
    AC_MSG_RESULT([no])
111
    PKG_CHECK_MODULES(GLADE, libglade-2.0,,[AC_MSG_ERROR([* Glade 2.0 or higher could not be found (is the package libglade2-devel installed?)])])
112
  fi
113

                
114
  PKG_CHECK_MODULES(GNOME, libgnome-2.0 libgnomeui-2.0, have_gnome=true,[AC_MSG_RESULT([* libgnome-2.0 and/or libgnomeui-2.0 could not be found..Bug Buddy integration will not be possible])]; have_gnome=false)
115

                
116
  PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= 0.4.1, have_libnotify=true,[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])]; have_libnotify=false)
117

                
118
  PKG_CHECK_MODULES(POLKIT, polkit-gobject-1, have_polkit1=true, [PKG_CHECK_MODULES(POLKIT, polkit-gnome, have_polkit_old=true,[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])]; have_polkit_old=false)]; have_polkit1=false)
119

                
120
  AC_MSG_CHECKING(for installed version of libgtkhtml3)
121
  pkg-config --exists libgtkhtml-3.14
122
  retval=$?
123
  gtk_html_found=false
124
  if test $retval -eq 0 ; then
125
    gtk_html_found=true
126
    gtk_html_version=3.14
127
  else
128
    pkg-config --exists libgtkhtml-3.8
129
    retval=$?
130
    if test $retval -eq 0 ; then
131
      gtk_html_found=true
132
      gtk_html_version=3.8
133
    else
134
      pkg-config --exists libgtkhtml-3.6
135
      retval=$?
136
      if test $retval -eq 0 ; then
137
        gtk_html_version=3.6
138
        gtk_html_found=true
139
      else
140
        pkg-config --exists libgtkhtml-3.4
141
        retval=$?
142
        if test $retval -eq 0 ; then
143
          gtk_html_version=3.4
144
          gtk_html_found=true
145
        else
146
          AC_MSG_ERROR(libgtkhtml 3.4 or higher is not found!)
147
        fi
148
      fi
149
   fi
150
  fi
151

                
152
  if [ $gtk_html_found = "true" ]; then
153
    version=`pkg-config --modversion libgtkhtml-${gtk_html_version}`
154
    AC_MSG_RESULT(found version ${version})
155
    PKG_CHECK_MODULES(GTKHTML, libgtkhtml-${gtk_html_version},, [AC_MSG_ERROR([* GTKHTML 3.4 or higher could not be found (is the package gtkhtml3-devel installed?)])])
156
  fi
157
fi
158

                
159
AC_CHECK_PROGS([PAR2CMDLINE], [par2])
160
if test "x$PAR2CMDLINE" = "x" ; then
161
  AC_MSG_ERROR([par2cmdline is not found. This is required for NNTPGrab])
162
fi
163

                
164
dnl PKG_CHECK_MODULES(LIBPAR2, libpar2, libpar2_found=true, libpar2_found=false)
165
dnl if test "$libpar2_found" != "true" ; then
166
dnl     AC_LANG_PUSH([C++])
167
dnl     PKG_CHECK_MODULES(SIGC, sigc++-2.0,, [AC_MSG_ERROR([* libsigc++-2.0 could not be found (is the package libsigc++-2.0 installed?)])])
168
dnl     CPPFLAGS="$CXXFLAGS $SIGC_CFLAGS"
169
dnl     AC_CHECK_LIB(par2, main,,[AC_MSG_ERROR([* libpar2 could not be found])])
170
dnl     AC_CHECK_HEADERS([libpar2/par2cmdline.h],, [AC_MSG_ERROR([* libpar2 headers could not be found])])
171
dnl     LIBPAR2_LIBS="-lpar2 $SIGC_LIBS"
172
dnl     LIBPAR2_CFLAGS="$SIGC_CFLAGS"
173
dnl     AC_LANG_POP([C++])
174
dnl fi
175

                
176
AC_SUBST(GTK_LIBS)
177
AC_SUBST(GTK_CFLAGS)
178
AC_SUBST(GLADE_CFLAGS)
179
AC_SUBST(GLADE_LIBS)
180
AC_SUBST(GNOME_LIBS)
181
AC_SUBST(GNOME_CFLAGS)
182
AM_CONDITIONAL(HAVE_GNOME, $have_gnome)
183
AC_SUBST(POLKIT_LIBS)
184
AC_SUBST(POLKIT_CFLAGS)
185
AM_CONDITIONAL(HAVE_POLKIT, test "$have_polkit1" == "true" -o "$have_polkit_old" == "true")
186
AM_CONDITIONAL(HAVE_POLKIT1, test "$have_polkit1" == "true")
187
AM_CONDITIONAL(HAVE_POLKIT_OLD, test "$have_polkit_old" == "true")
188
AC_SUBST(LIBNOTIFY_LIBS)
189
AC_SUBST(LIBNOTIFY_CFLAGS)
190
AM_CONDITIONAL(HAVE_LIBNOTIFY, $have_libnotify)
191
AC_SUBST(GTKHTML_LIBS)
192
AC_SUBST(GTKHTML_CFLAGS)
193
dnl AC_SUBST(LIBPAR2_LIBS)
194
dnl AC_SUBST(LIBPAR2_CFLAGS)
195

                
196
m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
197

                
198
AC_ARG_ENABLE(doxygen-docs, AS_HELP_STRING([--enable-doxygen-docs],[build DOXYGEN documentation (requires Doxygen)]),enable_doxygen_docs=$enableval,enable_doxygen_docs=auto)
199

                
200
### Doxygen Documentation
201

                
202
AC_PATH_PROG(DOXYGEN, doxygen, no)
203

                
204
AC_MSG_CHECKING([whether to build Doxygen documentation])
205

                
206
if test x$DOXYGEN = xno ; then
207
    have_doxygen=no
208
else
209
    have_doxygen=yes
210
fi
211

                
212
if test x$enable_doxygen_docs = xauto ; then
213
    if test x$have_doxygen = xno ; then
214
        enable_doxygen_docs=no
215
    else
216
        enable_doxygen_docs=yes
217
    fi
218
fi
219

                
220
if test x$enable_doxygen_docs = xyes; then
221
    if test x$have_doxygen = xno; then
222
      AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
223
    fi
224
fi
225

                
226
AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
227
AC_MSG_RESULT(yes)
228

                
229
# Mono
230
#AC_PATH_PROG(GACUTIL, gacutil, no)
231
#if test "x$GACUTIL" = "xno" ; then
232
#        AC_MSG_ERROR([No gacutil tool found])
233
#fi
234
#AC_SUBST(GACUTIL)
235

                
236
dnl Default search paths for headers and libs
237
dnl ----------------------------------------
238

                
239
ac_default_lib_searchpath="/sw/lib /usr/lib64 /usr/local/lib64 /usr/lib /usr/local/lib /opt/lib"
240
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/lib/openssl/lib /usr/X11R6/lib"
241
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/X11R6/lib/mozilla* /usr/lib/mozilla*"
242
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/local/mozilla* /usr/local/mozilla*/lib"
243
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/local/ssl*/lib /usr/local/lib/openssl"
244
ac_default_lib_searchpath="$ac_default_lib_searchpath /opt/gnome/lib/mozilla /opt/mozilla/lib"
245
ac_default_lib_searchpath="$ac_default_lib_searchpath /usr/lib/curl /usr/local/lib/curl /opt/curl/lib"
246
ac_default_lib_searchpath="$ac_default_lib_searchpath /opt/MozillaThunderbird/lib64 /opt/openssl/lib"
247
ac_default_lib_searchpath="$ac_default_lib_searchpath /sw/lib/mozilla /dist/lib"
248

                
249
ac_default_inc_searchpath="/sw/include /usr/include /usr/include/libxml2 /usr/local/include "
250
ac_default_inc_searchpath="$ac_default_inc_searchpath /opt/include /opt/openssl/include "
251
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/lib/openssl/include /usr/include/mozilla*"
252
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/local/mozilla* /usr/local/mozilla*/include"
253
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/local/ssl/include /usr/local/include/openssl"
254
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/include/mozilla*/gtkembedmoz /usr/local/include/mozilla*/gtkembedmoz"
255
ac_default_inc_searchpath="$ac_default_inc_searchpath /opt/gnome/include/mozilla /opt/mozilla/include"
256
ac_default_inc_searchpath="$ac_default_inc_searchpath /usr/include/curl /usr/local/include/curl /opt/curl/include"
257
ac_default_inc_searchpath="$ac_default_inc_searchpath /sw/include/mozilla /usr/include/pcre /dist/include"
258

                
259
dnl --------------------
260
dnl OS specific settings
261
dnl --------------------
262

                
263
case "$host_os" in
264
        mingw32)
265
                CPPFLAGS="$CPPFLAGS -mms-bitfields"
266
                CFLAGS="$CFLAGS -DOS=\"\\\"Windows\\\"\""
267
                AC_CHECK_TOOL(WINDRES, windres, no)
268
                if test "$WINDRES" = no; then 
269
                        AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.]) 
270
                fi
271
                AM_CONDITIONAL(WIN32, true)
272
                AC_DEFINE(WIN32, 1, [Is this an Win32 platform])
273
                AM_CONDITIONAL(DARWIN, false);;
274
       cygwin)
275
                CFLAGS="$CFLAGS -DOS=\"\\\"Windows\\\"\""
276
                AC_CHECK_TOOL(WINDRES, windres, no)
277
                if test "$WINDRES" = no; then
278
                        AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
279
                fi
280
                AM_CONDITIONAL(WIN32, true)
281
                AC_DEFINE(WIN32, 1, [Is this an Win32 platform])
282
                AM_CONDITIONAL(DARWIN, false)
283
                LDFLAGS="$LDFLAGS -mwindows";;
284
        darwin*)
285
                CFLAGS="$CFLAGS -DOS=\"\\\"Mac_OS_X/X86\\\"\""
286
                CPPFLAGS="$CPPFLAGS -DDARWIN"
287
                AM_CONDITIONAL(WIN32, false)
288
                AM_CONDITIONAL(DARWIN, true);;
289
        *)
290
                CFLAGS="$CFLAGS -DOS=\"\\\"`uname -s`\\\"\""
291
                AM_CONDITIONAL(WIN32, false)
292
                AM_CONDITIONAL(DARWIN, false);;
293
esac
294

                
295
dnl ---------------------
296
dnl Mac OS X integration
297
dnl ---------------------
298
if test "$host_os" = "darwin9" -o "$host_os" = "darwin10.2.0" ; then
299
  if [ "$gui" = "true" ]; then
300
    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])])
301
  fi
302

                
303
  # Mac OS X doesn't like 'EXPORTS' mentioned in the .def files..strip them out
304
  grep -v EXPORTS plugins/nntpgrab_plugin.def > tmp
305
  unlink plugins/nntpgrab_plugin.def
306
  mv tmp plugins/nntpgrab_plugin.def
307

                
308
  grep -v EXPORTS base/nntpgrab_utils.def > tmp
309
  unlink base/nntpgrab_utils.def
310
  mv tmp base/nntpgrab_utils.def
311

                
312
  grep -v EXPORTS nntpgrab_core/nntpgrab.def > tmp
313
  unlink nntpgrab_core/nntpgrab.def
314
  mv tmp nntpgrab_core/nntpgrab.def
315

                
316
  grep -v EXPORTS automation/nntpgrab_automation.def > tmp
317
  unlink automation/nntpgrab_automation.def
318
  mv tmp automation/nntpgrab_automation.def
319

                
320
  grep -v EXPORTS glue/nntpgrab_glue.def > tmp
321
  unlink glue/nntpgrab_glue.def
322
  mv tmp glue/nntpgrab_glue.def
323

                
324
  grep -v EXPORTS gui_base/nntpgrab_gui_base.def > tmp
325
  unlink gui_base/nntpgrab_gui_base.def
326
  mv tmp gui_base/nntpgrab_gui_base.def
327
fi
328

                
329
AC_SUBST(MAC_INTEGRATION_CFLAGS)
330
AC_SUBST(MAC_INTEGRATION_LIBS)
331

                
332
dnl ---
333
dnl PCRE is only necessary when GLib 2.14.0 or higher is not found
334
dnl ---
335
AC_MSG_CHECKING(if GLIB >= 2.14.0)
336
pkg-config --atleast-version=2.14.0 glib-2.0
337
if test `echo $?` = 0; then
338
  AC_MSG_RESULT([yes])
339
else
340
  AC_MSG_RESULT([no])
341
  AC_FIND_LIB2(pcre, $ac_default_lib_searchpath, pcre_libraries, [PCRE libraries.], [PCRE libraries could not be found])
342
  AC_FIND_HEADER2(pcre.h, $ac_default_inc_searchpath, pcre_headers, [PCRE headers.], [PCRE headers could not be found])
343
fi
344

                
345
if test "$have_soup" = "false" -a "$gui" = "true"; then
346
  dnl ---------------
347
  dnl libCURL support
348
  dnl ---------------
349
  AC_FIND_LIB2(curl, $ac_default_lib_searchpath, libcurl_libraries,
350
    [Curl library],
351
    [Curl library couldn't be found])
352

                
353
  AC_FIND_HEADER2(curl/curl.h, $ac_default_inc_searchpath, libcurl_headers,
354
    [Curl headers],
355
    [Curl headers could not be found],
356
     curl)
357
fi
358

                
359
AM_CONDITIONAL(HAVE_SSL, $ssl)
360
if test "$ssl" = "true" ; then
361
  PKG_CHECK_MODULES(NSS, nss, nss_found=true,[AC_MSG_RESULT([* NSS could not be found (is the package nss-devel installed?)])]; nss_found=false)
362
  if test "$nss_found" = "true" ; then
363
    AC_FIND_LIB(nss_compat_ossl, $ac_default_lib_searchpath, nss_compat_ossl_libraries,
364
      [nss_compat_ossl libraries],
365
      [nss_compat_ossl libraries could not be found])
366

                
367
    AC_FIND_HEADER(nss_compat_ossl/nss_compat_ossl.h, $ac_default_inc_searchpath, nss_compat_ossl_headers,
368
      [nss_compat_ossl headers],
369
      [nss_compat_oss header could not be found],
370
      nss_compat_ossl)
371
  fi
372

                
373
  if test     "$nss_found" = "true" -a \
374
      "$nss_compat_ossl_libraries_ok" = "true" -a \
375
      "$nss_compat_ossl_headers_ok" = "true" ; then
376
              have_nss_compat_ossl=true
377
              NSS_LIBS="$NSS_LIBS -lnss_compat_ossl"
378
  else
379
              have_nss_compat_ossl=false
380
              NSS_CFLAGS=""
381
              NSS_LIBS=""
382
  fi
383

                
384
  if test "$have_nss_compat_ossl" = "false" ; then
385
      AC_FIND_LIB2(ssl, $ac_default_lib_searchpath, openssl_libraries,
386
              [OpenSSL libraries],
387
              [OpenSSL library not found])
388
  
389
      AC_FIND_HEADER2(openssl/md5.h, $ac_default_inc_searchpath, openssl_headers,
390
              [OpenSSL headers],
391
              [OpenSSL headers could not be found])
392
  
393
      openssl_libraries_LIBS="$openssl_libraries_LIBS -lcrypto"
394
  fi
395
fi
396

                
397
AM_CONDITIONAL(HAVE_NSS_COMPAT_OSSL, test "$have_nss_compat_ossl" = "true")
398

                
399
AC_SUBST(PCRE_CFLAGS, $pcre_headers_CFLAGS)
400
AC_SUBST(PCRE_LIBS, $pcre_libraries_LIBS)
401
AC_SUBST(CURL_CFLAGS, $libcurl_headers_CFLAGS)
402
AC_SUBST(CURL_LIBS, $libcurl_libraries_LIBS)
403
AC_SUBST(NSS_CFLAGS)
404
AC_SUBST(NSS_LIBS)
405
AC_SUBST(OPENSSL_CFLAGS, $openssl_headers_CFLAGS)
406
AC_SUBST(OPENSSL_LIBS, $openssl_libraries_LIBS)
407

                
408
# gettext
409
AC_PROG_INTLTOOL([0.21], [no-xml])
410
AC_PATH_PROG(MSGFMT, msgfmt, msgfmt)
411

                
412
ALL_LINGUAS="nl fr"
413
AM_GLIB_GNU_GETTEXT
414

                
415
if test "x$WIN32_TRUE" = "x" ; then
416
    nntpgrablocaledir='../${DATADIRNAME}/locale'
417
else
418
    nntpgrablocaledir='${prefix}/${DATADIRNAME}/locale'
419
fi
420
AC_SUBST(nntpgrablocaledir)
421

                
422
AC_CHECK_FUNC(strptime,[ AC_DEFINE(HAVE_STRPTIME, 1, [strptime check]) AM_CONDITIONAL(HAVE_STRPTIME, true) ],[ AM_CONDITIONAL(HAVE_STRPTIME, false) ])
423
AC_CHECK_FUNC(backtrace_symbols, [AC_DEFINE(HAVE_BACKTRACE, 1, [backtrace_symbols check])])
424

                
425
dnl Checks for mkdtemp function
426

                
427
mkdtemp_missing=false
428
AC_CHECK_FUNC(mkdtemp,
429
    [AC_DEFINE([HAVE_MKDTEMP], 1, [Have GlibC function to make temp dirs])],
430
    mkdtemp_missing=true)
431
AM_CONDITIONAL(MKDTEMP_MISSING, test x$mkdtemp_missing = xtrue)
432

                
433
dnl Set PACKAGE SOURCE DIR in config.h.
434
packagesrcdir=`cd $srcdir && pwd`
435

                
436
dnl Set PACKAGE PREFIX
437
if test "x${prefix}" = "xNONE"; then
438
  packageprefix=${ac_default_prefix}
439
else
440
  packageprefix=${prefix}
441
fi
442

                
443
packagedatadir=share/${PACKAGE}
444
pkgdir=${packageprefix}/${packagedatadir}
445
plugindir=${libdir}/${PACKAGE}
446
wwwdir=${pkgdir}/web
447

                
448
AC_DEFINE_UNQUOTED(SHARE_DIR, "${pkgdir}", [Location of NNTPGrab icons])
449
AC_SUBST(PLUGINDIR, "${plugindir}")
450
AC_SUBST(WWWDIR, "${wwwdir}")
451
CPPFLAGS="$CPPFLAGS -DPLUGIN_DIR=\"\\\"\${PLUGINDIR}\\\"\" -DWWW_DIR=\"\\\"\${WWWDIR}\\\"\""
452

                
453
# -fstack-protector
454
AC_ARG_ENABLE([stack-protector],
455
    [AS_HELP_STRING([--disable-stack-protector],
456
        [Disable GCC's/libc's stack-smashing protection])],
457
    [case "${enableval}" in
458
         yes) enable_ssp=yes ;;
459
          no) enable_ssp=no ;;
460
           *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
461
     esac],
462
    [enable_ssp=yes])
463

                
464
if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
465
    AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
466
    enable_ssp=no
467
fi
468

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

                
475
    # Get -lssp if it exists
476
    GCC_STACK_PROTECT_LIB
477

                
478
    AC_MSG_CHECKING([whether stack-smashing protection is available])
479
    ssp_old_cflags="$CFLAGS"
480
    ssp_old_ldflags="$LDFLAGS"
481
    CFLAGS="$CFLAGS -fstack-protector-all -fPIC"
482
    LDFLAGS="$LDFLAGS -Wl,-z,defs"
483
    cat confdefs.h > conftest.c
484
    cat >>conftest.c <<_ACEOF
485
void test_broken_ssp(c)
486
    const char *c;
487
{
488
    char arr[[123]], *p; /* beware of possible double-braces if copying this */
489
    for (p = arr; *c; ++p) {
490
        *p = *c;
491
        ++c;
492
    }
493
}
494
_ACEOF
495
    rm -f conftest.o
496

                
497
    if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
498
        AC_MSG_RESULT([yes])
499
        AC_MSG_CHECKING([whether stack-smashing protection is buggy])
500
        if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
501
            AC_MSG_RESULT([no])
502
        else
503
            AC_MSG_RESULT([yes])
504
            enable_ssp=no
505
        fi
506
    else
507
        AC_MSG_RESULT([no])
508
    fi
509

                
510
    rm -f conftest.c conftest.o conftest.so
511

                
512
    CFLAGS="$ssp_old_cflags"
513
    LDFLAGS="$ssp_old_ldflags"
514
fi
515

                
516
if test x"$enable_ssp" = x"yes"; then
517
    # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
518
    GCC_STACK_PROTECT_CC
519

                
520
    AC_LANG_PUSH([C++])
521
    GCC_STACK_PROTECT_CXX
522
    AC_LANG_POP([C++])
523
    # XXX: Update the enable_ssp value now for output later?
524
fi
525

                
526
if test "$php_module" = "true" ; then
527
    AC_CONFIG_SUBDIRS(client/web/module)
528
fi
529

                
530
AC_OUTPUT([
531
Makefile
532
Doxyfile
533
po/Makefile.in
534
base/Makefile
535
base/nntpgrab_utils.pc
536
gui_base/Makefile
537
automation/Makefile
538
automation/nntpgrab_automation.pc
539
nntpgrab_core/Makefile
540
nntpgrab_core/nntpgrab.pc
541
glue/Makefile
542
glue/nntpgrab_glue.pc
543
server/Makefile
544
plugins/Makefile
545
plugins/antisleep/Makefile
546
plugins/auto_import/Makefile
547
plugins/decoder/Makefile
548
plugins/example/Makefile
549
plugins/jsonrpc/Makefile
550
plugins/logger/Makefile
551
plugins/networkmanager/Makefile
552
plugins/par2/Makefile
553
plugins/unpack/Makefile
554
client/Makefile
555
client/web/Makefile
556
client/gui/Makefile
557
tests/Makefile
558
])