1 dnl Process this file with autoconf to produce a configure script.
2 dnl $Id: configure.ac,v 1.23 2005/07/09 22:21:33 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 GTKCFLAGS="`pkg-config $jigdo_pkg_config_prefix gtk+-2.0 $gth --cflags 2>/dev/null`"
378 GTKLIBS="`pkg-config $jigdo_pkg_config_prefix gtk+-2.0 $gth --libs 2>/dev/null`"
379 GLIBLIBS="`pkg-config $jigdo_pkg_config_prefix glib-2.0 $gth --libs 2>/dev/null`"
381 dnl ____________________
383 dnl The following adds flags for libcurl
384 dnl On Windows, no curl-config is supplied
385 if test "$jigdo_gui" = "yes"; then
386 if test "$is_windows" = "no"; then
387 AC_MSG_CHECKING(for libcurl 7.11.0 or later)
388 set x `curl-config --version 2>&1`
390 case "$1" in [[0-9]*]) ;; *) shift;; esac
392 AC_MSG_RESULT($jigdo_curlver)
393 case "$jigdo_curlver" in
394 [[1-9][0-9].*|[8-9].*|7.1[1-9]*|7.[2-9][0-9]*])
395 CURLCFLAGS="`curl-config --cflags 2>/dev/null`"
396 CURLLIBS="`curl-config --libs 2>/dev/null`"
399 AC_MSG_RESULT([ * libcurl not installed, or the installed version])
400 AC_MSG_RESULT([ * is too old, or curl-config is not in \$PATH.])
401 AC_MSG_RESULT([ * Please install libcurl 7.11.0 or later, it is])
402 AC_MSG_RESULT([ * needed by the jigdo GUI application.])
403 installDevel "libcurl2" "libcurl2"
406 AC_CHECK_LIB(curl, curl_global_init, have_libcurl="-lcurl", have_libcurl="no")
407 AC_CHECK_LIB(curldll, curl_global_init, have_libcurl="-lcurldll", )
408 AC_CHECK_LIB(libcurl, curl_global_init, have_libcurl="-llibcurl", )
409 AC_CHECK_HEADER(curl/curl.h, have_curl_h="yes", have_curl_h="no")
410 if test "$have_libcurl" = "no" -o "$have_curl_h" = "no"; then
411 AC_MSG_RESULT([ * Please install libcurl 7.11.0 or later, it is])
412 AC_MSG_RESULT([ * needed by the jigdo GUI application.])
415 CURLLIBS="$have_libcurl"
420 if test "$jigdo_gui" = "yes"; then IF_GUI=""; else IF_GUI="#"; fi
425 dnl AC_SUBST(LIBWWWCFLAGS)
426 dnl AC_SUBST(LIBWWWLIBS)
429 dnl ____________________
431 if test "$jigdo_gui" = "yes" && test ! -e "$srcdir/src/gtk/interface.hh"; then
432 AC_CHECK_PROG(have_glade, glade-2, yes, no)
433 if test "$have_glade" = "no"; then
434 AC_MSG_RESULT([ * glade-2 was not found on your system. Please install])
435 AC_MSG_RESULT([ * it, it is needed to compile the jigdo GUI (actually,])
436 AC_MSG_RESULT([ * to create the file src/gtk/interface.hh)])
439 dnl ____________________
441 AC_MSG_CHECKING(for value of --with-uint64)
443 [ --with-uint64=TYPE Specify unsigned type of at least 64 bits [auto]
444 (Replace spaces with underscores in TYPE)],
445 jigdo_uint64="$withval", jigdo_uint64="auto")
446 AC_MSG_RESULT(\"$jigdo_uint64\")
448 AC_CACHE_CHECK(for unsigned long long, jigdo_cv_have_ulonglong,
449 AC_TRY_COMPILE(, unsigned long long x = 0,
450 jigdo_cv_have_ulonglong=yes, jigdo_cv_have_ulonglong=no))
451 if test "$jigdo_cv_have_ulonglong" = "yes"; then
452 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1)
454 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 0)
457 if test "$jigdo_uint64" = auto; then
458 AC_CHECK_SIZEOF(unsigned long, 0)
459 AC_CHECK_SIZEOF(unsigned long long, 0)
460 if test "$ac_cv_sizeof_unsigned_long" -ge 8; then
461 jigdo_uint64='unsigned long'
462 elif test "$ac_cv_sizeof_unsigned_long_long" -ge 8; then
463 jigdo_uint64='unsigned long long'
465 #if test "$jigdo_cv_have_ulonglong" = "yes"; then
466 jigdo_uint64='unsigned long long'
468 # jigdo_uint64='unsigned long'
470 AC_MSG_RESULT([ * Could not find an unsigned type with at least 64])
471 AC_MSG_RESULT([ * bits (or maybe char has >8 bits?) - defaulting to])
472 AC_MSG_RESULT([ * \`$jigdo_uint64'. You may want to override])
473 AC_MSG_RESULT([ * this using --with-uint64=TYPE])
475 elif test "$jigdo_uint64" = yes -o "$jigdo_uint64" = no; then
476 AC_MSG_ERROR(Invalid argument to --with-uint64 option)
478 jigdo_uint64=`echo $jigdo_uint64 | sed -e 's/_/ /g'`
480 AC_MSG_CHECKING(for 64 bit unsigned integer type)
481 AC_MSG_RESULT($jigdo_uint64)
482 AC_DEFINE_UNQUOTED(TYPE_UINT64, $jigdo_uint64)
484 AC_CACHE_CHECK(for operator<<(uint64),
485 jigdo_cv_prog_cxx_outuint64,
487 [ #include <iostream>
489 using namespace std; ],
491 cout << x << endl; ],
492 jigdo_cv_prog_cxx_outuint64="yes", jigdo_cv_prog_cxx_outuint64="no")
494 if test "$jigdo_cv_prog_cxx_outuint64" = "yes"; then
495 AC_DEFINE(HAVE_OUTUINT64, 1)
497 AC_DEFINE(HAVE_OUTUINT64, 0)
500 AC_CACHE_CHECK([for string::compare(size_t,size_t,string,size_t,size_t)],
501 jigdo_cv_prog_cxx_stringcmp,
505 using namespace std; ],
507 s.compare(0, std::string::npos, t, 0, std::string::npos); ],
508 jigdo_cv_prog_cxx_stringcmp="yes", jigdo_cv_prog_cxx_stringcmp="no")
510 if test "$jigdo_cv_prog_cxx_stringcmp" = "yes"; then
511 AC_DEFINE(HAVE_STRINGCMP, 1)
513 AC_DEFINE(HAVE_STRINGCMP, 0)
515 AC_CACHE_CHECK([for string::compare(size_t,size_t,const char*,size_t)],
516 jigdo_cv_prog_cxx_stringstrcmp,
520 using namespace std; ],
521 [ string s; const char* t = "x";
522 s.compare(0, std::string::npos, t, 1); ],
523 jigdo_cv_prog_cxx_stringstrcmp="yes", jigdo_cv_prog_cxx_stringstrcmp="no")
525 if test "$jigdo_cv_prog_cxx_stringstrcmp" = "yes"; then
526 AC_DEFINE(HAVE_STRINGSTRCMP, 1)
528 AC_DEFINE(HAVE_STRINGSTRCMP, 0)
530 dnl ____________________
532 dnl Checks for library functions.
533 AC_CHECK_FUNCS(lstat truncate ftruncate mmap memcpy fileno snprintf \
536 dnl Check whether reading width of TTY via ioctl() works
537 AC_CACHE_CHECK([for TIOCGWINSZ ioctl],
538 jigdo_cv_ioctl_winsz,
541 #include <sys/ioctl.h>],
542 [ struct winsize w; int i;
543 ioctl(fileno(stdout), TIOCGWINSZ, &w);
545 jigdo_cv_ioctl_winsz="yes", jigdo_cv_ioctl_winsz="no")
547 if test "$jigdo_cv_ioctl_winsz" = "yes"; then
548 AC_DEFINE(HAVE_IOCTL_WINSZ, 1)
549 elif test "$is_windows" = "no"; then
550 AC_MSG_RESULT([ * jigdo-file progress reports will not be formatted])
551 AC_MSG_RESULT([ * nicely, because no way has been found to determine])
552 AC_MSG_RESULT([ * the screen width in characters.])
553 AC_DEFINE(HAVE_IOCTL_WINSZ, 0)
555 AC_DEFINE(HAVE_IOCTL_WINSZ, 0)
558 dnl Check whether getopt_long is present
559 AC_CACHE_CHECK([for getopt_long in <getopt.h>],
560 jigdo_cv_func_getopt_long,
562 [ #include <getopt.h> ],
563 [[ static const struct option longopts[] = { { 0, 0, 0, 0 } };
564 int c = getopt_long(0, 0, "", longopts, 0); ]],
565 jigdo_cv_func_getopt_long="yes", jigdo_cv_func_getopt_long="no"
568 if test "$jigdo_cv_func_getopt_long" = "yes"; then
569 AC_DEFINE(HAVE_GETOPT_LONG, 1)
571 AC_DEFINE(HAVE_GETOPT_LONG, 0)
574 dnl Check whether uname() is present
575 AC_CACHE_CHECK([for uname in <sys/utsname.h>],
578 [ #include <sys/utsname.h> ],
579 [ struct utsname ubuf; uname(&ubuf); ],
580 jigdo_cv_func_uname="yes", jigdo_cv_func_uname="no"
583 if test "$jigdo_cv_func_uname" = "yes"; then
584 AC_DEFINE(HAVE_UNAME, 1)
586 AC_DEFINE(HAVE_UNAME, 0)
589 dnl On native Windows (MinGW32), there is no snprintf, just _snprintf
590 if test "$ac_cv_func_snprintf" = no -a "$ac_cv_func__snprintf" = "yes"; then
591 AC_DEFINE(snprintf, _snprintf)
593 dnl On native Windows, must use _stati64 for big file support
594 AC_CACHE_CHECK(for _stati64, jigdo_cv_func__stati64,
595 AC_TRY_COMPILE([ #include <sys/types.h>
596 #include <sys/stat.h>],
597 [ struct __stati64 buf;
598 int x = _stati64("file", &buf);],
599 jigdo_cv_func__stati64=yes, jigdo_cv_func__stati64=no))
600 if test "$is_windows" = "yes" -a "$ac_cv_func__stati64" = "yes"; then
601 AC_DEFINE(stat, _stati64)
603 dnl ______________________________________________________________________
605 dnl Check for Native Language Support (gettext)
606 AC_MSG_CHECKING(for value of --enable-nls)
608 [ --disable-nls Disable multi-language support],
609 USE_NLS=$enableval, USE_NLS=yes)
610 AC_MSG_RESULT(\"$USE_NLS\")
613 if test "$USE_NLS" = "yes"; then
615 AC_MSG_CHECKING(for dgettext in <libintl.h> and libc)
616 AC_TRY_LINK([#include <libintl.h>], dgettext(0, 0),
617 have_intl="yes", have_intl="no");
618 AC_MSG_RESULT($have_intl)
619 if test "$have_intl" = "no"; then
621 AC_MSG_CHECKING(for dgettext in <libintl.h> and -lintl)
622 AC_TRY_LINK([#include <libintl.h>], dgettext(0, 0),
623 have_intl="yes", have_intl="no");
624 AC_MSG_RESULT($have_intl)
626 if test "$have_intl" = "no"; then
627 AC_MSG_RESULT([ * Disabling gettext support - jigdo will not be])
628 AC_MSG_RESULT([ * able to display translated status/error])
629 AC_MSG_RESULT([ * messages instead of the default English ones.])
634 if test "$USE_NLS" = "yes"; then
635 AC_DEFINE(ENABLE_NLS, 1)
637 AC_MSG_CHECKING(for catalogs to be installed)
638 ALL_LINGUAS=`(cd "$srcdir/po" && echo *.po *.pox "") \
639 | sed -e "s/\**\.pox* / /g"`
640 if test "$LINGUAS"; then
642 for provided in $ALL_LINGUAS; do
644 for wanted in $LINGUAS; do
645 case "$provided" in "$wanted"*) x=" $provided";; esac
646 case "$wanted" in "$provided"*) x=" $provided";; esac
648 NEW_LINGUAS="$NEW_LINGUAS$x"
650 LINGUAS="$NEW_LINGUAS"
651 AC_MSG_RESULT(LINGUAS:$LINGUAS)
653 LINGUAS="$ALL_LINGUAS"
654 AC_MSG_RESULT($LINGUAS)
656 for x in $LINGUAS; do CATALOGS="$CATALOGS $x.gmo"; done
658 AC_DEFINE(ENABLE_NLS, 0)
661 dnl ______________________________________________________________________
663 dnl Checks for other --enable-xxx, --with-xxx switches
665 dnl AC_MSG_CHECKING(for value of --enable-libwww-hacks)
666 dnl AC_ARG_ENABLE(libwww-hacks,
667 dnl [ --disable-libwww-hacks Don't compile fixed versions of some libwww
668 dnl code (Try this if you see link errors/crashes)],
669 dnl jigdo_libwww_hacks=$enableval, jigdo_libwww_hacks=yes)
670 dnl AC_MSG_RESULT(\"$jigdo_libwww_hacks\")
671 dnl if test "$jigdo_libwww_hacks" = yes; then
672 dnl IF_LIBWWW_HACKS="" # enable hacks
673 dnl elif test "$jigdo_libwww_hacks" != no; then
674 dnl AC_MSG_ERROR(Invalid argument to --enable-libwww-hacks option)
676 dnl IF_LIBWWW_HACKS="#" # disable hacks, by commenting out Makefile line
678 dnl AC_SUBST(IF_LIBWWW_HACKS)
679 dnl ______________________________________________________________________
681 dnl Do this at end in order not to influence other compile tests which
682 dnl might return warnings. Turning the warnings into errors would make
684 dnl if test "$jigdo_debug" = "yes"; then
685 dnl #if test "$GCC" = yes; then CFLAGS="$CFLAGS -Werror"; fi
686 dnl if test "$GXX" = yes; then CXXFLAGS="$CXXFLAGS -Werror"; fi
688 if test "$GXX" = "yes"; then
689 CFLAGS="-Wall $CFLAGS -W"
690 CXXFLAGS="$CXXFLAGS -Wall -W -Wpointer-arith -Wconversion -Woverloaded-virtual"
692 dnl ______________________________________________________________________
694 if test "$cross_compiling" = yes; then
696 IFNOT_CROSSCOMPILING="#"
698 IF_CROSSCOMPILING="#"
699 IFNOT_CROSSCOMPILING=""
701 AC_SUBST(IF_CROSSCOMPILING)
702 AC_SUBST(IFNOT_CROSSCOMPILING)
703 dnl ______________________________________________________________________
705 dnl Touch TAGS to prevent it from being recreated when a normal user
706 dnl builds the program. TAGS should only be updated once changes are
707 dnl made to the source.
708 touch "$srcdir/src/TAGS"
710 SUBDIRS="glibcurl gtk job net util"
711 SRC_MAKEDEPS="$srcdir/src/Makedeps"
712 dnl When bootstrapping from CVS, we need to make sure that correct
713 dnl dependencies cause gtk/interface.hh to be created
714 if test -e "$SRC_MAKEDEPS"; then true; else
715 AC_MSG_RESULT(Creating $SRC_MAKEDEPS)
716 touch "$SRC_MAKEDEPS"
717 echo >"$srcdir/src/gtk/interface.hh"
719 find . -type f '(' -name '*.cc' -o -name '*.c' ')' \
720 | xargs "$ac_cv_prog_AWK" -f ../scripts/depend.awk "$srcdir" $SUBDIRS -
722 rm -f "$SRC_MAKEDEPS.bak" "$srcdir/src/gtk/interface.hh"
724 AC_SUBST_FILE(SRC_MAKEDEPS)
726 dnl Create subdirs in src directory
727 for dir in "" $SUBDIRS; do
728 test ! -d "src/$dir" && mkdir "src/$dir"
730 AC_OUTPUT(Makefile doc/Makefile src/Makefile po/Makefile)