path_to_top -> top_builddir
[elinks/images.git] / configure.in
blobc0931fa7eafe9039ab6c941d1299c79dad8b6313
1 dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.13)
4 AC_INIT(src/main/main.c)
5 AC_CONFIG_AUX_DIR(config)
7 PACKAGE=elinks
8 VERSION=0.11.GIT
9 AC_SUBST(PACKAGE)
10 AC_SUBST(VERSION)
11 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
12 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
13 AC_CONFIG_HEADERS(config.h)
15 AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
16 AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
17 AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
19 AC_PROG_MAKE_SET
21 builddir="`pwd`"
23 dnl ===================================================================
24 dnl Load feature configuration file and start logging features.
25 dnl ===================================================================
27 features="features.conf"
28 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
29 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
30 echo "Feature summary:" > features.log
32 dnl ===================================================================
33 dnl Checks for programs.
34 dnl ===================================================================
36 AC_PROG_CC
37 AC_PROG_AWK
38 AC_PATH_PROGS(AWK, "$AWK")
39 AC_PROG_RANLIB
40 AC_PROG_INSTALL
42 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
44 CONFIG_ASCIIDOC="no"
45 CONFIG_POD2HTML="no"
46 CONFIG_XMLTO="no"
47 CONFIG_JW="no"
49 if test "x$CONFIG_DOC" != xno; then
50         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
51         if test "x$ASCIIDOC" != "x"; then
52                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
53                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
54                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
55         fi
57         AC_PATH_PROGS(XMLTO, "xmlto")
58         if test "x$XMLTO" != "x"; then
59                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
60                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
61                 EL_CONFIG(MAN_XMLTO, [man (groff)])
62         fi
64         AC_PATH_PROGS(JW, "jw")
65         if test "x$JW" != "x"; then
66                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
67                 EL_CONFIG(MANUAL_JW, [PDF])
68         fi
70         AC_PATH_PROGS(POD2HTML, "pod2html")
71         if test "x$POD2HTML" != "x"; then
72                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
73         fi
76 AC_SUBST(CONFIG_ASCIIDOC)
77 AC_SUBST(CONFIG_POD2HTML)
78 AC_SUBST(CONFIG_XMLTO)
79 AC_SUBST(CONFIG_JW)
81 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation])
83 if test "$CONFIG_ASCIIDOC" = yes &&
84    test "$CONFIG_XMLTO" = yes &&
85    test "$CONFIG_JW" = yes; then
86         EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
89 if test "$CONFIG_ASCIIDOC" = yes &&
90    test "$CONFIG_XMLTO" = yes; then
91         EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
94 AC_SUBST(CONFIG_ASCIIDOC)
95 AC_SUBST(CONFIG_POD2HTML)
96 AC_SUBST(CONFIG_XMLTO)
97 AC_SUBST(CONFIG_JW)
99 dnl gcc specific options (to be continued at the bottom of configure)
100 if test "x$ac_cv_prog_gcc" = "xyes"; then
101   dnl We want to see all warnings and live with none.
102   dnl We can't set up -Werror here as there may be some warnings in test
103   dnl suite of configure, and we don't want to fail them.
104   CFLAGS="$CFLAGS -Wall"
107 dnl ===================================================================
108 dnl Checks for special OSes.
109 dnl ===================================================================
111 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
112 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
114         AC_MSG_CHECKING([for $2])
116         for flag in $3; do
117                 AC_TRY_COMPILE(, [#ifndef $flag
118 kill me!
119 #endif ], $1=yes, $1=no)
120                 if test "[$]$1" = yes; then
121                         EL_CONFIG([$1], [$2])
122                         break
123                 fi
124         done
126         AC_MSG_RESULT([$]$1)
129 EL_CHECK_COMPILER_MACROS(CONFIG_BEOS, [BEOS], [__BEOS__])
130 AC_SUBST(CONFIG_BEOS)
132 EL_CHECK_COMPILER_MACROS(CONFIG_RISCOS, [RISCOS], [__riscos__])
133 AC_SUBST(CONFIG_RISCOS)
135 EL_CHECK_COMPILER_MACROS(CONFIG_WIN32, [WIN32], [_WIN32 __WIN32__])
136 AC_SUBST(CONFIG_WIN32)
138 EL_CHECK_COMPILER_MACROS(CONFIG_OS2, [EMX], [__EMX__])
139 AC_SUBST(CONFIG_OS2)
140 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
142 AC_MSG_CHECKING([for UNIX])
143 dnl FIXME: some depend kind of mechanism
144 if test "$CONFIG_BEOS" = no && \
145    test "$CONFIG_RISCOS" = no && \
146    test "$CONFIG_WIN32" = no && \
147    test "$CONFIG_OS2" = no; then
148         EL_CONFIG(CONFIG_UNIX, [UNIX])
149 else
150         CONFIG_UNIX=no
152 AC_MSG_RESULT($CONFIG_UNIX)
153 AC_SUBST(CONFIG_UNIX)
155 dnl ===================================================================
156 dnl Checks for header files.
157 dnl ===================================================================
159 AC_HEADER_DIRENT
160 AC_HEADER_STDC
161 AC_HEADER_SYS_WAIT
162 AC_HEADER_TIME
164 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
165 AC_CHECK_HEADERS(sigaction.h)
166 AC_CHECK_HEADERS(arpa/inet.h)
167 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
168 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
169 AC_CHECK_HEADERS(ifaddrs.h)
170 AC_CHECK_HEADERS(sys/cygwin.h io.h)
171 AC_CHECK_HEADERS(sys/fmutex.h)
172 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
173 AC_CHECK_HEADERS(sys/resource.h)
174 AC_CHECK_HEADERS(sys/select.h)
175 AC_CHECK_HEADERS(sys/signal.h)
176 AC_CHECK_HEADERS(sys/socket.h)
177 AC_CHECK_HEADERS(sys/time.h)
178 AC_CHECK_HEADERS(sys/utsname.h)
179 AC_CHECK_HEADERS(stdint.h inttypes.h)
180 AC_CHECK_HEADERS(locale.h pwd.h)
181 AC_CHECK_HEADERS(termios.h)
184 AC_CHECK_HEADERS(sys/un.h,
185         [CONFIG_INTERLINK=yes
186          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
187         [CONFIG_INTERLINK=no])
188 AC_SUBST(CONFIG_INTERLINK)
190 dnl ===================================================================
191 dnl Checks for typedefs, structures, and compiler characteristics.
192 dnl ===================================================================
194 AC_STRUCT_TM
195 AC_C_CONST
196 AC_C_INLINE
197 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
199 AC_SYS_LARGEFILE
200 AC_TYPE_SIZE_T
201 AC_TYPE_OFF_T
202 EL_CHECK_TYPE(ssize_t, int)
203 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
204 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
205 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
206 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
208 AC_CHECK_SIZEOF(char, 1)
209 AC_CHECK_SIZEOF(short, 2)
210 AC_CHECK_SIZEOF(int, 4)
211 AC_CHECK_SIZEOF(long, 4)
212 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
214 dnl Check for variadic macros
215 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
216                 [#include <stdio.h>
217                  #define a(b,c...) printf(b,##c)],
218                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
220 dnl Check for -rdynamic
221 dnl FIXME: This check doesn't work. Something to do with the compiler
222 dnl happily ignoring it and stderr not being checked for error messages.
223 AC_MSG_CHECKING([for -rdynamic])
224 LDFLAGS_X="$LDFLAGS"
225 LDFLAGS="$LDFLAGS -rdynamic"
226 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
227 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
228 AC_MSG_RESULT($have_rdynamic)
230 dnl ===================================================================
231 dnl Check for POSIX <regex.h>
232 dnl ===================================================================
234 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
236 dnl ===================================================================
237 dnl Checks for library functions.
238 dnl ===================================================================
240 AC_PROG_GCC_TRADITIONAL
241 AC_FUNC_MEMCMP
242 AC_FUNC_MMAP
243 AC_FUNC_STRFTIME
244 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
245 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
246 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
247 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
248 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
249 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
250 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
251 AC_CHECK_FUNCS(gettimeofday clock_gettime)
253 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
255 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
256 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
257 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
259 dnl These aren't probably needed now, as they are commented in links.h.
260 dnl I've no idea about their historical background, but I keep them here
261 dnl just in the case they will help later. --pasky
262 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
263 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
264 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
265 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
267 if test x"$HAVE_RAISE" = x; then
268         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
269                 AC_ERROR([Unable to emulate raise()])
270         fi
273 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
274 AC_TRY_LINK([#include <stdarg.h>
275 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
276 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
277 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
278         EL_DEFINE(HAVE_VA_COPY, __va_copy)
281 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
282 AC_TRY_LINK([#include <unistd.h>
283 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
284 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
285 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
286         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
289 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
290 AC_TRY_RUN([
291 #include <stdio.h>
292 #include <stdarg.h>
293 #include <stdlib.h>
294 #include <string.h>
296 char buf[8];
298 int bar(char *buf, const char *format, va_list ap)
300        return vsnprintf(buf, 0, format, ap);
303 void foo(const char *format, ...) {
304        va_list ap;
305        int len;
307        va_start(ap, format);
308        len = bar(buf, format, ap);
309        va_end(ap);
310        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
312        va_start(ap, format);
313        len = bar(buf, format, ap);
314        va_end(ap);
315        if ((len != 6) && (len != 7)) exit(1);
317        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
319        exit(0);
321 main() { foo("hello\n"); }
323 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
324 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
325         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
328 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
330 dnl ===================================================================
331 dnl Checks for libraries.
332 dnl ===================================================================
334 dnl Replace `main' with a function in -lsocket:
335 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
336 if test "$cf_result" = no; then
337         AC_CHECK_LIB(socket, socket)
340 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
341 if test "$cf_result" = no; then
342         AC_CHECK_LIB(socket, setsockopt)
345 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
346 if test "$cf_result" = no; then
347         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
348         if test "$cf_result" = no; then
349                 AC_CHECK_LIB(nsl, gethostbyname)
350         else
351                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
352         fi
355 dnl ===================================================================
356 dnl Checks for packaging specific options.
357 dnl ===================================================================
359 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
360             [ if test "$withval" != no && test "$withval" != yes; then
361                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
362               fi ])
364 dnl ===================================================================
365 dnl Checks for a libraries, optional even if installed.
366 dnl ===================================================================
368 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
369 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
371         AC_MSG_CHECKING([for $2 support])
373         if test "[$]$1" != no; then
374                 AC_MSG_RESULT(yes)
375                 EL_SAVE_FLAGS
376                 if test -n "$withval" && test -d "$withval"; then
377                         CFLAGS="$CFLAGS -I$withval/include";
378                         CPPFLAGS="$CPPFLAGS -I$withval/include";
379                         LDFLAGS="$LDFLAGS -L$withval/lib";
380                 fi
382                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
383                 if test "[$]$1" = yes; then
384                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
385                 fi
387                 if test "[$]$1" = yes; then
388                         EL_CONFIG([$1], [$2])
389                         LIBS="$LIBS -l$4"
390                 else
391                         if test -n "[$]WITHVAL_$1" &&
392                            test "[$]WITHVAL_$1" != xno; then
393                                 AC_MSG_ERROR([$2 not found])
394                         fi
395                         EL_RESTORE_FLAGS
396                 fi
397         else
398                 AC_MSG_RESULT(disabled)
399         fi
402 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
403 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
405         $1=yes
406         WITHVAL_$1=
408         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
409         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
411         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
413         EL_LOG_CONFIG([$1], [$2], [])
416 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
417         [  --without-gpm           disable gpm (mouse) support])
419 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
420         [  --without-zlib          disable zlib support])
422 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
423         [  --without-bzlib         disable bzlib support])
425 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
426         [  --without-idn           disable international domain names support])
428 dnl ===================================================================
429 dnl Bookmark and XBEL support
430 dnl ===================================================================
432 EL_SAVE_FLAGS
434 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
435               [  --disable-bookmarks     disable bookmark support])
437 # Check whether --enable-xbel or --disable-xbel was given.
438 if test "x${enable_xbel}" != xno; then
439         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
441         if test "$HAVE_LIBEXPAT" = yes; then
442                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
443                 if test "$HAVE_LIBEXPAT" = yes; then
444                         LIBS="$LIBS -lexpat"
445                 fi
446         fi
450 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
451               [XBEL bookmarks],
452               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
454 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
455         EL_RESTORE_FLAGS
458 dnl ===================================================================
459 dnl Checks for BSD sysmouse
460 dnl ===================================================================
462 HAVE_SYSMOUSE_HEADER="no"
464 # Either of these header files provides the (same) sysmouse interface
465 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
467 dnl ===================================================================
468 dnl Checks for OS/2
469 dnl ===================================================================
471 if test "$CONFIG_OS2" = yes; then
472         EL_CONFIG_OS2
475 dnl ===================================================================
476 dnl Checks for Win32
477 dnl ===================================================================
479 if test "$CONFIG_WIN32" = yes; then
480         EL_CONFIG_WIN32
483 dnl ===================================================================
484 dnl Check for Guile, optional even if installed.
485 dnl ===================================================================
487 enable_guile="no";
489 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
490             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
492 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
493 # GUILE_FLAGS but I really don't want to require people to have Guile in order
494 # to compile CVS. Also, the macro seems to be really stupid regarding searching
495 # for Guile in $PATH etc. --pasky
497 AC_MSG_CHECKING([for Guile])
499 if test "$enable_guile" = "yes"; then
500         AC_MSG_RESULT(yes);
501         ## Based on the GUILE_FLAGS macro.
503         if test -d "$withval"; then
504                 GUILE_PATH="$withval:$PATH"
505         else
506                 GUILE_PATH="$PATH"
507         fi
509         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
511         ## First, let's just see if we can find Guile at all.
512         if test "$GUILE_CONFIG" != no; then
513                 cf_result="yes";
515                 GUILE_LIBS="`guile-config link`"
516                 GUILE_CFLAGS="`guile-config compile`"
517                 LIBS="$GUILE_LIBS $LIBS"
518                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
519                 EL_CONFIG(CONFIG_GUILE, [Guile])
520                 AC_SUBST(GUILE_CFLAGS)
521                 cat <<EOF
522 ***********************************************************************
523 The Guile support is incomplete and not so well integrated to ELinks
524 yet. That means, ie., that you have no Guile console and there might
525 not be all the necessary hooks. Also, the Guile interface is not too
526 well tested (success stories heartily welcomed!).  See
527 src/scripting/guile/README for further details and hints.
528 ***********************************************************************
530         else
531                 if test -n "$withval" && test "x$withval" != xno; then
532                         AC_MSG_ERROR([Guile not found])
533                 else
534                         AC_MSG_WARN([Guile support disabled])
535                 fi
536         fi
537 else
538         AC_MSG_RESULT(no);
541 dnl ===================================================================
542 dnl Check for Perl
543 dnl ===================================================================
544 enable_perl="no";
546 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
547             [
548 if test "$withval" = yes; then
549         # FIXME: If withval is a valid directory append it to PATH
550         # so that you can specify one of several perl installations.
551         withval="";
552         enable_perl=yes;
554             ])
556 AC_MSG_CHECKING([for Perl])
558 cf_result=no
560 EL_SAVE_FLAGS
562 if test "$enable_perl" = "yes"; then
563         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
564         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
565         LIBS="$PERL_LIBS $LIBS"
566         CFLAGS="$PERL_CFLAGS $CFLAGS"
567         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
568         AC_TRY_LINK([
569 #include <EXTERN.h>
570 #include <perl.h>
571 #include <perlapi.h>
573                     [PerlInterpreter *my_perl = perl_alloc();],
574                     cf_result=yes, cf_result=no)
577 if test "$cf_result" != "yes"; then
578         EL_RESTORE_FLAGS
579 else
580         EL_CONFIG(CONFIG_PERL, [Perl])
582         CFLAGS="$CFLAGS_X"
583         AC_SUBST(PERL_LIBS)
584         AC_SUBST(PERL_CFLAGS)
587 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
588 dnl ===================================================================
589 dnl Check for Python
590 dnl ===================================================================
591 enable_python="no";
593 AC_ARG_WITH(python, [  --with-python           enable Python support],
594             [
595 if test "$withval" = yes; then
596         # FIXME: If withval is a valid directory append it to PATH
597         # so that you can specify one of several Python installations.
598         withval="";
599         enable_python=yes;
600         cat <<EOF
601 ***********************************************************************
602 The Python support is incomplete and not so well integrated to ELinks
603 yet. That means, ie., that you have no Python console and there might
604 not be all the necessary hooks. Also, the Python interface is not too
605 well tested (success stories heartily welcomed!).
606 ***********************************************************************
609             ])
611 AC_MSG_CHECKING([for Python])
613 cf_result=no
615 EL_SAVE_FLAGS
617 if test "$enable_python" = "yes"; then
618         PYTHON_LIBS="-lpython"
619         PYTHON_CFLAGS="-I`python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
620         LIBS="$PYTHON_LIBS $LIBS"
621         CFLAGS="$PYTHON_CFLAGS $CFLAGS"
622         CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
623         AC_TRY_LINK([
624 #include <Python.h>
626                     [Py_Initialize();],
627                     cf_result=yes, cf_result=no)
630 if test "$cf_result" != "yes"; then
631         EL_RESTORE_FLAGS
632 else
633         EL_CONFIG(CONFIG_PYTHON, [Python])
635         CFLAGS="$CFLAGS_X"
636         AC_SUBST(PYTHON_LIBS)
637         AC_SUBST(PYTHON_CFLAGS)
640 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
643 dnl ===================================================================
644 dnl Check for Lua, optional even if installed.
645 dnl ===================================================================
647 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
648 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
650 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
651             [if test "$withval" = no; then disable_lua=yes; fi])
652 AC_MSG_CHECKING([for Lua])
654 EL_SAVE_FLAGS
655 cf_result=no
657 if test -z "$disable_lua"; then
658         if test ! -d "$withval"; then
659                 withval="";
660         fi
661         for luadir in "$withval" "" /usr /usr/local; do
662                 for suffix in "" 50 51; do
663                         if test "$cf_result" = no; then
664                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
666                                 if test ! -z "$luadir"; then
667                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
668                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
669                                 fi
671                                 LIBS="$LUA_LIBS $LIBS_X"
672                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
673                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
675                                 # Check that it is a compatible Lua version
676                                 AC_TRY_LINK([   #include <lua.h>
677                                                 #include <lualib.h>],
678                                             [   lua_State *L = lua_open();
679                                                 lua_baselibopen(L);
680                                                 lua_mathlibopen(L);
681                                                 lua_strlibopen(L);
682                                                 lua_tablibopen(L);
683                                                 lua_pushboolean(L, 1);
684                                                 lua_close(L);],
685                                             cf_result=yes, cf_result=no)
686                         fi
687                 done
688         done
691 AC_MSG_RESULT($cf_result)
693 if test "$cf_result" != yes; then
694         EL_RESTORE_FLAGS
695 else
696         EL_CONFIG(CONFIG_LUA, [Lua])
697         AC_CHECK_HEADERS(lauxlib.h)
699         CFLAGS="$CFLAGS_X"
700         AC_SUBST(LUA_LIBS)
701         AC_SUBST(LUA_CFLAGS)
705 dnl ===================================================================
706 dnl Check for Ruby, optional even if installed.
707 dnl ===================================================================
709 EL_CONFIG_RUBY
711 dnl ===================================================================
712 dnl Setup global scripting
713 dnl ===================================================================
715 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY], [Scripting])
716 AC_SUBST(CONFIG_GUILE)
717 AC_SUBST(CONFIG_LUA)
718 AC_SUBST(CONFIG_PERL)
719 AC_SUBST(CONFIG_PYTHON)
720 AC_SUBST(CONFIG_RUBY)
721 AC_SUBST(CONFIG_SCRIPTING)
724 dnl ===================================================================
725 dnl Check for SpiderMonkey, optional even if installed.
726 dnl ===================================================================
728 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
729             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
730 AC_MSG_CHECKING([for SpiderMonkey])
732 EL_SAVE_FLAGS
733 cf_result=no
735 if test -z "$disable_spidermonkey"; then
736         if test ! -d "$withval"; then
737                 withval="";
738         fi
739         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
740                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
741                         for spidermonkeylib in js smjs; do
742                                 if test "$cf_result" = no; then
743                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
745                                         if test ! -z "$spidermonkeydir"; then
746                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
747                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
748                                         fi
750                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
751                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
752                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
754                                         AC_TRY_LINK([#define XP_UNIX
755                                                      #include <jsapi.h>],
756                                                      [JS_GetImplementationVersion()],
757                                                      cf_result=yes, cf_result=no)
758                                 fi
759                         done
760                 done
761         done
764 AC_MSG_RESULT($cf_result)
766 if test "$cf_result" != yes; then
767         EL_RESTORE_FLAGS
768 else
769         EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
771         CFLAGS="$CFLAGS_X"
772         AC_SUBST(SPIDERMONKEY_LIBS)
773         AC_SUBST(SPIDERMONKEY_CFLAGS)
776 AC_SUBST(CONFIG_SPIDERMONKEY)
778 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
781 dnl ===================================================================
782 dnl Check for SSL support.
783 dnl ===================================================================
785 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
786 dnl is enabled, we won't try to use OpenSSL anymore.
788 dnl For wiping SSL hooks..
789 #ifdef CONFIG_SSL
791 disable_openssl=""
792 disable_gnutls=""
793 enable_gnutls=""
795 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
796             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
797 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
798             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
799 gnutls_withval="$withval"
801 if test "$enable_gnutls" = yes; then
802         disable_openssl=yes;
805 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
806             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
807 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
808 openssl_withval="$withval"
810 dnl ---- OpenSSL
812 AC_MSG_CHECKING([for OpenSSL])
814 EL_SAVE_FLAGS
815 cf_result="no"
817 if test "$disable_openssl" = yes; then
818         cf_result="not used"
819 else
820         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
821                          /usr/lib/openssl /usr/local/ssl \
822                          /usr/local/www /usr/lib/ssl /usr/local \
823                          /usr/pkg /opt /opt/openssl; do
824                 if test "$cf_result" = no; then
825                         if test -d "$ssldir"; then
826                                 OPENSSL_CFLAGS="-I$ssldir/include"
827                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
828                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
829                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
830 #                               # FIXME: This created serious portability problems. --pasky
831 #                               if test "$CC" == "gcc"; then
832 #                                       # I'm not sure about compatibility here. --pasky
833 #                                       LIBS="$LIBS -R$ssldir/lib"
834 #                               fi
835                         else
836                                 LIBS="-lssl -lcrypto $LIBS_X"
837                         fi
838                         AC_TRY_LINK([#include <openssl/ssl.h>],
839                                     [OpenSSL_add_all_algorithms()],
840                                     cf_result=yes, cf_result=no)
841                         if test "$cf_result" != yes; then
842                                 AC_TRY_LINK([#include <openssl/ssl.h>],
843                                             [SSLeay_add_ssl_algorithms()],
844                                             cf_result=yes, cf_result=no)
845                         fi
846                 fi
847         done
849         if test "$cf_result" != yes; then
850                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
851                         AC_MSG_ERROR([OpenSSL not found])
852                 fi
853                 EL_RESTORE_FLAGS
854         else
855                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
857                 CFLAGS="$CFLAGS_X"
858                 AC_SUBST(OPENSSL_CFLAGS)
859         fi
862 AC_MSG_RESULT($cf_result)
864 dnl ---- GNU TLS
865 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
866 dnl it looks ugly then.
868 if test "$cf_result" = yes; then
869         cf_result="not used"
871 else
872         EL_SAVE_FLAGS
873         cf_result="no"
875         if test -z "$disable_gnutls"; then
876                 # Sure, we maybe _could_ use their macro, but how to ensure
877                 # that the ./configure script won't fail if the macro won't be
878                 # found..? :( --pasky
880                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
882                 if test -d "$gnutls_withval"; then
883                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
884                 fi
886                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
888                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
889                         cf_result=no
890                 else
891                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
892                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
894                         LIBS="$GNUTLS_LIBS $LIBS_X"
895                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
896                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
898                         # Verify if it's really usable
899                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
900                                     [gnutls_check_version(NULL)],
901                                     cf_result=yes, cf_result=no)
902                 fi
904                 if test "$cf_result" = yes; then
905                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
907                         CFLAGS="$CFLAGS_X"
908                         AC_SUBST(GNUTLS_CFLAGS)
910                         # Verify if the MD5 compatibility layer is usable.
911                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
912                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
913                                                   [GNU TLS OpenSSL compatibility],
914                                                   gnutls/openssl.h, gnutls-openssl,
915                                                   MD5_Init)
916                 else
917                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
918                                 AC_MSG_ERROR([GNUTLS not found])
919                         fi
920                         EL_RESTORE_FLAGS
921                 fi
922         fi
925 AC_MSG_CHECKING([for GNU TLS])
926 AC_MSG_RESULT($cf_result)
928 dnl Final SSL setup
930 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
931 AC_SUBST(CONFIG_OPENSSL)
932 AC_SUBST(CONFIG_GNUTLS)
934 #endif
936 AC_MSG_CHECKING([whether to be or not to be])
937 AC_MSG_RESULT([needs to be determined experimentally])
939 dnl ===================================================================
940 dnl Check for IPv6 support and related functions.
941 dnl ===================================================================
943 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
944 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
945 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
947 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
948 if test "$HAVE_GETADDRINFO" != yes; then
949         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
950         if test "$HAVE_GETADDRINFO" = yes; then
951                 LIBS="$LIBS -linet6"
952         fi
956 dnl ===================================================================
957 dnl Checking for X11 (window title restoring).
958 dnl ===================================================================
960 AC_PATH_X
961 if test x"$no_x" != xyes; then
962         if test -n "$x_includes"; then
963                 X_CFLAGS="-I$x_includes"
964                 CPPFLAGS="$CPPFLAGS -I$x_includes"
965         fi
966         if test -n "$x_libraries"; then
967                 LDFLAGS="$LDFLAGS -L$x_libraries"
968         fi
969         LIBS="-lX11 $LIBS"
970         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
971         AC_SUBST(X_CFLAGS)
975 dnl ===================================================================
976 dnl Backtraces displaying support.
977 dnl ===================================================================
979 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
980 # possible checks for other system-specific means go here
983 dnl ===================================================================
984 dnl SMB protocol support.
985 dnl ===================================================================
987 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
990 dnl ===================================================================
991 dnl Gettext grey zone. Beware.
992 dnl ===================================================================
994 ALL_LINGUAS="be bg ca cs da de el es et fi fr gl hr hu id is it lt nl nb pl pt pt_BR ro ru sk sr sv tr uk"
996 AM_GNU_GETTEXT
998 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
999 dnl # f33r d4 l33t... I hope it's portable. :)
1000 dnl cf_result=$((48#z - 48#a + 1));
1001 dnl AC_MSG_RESULT($cf_result)
1004 dnl ===================================================================
1005 dnl Compile-time features control
1006 dnl ===================================================================
1008 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1009               [  --disable-cookies       disable cookie support])
1011 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1012               [  --disable-formhist      disable form history support])
1014 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1015               [  --disable-globhist      disable global history support])
1018 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1019               [  --disable-mailcap       disable mailcap support])
1021 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1022               [  --disable-mimetypes     disable mimetypes files support])
1025 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1026               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1027               [IPv6],
1028               [  --disable-ipv6          disable IPv6 support])
1030 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1031               [  --enable-bittorrent     enable BitTorrent protocol support])
1033 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1034               [  --disable-data          disable data protocol support])
1036 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1037               [  --disable-uri-rewrite   disable URI rewrite support])
1039 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1040               [  --enable-cgi            enable local CGI support])
1042 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1043               [  --enable-finger         enable finger protocol support])
1045 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1046               [  --disable-ftp           disable ftp protocol support])
1048 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1049               [  --enable-gopher         enable gopher protocol support])
1051 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1052               [  --enable-nntp           enable nntp protocol support])
1054 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1055               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1058 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1059               [  --disable-mouse         disable mouse support])
1061 # GPM mouse is Linux specific, so ...
1062 CONFIG_SYSMOUSE=yes
1063 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1064               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1065               [BSD sysmouse],
1066               [  --disable-sysmouse      disable BSD sysmouse support])
1068 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1069               [  --enable-88-colors     enable 88 color support])
1071 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1072               [  --enable-256-colors     enable 256 color support])
1075 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1076               [  --enable-exmode         enable exmode (CLI) interface])
1078 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1079               [  --disable-leds          disable LEDs support])
1081 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1082               [  --disable-marks         disable document marks support])
1085 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1086               [  --disable-css           disable Cascading Style Sheet support])
1088 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1089               [  --enable-html-highlight HTML highlighting using DOM engine])
1091 dnl Everything in the tree already uses CONFIG_DOM
1092 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1093 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1095 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1096               [  --disable-backtrace     disable backtrace support])
1098 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1099               [  --enable-no-root        enable prevention of usage by root])
1102 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1103               [  --enable-debug          enable leak debug and internal error checking])
1105 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1106               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1108 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1109               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1111 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1112               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1114 if test "$CONFIG_OPENSSL" != yes &&
1115    test "$CONFIG_GNUTLS_OPENSSL_COMPAT" != yes ||
1116    test "$CONFIG_OWN_LIBC" = yes;
1117 then
1118         AC_MSG_CHECKING(for built-in MD5 support)
1119         AC_MSG_RESULT(yes)
1120         EL_CONFIG(CONFIG_MD5, [Built-in MD5])
1123 AC_SUBST(CONFIG_MD5)
1125 if test "$CONFIG_BITTORRENT" = yes; then
1126         if test "$CONFIG_OPENSSL" != yes ||
1127            test "$CONFIG_OWN_LIBC" = yes;
1128         then
1129                 AC_MSG_CHECKING(for built-in SHA1 support)
1130                 AC_MSG_RESULT(yes)
1131                 EL_CONFIG(CONFIG_SHA1, [Built-in SHA1])
1132         fi
1135 AC_SUBST(CONFIG_SHA1)
1137 if test "$CONFIG_CSS" = yes || test "$CONFIG_DOM" = yes;
1138 then
1139         EL_CONFIG(CONFIG_SCANNER, [Built-in scanner])
1141 AC_SUBST(CONFIG_SCANNER)
1143 AC_ARG_ENABLE(weehoofooboomookerchoo,
1144               [
1145     Also check out the features.conf file for more information about features!
1146               ],
1147               [AC_MSG_ERROR(Are you strange, or what?)])
1150 dnl == EMX hack
1152 test "$CONFIG_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1153 test "$CONFIG_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1156 dnl ===================================================================
1157 dnl Export directory paths
1158 dnl ===================================================================
1160 # Set up the ``entry points'' if they were not supplied by builder
1161 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1162 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1164 # Create CONFDIR #define for config.h
1166 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1167 # it's autoconf fault to force us to do such hacks ;p.
1168 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1169   # sysconfdir is set to its default value... fine, let's append /elinks/
1170   # XXX: We can't modify listing of the default in ./configure --help :-(
1171   sysconfdir_n=`eval echo "$sysconfdir"`
1172   sysconfdir=$sysconfdir_n
1173   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1174         sysconfdir="$sysconfdir/elinks"
1177 CONFDIR=$sysconfdir
1178 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1179 AC_SUBST(CONFDIR)
1181 # Create LOCALEDIR #define for config.h
1182 LOCALEDIR=`eval echo "$datadir/locale"`
1183 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1184 AC_SUBST(LOCALEDIR)
1186 # Create LIBDIR #define for config.h
1187 LIBDIR=`eval echo "$libdir"`
1188 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1189 AC_SUBST(LIBDIR)
1191 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1192 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1194 dnl ===================================================================
1195 dnl A little fine tuning of gcc specific options (continued)
1196 dnl ===================================================================
1198 if test "x$ac_cv_prog_gcc" = "xyes"; then
1199   if test "$CONFIG_DEBUG" = "yes"; then
1200     dnl We want to see all warnings and live with none (in debug mode).
1201     CFLAGS="$CFLAGS -Werror"
1202   fi
1204   case "`gcc -dumpversion`" in
1205     3.0|3.1|3.2)
1206       # These should be ok using -Werror
1207       ;;
1208     3.*)
1209       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1210       # "dereferencing type-punned pointer will break strict-aliasing rules"
1211       # warnings. Disable them by not doing any strict-aliasing. The
1212       # alternative is just too ugly. Thanks gcc guys!! ;)
1213       CFLAGS="$CFLAGS -fno-strict-aliasing"
1214       ;;
1215     4.*)
1216       # Do not show warnings related to (char * | unsigned char *) type
1217       # difference.
1218       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1219       ;;
1220     *)
1221       # These should be ok using -Werror
1222       ;;
1223   esac
1226 # CFLAGS doesn't contain all compile flags. Some will be added only when
1227 # needed in the respective source directory. To get all compile flags
1228 # easily just add CPPFLAGS.
1229 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1231 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1232 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1234 dnl ===================================================================
1235 dnl Generated files
1236 dnl ===================================================================
1238 AC_OUTPUT([ \
1239  Makefile.config \
1240  contrib/elinks.spec \
1241  contrib/lua/hooks.lua \
1242  contrib/conv/w3m2links.awk \
1243  doc/man/man1/elinks.1 \
1244  src/intl/gettext/ref-add.sed \
1245  src/intl/gettext/ref-del.sed
1248 srcdir2="$(cd "$srcdir" && pwd)"
1249 if test "$srcdir2" != "$builddir"; then
1250         for i in $(make -C "$srcdir" list | grep Makefile); do
1251                 $MKINSTALLDIRS "$builddir/$(dirname $i)"
1252                 grep top_builddir= "$srcdir/$i" > "$builddir/$i"
1253                 case "$srcdir" in
1254                 /*)     echo "include $srcdir/$i" >> "$builddir/$i" ;;
1255                 *)      echo "include \$(top_builddir)/$srcdir/$i" >> "$builddir/$i" ;;
1256                 esac
1257                 echo "creating $builddir/$i"
1258         done
1262 dnl ===================================================================
1263 dnl Configuration summary
1264 dnl ===================================================================
1266 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1267 cat features.log