Revert "ELinks doesn't change current directory, so get_cwd and set_cwd are useless"
[elinks.git] / configure.in
blob01c8b399363455aee7f9d34b0bbc5ef65441468a
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.12.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 MAKE=
21 for make in gnumake gmake make false; do
22         if test "x$MAKE" = x; then
23                 AC_PATH_PROGS(MAKE, "$make")
24         fi
25 done
27 builddir="`pwd`"
29 # Cleanup if we are configuring with a previous build in the tree
30 if test -e Makefile.config; then
31         AC_MSG_CHECKING([for previous build to clean])
32         "$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
33         AC_MSG_RESULT(done)
36 dnl ===================================================================
37 dnl Load feature configuration file and start logging features.
38 dnl ===================================================================
40 features="features.conf"
41 AC_CHECK_FILE("$srcdir/$features", [ . $srcdir/$features ])
42 AC_CHECK_FILE("$builddir/$features", [ . $builddir/$features ])
43 echo "Feature summary:" > features.log
45 dnl ===================================================================
46 dnl Checks for programs.
47 dnl ===================================================================
49 AC_PROG_CC
50 AC_PROG_AWK
51 AC_PATH_PROGS(AWK, "$AWK")
52 AC_PROG_RANLIB
53 AC_PROG_INSTALL
55 AC_PATH_PROGS(CG_COMMIT_ID, "cg-commit-id")
56 AC_PATH_PROGS(SPARSE, "sparse")
58 CONFIG_ASCIIDOC="no"
59 CONFIG_POD2HTML="no"
60 CONFIG_XMLTO="no"
61 CONFIG_JW="no"
63 if test "x$CONFIG_DOC" != xno; then
64         AC_PATH_PROGS(ASCIIDOC, "asciidoc")
65         if test "x$ASCIIDOC" != "x"; then
66                 EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
67                 EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
68                 EL_CONFIG(MAN_ASCIIDOC, [HTML])
70                 echo > config.asciidoc-unsafe.txt
71                 if "$ASCIIDOC" --unsafe config.asciidoc-unsafe.txt >/dev/null 2>/dev/null; then
72                         ASCIIDOC_FLAGS=--unsafe
73                 fi
74                 rm config.asciidoc-unsafe.*
75         fi
77         AC_PATH_PROGS(XMLTO, "xmlto")
78         if test "x$XMLTO" != "x"; then
79                 EL_CONFIG(CONFIG_XMLTO, [XmlTo])
80                 EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
81                 EL_CONFIG(MAN_XMLTO, [man (groff)])
82         fi
84         AC_PATH_PROGS(JW, "jw")
85         if test "x$JW" != "x"; then
86                 EL_CONFIG(CONFIG_JW, [JadeWrapper])
87                 EL_CONFIG(MANUAL_JW, [PDF])
88         fi
90         AC_PATH_PROGS(POD2HTML, "pod2html")
91         if test "x$POD2HTML" != "x"; then
92                 EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
93         fi
96 AC_SUBST(ASCIIDOC_FLAGS)
97 AC_SUBST(CONFIG_ASCIIDOC)
98 AC_SUBST(CONFIG_POD2HTML)
99 AC_SUBST(CONFIG_XMLTO)
100 AC_SUBST(CONFIG_JW)
102 EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
103 EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
104 EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
106 dnl gcc specific options (to be continued at the bottom of configure)
107 if test "x$ac_cv_prog_gcc" = "xyes"; then
108   dnl We want to see all warnings and live with none.
109   dnl We can't set up -Werror here as there may be some warnings in test
110   dnl suite of configure, and we don't want to fail them.
111   CFLAGS="$CFLAGS -Wall"
114 dnl ===================================================================
115 dnl Checks for special OSes.
116 dnl ===================================================================
118 dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
119 AC_DEFUN([EL_CHECK_COMPILER_MACROS],
121         AC_MSG_CHECKING([for $2])
123         for flag in $3; do
124                 AC_TRY_COMPILE(, [#ifndef $flag
125 kill me!
126 #endif ], $1=yes, $1=no)
127                 if test "[$]$1" = yes; then
128                         EL_CONFIG([$1], [$2])
129                         break
130                 fi
131         done
133         AC_MSG_RESULT([$]$1)
136 EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
137 AC_SUBST(CONFIG_OS_BEOS)
139 EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
140 AC_SUBST(CONFIG_OS_RISCOS)
142 EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
143 AC_SUBST(CONFIG_OS_WIN32)
145 EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
146 AC_SUBST(CONFIG_OS_OS2)
147 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
149 AC_MSG_CHECKING([for UNIX])
150 dnl FIXME: some depend kind of mechanism
151 if test "$CONFIG_OS_BEOS" = no && \
152    test "$CONFIG_OS_RISCOS" = no && \
153    test "$CONFIG_OS_WIN32" = no && \
154    test "$CONFIG_OS_OS2" = no; then
155         EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
156 else
157         CONFIG_OS_UNIX=no
159 AC_MSG_RESULT($CONFIG_OS_UNIX)
160 AC_SUBST(CONFIG_OS_UNIX)
162 dnl ===================================================================
163 dnl Checks for header files.
164 dnl ===================================================================
166 AC_HEADER_DIRENT
167 AC_HEADER_STDC
168 AC_HEADER_SYS_WAIT
169 AC_HEADER_TIME
171 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
172 AC_CHECK_HEADERS(sigaction.h)
173 AC_CHECK_HEADERS(arpa/inet.h)
174 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
175 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
176 AC_CHECK_HEADERS(ifaddrs.h)
177 AC_CHECK_HEADERS(sys/cygwin.h io.h)
178 AC_CHECK_HEADERS(sys/fmutex.h)
179 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
180 AC_CHECK_HEADERS(sys/resource.h)
181 AC_CHECK_HEADERS(sys/select.h)
182 AC_CHECK_HEADERS(sys/signal.h)
183 AC_CHECK_HEADERS(sys/socket.h)
184 AC_CHECK_HEADERS(sys/time.h)
185 AC_CHECK_HEADERS(sys/utsname.h)
186 AC_CHECK_HEADERS(stdint.h inttypes.h)
187 AC_CHECK_HEADERS(locale.h pwd.h)
188 AC_CHECK_HEADERS(termios.h)
191 AC_CHECK_HEADERS(sys/un.h,
192         [CONFIG_INTERLINK=yes
193          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
194         [CONFIG_INTERLINK=no])
195 AC_SUBST(CONFIG_INTERLINK)
197 dnl ===================================================================
198 dnl Checks for typedefs, structures, and compiler characteristics.
199 dnl ===================================================================
201 AC_STRUCT_TM
202 AC_C_CONST
203 AC_C_INLINE
204 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
206 AC_SYS_LARGEFILE
207 AC_TYPE_SIZE_T
208 AC_TYPE_OFF_T
209 EL_CHECK_TYPE(ssize_t, int)
210 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
211 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
212 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
213 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
215 AC_CHECK_SIZEOF(char, 1)
216 AC_CHECK_SIZEOF(short, 2)
217 AC_CHECK_SIZEOF(int, 4)
218 AC_CHECK_SIZEOF(long, 4)
219 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
221 dnl Check for variadic macros
222 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
223                 [#include <stdio.h>
224                  #define a(b,c...) printf(b,##c)],
225                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
227 dnl Check for -rdynamic
228 dnl FIXME: This check doesn't work. Something to do with the compiler
229 dnl happily ignoring it and stderr not being checked for error messages.
230 AC_MSG_CHECKING([for -rdynamic])
231 LDFLAGS_X="$LDFLAGS"
232 LDFLAGS="$LDFLAGS -rdynamic"
233 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
234 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
235 AC_MSG_RESULT($have_rdynamic)
237 dnl ===================================================================
238 dnl Check for POSIX <regex.h>
239 dnl ===================================================================
241 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
243 dnl ===================================================================
244 dnl Checks for library functions.
245 dnl ===================================================================
247 AC_PROG_GCC_TRADITIONAL
248 AC_FUNC_MEMCMP
249 AC_FUNC_MMAP
250 AC_FUNC_STRFTIME
251 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
252 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
253 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
254 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
255 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
256 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
257 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
258 AC_CHECK_FUNCS(gettimeofday clock_gettime)
260 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
262 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
263 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
264 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
266 dnl These aren't probably needed now, as they are commented in links.h.
267 dnl I've no idea about their historical background, but I keep them here
268 dnl just in the case they will help later. --pasky
269 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
270 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
271 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
272 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
274 if test x"$HAVE_RAISE" = x; then
275         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
276                 AC_ERROR([Unable to emulate raise()])
277         fi
280 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
281 AC_TRY_LINK([#include <stdarg.h>
282 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
283 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
284 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
285         EL_DEFINE(HAVE_VA_COPY, __va_copy)
288 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
289 AC_TRY_LINK([#include <unistd.h>
290 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
291 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
292 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
293         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
296 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
297 AC_TRY_RUN([
298 #include <stdio.h>
299 #include <stdarg.h>
300 #include <stdlib.h>
301 #include <string.h>
303 char buf[8];
305 int bar(char *buf, const char *format, va_list ap)
307        return vsnprintf(buf, 0, format, ap);
310 void foo(const char *format, ...) {
311        va_list ap;
312        int len;
314        va_start(ap, format);
315        len = bar(buf, format, ap);
316        va_end(ap);
317        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
319        va_start(ap, format);
320        len = bar(buf, format, ap);
321        va_end(ap);
322        if ((len != 6) && (len != 7)) exit(1);
324        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
326        exit(0);
328 main() { foo("hello\n"); }
330 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
331 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
332         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
335 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
337 dnl ===================================================================
338 dnl Checks for libraries.
339 dnl ===================================================================
341 dnl Replace `main' with a function in -lsocket:
342 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
343 if test "$cf_result" = no; then
344         AC_CHECK_LIB(socket, socket)
347 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
348 if test "$cf_result" = no; then
349         AC_CHECK_LIB(socket, setsockopt)
352 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
353 if test "$cf_result" = no; then
354         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
355         if test "$cf_result" = no; then
356                 AC_CHECK_LIB(nsl, gethostbyname)
357         else
358                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
359         fi
362 dnl ===================================================================
363 dnl Checks for packaging specific options.
364 dnl ===================================================================
366 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
367             [ if test "$withval" != no && test "$withval" != yes; then
368                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
369               fi ])
371 dnl ===================================================================
372 dnl Checks for a libraries, optional even if installed.
373 dnl ===================================================================
375 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
376 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
378         AC_MSG_CHECKING([for $2 support])
380         if test "[$]$1" != no; then
381                 AC_MSG_RESULT(yes)
382                 EL_SAVE_FLAGS
383                 if test -n "$withval" && test -d "$withval"; then
384                         # Be a little more careful when setting
385                         # include and lib directories. This way
386                         # $withval will work when includes are
387                         # there but the library is in the common
388                         # /usr/lib ... Does the right thing when
389                         # looking for gc on Debian.
390                         if test -d "$withval/include"; then
391                                 CFLAGS="$CFLAGS -I$withval/include"
392                                 CPPFLAGS="$CPPFLAGS -I$withval/include"
393                         else
394                                 CFLAGS="$CFLAGS -I$withval"
395                                 CPPFLAGS="$CPPFLAGS -I$withval"
396                         fi
397                         if test -d "$withval/lib"; then
398                                 LDFLAGS="$LDFLAGS -L$withval/lib"
399                         fi
400                 fi
402                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
403                 if test "[$]$1" = yes; then
404                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
405                 fi
407                 if test "[$]$1" = yes; then
408                         EL_CONFIG([$1], [$2])
409                         LIBS="$LIBS -l$4"
410                 else
411                         if test -n "[$]WITHVAL_$1" &&
412                            test "[$]WITHVAL_$1" != xno; then
413                                 AC_MSG_ERROR([$2 not found])
414                         fi
415                         EL_RESTORE_FLAGS
416                 fi
417         else
418                 AC_MSG_RESULT(disabled)
419         fi
422 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
423 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
425         $1=yes
426         WITHVAL_$1=
428         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
429         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
431         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
433         EL_LOG_CONFIG([$1], [$2], [])
436 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
437         [  --without-gpm           disable gpm (mouse) support])
439 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
440         [  --without-zlib          disable zlib support])
442 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
443         [  --without-bzlib         disable bzlib support])
445 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
446         [  --without-idn           disable international domain names support])
448 if test "x{with_gc}" != xno; then
449         EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
450                 [  --with-gc            enable Boehm's garbage collector])
453 EL_ARG_ENABLE(CONFIG_LZMA, lzma, [lzma],
454               [  --enable-lzma           enable lzma encoding support])
455 dnl ===================================================================
456 dnl Check for GSSAPI, optional even if installed.
457 dnl ===================================================================
459 enable_gssapi="no";
461 AC_ARG_WITH(gssapi, [  --with-gssapi           enable GSSAPI support],
462             [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
464 AC_MSG_CHECKING([for GSSAPI])
466 if test "$enable_gssapi" = "yes"; then
467         AC_MSG_RESULT(yes)
468         GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
469         GSSAPI_LIBS=`krb5-config --libs gssapi`
470         CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
471         LIBS="$GSSAPI_LIBS $LIBS"
472         EL_CONFIG(CONFIG_GSSAPI, [GssApi])
473 else
474         AC_MSG_RESULT(no)
477 AC_SUBST(CONFIG_GSSAPI)
479 dnl ===================================================================
480 dnl Bookmark and XBEL support
481 dnl ===================================================================
483 EL_SAVE_FLAGS
485 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
486               [  --disable-bookmarks     disable bookmark support])
488 # Check whether --enable-xbel or --disable-xbel was given.
489 if test "x${enable_xbel}" != xno; then
490         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
492         if test "$HAVE_LIBEXPAT" = yes; then
493                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
494                 if test "$HAVE_LIBEXPAT" = yes; then
495                         LIBS="$LIBS -lexpat"
496                 fi
497         fi
501 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
502               [XBEL bookmarks],
503               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
505 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
506         EL_RESTORE_FLAGS
509 dnl ===================================================================
510 dnl Checks for BSD sysmouse
511 dnl ===================================================================
513 HAVE_SYSMOUSE_HEADER="no"
515 # Either of these header files provides the (same) sysmouse interface
516 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
518 dnl ===================================================================
519 dnl Checks for OS/2
520 dnl ===================================================================
522 if test "$CONFIG_OS_OS2" = yes; then
523         EL_CONFIG_OS_OS2
526 dnl ===================================================================
527 dnl Checks for Win32
528 dnl ===================================================================
530 if test "$CONFIG_OS_WIN32" = yes; then
531         EL_CONFIG_OS_WIN32
534 dnl ===================================================================
535 dnl Check for SEE (Simple Ecmascript Engine)
536 dnl ===================================================================
537 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
538             [ if test "x$withval" != xno; then enable_see=yes; fi ])
540 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
541 # SEE_FLAGS but I really don't want to require people to have Guile in order
542 # to compile CVS. Also, the macro seems to be really stupid regarding searching
543 # for Guile in $PATH etc. --pasky
545 AC_MSG_CHECKING([for SEE])
547 CONFIG_ECMASCRIPT_SEE=no
549 if test "$enable_see" = "yes"; then
550         AC_MSG_RESULT(yes);
551         ## Based on the SEE_FLAGS macro.
553         if test -d "$withval"; then
554                 SEE_PATH="$withval:$PATH"
555         else
556                 SEE_PATH="$PATH"
557         fi
559         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
561         ## First, let's just see if we can find Guile at all.
562         if test "$SEE_CONFIG" != no; then
563                 cf_result="yes";
565                 SEE_LIBS="`$SEE_CONFIG --libs`"
566                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
567                 LIBS="$SEE_LIBS $LIBS"
568                 CPPFLAGS="$CPPFLAGS $SEE_CFLAGS"
569                 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
570                 AC_SUBST(SEE_CFLAGS)
571         else
572                 if test -n "$withval" && test "x$withval" != xno; then
573                         AC_MSG_ERROR([SEE not found])
574                 else
575                         AC_MSG_WARN([SEE support disabled])
576                 fi
577         fi
578 else
579         AC_MSG_RESULT(no);
583 dnl ===================================================================
584 dnl Check for SpiderMonkey, optional even if installed.
585 dnl ===================================================================
587 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
588             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
589 AC_MSG_CHECKING([for SpiderMonkey])
591 EL_SAVE_FLAGS
592 cf_result=no
594 if test -z "$disable_spidermonkey"; then
595         if test ! -d "$withval"; then
596                 withval="";
597         fi
598         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
599                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
600                         for spidermonkeylib in js smjs mozjs; do
601                                 if test "$cf_result" = no; then
602                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
604                                         if test ! -z "$spidermonkeydir"; then
605                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
606                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
607                                         fi
609                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
610                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
611                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
613                                         AC_TRY_LINK([#define XP_UNIX
614                                                      #include <jsapi.h>],
615                                                      [JS_GetImplementationVersion()],
616                                                      cf_result=yes, cf_result=no)
617                                 fi
618                         done
619                 done
620         done
623 AC_MSG_RESULT($cf_result)
624 CONFIG_SPIDERMONKEY="$cf_result"
625 EL_RESTORE_FLAGS
627 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
628    test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
629         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
630 else
631         CONFIG_ECMASCRIPT_SMJS=no
634 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
635 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
636 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
639 dnl ===================================================================
640 dnl Optional Spidermonkey-based ECMAScript browser scripting
641 dnl ===================================================================
643 AC_ARG_ENABLE(sm-scripting,
644               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
645               [if test "$enableval" != no; then enableval="yes"; fi
646                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
648 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
649    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
650         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
651 else
652         CONFIG_SCRIPTING_SPIDERMONKEY=no
655 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
656    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
657         LIBS="$LIBS $SPIDERMONKEY_LIBS"
658         AC_SUBST(SPIDERMONKEY_LIBS)
659         AC_SUBST(SPIDERMONKEY_CFLAGS)
660         AC_SUBST(CONFIG_SPIDERMONKEY)
663 dnl ===================================================================
664 dnl Check for Guile, optional even if installed.
665 dnl ===================================================================
667 enable_guile="no";
669 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
670             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
672 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
673 # GUILE_FLAGS but I really don't want to require people to have Guile in order
674 # to compile CVS. Also, the macro seems to be really stupid regarding searching
675 # for Guile in $PATH etc. --pasky
677 AC_MSG_CHECKING([for Guile])
679 if test "$enable_guile" = "yes"; then
680         AC_MSG_RESULT(yes);
681         ## Based on the GUILE_FLAGS macro.
683         if test -d "$withval"; then
684                 GUILE_PATH="$withval:$PATH"
685         else
686                 GUILE_PATH="$PATH"
687         fi
689         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
691         ## First, let's just see if we can find Guile at all.
692         if test "$GUILE_CONFIG" != no; then
693                 cf_result="yes";
695                 GUILE_LIBS="`guile-config link`"
696                 GUILE_CFLAGS="`guile-config compile`"
697                 LIBS="$GUILE_LIBS $LIBS"
698                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
699                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
700                 AC_SUBST(GUILE_CFLAGS)
701                 cat <<EOF
702 ***********************************************************************
703 The Guile support is incomplete and not so well integrated to ELinks
704 yet. That means, e.g., that you have no Guile console and there might
705 not be all the necessary hooks. Also, the Guile interface is not too
706 well tested (success stories heartily welcomed!).  See
707 src/scripting/guile/README for further details and hints.
708 ***********************************************************************
710         else
711                 if test -n "$withval" && test "x$withval" != xno; then
712                         AC_MSG_ERROR([Guile not found])
713                 else
714                         AC_MSG_WARN([Guile support disabled])
715                 fi
716         fi
717 else
718         AC_MSG_RESULT(no);
721 dnl ===================================================================
722 dnl Check for Perl
723 dnl ===================================================================
724 enable_perl="no";
726 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
727             [
728 if test "$withval" = yes; then
729         # FIXME: If withval is a valid directory append it to PATH
730         # so that you can specify one of several perl installations.
731         withval="";
732         enable_perl=yes;
734             ])
736 AC_MSG_CHECKING([for Perl])
738 cf_result=no
740 EL_SAVE_FLAGS
742 if test "$enable_perl" = "yes"; then
743         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
744         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
745         LIBS="$PERL_LIBS $LIBS"
746         CFLAGS="$PERL_CFLAGS $CFLAGS"
747         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
748         AC_TRY_LINK([
749 #include <EXTERN.h>
750 #include <perl.h>
751 #include <perlapi.h>
753                     [PerlInterpreter *my_perl = perl_alloc();],
754                     cf_result=yes, cf_result=no)
757 if test "$cf_result" != "yes"; then
758         EL_RESTORE_FLAGS
759 else
760         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
762         CFLAGS="$CFLAGS_X"
763         AC_SUBST(PERL_LIBS)
764         AC_SUBST(PERL_CFLAGS)
767 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
768 dnl ===================================================================
769 dnl Check for Python
770 dnl ===================================================================
771 enable_python="no";
773 AC_ARG_WITH(python, [  --with-python=[prefix]       enable Python support],
774             [
775 if test "$withval" != no; then
776         # FIXME: If withval is a valid directory append it to PATH
777         # so that you can specify one of several Python installations.
778         if test "$withval" != yes; then
779                 python_prefix="$withval"
780         else
781                 python_prefix=""
782         fi
783         enable_python=yes
784         cat <<EOF
785 ***********************************************************************
786 The Python support is incomplete and not so well integrated to ELinks
787 yet. That means, e.g.., that you have no Python console and there might
788 not be all the necessary hooks. Also, the Python interface is not too
789 well tested (success stories heartily welcomed!).
790 ***********************************************************************
793             ])
796 cf_result=no
798 EL_SAVE_FLAGS
800 if test "$enable_python" = "yes"; then
801         if test -n "$python_prefix" && test -d "$python_prefix/bin"; then
802                 PYTHON_PATH="$python_prefix/bin:$PATH"
803         else
804                 PYTHON_PATH="$PATH"
805         fi
806         AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
807         if test "$PYTHON" = "no" ; then
808                 cf_result=no
809         else
810                 PYTHON_CFLAGS="-I`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_inc()' 2> /dev/null`"
811                 PYTHON_LIBS="-lpython`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_config_var("VERSION")' 2> /dev/null`"
812                 if test -n "$python_prefix" && test -d "$python_prefix/lib"; then
813                         PYTHON_LIBS="-L$python_prefix/lib $PYTHON_LIBS"
814                 fi
815                 LIBS="$PYTHON_LIBS $LIBS"
816                 CFLAGS="$PYTHON_CFLAGS $CFLAGS"
817                 AC_TRY_LINK([#include <Python.h>],
818                     [Py_Initialize();],
819                     cf_result=yes, cf_result=no)
821                 if test "$cf_result" != "yes"; then
822                         EL_RESTORE_FLAGS
823                 else
824                         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
826                         CFLAGS="$CFLAGS_X"
827                         AC_SUBST(PYTHON_LIBS)
828                         AC_SUBST(PYTHON_CFLAGS)
829                 fi
830         fi
833 AC_MSG_CHECKING([for Python])
834 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
837 dnl ===================================================================
838 dnl Check for Lua, optional even if installed.
839 dnl ===================================================================
841 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
842 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
844 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
845             [if test "$withval" = no; then disable_lua=yes; fi])
846 AC_MSG_CHECKING([for Lua])
848 EL_SAVE_FLAGS
849 cf_result=no
851 if test -z "$disable_lua"; then
852         if test ! -d "$withval"; then
853                 withval="";
854         fi
855         for luadir in "$withval" "" /usr /usr/local; do
856                 for suffix in "" 50 51; do
857                         if test "$cf_result" = no; then
858                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
860                                 if test ! -z "$luadir"; then
861                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
862                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
863                                 fi
865                                 LIBS="$LUA_LIBS $LIBS_X"
866                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
867                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
869                                 # Check that it is a compatible Lua version
870                                 AC_TRY_LINK([   #include <lua.h>
871                                                 #include <lualib.h>],
872                                             [   lua_State *L = lua_open();
873                                                 luaopen_base(L);
874                                                 luaopen_table(L);
875                                                 luaopen_io(L);
876                                                 luaopen_string(L);
877                                                 luaopen_math(L);
878                                                 lua_pushboolean(L, 1);
879                                                 lua_close(L);],
880                                             cf_result=yes, cf_result=no)
881                         fi
882                 done
883         done
886 AC_MSG_RESULT($cf_result)
888 if test "$cf_result" != yes; then
889         EL_RESTORE_FLAGS
890 else
891         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
892         AC_CHECK_HEADERS(lauxlib.h)
894         CFLAGS="$CFLAGS_X"
895         AC_SUBST(LUA_LIBS)
896         AC_SUBST(LUA_CFLAGS)
900 dnl ===================================================================
901 dnl Check for Ruby, optional even if installed.
902 dnl ===================================================================
904 EL_CONFIG_SCRIPTING_RUBY
906 dnl ===================================================================
907 dnl Setup global scripting
908 dnl ===================================================================
910 EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_SCRIPTING_GUILE CONFIG_SCRIPTING_LUA CONFIG_SCRIPTING_PERL CONFIG_SCRIPTING_PYTHON CONFIG_SCRIPTING_RUBY CONFIG_SCRIPTING_SPIDERMONKEY], [Browser scripting])
911 AC_SUBST(CONFIG_SCRIPTING_GUILE)
912 AC_SUBST(CONFIG_SCRIPTING_LUA)
913 AC_SUBST(CONFIG_SCRIPTING_PERL)
914 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
915 AC_SUBST(CONFIG_SCRIPTING_RUBY)
916 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
917 AC_SUBST(CONFIG_SCRIPTING)
920 dnl ===================================================================
921 dnl Check for SSL support.
922 dnl ===================================================================
924 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
925 dnl is enabled, we won't try to use OpenSSL anymore.
927 dnl For wiping SSL hooks..
928 #ifdef CONFIG_SSL
930 disable_openssl=""
931 disable_gnutls=""
932 enable_gnutls=""
934 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
935             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
936 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
937             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
938 gnutls_withval="$withval"
940 if test "$enable_gnutls" = yes; then
941         disable_openssl=yes;
944 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
945             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
946 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
947 openssl_withval="$withval"
949 dnl ---- OpenSSL
951 AC_MSG_CHECKING([for OpenSSL])
953 EL_SAVE_FLAGS
954 cf_result="no"
956 if test "$disable_openssl" = yes; then
957         cf_result="not used"
958 else
959         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
960                          /usr/lib/openssl /usr/local/ssl \
961                          /usr/local/www /usr/lib/ssl /usr/local \
962                          /usr/pkg /opt /opt/openssl; do
963                 if test "$cf_result" = no; then
964                         if test -d "$ssldir"; then
965                                 OPENSSL_CFLAGS="-I$ssldir/include"
966                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
967                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
968                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
969 #                               # FIXME: This created serious portability problems. --pasky
970 #                               if test "$CC" == "gcc"; then
971 #                                       # I'm not sure about compatibility here. --pasky
972 #                                       LIBS="$LIBS -R$ssldir/lib"
973 #                               fi
974                         else
975                                 LIBS="-lssl -lcrypto $LIBS_X"
976                         fi
977                         AC_TRY_LINK([#include <openssl/ssl.h>],
978                                     [OpenSSL_add_all_algorithms()],
979                                     cf_result=yes, cf_result=no)
980                         if test "$cf_result" != yes; then
981                                 AC_TRY_LINK([#include <openssl/ssl.h>],
982                                             [SSLeay_add_ssl_algorithms()],
983                                             cf_result=yes, cf_result=no)
984                         fi
985                 fi
986         done
988         if test "$cf_result" != yes; then
989                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
990                         AC_MSG_ERROR([OpenSSL not found])
991                 fi
992                 EL_RESTORE_FLAGS
993         else
994                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
996                 CFLAGS="$CFLAGS_X"
997                 AC_SUBST(OPENSSL_CFLAGS)
998         fi
1001 AC_MSG_RESULT($cf_result)
1003 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1004 dnl ---- GNU TLS
1005 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
1006 dnl it looks ugly then.
1008 if test "$cf_result" = yes; then
1009         cf_result="not used"
1011 else
1012         EL_SAVE_FLAGS
1013         cf_result="no"
1015         if test -z "$disable_gnutls"; then
1016                 # Sure, we maybe _could_ use their macro, but how to ensure
1017                 # that the ./configure script won't fail if the macro won't be
1018                 # found..? :( --pasky
1020                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
1022                 if test -d "$gnutls_withval"; then
1023                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1024                 fi
1026                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1028                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1029                         cf_result=no
1030                 else
1031                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1032                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1034                         LIBS="$GNUTLS_LIBS $LIBS_X"
1035                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1036                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1038                         # Verify if it's really usable.  gnutls_session was
1039                         # renamed to gnutls_session_t before GNU TLS 1.2.0
1040                         # (on 2004-06-13); ELinks now requires this.
1041                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
1042                                     [gnutls_session_t dummy;
1043                                      gnutls_check_version(NULL)],
1044                                     cf_result=yes, cf_result=no)
1045                 fi
1047                 if test "$cf_result" = yes; then
1048                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1050                         CFLAGS="$CFLAGS_X"
1051                         AC_SUBST(GNUTLS_CFLAGS)
1053                         # Verify if the MD5 compatibility layer is usable.
1054                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1055                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1056                                                   [GNU TLS OpenSSL compatibility],
1057                                                   gnutls/openssl.h, gnutls-openssl,
1058                                                   MD5_Init)
1059                 else
1060                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1061                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1062                         fi
1063                         EL_RESTORE_FLAGS
1064                 fi
1065         fi
1068 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1069 AC_MSG_RESULT($cf_result)
1071 dnl Final SSL setup
1073 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1074 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1075 AC_SUBST(CONFIG_OPENSSL)
1076 AC_SUBST(CONFIG_GNUTLS)
1078 #endif
1080 AC_MSG_CHECKING([whether to be or not to be])
1081 AC_MSG_RESULT([needs to be determined experimentally])
1083 dnl ===================================================================
1084 dnl Check for IPv6 support and related functions.
1085 dnl ===================================================================
1087 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1088 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1089 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1091 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1092 if test "$HAVE_GETADDRINFO" != yes; then
1093         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1094         if test "$HAVE_GETADDRINFO" = yes; then
1095                 LIBS="$LIBS -linet6"
1096         fi
1100 dnl ===================================================================
1101 dnl Checking for X11 (window title restoring).
1102 dnl ===================================================================
1104 AC_PATH_X
1105 if test x"$no_x" != xyes; then
1106         if test -n "$x_includes"; then
1107                 X_CFLAGS="-I$x_includes"
1108                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1109         fi
1110         if test -n "$x_libraries"; then
1111                 LDFLAGS="$LDFLAGS -L$x_libraries"
1112         fi
1113         LIBS="-lX11 $LIBS"
1114         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1115         AC_SUBST(X_CFLAGS)
1119 dnl ===================================================================
1120 dnl Backtraces displaying support.
1121 dnl ===================================================================
1123 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1124 # possible checks for other system-specific means go here
1127 dnl ===================================================================
1128 dnl SMB protocol support.
1129 dnl ===================================================================
1131 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1134 dnl ===================================================================
1135 dnl Gettext grey zone. Beware.
1136 dnl ===================================================================
1138 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"
1140 AM_GNU_GETTEXT
1142 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1143 dnl # f33r d4 l33t... I hope it's portable. :)
1144 dnl cf_result=$((48#z - 48#a + 1));
1145 dnl AC_MSG_RESULT($cf_result)
1148 dnl ===================================================================
1149 dnl Compile-time features control
1150 dnl ===================================================================
1152 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1153               [  --disable-cookies       disable cookie support])
1155 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1156               [  --disable-formhist      disable form history support])
1158 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1159               [  --disable-globhist      disable global history support])
1162 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1163               [  --disable-mailcap       disable mailcap support])
1165 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1166               [  --disable-mimetypes     disable mimetypes files support])
1169 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1170               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1171               [IPv6],
1172               [  --disable-ipv6          disable IPv6 support])
1174 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1175               [  --enable-bittorrent     enable BitTorrent protocol support])
1177 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1178               [  --disable-data          disable data protocol support])
1180 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1181               [  --disable-uri-rewrite   disable URI rewrite support])
1183 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1184               [  --enable-cgi            enable local CGI support])
1186 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1187               [  --enable-finger         enable finger protocol support])
1189 dnl ===================================================================
1190 dnl FSP protocol
1191 dnl ===================================================================
1192 EL_SAVE_FLAGS
1194 if test "x${enable_fsp}" != xno; then
1195         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1197         if test "$HAVE_FSPLIB" = yes; then
1198                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1199                 if test "$HAVE_FSPLIB" = yes; then
1200                         LIBS="$LIBS -lfsplib"
1201                 else
1202                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1203                         if test "$HAVE_FSPLIB" = yes; then
1204                                 LIBS="$LIBS -lfsp"
1205                         fi
1206                 fi
1207         fi
1210 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1211               [  --enable-fsp            enable FSP protocol support])
1213 if test "x$CONFIG_FSP" = xno; then
1214         EL_RESTORE_FLAGS
1217 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1218               [  --disable-ftp           disable ftp protocol support])
1220 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1221               [  --enable-gopher         enable gopher protocol support])
1223 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1224               [  --enable-nntp           enable nntp protocol support])
1226 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1227               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1230 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1231               [  --disable-mouse         disable mouse support])
1233 # GPM mouse is Linux specific, so ...
1234 CONFIG_SYSMOUSE=yes
1235 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1236               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1237               [BSD sysmouse],
1238               [  --disable-sysmouse      disable BSD sysmouse support])
1240 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1241               [  --enable-88-colors      enable 88 color support])
1243 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1244               [  --enable-256-colors     enable 256 color support])
1247 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1248               [  --enable-exmode         enable exmode (CLI) interface])
1250 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1251               [  --disable-leds          disable LEDs support])
1253 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1254               [  --disable-marks         disable document marks support])
1257 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1258               [  --disable-css           disable Cascading Style Sheet support])
1260 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1261               [  --enable-html-highlight HTML highlighting using DOM engine])
1263 dnl Everything in the tree already uses CONFIG_DOM
1264 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1265 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1267 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1268               [  --disable-backtrace     disable backtrace support])
1270 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1271               [  --enable-no-root        enable prevention of usage by root])
1274 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1275               [  --enable-debug          enable leak debug and internal error checking])
1277 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1278               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1280 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1281               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1283 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1284               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1286 AC_ARG_ENABLE(weehoofooboomookerchoo,
1287               [
1288     Also check out the features.conf file for more information about features!
1289               ],
1290               [AC_MSG_ERROR(Are you strange, or what?)])
1293 dnl == EMX hack
1295 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1296 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1299 dnl ===================================================================
1300 dnl Export directory paths
1301 dnl ===================================================================
1303 # Set up the ``entry points'' if they were not supplied by builder
1304 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1305 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1307 # Create CONFDIR #define for config.h
1309 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1310 # it's autoconf fault to force us to do such hacks ;p.
1311 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1312   # sysconfdir is set to its default value... fine, let's append /elinks/
1313   # XXX: We can't modify listing of the default in ./configure --help :-(
1314   sysconfdir_n=`eval echo "$sysconfdir"`
1315   sysconfdir=$sysconfdir_n
1316   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1317         sysconfdir="$sysconfdir/elinks"
1320 CONFDIR=$sysconfdir
1321 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1322 AC_SUBST(CONFDIR)
1324 # Create LOCALEDIR #define for config.h
1325 LOCALEDIR=`eval echo "$datadir/locale"`
1326 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1327 AC_SUBST(LOCALEDIR)
1329 # Create LIBDIR #define for config.h
1330 LIBDIR=`eval echo "$libdir"`
1331 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1332 AC_SUBST(LIBDIR)
1334 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1335 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1337 dnl ===================================================================
1338 dnl A little fine tuning of gcc specific options (continued)
1339 dnl ===================================================================
1341 if test "x$ac_cv_prog_gcc" = "xyes"; then
1342   if test "$CONFIG_DEBUG" = "yes"; then
1343     dnl We want to see all warnings and live with none (in debug mode).
1344     CFLAGS="$CFLAGS -Werror"
1345   fi
1347   case "`$CC -dumpversion`" in
1348     3.0|3.1|3.2)
1349       # These should be ok using -Werror
1350       ;;
1351     3.*)
1352       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1353       # "dereferencing type-punned pointer will break strict-aliasing rules"
1354       # warnings. Disable them by not doing any strict-aliasing. The
1355       # alternative is just too ugly. Thanks gcc guys!! ;)
1356       CFLAGS="$CFLAGS -fno-strict-aliasing"
1357       ;;
1358     4.*)
1359       # Do not show warnings related to (char * | unsigned char *) type
1360       # difference.
1361       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1362       ;;
1363     *)
1364       # These should be ok using -Werror
1365       ;;
1366   esac
1369 # CFLAGS doesn't contain all compile flags. Some will be added only when
1370 # needed in the respective source directory. To get all compile flags
1371 # easily just add CPPFLAGS.
1372 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1374 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1375 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1377 dnl ===================================================================
1378 dnl Colored make output
1379 dnl ===================================================================
1381 if test $(`which tput` colors) -ge 4; then
1382         MAKE_COLOR=1
1383         AC_SUBST(MAKE_COLOR)
1386 dnl ===================================================================
1387 dnl Generated files
1388 dnl ===================================================================
1390 AC_OUTPUT([ \
1391  Makefile.config \
1392  contrib/elinks.spec \
1393  contrib/lua/hooks.lua \
1394  contrib/conv/w3m2links.awk \
1395  doc/man/man1/elinks.1 \
1396  src/intl/gettext/ref-add.sed \
1397  src/intl/gettext/ref-del.sed
1400 abs_srcdir="$(cd "$srcdir" && pwd)"
1401 # builddir is always absolute!
1402 if test "$abs_srcdir" != "$builddir"; then
1403         # Bootstrap the Makefile creation
1404         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1405         "$MAKE" "SRC=$abs_srcdir" init
1407         # Make cg-status ignore this build directory
1408         echo "*" > "$builddir/.gitignore"
1411 dnl ===================================================================
1412 dnl Configuration summary
1413 dnl ===================================================================
1415 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1416 cat features.log