Minor fixes in french translation.
[elinks.git] / configure.in
blobcb2cd8e1e6f06d7c2e3ff08e08809ed2635b71ef
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(wctype.h)
172 AC_CHECK_HEADERS(fcntl.h limits.h time.h unistd.h)
173 AC_CHECK_HEADERS(sigaction.h)
174 AC_CHECK_HEADERS(arpa/inet.h)
175 AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
176 AC_CHECK_HEADERS(net/if.h netdb.h netinet/in.h netinet/in6_var.h)
177 AC_CHECK_HEADERS(ifaddrs.h)
178 AC_CHECK_HEADERS(sys/cygwin.h io.h)
179 AC_CHECK_HEADERS(sys/fmutex.h)
180 AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
181 AC_CHECK_HEADERS(sys/resource.h)
182 AC_CHECK_HEADERS(sys/select.h)
183 AC_CHECK_HEADERS(sys/signal.h)
184 AC_CHECK_HEADERS(sys/socket.h)
185 AC_CHECK_HEADERS(sys/time.h)
186 AC_CHECK_HEADERS(sys/utsname.h)
187 AC_CHECK_HEADERS(stdint.h inttypes.h)
188 AC_CHECK_HEADERS(locale.h pwd.h)
189 AC_CHECK_HEADERS(termios.h)
192 AC_CHECK_HEADERS(sys/un.h,
193         [CONFIG_INTERLINK=yes
194          EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
195         [CONFIG_INTERLINK=no])
196 AC_SUBST(CONFIG_INTERLINK)
198 dnl ===================================================================
199 dnl Checks for typedefs, structures, and compiler characteristics.
200 dnl ===================================================================
202 AC_STRUCT_TM
203 AC_C_CONST
204 AC_C_INLINE
205 EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
207 AC_SYS_LARGEFILE
208 AC_TYPE_SIZE_T
209 AC_TYPE_OFF_T
210 EL_CHECK_TYPE(ssize_t, int)
211 EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
212 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
213 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
214 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
216 AC_CHECK_SIZEOF(char, 1)
217 AC_CHECK_SIZEOF(short, 2)
218 AC_CHECK_SIZEOF(int, 4)
219 AC_CHECK_SIZEOF(long, 4)
220 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
222 dnl Check for variadic macros
223 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
224                 [#include <stdio.h>
225                  #define a(b,c...) printf(b,##c)],
226                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
228 dnl Check for -rdynamic
229 dnl FIXME: This check doesn't work. Something to do with the compiler
230 dnl happily ignoring it and stderr not being checked for error messages.
231 AC_MSG_CHECKING([for -rdynamic])
232 LDFLAGS_X="$LDFLAGS"
233 LDFLAGS="$LDFLAGS -rdynamic"
234 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
235 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
236 AC_MSG_RESULT($have_rdynamic)
238 dnl ===================================================================
239 dnl Check for POSIX <regex.h>
240 dnl ===================================================================
242 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
244 dnl ===================================================================
245 dnl Checks for library functions.
246 dnl ===================================================================
248 AC_PROG_GCC_TRADITIONAL
249 AC_FUNC_MEMCMP
250 AC_FUNC_MMAP
251 AC_FUNC_STRFTIME
252 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
253 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
254 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
255 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
256 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
257 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
258 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
259 AC_CHECK_FUNCS(gettimeofday clock_gettime)
261 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
263 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
264 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
265 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
267 dnl These aren't probably needed now, as they are commented in links.h.
268 dnl I've no idea about their historical background, but I keep them here
269 dnl just in the case they will help later. --pasky
270 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
271 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
272 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
273 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
275 if test x"$HAVE_RAISE" = x; then
276         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
277                 AC_ERROR([Unable to emulate raise()])
278         fi
281 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
282 AC_TRY_LINK([#include <stdarg.h>
283 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
284 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
285 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
286         EL_DEFINE(HAVE_VA_COPY, __va_copy)
289 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
290 AC_TRY_LINK([#include <unistd.h>
291 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
292 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
293 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
294         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
297 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
298 AC_TRY_RUN([
299 #include <stdio.h>
300 #include <stdarg.h>
301 #include <stdlib.h>
302 #include <string.h>
304 char buf[8];
306 int bar(char *buf, const char *format, va_list ap)
308        return vsnprintf(buf, 0, format, ap);
311 void foo(const char *format, ...) {
312        va_list ap;
313        int len;
315        va_start(ap, format);
316        len = bar(buf, format, ap);
317        va_end(ap);
318        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
320        va_start(ap, format);
321        len = bar(buf, format, ap);
322        va_end(ap);
323        if ((len != 6) && (len != 7)) exit(1);
325        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
327        exit(0);
329 main() { foo("hello\n"); }
331 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
332 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
333         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
336 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
338 dnl ===================================================================
339 dnl Checks for libraries.
340 dnl ===================================================================
342 dnl Replace `main' with a function in -lsocket:
343 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
344 if test "$cf_result" = no; then
345         AC_CHECK_LIB(socket, socket)
348 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
349 if test "$cf_result" = no; then
350         AC_CHECK_LIB(socket, setsockopt)
353 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
354 if test "$cf_result" = no; then
355         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
356         if test "$cf_result" = no; then
357                 AC_CHECK_LIB(nsl, gethostbyname)
358         else
359                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
360         fi
363 dnl ===================================================================
364 dnl Checks for packaging specific options.
365 dnl ===================================================================
367 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
368             [ if test "$withval" != no && test "$withval" != yes; then
369                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
370               fi ])
372 dnl ===================================================================
373 dnl Checks for a libraries, optional even if installed.
374 dnl ===================================================================
376 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
377 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
379         AC_MSG_CHECKING([for $2 support])
381         if test "[$]$1" != no; then
382                 AC_MSG_RESULT(yes)
383                 EL_SAVE_FLAGS
384                 if test -n "$withval" && test -d "$withval"; then
385                         # Be a little more careful when setting
386                         # include and lib directories. This way
387                         # $withval will work when includes are
388                         # there but the library is in the common
389                         # /usr/lib ... Does the right thing when
390                         # looking for gc on Debian.
391                         if test -d "$withval/include"; then
392                                 CFLAGS="$CFLAGS -I$withval/include"
393                                 CPPFLAGS="$CPPFLAGS -I$withval/include"
394                         else
395                                 CFLAGS="$CFLAGS -I$withval"
396                                 CPPFLAGS="$CPPFLAGS -I$withval"
397                         fi
398                         if test -d "$withval/lib"; then
399                                 LDFLAGS="$LDFLAGS -L$withval/lib"
400                         fi
401                 fi
403                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
404                 if test "[$]$1" = yes; then
405                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
406                 fi
408                 if test "[$]$1" = yes; then
409                         EL_CONFIG([$1], [$2])
410                         LIBS="$LIBS -l$4"
411                 else
412                         if test -n "[$]WITHVAL_$1" &&
413                            test "[$]WITHVAL_$1" != xno; then
414                                 AC_MSG_ERROR([$2 not found])
415                         fi
416                         EL_RESTORE_FLAGS
417                 fi
418         else
419                 AC_MSG_RESULT(disabled)
420         fi
423 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
424 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
426         $1=yes
427         WITHVAL_$1=
429         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
430         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
432         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
434         EL_LOG_CONFIG([$1], [$2], [])
437 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
438         [  --without-gpm           disable gpm (mouse) support])
440 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
441         [  --without-zlib          disable zlib support])
443 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
444         [  --without-bzlib         disable bzlib support])
446 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
447         [  --without-idn           disable international domain names support])
449 if test "x{with_gc}" != xno; then
450         EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
451                 [  --with-gc               enable Boehm's garbage collector])
454 EL_ARG_ENABLE(CONFIG_LZMA, lzma, [lzma],
455               [  --enable-lzma           enable lzma encoding support])
456 dnl ===================================================================
457 dnl Check for GSSAPI, optional even if installed.
458 dnl ===================================================================
460 enable_gssapi="no";
462 AC_ARG_WITH(gssapi, [  --with-gssapi           enable GSSAPI support],
463             [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
465 AC_MSG_CHECKING([for GSSAPI])
467 if test "$enable_gssapi" = "yes"; then
468         AC_MSG_RESULT(yes)
469         GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
470         GSSAPI_LIBS=`krb5-config --libs gssapi`
471         CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
472         LIBS="$GSSAPI_LIBS $LIBS"
473         EL_CONFIG(CONFIG_GSSAPI, [GssApi])
474 else
475         AC_MSG_RESULT(no)
478 AC_SUBST(CONFIG_GSSAPI)
480 dnl ===================================================================
481 dnl Bookmark and XBEL support
482 dnl ===================================================================
484 EL_SAVE_FLAGS
486 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
487               [  --disable-bookmarks     disable bookmark support])
489 # Check whether --enable-xbel or --disable-xbel was given.
490 if test "x${enable_xbel}" != xno; then
491         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
493         if test "$HAVE_LIBEXPAT" = yes; then
494                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
495                 if test "$HAVE_LIBEXPAT" = yes; then
496                         LIBS="$LIBS -lexpat"
497                 fi
498         fi
502 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
503               [XBEL bookmarks],
504               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
506 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
507         EL_RESTORE_FLAGS
510 dnl ===================================================================
511 dnl Checks for BSD sysmouse
512 dnl ===================================================================
514 HAVE_SYSMOUSE_HEADER="no"
516 # Either of these header files provides the (same) sysmouse interface
517 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
519 dnl ===================================================================
520 dnl Checks for OS/2
521 dnl ===================================================================
523 if test "$CONFIG_OS_OS2" = yes; then
524         EL_CONFIG_OS_OS2
527 dnl ===================================================================
528 dnl Checks for Win32
529 dnl ===================================================================
531 if test "$CONFIG_OS_WIN32" = yes; then
532         EL_CONFIG_OS_WIN32
535 dnl ===================================================================
536 dnl Check for SEE (Simple Ecmascript Engine)
537 dnl ===================================================================
538 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
539             [ if test "x$withval" != xno; then enable_see=yes; fi ])
541 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
542 # SEE_FLAGS but I really don't want to require people to have Guile in order
543 # to compile CVS. Also, the macro seems to be really stupid regarding searching
544 # for Guile in $PATH etc. --pasky
546 AC_MSG_CHECKING([for SEE])
548 CONFIG_ECMASCRIPT_SEE=no
550 if test "$enable_see" = "yes"; then
551         AC_MSG_RESULT(yes);
552         ## Based on the SEE_FLAGS macro.
554         if test -d "$withval"; then
555                 SEE_PATH="$withval:$PATH"
556         else
557                 SEE_PATH="$PATH"
558         fi
560         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
562         ## First, let's just see if we can find Guile at all.
563         if test "$SEE_CONFIG" != no; then
564                 cf_result="yes";
566                 SEE_LIBS="`$SEE_CONFIG --libs`"
567                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
568                 LIBS="$SEE_LIBS $LIBS"
569                 CPPFLAGS="$CPPFLAGS $SEE_CFLAGS"
570                 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
571                 AC_SUBST(SEE_CFLAGS)
572         else
573                 if test -n "$withval" && test "x$withval" != xno; then
574                         AC_MSG_ERROR([SEE not found])
575                 else
576                         AC_MSG_WARN([SEE support disabled])
577                 fi
578         fi
579 else
580         AC_MSG_RESULT(no);
584 dnl ===================================================================
585 dnl Check for SpiderMonkey, optional even if installed.
586 dnl ===================================================================
588 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
589             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
590 AC_MSG_CHECKING([for SpiderMonkey])
592 EL_SAVE_FLAGS
593 cf_result=no
595 if test -z "$disable_spidermonkey"; then
596         if test ! -d "$withval"; then
597                 withval="";
598         fi
599         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
600                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
601                         for spidermonkeylib in js smjs mozjs; do
602                                 if test "$cf_result" = no; then
603                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
605                                         if test ! -z "$spidermonkeydir"; then
606                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
607                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
608                                         fi
610                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
611                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
612                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
614                                         AC_TRY_LINK([#define XP_UNIX
615                                                      #include <jsapi.h>],
616                                                      [JS_GetImplementationVersion()],
617                                                      cf_result=yes, cf_result=no)
618                                 fi
619                         done
620                 done
621         done
624 AC_MSG_RESULT($cf_result)
625 CONFIG_SPIDERMONKEY="$cf_result"
626 EL_RESTORE_FLAGS
628 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
629    test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
630         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
631 else
632         CONFIG_ECMASCRIPT_SMJS=no
635 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
636 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
637 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
640 dnl ===================================================================
641 dnl Optional Spidermonkey-based ECMAScript browser scripting
642 dnl ===================================================================
644 AC_ARG_ENABLE(sm-scripting,
645               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
646               [if test "$enableval" != no; then enableval="yes"; fi
647                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
649 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
650    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
651         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
652 else
653         CONFIG_SCRIPTING_SPIDERMONKEY=no
656 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
657    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
658         LIBS="$LIBS $SPIDERMONKEY_LIBS"
659         AC_SUBST(SPIDERMONKEY_LIBS)
660         AC_SUBST(SPIDERMONKEY_CFLAGS)
661         AC_SUBST(CONFIG_SPIDERMONKEY)
664 dnl ===================================================================
665 dnl Check for Guile, optional even if installed.
666 dnl ===================================================================
668 enable_guile="no";
670 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
671             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
673 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
674 # GUILE_FLAGS but I really don't want to require people to have Guile in order
675 # to compile CVS. Also, the macro seems to be really stupid regarding searching
676 # for Guile in $PATH etc. --pasky
678 AC_MSG_CHECKING([for Guile])
680 if test "$enable_guile" = "yes"; then
681         AC_MSG_RESULT(yes);
682         ## Based on the GUILE_FLAGS macro.
684         if test -d "$withval"; then
685                 GUILE_PATH="$withval:$PATH"
686         else
687                 GUILE_PATH="$PATH"
688         fi
690         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
692         ## First, let's just see if we can find Guile at all.
693         if test "$GUILE_CONFIG" != no; then
694                 cf_result="yes";
696                 GUILE_LIBS="`guile-config link`"
697                 GUILE_CFLAGS="`guile-config compile`"
698                 LIBS="$GUILE_LIBS $LIBS"
699                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
700                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
701                 AC_SUBST(GUILE_CFLAGS)
702                 cat <<EOF
703 ***********************************************************************
704 The Guile support is incomplete and not so well integrated to ELinks
705 yet. That means, e.g., that you have no Guile console and there might
706 not be all the necessary hooks. Also, the Guile interface is not too
707 well tested (success stories heartily welcomed!).  See
708 src/scripting/guile/README for further details and hints.
709 ***********************************************************************
711         else
712                 if test -n "$withval" && test "x$withval" != xno; then
713                         AC_MSG_ERROR([Guile not found])
714                 else
715                         AC_MSG_WARN([Guile support disabled])
716                 fi
717         fi
718 else
719         AC_MSG_RESULT(no);
722 dnl ===================================================================
723 dnl Check for Perl
724 dnl ===================================================================
725 enable_perl="no";
727 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
728             [
729 if test "$withval" = yes; then
730         # FIXME: If withval is a valid directory append it to PATH
731         # so that you can specify one of several perl installations.
732         withval="";
733         enable_perl=yes;
735             ])
737 AC_MSG_CHECKING([for Perl])
739 cf_result=no
741 EL_SAVE_FLAGS
743 if test "$enable_perl" = "yes"; then
744         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
745         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
746         LIBS="$PERL_LIBS $LIBS"
747         CFLAGS="$PERL_CFLAGS $CFLAGS"
748         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
749         AC_TRY_LINK([
750 #include <EXTERN.h>
751 #include <perl.h>
752 #include <perlapi.h>
754                     [PerlInterpreter *my_perl = perl_alloc();],
755                     cf_result=yes, cf_result=no)
758 if test "$cf_result" != "yes"; then
759         EL_RESTORE_FLAGS
760 else
761         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
763         CFLAGS="$CFLAGS_X"
764         AC_SUBST(PERL_LIBS)
765         AC_SUBST(PERL_CFLAGS)
768 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
769 dnl ===================================================================
770 dnl Check for Python
771 dnl ===================================================================
772 enable_python="no";
774 AC_ARG_WITH(python, [  --with-python=[DIR]     enable Python support],
775             [ if test "x$withval" != xno; then enable_python=yes; fi ])
777 EL_SAVE_FLAGS
778 cf_result=no
780 AC_MSG_CHECKING([for Python])
782 if test "$enable_python" = "yes"; then
783         AC_MSG_RESULT(yes);
785         if test -d "$withval"; then
786                 PYTHON_PATH="$withval:$PATH"
787         else
788                 PYTHON_PATH="$PATH"
789         fi
791         AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
793         if test "$PYTHON" != no; then
794                 cf_result="yes";
796                 PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
797                 PYTHON_LIBS="`$PYTHON -c 'from distutils import sysconfig; var = sysconfig.get_config_var; print "%s %s %s -L%s -lpython%s" % (var("LINKFORSHARED"), var("LIBS"), var("SYSLIBS"), var("LIBPL"), var("VERSION"))'`"
798                 LIBS="$PYTHON_LIBS $LIBS"
799                 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
800                 AC_TRY_LINK([#include <Python.h>],
801                     [Py_Initialize();],
802                     cf_result=yes, cf_result=no)
804                 if test "$cf_result" != "yes"; then
805                         EL_RESTORE_FLAGS
806                 else
807                         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
808                         AC_SUBST(PYTHON_LIBS)
809                         AC_SUBST(PYTHON_CFLAGS)
810                         cat <<EOF
811 ***********************************************************************
812 The Python support is incomplete and not so well integrated to ELinks
813 yet. That means, e.g.., that you have no Python console and there might
814 not be all the necessary hooks. Also, the Python interface is not too
815 well tested (success stories heartily welcomed!).
816 ***********************************************************************
818                 fi
819         else
820                 if test -n "$withval" && test "x$withval" != xno; then
821                         AC_MSG_ERROR([Python not found])
822                 else
823                         AC_MSG_WARN([Python support disabled])
824                 fi
825         fi
826 else
827         AC_MSG_RESULT(no);
831 dnl ===================================================================
832 dnl Check for Lua, optional even if installed.
833 dnl ===================================================================
835 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
836 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
838 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
839             [if test "$withval" = no; then disable_lua=yes; fi])
840 AC_MSG_CHECKING([for Lua])
842 EL_SAVE_FLAGS
843 cf_result=no
845 if test -z "$disable_lua"; then
846         if test ! -d "$withval"; then
847                 withval="";
848         fi
849         for luadir in "$withval" "" /usr /usr/local; do
850                 for suffix in "" 50 51; do
851                         if test "$cf_result" = no; then
852                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
854                                 if test ! -z "$luadir"; then
855                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
856                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
857                                 fi
859                                 LIBS="$LUA_LIBS $LIBS_X"
860                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
861                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
863                                 # Check that it is a compatible Lua version
864                                 AC_TRY_LINK([   #include <lua.h>
865                                                 #include <lualib.h>],
866                                             [   lua_State *L = lua_open();
867                                                 luaopen_base(L);
868                                                 luaopen_table(L);
869                                                 luaopen_io(L);
870                                                 luaopen_string(L);
871                                                 luaopen_math(L);
872                                                 lua_pushboolean(L, 1);
873                                                 lua_close(L);],
874                                             cf_result=yes, cf_result=no)
875                         fi
876                 done
877         done
880 AC_MSG_RESULT($cf_result)
882 if test "$cf_result" != yes; then
883         EL_RESTORE_FLAGS
884 else
885         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
886         AC_CHECK_HEADERS(lauxlib.h)
888         CFLAGS="$CFLAGS_X"
889         AC_SUBST(LUA_LIBS)
890         AC_SUBST(LUA_CFLAGS)
894 dnl ===================================================================
895 dnl Check for Ruby, optional even if installed.
896 dnl ===================================================================
898 EL_CONFIG_SCRIPTING_RUBY
900 dnl ===================================================================
901 dnl Setup global scripting
902 dnl ===================================================================
904 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])
905 AC_SUBST(CONFIG_SCRIPTING_GUILE)
906 AC_SUBST(CONFIG_SCRIPTING_LUA)
907 AC_SUBST(CONFIG_SCRIPTING_PERL)
908 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
909 AC_SUBST(CONFIG_SCRIPTING_RUBY)
910 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
911 AC_SUBST(CONFIG_SCRIPTING)
914 dnl ===================================================================
915 dnl Check for SSL support.
916 dnl ===================================================================
918 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
919 dnl is enabled, we won't try to use OpenSSL anymore.
921 dnl For wiping SSL hooks..
922 #ifdef CONFIG_SSL
924 disable_openssl=""
925 disable_gnutls=""
926 enable_gnutls=""
928 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
929             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
930 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
931             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
932 gnutls_withval="$withval"
934 if test "$enable_gnutls" = yes; then
935         disable_openssl=yes;
938 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
939             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
940 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
941 openssl_withval="$withval"
943 dnl ---- OpenSSL
945 AC_MSG_CHECKING([for OpenSSL])
947 EL_SAVE_FLAGS
948 cf_result="no"
950 if test "$disable_openssl" = yes; then
951         cf_result="not used"
952 else
953         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
954                          /usr/lib/openssl /usr/local/ssl \
955                          /usr/local/www /usr/lib/ssl /usr/local \
956                          /usr/pkg /opt /opt/openssl; do
957                 if test "$cf_result" = no; then
958                         if test -d "$ssldir"; then
959                                 OPENSSL_CFLAGS="-I$ssldir/include"
960                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
961                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
962                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
963 #                               # FIXME: This created serious portability problems. --pasky
964 #                               if test "$CC" == "gcc"; then
965 #                                       # I'm not sure about compatibility here. --pasky
966 #                                       LIBS="$LIBS -R$ssldir/lib"
967 #                               fi
968                         else
969                                 LIBS="-lssl -lcrypto $LIBS_X"
970                         fi
971                         AC_TRY_LINK([#include <openssl/ssl.h>],
972                                     [OpenSSL_add_all_algorithms()],
973                                     cf_result=yes, cf_result=no)
974                         if test "$cf_result" != yes; then
975                                 AC_TRY_LINK([#include <openssl/ssl.h>],
976                                             [SSLeay_add_ssl_algorithms()],
977                                             cf_result=yes, cf_result=no)
978                         fi
979                 fi
980         done
982         if test "$cf_result" != yes; then
983                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
984                         AC_MSG_ERROR([OpenSSL not found])
985                 fi
986                 EL_RESTORE_FLAGS
987         else
988                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
990                 CFLAGS="$CFLAGS_X"
991                 AC_SUBST(OPENSSL_CFLAGS)
992         fi
995 AC_MSG_RESULT($cf_result)
997 CONFIG_GNUTLS_OPENSSL_COMPAT=no
998 dnl ---- GNU TLS
999 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
1000 dnl it looks ugly then.
1002 if test "$cf_result" = yes; then
1003         cf_result="not used"
1005 else
1006         EL_SAVE_FLAGS
1007         cf_result="no"
1009         if test -z "$disable_gnutls"; then
1010                 # Sure, we maybe _could_ use their macro, but how to ensure
1011                 # that the ./configure script won't fail if the macro won't be
1012                 # found..? :( --pasky
1014                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
1016                 if test -d "$gnutls_withval"; then
1017                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1018                 fi
1020                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1022                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1023                         cf_result=no
1024                 else
1025                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1026                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1028                         LIBS="$GNUTLS_LIBS $LIBS_X"
1029                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1030                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1032                         # Verify if it's really usable.  gnutls_session was
1033                         # renamed to gnutls_session_t before GNU TLS 1.2.0
1034                         # (on 2004-06-13); ELinks now requires this.
1035                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
1036                                     [gnutls_session_t dummy;
1037                                      gnutls_check_version(NULL)],
1038                                     cf_result=yes, cf_result=no)
1039                 fi
1041                 if test "$cf_result" = yes; then
1042                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1044                         CFLAGS="$CFLAGS_X"
1045                         AC_SUBST(GNUTLS_CFLAGS)
1047                         # Verify if the MD5 compatibility layer is usable.
1048                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1049                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1050                                                   [GNU TLS OpenSSL compatibility],
1051                                                   gnutls/openssl.h, gnutls-openssl,
1052                                                   MD5_Init)
1053                 else
1054                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1055                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1056                         fi
1057                         EL_RESTORE_FLAGS
1058                 fi
1059         fi
1062 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1063 AC_MSG_RESULT($cf_result)
1065 dnl Final SSL setup
1067 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1068 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1069 AC_SUBST(CONFIG_OPENSSL)
1070 AC_SUBST(CONFIG_GNUTLS)
1072 #endif
1074 AC_MSG_CHECKING([whether to be or not to be])
1075 AC_MSG_RESULT([needs to be determined experimentally])
1077 dnl ===================================================================
1078 dnl Check for IPv6 support and related functions.
1079 dnl ===================================================================
1081 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1082 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1083 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1085 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1086 if test "$HAVE_GETADDRINFO" != yes; then
1087         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1088         if test "$HAVE_GETADDRINFO" = yes; then
1089                 LIBS="$LIBS -linet6"
1090         fi
1094 dnl ===================================================================
1095 dnl Checking for X11 (window title restoring).
1096 dnl ===================================================================
1098 AC_PATH_X
1099 if test x"$no_x" != xyes; then
1100         if test -n "$x_includes"; then
1101                 X_CFLAGS="-I$x_includes"
1102                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1103         fi
1104         if test -n "$x_libraries"; then
1105                 LDFLAGS="$LDFLAGS -L$x_libraries"
1106         fi
1107         LIBS="-lX11 $LIBS"
1108         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1109         AC_SUBST(X_CFLAGS)
1113 dnl ===================================================================
1114 dnl Backtraces displaying support.
1115 dnl ===================================================================
1117 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1118 # possible checks for other system-specific means go here
1121 dnl ===================================================================
1122 dnl SMB protocol support.
1123 dnl ===================================================================
1125 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1128 dnl ===================================================================
1129 dnl Gettext grey zone. Beware.
1130 dnl ===================================================================
1132 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"
1134 AM_GNU_GETTEXT
1136 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1137 dnl # f33r d4 l33t... I hope it's portable. :)
1138 dnl cf_result=$((48#z - 48#a + 1));
1139 dnl AC_MSG_RESULT($cf_result)
1142 dnl ===================================================================
1143 dnl Compile-time features control
1144 dnl ===================================================================
1146 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1147               [  --disable-cookies       disable cookie support])
1149 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1150               [  --disable-formhist      disable form history support])
1152 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1153               [  --disable-globhist      disable global history support])
1156 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1157               [  --disable-mailcap       disable mailcap support])
1159 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1160               [  --disable-mimetypes     disable mimetypes files support])
1163 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1164               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1165               [IPv6],
1166               [  --disable-ipv6          disable IPv6 support])
1168 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1169               [  --enable-bittorrent     enable BitTorrent protocol support])
1171 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1172               [  --disable-data          disable data protocol support])
1174 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1175               [  --disable-uri-rewrite   disable URI rewrite support])
1177 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1178               [  --enable-cgi            enable local CGI support])
1180 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1181               [  --enable-finger         enable finger protocol support])
1183 dnl ===================================================================
1184 dnl FSP protocol
1185 dnl ===================================================================
1186 EL_SAVE_FLAGS
1188 if test "x${enable_fsp}" != xno; then
1189         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1191         if test "$HAVE_FSPLIB" = yes; then
1192                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1193                 if test "$HAVE_FSPLIB" = yes; then
1194                         LIBS="$LIBS -lfsplib"
1195                 else
1196                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1197                         if test "$HAVE_FSPLIB" = yes; then
1198                                 LIBS="$LIBS -lfsp"
1199                         fi
1200                 fi
1201         fi
1204 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1205               [  --enable-fsp            enable FSP protocol support])
1207 if test "x$CONFIG_FSP" = xno; then
1208         EL_RESTORE_FLAGS
1211 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1212               [  --disable-ftp           disable ftp protocol support])
1214 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1215               [  --enable-gopher         enable gopher protocol support])
1217 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1218               [  --enable-nntp           enable nntp protocol support])
1220 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1221               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1224 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1225               [  --disable-mouse         disable mouse support])
1227 # GPM mouse is Linux specific, so ...
1228 CONFIG_SYSMOUSE=yes
1229 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1230               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1231               [BSD sysmouse],
1232               [  --disable-sysmouse      disable BSD sysmouse support])
1234 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1235               [  --enable-88-colors      enable 88 color support])
1237 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1238               [  --enable-256-colors     enable 256 color support])
1241 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1242               [  --enable-exmode         enable exmode (CLI) interface])
1244 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1245               [  --disable-leds          disable LEDs support])
1247 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1248               [  --disable-marks         disable document marks support])
1251 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1252               [  --disable-css           disable Cascading Style Sheet support])
1254 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1255               [  --enable-html-highlight HTML highlighting using DOM engine])
1257 dnl Everything in the tree already uses CONFIG_DOM
1258 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1259 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1261 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1262               [  --disable-backtrace     disable backtrace support])
1264 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1265               [  --enable-no-root        enable prevention of usage by root])
1268 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1269               [  --enable-debug          enable leak debug and internal error checking])
1271 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1272               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1274 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1275               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1277 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1278               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1280 EL_ARG_ENABLE(CONFIG_UTF_8, utf-8, [UTF-8],
1281               [  --enable-utf-8          enable UTF-8 support])
1284 AC_ARG_ENABLE(weehoofooboomookerchoo,
1285               [
1286     Also check out the features.conf file for more information about features!
1287               ],
1288               [AC_MSG_ERROR(Are you strange, or what?)])
1291 dnl == EMX hack
1293 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1294 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1297 dnl ===================================================================
1298 dnl Export directory paths
1299 dnl ===================================================================
1301 # Set up the ``entry points'' if they were not supplied by builder
1302 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1303 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1305 # Create CONFDIR #define for config.h
1307 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1308 # it's autoconf fault to force us to do such hacks ;p.
1309 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1310   # sysconfdir is set to its default value... fine, let's append /elinks/
1311   # XXX: We can't modify listing of the default in ./configure --help :-(
1312   sysconfdir_n=`eval echo "$sysconfdir"`
1313   sysconfdir=$sysconfdir_n
1314   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1315         sysconfdir="$sysconfdir/elinks"
1318 CONFDIR=$sysconfdir
1319 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1320 AC_SUBST(CONFDIR)
1322 # Create LOCALEDIR #define for config.h
1323 LOCALEDIR=`eval echo "$datadir/locale"`
1324 while echo "$LOCALEDIR" | grep "\\$"
1326         LOCALEDIR=`eval echo "$LOCALEDIR"`
1327 done > /dev/null 2> /dev/null
1328 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1329 AC_SUBST(LOCALEDIR)
1331 # Create LIBDIR #define for config.h
1332 LIBDIR=`eval echo "$libdir"`
1333 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1334 AC_SUBST(LIBDIR)
1336 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1337 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1339 dnl ===================================================================
1340 dnl A little fine tuning of gcc specific options (continued)
1341 dnl ===================================================================
1343 if test "x$ac_cv_prog_gcc" = "xyes"; then
1344   if test "$CONFIG_DEBUG" = "yes"; then
1345     dnl We want to see all warnings and live with none (in debug mode).
1346     CFLAGS="$CFLAGS -Werror"
1347   fi
1349   case "`$CC -dumpversion`" in
1350     3.0|3.1|3.2)
1351       # These should be ok using -Werror
1352       ;;
1353     3.*)
1354       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1355       # "dereferencing type-punned pointer will break strict-aliasing rules"
1356       # warnings. Disable them by not doing any strict-aliasing. The
1357       # alternative is just too ugly. Thanks gcc guys!! ;)
1358       CFLAGS="$CFLAGS -fno-strict-aliasing"
1359       ;;
1360     4.*)
1361       # Do not show warnings related to (char * | unsigned char *) type
1362       # difference.
1363       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1364       ;;
1365     *)
1366       # These should be ok using -Werror
1367       ;;
1368   esac
1371 # CFLAGS doesn't contain all compile flags. Some will be added only when
1372 # needed in the respective source directory. To get all compile flags
1373 # easily just add CPPFLAGS.
1374 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1376 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1377 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1379 dnl ===================================================================
1380 dnl Colored make output
1381 dnl ===================================================================
1383 if test $(`which tput` colors) -ge 4; then
1384         MAKE_COLOR=1
1385         AC_SUBST(MAKE_COLOR)
1388 dnl ===================================================================
1389 dnl Generated files
1390 dnl ===================================================================
1392 AC_OUTPUT([ \
1393  Makefile.config \
1394  contrib/elinks.spec \
1395  contrib/lua/hooks.lua \
1396  contrib/conv/w3m2links.awk \
1397  doc/man/man1/elinks.1 \
1398  src/intl/gettext/ref-add.sed \
1399  src/intl/gettext/ref-del.sed
1402 abs_srcdir="$(cd "$srcdir" && pwd)"
1403 # builddir is always absolute!
1404 if test "$abs_srcdir" != "$builddir"; then
1405         # Bootstrap the Makefile creation
1406         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1407         "$MAKE" "SRC=$abs_srcdir" init
1409         # Make cg-status ignore this build directory
1410         echo "*" > "$builddir/.gitignore"
1413 dnl ===================================================================
1414 dnl Configuration summary
1415 dnl ===================================================================
1417 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1418 cat features.log