1 dnl Process this file with autoconf to produce a configure script.
2 dnl $Id: configure.ac,v 1.25 2006/05/19 16:05:40 atterer Exp $
3 AC_INIT(src/jigdo-file.cc)
4 AC_CONFIG_HEADER(src/config.h)
5 dnl ______________________________________________________________________
7 dnl Version number of our program.
8 read tmpa tmpb JIGDO_VERSION < "$srcdir/jigdo.spec"
9 AC_DEFINE_UNQUOTED(JIGDO_VERSION, "$JIGDO_VERSION")
10 AC_SUBST(JIGDO_VERSION)
11 dnl ______________________________________________________________________
13 dnl installDevel is given 2 arguments: Name of "devel" package on
14 dnl Debian-based systems, name on RPM-based systems
15 if test -f "/etc/debian_version"; then
17 AC_MSG_RESULT([ * (Your system appears to be Debian-based; try])
18 AC_MSG_RESULT([ * installing the \`$1-dev' package.)])
20 elif test -x "/usr/bin/rpm" -o -x "/usr/local/bin/rpm"; then
22 AC_MSG_RESULT([ * (Your system appears to be RPM-based; try])
23 AC_MSG_RESULT([ * installing the package named \`$2-devel' or])
24 AC_MSG_RESULT([ * similar.)])
28 AC_MSG_RESULT([ * (If the software on your system is managed by a])
29 AC_MSG_RESULT([ * package manager like RPM, try installing the])
30 AC_MSG_RESULT([ * package named \`$2-devel' or similar.)])
33 dnl ______________________________________________________________________
35 dnl Checks for programs.
39 dnl Add -Wno-unused-parameter to CFLAGS if supported
40 dnl ORIG_CFLAGS="$CFLAGS"
41 dnl CFLAGS="$CFLAGS -Wno-unused-parameter" # GCC >=3.0
42 dnl AC_TRY_COMPILE(, int x = 0, , CFLAGS="$ORIG_CFLAGS")
45 CFLAGS=`echo "$CFLAGS" | sed 's/\(^\| \)-g\( \|$\)/ /'`
46 CXXFLAGS=`echo "$CXXFLAGS" | sed 's/\(^\| \)-g\( \|$\)/ /'`
49 if test "$GXX" = yes; then
50 AC_MSG_CHECKING(for GCC version)
51 gccver=`$CXX -dumpversion`
52 AC_MSG_RESULT($gccver);
57 3.0|3.0.*|3.1|3.1.*|3.3|3.3.*)
58 #AC_MSG_RESULT([ * Big file support may be broken in GCC 3.2 and])
59 #AC_MSG_RESULT([ * 3.3! If you compile jigdo on Linux (and maybe])
60 #AC_MSG_RESULT([ * other OSes), it might not be able to create])
61 #AC_MSG_RESULT([ * files bigger than 2 GB, such as DVD images.])
62 #AC_MSG_RESULT([ * (Try GCC 2.95 or GCC 3.4 or later)])
68 dnl ____________________
70 dnl Checks for typedefs, structures, and compiler characteristics.
73 AC_MSG_CHECKING(whether we are compiling for Windows)
74 AC_EGREP_CPP(poorsoul, [
75 #if defined WINNT || defined __WINNT || defined __WINNT__ || defined WIN32 \
76 || defined _WIN32 || defined __WIN32 || defined __WIN32__
78 #endif], is_windows=yes, is_windows=no)
79 AC_MSG_RESULT($is_windows)
80 if test "$is_windows" = yes; then
95 if test "$is_windows" = "yes"; then
96 if test "$ac_cv_prog_cc_g" = "yes"; then
97 CFLAGS="$CFLAGS -mms-bitfields -march=pentium"
99 if test "$ac_cv_prog_cxx_g" = "yes"; then
100 CXXFLAGS="$CXXFLAGS -mms-bitfields -march=pentium"
103 dnl ____________________
105 AC_CACHE_CHECK(whether the C++ compiler is recent enough,
106 jigdo_cv_prog_cxx_recent,
111 template<typename T = double> struct X {
112 template<class U> void function(T* t, U* u);
114 template<> struct X<void> { void function(void* t, int* u); };
116 void B::X<void>::function(void*, int*) { }
117 },, jigdo_cv_prog_cxx_recent="yes", jigdo_cv_prog_cxx_recent="no")
119 if test "$jigdo_cv_prog_cxx_recent" = "no"; then
120 AC_MSG_RESULT([ * Your compiler failed to recognize some advanced C++])
121 AC_MSG_RESULT([ * constructs - it might be too old to compile jigdo.])
122 AC_MSG_RESULT([ * In case compilation fails, try upgrading to a newer])
123 AC_MSG_RESULT([ * compiler, e.g. GCC 2.95 or later.])
126 dnl ________________________________________
128 dnl C99-style vararg macros are not supported by GCC 2.95
129 AC_CACHE_CHECK([whether the C++ preprocessor supports variable-arg macros],
130 jigdo_cv_prog_cxx_varmacro,
132 #if defined(__GNUC__) && __GNUC__ < 3
133 # define debug(_args...) do { } while (false)
135 # define debug(...) do { } while (false)
138 int debug = 0; // No substitution!
142 },, jigdo_cv_prog_cxx_varmacro="yes", jigdo_cv_prog_cxx_varmacro="no")
144 if test "$jigdo_cv_prog_cxx_varmacro" = "yes"; then
145 AC_DEFINE(HAVE_VARMACRO, 1)
147 AC_DEFINE(HAVE_VARMACRO, 0)
149 dnl ________________________________________
152 dnl AC_CACHE_CHECK([whether C++ supports accessing files larger than 4 GB],
153 dnl jigdo_cv_prog_cxx_lfs,
154 dnl AC_TRY_COMPILE([#include <fstream>],
155 dnl [using namespace std; ifstream i; i.seekg(0x100000000, ios::beg);],
156 dnl jigdo_cv_prog_cxx_lfs="yes", jigdo_cv_prog_cxx_lfs="no")
158 dnl if test "$jigdo_cv_prog_cxx_lfs" = "no"; then
159 dnl AC_MSG_RESULT([ * There is a problem accessing large files.])
160 dnl AC_MSG_RESULT([ * jigdo may be unable to work with DVD-sized images.])
162 dnl ________________________________________
164 AC_CHECK_PROG(have_wget, wget, yes, no)
165 if test "$have_wget" = "no"; then
166 AC_MSG_RESULT([ * wget was not found on your system. Please install])
167 AC_MSG_RESULT([ * it, it is needed by jigdo-lite.])
169 dnl ________________________________________
171 AC_MSG_CHECKING(for value of --enable-debug)
173 [ --enable-debug Compile in lots of additional debugging code],
174 jigdo_debug=$enableval, jigdo_debug=no)
175 AC_MSG_RESULT(\"$jigdo_debug\")
176 if test "$jigdo_debug" = "yes"; then
180 if test "$ac_cv_prog_cc_g" = "yes"; then CFLAGS="$CFLAGS -g"; fi
181 if test "$ac_cv_prog_cxx_g" = "yes"; then CXXFLAGS="$CXXFLAGS -g"; fi
182 elif test "$jigdo_debug" != "no"; then
183 AC_MSG_ERROR(Invalid argument to --enable-debug option)
190 AC_SUBST(IFNOT_DEBUG)
192 AC_MSG_CHECKING(for value of --with-pkg-config-prefix)
193 AC_ARG_WITH(pkg-config-prefix,
194 [ --with-pkg-config-prefix=PATH When cross-compiling, specify prefix of
195 libraries/headers for target architecture [none]],
196 jigdo_pkg_config_prefix="$withval", jigdo_pkg_config_prefix="")
197 if test "$jigdo_pkg_config_prefix" = ""; then
198 AC_MSG_RESULT(not set)
199 jigdo_pkg_config_switch=""
201 AC_MSG_RESULT(\"$jigdo_pkg_config_prefix\")
202 if test "$GXX" = "yes"; then
203 CFLAGS="$CFLAGS -I$jigdo_pkg_config_prefix/include -L$jigdo_pkg_config_prefix/lib"
204 CXXFLAGS="$CXXFLAGS -I$jigdo_pkg_config_prefix/include -L$jigdo_pkg_config_prefix/lib"
205 CPPFLAGS="$CPPFLAGS -I$jigdo_pkg_config_prefix/include"
206 LDFLAGS="$LDFLAGS -L$jigdo_pkg_config_prefix/lib"
208 export PKG_CONFIG_PATH="$jigdo_pkg_config_prefix/lib/pkgconfig"
209 jigdo_pkg_config_prefix="--define-variable=prefix=$jigdo_pkg_config_prefix"
213 dnl CPPUNITCFLAGS='# `cppunit-config --cflags`'
214 dnl CPPUNITLIBS='# `cppunit-config --libs`'
216 dnl AC_CHECK_PROG(have_cppunit_config, cppunit-config, yes, no)
217 dnl if test "$have_cppunit_config" = "yes"; then
218 dnl CPPUNITCFLAGS="`cppunit-config --cflags`"
219 dnl CPPUNITLIBS="`cppunit-config --libs`"
220 dnl ORIG_LIBS="$LIBS"
221 dnl LIBS="$LIBS $CPPUNITCFLAGS $CPPUNITLIBS"
222 dnl AC_CACHE_CHECK([whether cppunit works],
223 dnl jigdo_cv_prog_cppunit,
225 dnl [ #include <cppunit/extensions/TestFactoryRegistry.h>
226 dnl #include <cppunit/ui/text/TestRunner.h>
227 dnl #include <cppunit/CompilerOutputter.h>
228 dnl using namespace CppUnit; ],
229 dnl [ TextUi::TestRunner runner;
230 dnl TestFactoryRegistry& registry =
231 dnl TestFactoryRegistry::getRegistry();
232 dnl runner.addTest(registry.makeTest());
233 dnl runner.run("", false); ],
234 dnl jigdo_cv_prog_cppunit="yes", jigdo_cv_prog_cppunit="no"
237 dnl LIBS="$ORIG_LIBS"
238 dnl if test "$jigdo_cv_prog_cppunit" = "yes"; then
241 dnl AC_MSG_RESULT([ * cppunit does not work - disabled.])
243 dnl elif test "$jigdo_debug" = "yes"; then
244 dnl AC_MSG_RESULT([ * cppunit was not found on your system. Please])
245 dnl AC_MSG_RESULT([ * install it if you want to run the unit tests.])
247 dnl AC_SUBST(IF_CPPUNIT)
248 dnl AC_SUBST(CPPUNITCFLAGS)
249 dnl AC_SUBST(CPPUNITLIBS)
250 dnl ______________________________________________________________________
252 dnl Checks for header files.
254 AC_CHECK_HEADERS(stddef.h unistd.h limits.h string.h)
256 dnl Checks for libraries and accompanying header files
258 AC_CHECK_LIB(z, zlibVersion, have_zlib="-lz", have_zlib="no")
259 if test "$is_windows" = yes; then
260 AC_CHECK_LIB(zdll, zlibVersion, have_zlib="-lzdll", )
262 AC_CHECK_HEADER(zlib.h, have_zlib_h="yes", have_zlib_h="no")
263 if test "$have_zlib" = "no" -o "$have_zlib_h" = "no"; then
264 AC_MSG_RESULT([ * Please install zlib, it is needed by all of the])
265 AC_MSG_RESULT([ * programs.])
266 installDevel "zlib1g" "zlib"
268 if test "$have_zlib" != "no"; then LIBS="$have_zlib $LIBS"; fi
271 AC_CHECK_LIB(bz2, BZ2_bzCompressInit, have_bzlib="-lbz2", have_bzlib="no")
272 if test "$is_windows" = yes; then
273 dnl For some reason, can't check for BZ2_bzCompressInit without #include <bzlib.h>
274 AC_CHECK_LIB(bz2, main, have_bzlib="-lbz2", )
275 AC_CHECK_LIB(bz2.dll, main, have_bzlib="-lbz2.dll", )
277 AC_CHECK_HEADER(bzlib.h, have_bzlib_h="yes", have_bzlib_h="no")
278 if test "$have_bzlib" = "no" -o "$have_bzlib_h" = "no"; then
279 AC_MSG_RESULT([ * Please install libbz2, it is needed by all of the])
280 AC_MSG_RESULT([ * programs.])
281 installDevel "libbz2" "libbz2"
283 if test "$have_bzlib" != "no"; then LIBS="$have_bzlib $LIBS"; fi
286 AC_MSG_CHECKING(for value of --with-libdb)
288 [ --without-libdb Don't use libdb (it's necessary for jigdo-file's cache)], #'
289 jigdo_libdb="$withval", jigdo_libdb="yes")
290 AC_MSG_RESULT(\"$jigdo_libdb\")
291 if test "$jigdo_libdb" = "yes"; then
292 AC_CHECK_HEADER(db.h, have_db_h="yes", have_db_h="no")
293 AC_MSG_CHECKING(for libdb version in db.h)
294 printf "#include <db.h>\nDB_VERSION_MAJOR DB_VERSION_MINOR\n" >conftest.c
295 set x `eval $ac_cpp conftest.c | egrep '^ *[[0-9]] *'`; v="$2"; vv="$3"
296 AC_MSG_RESULT($v.$vv)
297 if test "$v" -ne 3 -a "$v" -ne 4; then
298 AC_MSG_RESULT([ * Warning: jigdo is only known to work with libdb])
299 AC_MSG_RESULT([ * version 3 or 4 - maybe you should up/downgrade.])
300 installDevel "libdb4.2" "libdb4"
302 for db in "db-$v.$vv" "db$v.$vv" "db-$v" "db$v" "db"; do
303 # Doesn't work: db.h does a "#define db_create db_create_4002"
304 # AC_CHECK_LIB($db, db_create, have_libdb="$db", have_libdb="no")
305 AC_MSG_CHECKING(for db_create in lib$db)
308 AC_TRY_LINK([#include <db.h>], db_create(0, 0, 0),
309 have_libdb="yes", have_libdb="no")
310 AC_MSG_RESULT($have_libdb)
311 if test "$have_libdb" != "no"; then break; fi
314 if test "$have_libdb" = "no" -o "$have_db_h" = "no"; then
315 AC_MSG_RESULT([ * libdb not found - either install it, or use])
316 AC_MSG_RESULT([ * \`configure --without-libdb' to disable the db])
317 AC_MSG_RESULT([ * file cache of jigdo-file. If this check should not])
318 AC_MSG_RESULT([ * have failed, force e.g. -ldb to be used with])
319 AC_MSG_RESULT([ * \`configure --with-libdb=-ldb'])
320 installDevel "libdb4" "libdb4"
321 AC_MSG_ERROR(libdb not found.)
323 AC_DEFINE(HAVE_LIBDB, 1) dnl make compilation fail if libdb not there
324 elif test "$jigdo_libdb" != "no" -a "$jigdo_libdb" != "NO"; then
325 dnl Pass argument (e.g. "-ldb") to compiler
326 LIBS="$jigdo_libdb $LIBS"
327 AC_DEFINE(HAVE_LIBDB, 1)
329 AC_DEFINE(HAVE_LIBDB, 0)
331 dnl ________________________________________
333 AC_MSG_CHECKING(for value of --with-gui)
335 [ --with-gui Build the jigdo GTK+ GUI application [auto]],
336 jigdo_gui="$withval", jigdo_gui="auto")
337 AC_MSG_RESULT(\"$jigdo_gui\")
338 dnl ____________________
340 if test "$jigdo_gui" = "auto"; then
343 AC_MSG_RESULT([ * Disabling the build of the jigdo GUI application.])
344 AC_MSG_RESULT([ * Use --with-gui=yes to force an attempt to build it.])
348 jigdo_gui_failed() { return; }
351 if test "$jigdo_gui" = "yes"; then
352 AC_CHECK_PROG(PKGCONFIG, pkg-config, yes, no)
353 if test "$PKGCONFIG" = "no"; then
354 AC_MSG_RESULT([ * GTK+ not installed, or pkg-config not in])
355 AC_MSG_RESULT([ * \$PATH. Please install GTK+ 2.])
356 installDevel "libgtk2.0" "libgtk2.0"
360 GTKCFLAGS="# GUI application disabled by configure script"
362 GLIBLIBS="$GTKCFLAGS"
363 dnl LIBWWWCFLAGS="$GTKCFLAGS"
364 dnl LIBWWWLIBS="$GTKCFLAGS"
365 CURLCFLAGS="$GTKCFLAGS"
366 CURLLIBS="$GTKCFLAGS"
367 dnl The following adds flags for GTK+ and glib
368 if test "$jigdo_gui" = "yes"; then
369 AC_MSG_CHECKING(for GTK+ 2.4.0 or later)
370 gtk_ver="`pkg-config $jigdo_pkg_config_prefix gtk+-2.0 --modversion`"
371 AC_MSG_RESULT($gtk_ver)
372 if pkg-config gtk+-2.0 --atleast-version=2.4.0; then true; else
373 AC_MSG_RESULT([ * Installed version of GTK+ is too old])
376 if test "$is_windows" = yes; then gth="gthread-2.0"; else gth=""; fi
377 dnl gth="gthread-2.0"
378 GTKCFLAGS="`pkg-config $jigdo_pkg_config_prefix gtk+-2.0 $gth --cflags 2>/dev/null`"
379 GTKLIBS="`pkg-config $jigdo_pkg_config_prefix gtk+-2.0 $gth --libs 2>/dev/null`"
380 GLIBLIBS="`pkg-config $jigdo_pkg_config_prefix glib-2.0 $gth --libs 2>/dev/null`"
382 dnl ____________________
384 AC_MSG_CHECKING(for value of --with-libcurl)
386 [ --with-libcurl=-lcurl Use given -l switch instead of trying to
387 determine the right one],
388 jigdo_libcurl="$withval", jigdo_libcurl="auto")
389 AC_MSG_RESULT(\"$jigdo_libcurl\")
390 if test "$jigdo_libcurl" = "auto" \
391 || test "$jigdo_libcurl" = "yes" \
392 || test "$jigdo_libcurl" = "no"; then
396 dnl The following adds flags for libcurl
397 if test "$jigdo_gui" = "yes"; then
398 if test "$is_windows" = "no"; then
399 AC_MSG_CHECKING(for libcurl 7.11.0 or later)
400 set x `curl-config --version 2>&1`
402 case "$1" in [[0-9]*]) ;; *) shift;; esac
404 AC_MSG_RESULT($jigdo_curlver)
405 case "$jigdo_curlver" in
406 [[1-9][0-9].*|[8-9].*|7.1[1-9]*|7.[2-9][0-9]*])
407 CURLCFLAGS="`curl-config --cflags 2>/dev/null`"
408 CURLLIBS="`curl-config --libs 2>/dev/null`"
409 if test -n "$jigdo_libcurl"; then CURLLIBS="$jigdo_libcurl"; fi
412 AC_MSG_RESULT([ * libcurl not installed, or the installed version])
413 AC_MSG_RESULT([ * is too old, or curl-config is not in \$PATH.])
414 AC_MSG_RESULT([ * Please install libcurl 7.11.0 or later, it is])
415 AC_MSG_RESULT([ * needed by the jigdo GUI application.])
416 installDevel "libcurl2" "libcurl2"
419 dnl On Windows, no curl-config is supplied
420 if test -n "$jigdo_libcurl"; then
421 have_libcurl="$jigdo_libcurl"
423 dnl Just -lcurl will attempt static linking. You will need to specify
424 dnl "make X=-DCURL_STATICLIB" for this to work
425 dnl Will try SSL/non-SSL curl
426 AC_CHECK_LIB(curl, curl_global_init, have_libcurl="-lcurl", have_libcurl="no", -lwinmm -lws2_32)
427 AC_CHECK_LIB(curl , curl_global_init, have_libcurl="-lcurl", , -lcurl -lssl -lcrypto -lwinmm -lws2_32)
428 dnl This will pick up DLLs to link against
429 AC_CHECK_LIB(libcurl, curl_global_init, have_libcurl="-llibcurl",)
430 AC_CHECK_LIB(curldll, curl_global_init, have_libcurl="-lcurldll",)
432 AC_CHECK_HEADER(curl/curl.h, have_curl_h="yes", have_curl_h="no")
433 if test "$have_libcurl" = "no" -o "$have_curl_h" = "no"; then
434 AC_MSG_RESULT([ * Please install libcurl 7.11.0 or later, it is])
435 AC_MSG_RESULT([ * needed by the jigdo GUI application.])
438 CURLLIBS="$have_libcurl"
443 if test "$jigdo_gui" = "yes"; then IF_GUI=""; else IF_GUI="#"; fi
448 dnl AC_SUBST(LIBWWWCFLAGS)
449 dnl AC_SUBST(LIBWWWLIBS)
452 dnl ____________________
454 if test "$jigdo_gui" = "yes" && test ! -e "$srcdir/src/gtk/interface.hh"; then
455 AC_CHECK_PROG(have_glade, glade-2, yes, no)
456 if test "$have_glade" = "no"; then
457 AC_MSG_RESULT([ * glade-2 was not found on your system. Please install])
458 AC_MSG_RESULT([ * it, it is needed to compile the jigdo GUI (actually,])
459 AC_MSG_RESULT([ * to create the file src/gtk/interface.hh)])
462 dnl ____________________
464 AC_MSG_CHECKING(for value of --with-uint64)
466 [ --with-uint64=TYPE Specify unsigned type of at least 64 bits [auto]
467 (Replace spaces with underscores in TYPE)],
468 jigdo_uint64="$withval", jigdo_uint64="auto")
469 AC_MSG_RESULT(\"$jigdo_uint64\")
471 AC_CACHE_CHECK(for unsigned long long, jigdo_cv_have_ulonglong,
472 AC_TRY_COMPILE(, unsigned long long x = 0,
473 jigdo_cv_have_ulonglong=yes, jigdo_cv_have_ulonglong=no))
474 if test "$jigdo_cv_have_ulonglong" = "yes"; then
475 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1)
477 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 0)
480 if test "$jigdo_uint64" = auto; then
481 AC_CHECK_SIZEOF(unsigned long, 0)
482 AC_CHECK_SIZEOF(unsigned long long, 0)
483 if test "$ac_cv_sizeof_unsigned_long" -ge 8; then
484 jigdo_uint64='unsigned long'
485 elif test "$ac_cv_sizeof_unsigned_long_long" -ge 8; then
486 jigdo_uint64='unsigned long long'
488 #if test "$jigdo_cv_have_ulonglong" = "yes"; then
489 jigdo_uint64='unsigned long long'
491 # jigdo_uint64='unsigned long'
493 AC_MSG_RESULT([ * Could not find an unsigned type with at least 64])
494 AC_MSG_RESULT([ * bits (or maybe char has >8 bits?) - defaulting to])
495 AC_MSG_RESULT([ * \`$jigdo_uint64'. You may want to override])
496 AC_MSG_RESULT([ * this using --with-uint64=TYPE])
498 elif test "$jigdo_uint64" = yes -o "$jigdo_uint64" = no; then
499 AC_MSG_ERROR(Invalid argument to --with-uint64 option)
501 jigdo_uint64=`echo $jigdo_uint64 | sed -e 's/_/ /g'`
503 AC_MSG_CHECKING(for 64 bit unsigned integer type)
504 AC_MSG_RESULT($jigdo_uint64)
505 AC_DEFINE_UNQUOTED(TYPE_UINT64, $jigdo_uint64)
507 AC_CACHE_CHECK(for operator<<(uint64),
508 jigdo_cv_prog_cxx_outuint64,
510 [ #include <iostream>
512 using namespace std; ],
514 cout << x << endl; ],
515 jigdo_cv_prog_cxx_outuint64="yes", jigdo_cv_prog_cxx_outuint64="no")
517 if test "$jigdo_cv_prog_cxx_outuint64" = "yes"; then
518 AC_DEFINE(HAVE_OUTUINT64, 1)
520 AC_DEFINE(HAVE_OUTUINT64, 0)
523 AC_CACHE_CHECK([for string::compare(size_t,size_t,string,size_t,size_t)],
524 jigdo_cv_prog_cxx_stringcmp,
528 using namespace std; ],
530 s.compare(0, std::string::npos, t, 0, std::string::npos); ],
531 jigdo_cv_prog_cxx_stringcmp="yes", jigdo_cv_prog_cxx_stringcmp="no")
533 if test "$jigdo_cv_prog_cxx_stringcmp" = "yes"; then
534 AC_DEFINE(HAVE_STRINGCMP, 1)
536 AC_DEFINE(HAVE_STRINGCMP, 0)
538 AC_CACHE_CHECK([for string::compare(size_t,size_t,const char*,size_t)],
539 jigdo_cv_prog_cxx_stringstrcmp,
543 using namespace std; ],
544 [ string s; const char* t = "x";
545 s.compare(0, std::string::npos, t, 1); ],
546 jigdo_cv_prog_cxx_stringstrcmp="yes", jigdo_cv_prog_cxx_stringstrcmp="no")
548 if test "$jigdo_cv_prog_cxx_stringstrcmp" = "yes"; then
549 AC_DEFINE(HAVE_STRINGSTRCMP, 1)
551 AC_DEFINE(HAVE_STRINGSTRCMP, 0)
553 dnl ____________________
555 dnl Checks for library functions.
556 AC_CHECK_FUNCS(lstat truncate ftruncate mmap memcpy fileno snprintf \
559 dnl Check whether reading width of TTY via ioctl() works
560 AC_CACHE_CHECK([for TIOCGWINSZ ioctl],
561 jigdo_cv_ioctl_winsz,
563 [ #include <termio.h>
566 #include <sys/ioctl.h>],
567 [ struct winsize w; int i;
568 ioctl(fileno(stdout), TIOCGWINSZ, &w);
570 jigdo_cv_ioctl_winsz="yes", jigdo_cv_ioctl_winsz="no")
572 if test "$jigdo_cv_ioctl_winsz" = "yes"; then
573 AC_DEFINE(HAVE_IOCTL_WINSZ, 1)
574 elif test "$is_windows" = "no"; then
575 AC_MSG_RESULT([ * jigdo-file progress reports will not be formatted])
576 AC_MSG_RESULT([ * nicely, because no way has been found to determine])
577 AC_MSG_RESULT([ * the screen width in characters.])
578 AC_DEFINE(HAVE_IOCTL_WINSZ, 0)
580 AC_DEFINE(HAVE_IOCTL_WINSZ, 0)
583 dnl Check whether getopt_long is present
584 AC_CACHE_CHECK([for getopt_long in <getopt.h>],
585 jigdo_cv_func_getopt_long,
587 [ #include <getopt.h> ],
588 [[ static const struct option longopts[] = { { 0, 0, 0, 0 } };
589 int c = getopt_long(0, 0, "", longopts, 0); ]],
590 jigdo_cv_func_getopt_long="yes", jigdo_cv_func_getopt_long="no"
593 if test "$jigdo_cv_func_getopt_long" = "yes"; then
594 AC_DEFINE(HAVE_GETOPT_LONG, 1)
596 AC_DEFINE(HAVE_GETOPT_LONG, 0)
599 dnl Check whether uname() is present
600 AC_CACHE_CHECK([for uname in <sys/utsname.h>],
603 [ #include <sys/utsname.h> ],
604 [ struct utsname ubuf; uname(&ubuf); ],
605 jigdo_cv_func_uname="yes", jigdo_cv_func_uname="no"
608 if test "$jigdo_cv_func_uname" = "yes"; then
609 AC_DEFINE(HAVE_UNAME, 1)
611 AC_DEFINE(HAVE_UNAME, 0)
614 dnl On native Windows (MinGW32), there is no snprintf, just _snprintf
615 if test "$ac_cv_func_snprintf" = no -a "$ac_cv_func__snprintf" = "yes"; then
616 AC_DEFINE(snprintf, _snprintf)
618 dnl On native Windows, must use _stati64 for big file support
619 AC_CACHE_CHECK(for _stati64, jigdo_cv_func__stati64,
620 AC_TRY_COMPILE([ #include <sys/types.h>
621 #include <sys/stat.h>],
622 [ struct __stati64 buf;
623 int x = _stati64("file", &buf);],
624 jigdo_cv_func__stati64=yes, jigdo_cv_func__stati64=no))
625 if test "$is_windows" = "yes" -a "$ac_cv_func__stati64" = "yes"; then
626 AC_DEFINE(stat, _stati64)
628 dnl ______________________________________________________________________
630 dnl Check for Native Language Support (gettext)
631 AC_MSG_CHECKING(for value of --enable-nls)
633 [ --disable-nls Disable multi-language support],
634 USE_NLS=$enableval, USE_NLS=yes)
635 AC_MSG_RESULT(\"$USE_NLS\")
638 if test "$USE_NLS" = "yes"; then
640 AC_MSG_CHECKING(for dgettext in <libintl.h> and libc)
641 AC_TRY_LINK([#include <libintl.h>], dgettext(0, 0),
642 have_intl="yes", have_intl="no");
643 AC_MSG_RESULT($have_intl)
644 if test "$have_intl" = "no"; then
646 AC_MSG_CHECKING(for dgettext in <libintl.h> and -lintl)
647 AC_TRY_LINK([#include <libintl.h>], dgettext(0, 0),
648 have_intl="yes", have_intl="no");
649 AC_MSG_RESULT($have_intl)
651 if test "$have_intl" = "no"; then
652 AC_MSG_RESULT([ * Disabling gettext support - jigdo will not be])
653 AC_MSG_RESULT([ * able to display translated status/error])
654 AC_MSG_RESULT([ * messages instead of the default English ones.])
659 if test "$USE_NLS" = "yes"; then
660 AC_DEFINE(ENABLE_NLS, 1)
662 AC_MSG_CHECKING(for catalogs to be installed)
663 ALL_LINGUAS=`(cd "$srcdir/po" && echo *.po *.pox "") \
664 | sed -e "s/\**\.pox* / /g"`
665 if test "$LINGUAS"; then
667 for provided in $ALL_LINGUAS; do
669 for wanted in $LINGUAS; do
670 case "$provided" in "$wanted"*) x=" $provided";; esac
671 case "$wanted" in "$provided"*) x=" $provided";; esac
673 NEW_LINGUAS="$NEW_LINGUAS$x"
675 LINGUAS="$NEW_LINGUAS"
676 AC_MSG_RESULT(LINGUAS:$LINGUAS)
678 LINGUAS="$ALL_LINGUAS"
679 AC_MSG_RESULT($LINGUAS)
681 for x in $LINGUAS; do CATALOGS="$CATALOGS $x.gmo"; done
683 AC_DEFINE(ENABLE_NLS, 0)
686 dnl ______________________________________________________________________
688 dnl Checks for other --enable-xxx, --with-xxx switches
690 dnl AC_MSG_CHECKING(for value of --enable-libwww-hacks)
691 dnl AC_ARG_ENABLE(libwww-hacks,
692 dnl [ --disable-libwww-hacks Don't compile fixed versions of some libwww
693 dnl code (Try this if you see link errors/crashes)],
694 dnl jigdo_libwww_hacks=$enableval, jigdo_libwww_hacks=yes)
695 dnl AC_MSG_RESULT(\"$jigdo_libwww_hacks\")
696 dnl if test "$jigdo_libwww_hacks" = yes; then
697 dnl IF_LIBWWW_HACKS="" # enable hacks
698 dnl elif test "$jigdo_libwww_hacks" != no; then
699 dnl AC_MSG_ERROR(Invalid argument to --enable-libwww-hacks option)
701 dnl IF_LIBWWW_HACKS="#" # disable hacks, by commenting out Makefile line
703 dnl AC_SUBST(IF_LIBWWW_HACKS)
704 dnl ______________________________________________________________________
706 dnl Do this at end in order not to influence other compile tests which
707 dnl might return warnings. Turning the warnings into errors would make
709 dnl if test "$jigdo_debug" = "yes"; then
710 dnl #if test "$GCC" = yes; then CFLAGS="$CFLAGS -Werror"; fi
711 dnl if test "$GXX" = yes; then CXXFLAGS="$CXXFLAGS -Werror"; fi
713 if test "$GXX" = "yes"; then
714 CFLAGS="-Wall $CFLAGS -W"
715 CXXFLAGS="$CXXFLAGS -Wall -W -Wpointer-arith -Wconversion -Woverloaded-virtual"
717 dnl ______________________________________________________________________
719 if test "$cross_compiling" = yes; then
721 IFNOT_CROSSCOMPILING="#"
723 IF_CROSSCOMPILING="#"
724 IFNOT_CROSSCOMPILING=""
726 AC_SUBST(IF_CROSSCOMPILING)
727 AC_SUBST(IFNOT_CROSSCOMPILING)
728 dnl ______________________________________________________________________
730 dnl Touch TAGS to prevent it from being recreated when a normal user
731 dnl builds the program. TAGS should only be updated once changes are
732 dnl made to the source.
733 touch "$srcdir/src/TAGS"
735 SUBDIRS="glibcurl gtk job net util"
736 SRC_MAKEDEPS="$srcdir/src/Makedeps"
737 dnl When bootstrapping from CVS, we need to make sure that correct
738 dnl dependencies cause gtk/interface.hh to be created
739 if test -e "$SRC_MAKEDEPS"; then true; else
740 AC_MSG_RESULT(Creating $SRC_MAKEDEPS)
741 touch "$SRC_MAKEDEPS"
742 echo >"$srcdir/src/gtk/interface.hh"
744 find . -type f '(' -name '*.cc' -o -name '*.c' ')' \
745 | xargs "$ac_cv_prog_AWK" -f ../scripts/depend.awk "$srcdir" $SUBDIRS -
747 rm -f "$SRC_MAKEDEPS.bak" "$srcdir/src/gtk/interface.hh"
749 AC_SUBST_FILE(SRC_MAKEDEPS)
751 dnl Create subdirs in src directory
752 for dir in "" $SUBDIRS; do
753 test ! -d "src/$dir" && mkdir "src/$dir"
755 AC_OUTPUT(Makefile doc/Makefile src/Makefile po/Makefile)