add_accesskey_to_string: Add the Alt modifier to the string, too.
[elinks.git] / configure.in
blob884f1e49dd74fb45f7f07b7624bf641150102e84
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_SYS_TYPE(off_t, HAVE_OFF_T, [])
213 EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
214 EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
215 EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
217 AC_CHECK_SIZEOF(char, 1)
218 AC_CHECK_SIZEOF(short, 2)
219 AC_CHECK_SIZEOF(int, 4)
220 AC_CHECK_SIZEOF(long, 4)
221 test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
222 test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
224 dnl Check for variadic macros
225 EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
226                 [#include <stdio.h>
227                  #define a(b,c...) printf(b,##c)],
228                 [a("foo");a("%s","bar");a("%s%s","baz","quux");])
230 dnl Check for -rdynamic
231 dnl FIXME: This check doesn't work. Something to do with the compiler
232 dnl happily ignoring it and stderr not being checked for error messages.
233 AC_MSG_CHECKING([for -rdynamic])
234 LDFLAGS_X="$LDFLAGS"
235 LDFLAGS="$LDFLAGS -rdynamic"
236 AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
237 test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
238 AC_MSG_RESULT($have_rdynamic)
240 dnl ===================================================================
241 dnl Check for POSIX <regex.h>
242 dnl ===================================================================
244 EL_CHECK_SYS_TYPE(regex_t, HAVE_REGEX_H, [#include <regex.h>])
246 dnl ===================================================================
247 dnl Checks for library functions.
248 dnl ===================================================================
250 AC_PROG_GCC_TRADITIONAL
251 AC_FUNC_MEMCMP
252 AC_FUNC_MMAP
253 AC_FUNC_STRFTIME
254 AC_CHECK_FUNCS(cfmakeraw gethostbyaddr herror strerror)
255 AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
256 AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
257 AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
258 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
259 AC_CHECK_FUNCS(getifaddrs getpwnam inet_pton inet_ntop)
260 AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
261 AC_CHECK_FUNCS(gettimeofday clock_gettime)
263 AC_HAVE_FUNCS(cygwin_conv_to_full_win32_path)
265 AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
266 AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
267 AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
269 dnl These aren't probably needed now, as they are commented in links.h.
270 dnl I've no idea about their historical background, but I keep them here
271 dnl just in the case they will help later. --pasky
272 AC_CHECK_FUNCS(getpid, HAVE_GETPID=yes)
273 AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
274 AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
275 AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
277 if test x"$HAVE_RAISE" = x; then
278         if test x"$HAVE_KILL" = x || test x"$HAVE_GETPID" = x; then
279                 AC_ERROR([Unable to emulate raise()])
280         fi
283 AC_CACHE_CHECK([for __va_copy],el_cv_HAVE_VA_COPY,[
284 AC_TRY_LINK([#include <stdarg.h>
285 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
286 el_cv_HAVE_VA_COPY=yes,el_cv_HAVE_VA_COPY=no)])
287 if test x"$el_cv_HAVE_VA_COPY" = x"yes"; then
288         EL_DEFINE(HAVE_VA_COPY, __va_copy)
291 AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
292 AC_TRY_LINK([#include <unistd.h>
293 ], [int page_size = sysconf(_SC_PAGE_SIZE);],
294 el_cv_HAVE_SC_PAGE_SIZE=yes,el_cv_HAVE_SC_PAGE_SIZE=no)])
295 if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
296         EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
299 AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
300 AC_TRY_RUN([
301 #include <stdio.h>
302 #include <stdarg.h>
303 #include <stdlib.h>
304 #include <string.h>
306 char buf[8];
308 int bar(char *buf, const char *format, va_list ap)
310        return vsnprintf(buf, 0, format, ap);
313 void foo(const char *format, ...) {
314        va_list ap;
315        int len;
317        va_start(ap, format);
318        len = bar(buf, format, ap);
319        va_end(ap);
320        if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
322        va_start(ap, format);
323        len = bar(buf, format, ap);
324        va_end(ap);
325        if ((len != 6) && (len != 7)) exit(1);
327        if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
329        exit(0);
331 main() { foo("hello\n"); }
333 el_cv_HAVE_C99_VSNPRINTF=yes,el_cv_HAVE_C99_VSNPRINTF=no,el_cv_HAVE_C99_VSNPRINTF=cross)])
334 if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
335         EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
338 AC_CHECK_LIB(dl, dlopen) # OpenSSL and Lua frequently needs it
340 dnl ===================================================================
341 dnl Checks for libraries.
342 dnl ===================================================================
344 dnl Replace `main' with a function in -lsocket:
345 AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
346 if test "$cf_result" = no; then
347         AC_CHECK_LIB(socket, socket)
350 AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
351 if test "$cf_result" = no; then
352         AC_CHECK_LIB(socket, setsockopt)
355 AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
356 if test "$cf_result" = no; then
357         AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
358         if test "$cf_result" = no; then
359                 AC_CHECK_LIB(nsl, gethostbyname)
360         else
361                 test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
362         fi
365 dnl ===================================================================
366 dnl Checks for packaging specific options.
367 dnl ===================================================================
369 AC_ARG_WITH(xterm, [  --with-xterm            how to invoke the X terminal emulator],
370             [ if test "$withval" != no && test "$withval" != yes; then
371                 AC_DEFINE_UNQUOTED(XTERM, "$withval", [How to invoke XTerm])
372               fi ])
374 dnl ===================================================================
375 dnl Checks for a libraries, optional even if installed.
376 dnl ===================================================================
378 dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
379 AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
381         AC_MSG_CHECKING([for $2 support])
383         if test "[$]$1" != no; then
384                 AC_MSG_RESULT(yes)
385                 EL_SAVE_FLAGS
386                 if test -n "$withval" && test -d "$withval"; then
387                         # Be a little more careful when setting
388                         # include and lib directories. This way
389                         # $withval will work when includes are
390                         # there but the library is in the common
391                         # /usr/lib ... Does the right thing when
392                         # looking for gc on Debian.
393                         if test -d "$withval/include"; then
394                                 CFLAGS="$CFLAGS -I$withval/include"
395                                 CPPFLAGS="$CPPFLAGS -I$withval/include"
396                         else
397                                 CFLAGS="$CFLAGS -I$withval"
398                                 CPPFLAGS="$CPPFLAGS -I$withval"
399                         fi
400                         if test -d "$withval/lib"; then
401                                 LDFLAGS="$LDFLAGS -L$withval/lib"
402                         fi
403                 fi
405                 AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
406                 if test "[$]$1" = yes; then
407                         AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
408                 fi
410                 if test "[$]$1" = yes; then
411                         EL_CONFIG([$1], [$2])
412                         LIBS="$LIBS -l$4"
413                 else
414                         if test -n "[$]WITHVAL_$1" &&
415                            test "[$]WITHVAL_$1" != xno; then
416                                 AC_MSG_ERROR([$2 not found])
417                         fi
418                         EL_RESTORE_FLAGS
419                 fi
420         else
421                 AC_MSG_RESULT(disabled)
422         fi
425 dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
426 AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
428         $1=yes
429         WITHVAL_$1=
431         AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
432         if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
434         EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
436         EL_LOG_CONFIG([$1], [$2], [])
439 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
440         [  --without-gpm           disable gpm (mouse) support])
442 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzdopen,
443         [  --without-zlib          disable zlib support])
445 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
446         [  --without-bzlib         disable bzlib support])
448 EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN, idn, idna.h, idn, stringprep_check_version,
449         [  --without-idn           disable international domain names support])
451 if test "x{with_gc}" != xno; then
452         EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GC, gc, gc.h, gc, GC_init,
453                 [  --with-gc               enable Boehm's garbage collector])
456 EL_ARG_ENABLE(CONFIG_LZMA, lzma, [lzma],
457               [  --enable-lzma           enable lzma encoding support])
458 dnl ===================================================================
459 dnl Check for GSSAPI, optional even if installed.
460 dnl ===================================================================
462 enable_gssapi="no";
464 AC_ARG_WITH(gssapi, [  --with-gssapi           enable GSSAPI support],
465             [ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
467 AC_MSG_CHECKING([for GSSAPI])
469 if test "$enable_gssapi" = "yes"; then
470         AC_MSG_RESULT(yes)
471         GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
472         GSSAPI_LIBS=`krb5-config --libs gssapi`
473         CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
474         LIBS="$GSSAPI_LIBS $LIBS"
475         EL_CONFIG(CONFIG_GSSAPI, [GssApi])
476 else
477         AC_MSG_RESULT(no)
480 AC_SUBST(CONFIG_GSSAPI)
482 dnl ===================================================================
483 dnl Bookmark and XBEL support
484 dnl ===================================================================
486 EL_SAVE_FLAGS
488 EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
489               [  --disable-bookmarks     disable bookmark support])
491 # Check whether --enable-xbel or --disable-xbel was given.
492 if test "x${enable_xbel}" != xno; then
493         AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
495         if test "$HAVE_LIBEXPAT" = yes; then
496                 AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
497                 if test "$HAVE_LIBEXPAT" = yes; then
498                         LIBS="$LIBS -lexpat"
499                 fi
500         fi
504 EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
505               [XBEL bookmarks],
506               [  --disable-xbel          disable XBEL bookmark support (requires expat)])
508 if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
509         EL_RESTORE_FLAGS
512 dnl ===================================================================
513 dnl Checks for BSD sysmouse
514 dnl ===================================================================
516 HAVE_SYSMOUSE_HEADER="no"
518 # Either of these header files provides the (same) sysmouse interface
519 AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
521 dnl ===================================================================
522 dnl Checks for OS/2
523 dnl ===================================================================
525 if test "$CONFIG_OS_OS2" = yes; then
526         EL_CONFIG_OS_OS2
529 dnl ===================================================================
530 dnl Checks for Win32
531 dnl ===================================================================
533 if test "$CONFIG_OS_WIN32" = yes; then
534         EL_CONFIG_OS_WIN32
537 dnl ===================================================================
538 dnl Check for SEE (Simple Ecmascript Engine)
539 dnl ===================================================================
540 AC_ARG_WITH(see, [  --with-see              enable Simple Ecmascript Engine (SEE) support],
541             [ if test "x$withval" != xno; then enable_see=yes; fi ])
543 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
544 # SEE_FLAGS but I really don't want to require people to have Guile in order
545 # to compile CVS. Also, the macro seems to be really stupid regarding searching
546 # for Guile in $PATH etc. --pasky
548 AC_MSG_CHECKING([for SEE])
550 CONFIG_ECMASCRIPT_SEE=no
552 if test "$enable_see" = "yes"; then
553         AC_MSG_RESULT(yes);
554         ## Based on the SEE_FLAGS macro.
556         if test -d "$withval"; then
557                 SEE_PATH="$withval:$PATH"
558         else
559                 SEE_PATH="$PATH"
560         fi
562         AC_PATH_PROG(SEE_CONFIG, libsee-config, no, $SEE_PATH)
564         ## First, let's just see if we can find Guile at all.
565         if test "$SEE_CONFIG" != no; then
566                 cf_result="yes";
568                 SEE_LIBS="`$SEE_CONFIG --libs`"
569                 SEE_CFLAGS="`$SEE_CONFIG --cppflags`"
570                 LIBS="$SEE_LIBS $LIBS"
571                 CPPFLAGS="$CPPFLAGS $SEE_CFLAGS"
572                 EL_CONFIG(CONFIG_ECMASCRIPT_SEE, [SEE])
573                 AC_SUBST(SEE_CFLAGS)
574         else
575                 if test -n "$withval" && test "x$withval" != xno; then
576                         AC_MSG_ERROR([SEE not found])
577                 else
578                         AC_MSG_WARN([SEE support disabled])
579                 fi
580         fi
581 else
582         AC_MSG_RESULT(no);
586 dnl ===================================================================
587 dnl Check for SpiderMonkey, optional even if installed.
588 dnl ===================================================================
590 AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey Mozilla JavaScript engine support],
591             [if test "$withval" = no; then disable_spidermonkey=yes; fi])
592 AC_MSG_CHECKING([for SpiderMonkey])
594 EL_SAVE_FLAGS
595 cf_result=no
597 if test -z "$disable_spidermonkey"; then
598         if test ! -d "$withval"; then
599                 withval="";
600         fi
601         for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
602                 for spidermonkeyinclude in "/include" "/include/js" "/include/smjs" "/include/mozjs"; do
603                         for spidermonkeylib in js smjs mozjs; do
604                                 if test "$cf_result" = no; then
605                                         SPIDERMONKEY_LIBS="-l$spidermonkeylib"
607                                         if test ! -z "$spidermonkeydir"; then
608                                                 SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
609                                                 SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
610                                         fi
612                                         LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
613                                         CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
614                                         CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
616                                         AC_TRY_LINK([#define XP_UNIX
617                                                      #include <jsapi.h>],
618                                                      [JS_GetImplementationVersion()],
619                                                      cf_result=yes, cf_result=no)
620                                 fi
621                         done
622                 done
623         done
626 AC_MSG_RESULT($cf_result)
627 CONFIG_SPIDERMONKEY="$cf_result"
628 EL_RESTORE_FLAGS
630 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
631    test "x$CONFIG_ECMASCRIPT_SEE" != xyes; then
632         EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
633 else
634         CONFIG_ECMASCRIPT_SMJS=no
637 EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SEE CONFIG_ECMASCRIPT_SMJS], [ECMAScript (JavaScript)])
638 AC_SUBST(CONFIG_ECMASCRIPT_SEE)
639 AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
642 dnl ===================================================================
643 dnl Optional Spidermonkey-based ECMAScript browser scripting
644 dnl ===================================================================
646 AC_ARG_ENABLE(sm-scripting,
647               [  --disable-sm-scripting  ECMAScript browser scripting (requires Spidermonkey)],
648               [if test "$enableval" != no; then enableval="yes"; fi
649                CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
651 if test "x$CONFIG_SPIDERMONKEY" = xyes &&
652    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
653         EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
654 else
655         CONFIG_SCRIPTING_SPIDERMONKEY=no
658 if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
659    test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
660         LIBS="$LIBS $SPIDERMONKEY_LIBS"
661         AC_SUBST(SPIDERMONKEY_LIBS)
662         AC_SUBST(SPIDERMONKEY_CFLAGS)
663         AC_SUBST(CONFIG_SPIDERMONKEY)
666 dnl ===================================================================
667 dnl Check for Guile, optional even if installed.
668 dnl ===================================================================
670 enable_guile="no";
672 AC_ARG_WITH(guile, [  --with-guile            enable Guile support],
673             [ if test "x$withval" != xno; then enable_guile=yes; fi ])
675 # The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
676 # GUILE_FLAGS but I really don't want to require people to have Guile in order
677 # to compile CVS. Also, the macro seems to be really stupid regarding searching
678 # for Guile in $PATH etc. --pasky
680 AC_MSG_CHECKING([for Guile])
682 if test "$enable_guile" = "yes"; then
683         AC_MSG_RESULT(yes);
684         ## Based on the GUILE_FLAGS macro.
686         if test -d "$withval"; then
687                 GUILE_PATH="$withval:$PATH"
688         else
689                 GUILE_PATH="$PATH"
690         fi
692         AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
694         ## First, let's just see if we can find Guile at all.
695         if test "$GUILE_CONFIG" != no; then
696                 cf_result="yes";
698                 GUILE_LIBS="`guile-config link`"
699                 GUILE_CFLAGS="`guile-config compile`"
700                 LIBS="$GUILE_LIBS $LIBS"
701                 CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
702                 EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
703                 AC_SUBST(GUILE_CFLAGS)
704                 cat <<EOF
705 ***********************************************************************
706 The Guile support is incomplete and not so well integrated to ELinks
707 yet. That means, e.g., that you have no Guile console and there might
708 not be all the necessary hooks. Also, the Guile interface is not too
709 well tested (success stories heartily welcomed!).  See
710 src/scripting/guile/README for further details and hints.
711 ***********************************************************************
713         else
714                 if test -n "$withval" && test "x$withval" != xno; then
715                         AC_MSG_ERROR([Guile not found])
716                 else
717                         AC_MSG_WARN([Guile support disabled])
718                 fi
719         fi
720 else
721         AC_MSG_RESULT(no);
724 dnl ===================================================================
725 dnl Check for Perl
726 dnl ===================================================================
727 enable_perl="no";
729 AC_ARG_WITH(perl, [  --with-perl             enable Perl support],
730             [
731 if test "$withval" = yes; then
732         # FIXME: If withval is a valid directory append it to PATH
733         # so that you can specify one of several perl installations.
734         withval="";
735         enable_perl=yes;
737             ])
739 AC_MSG_CHECKING([for Perl])
741 cf_result=no
743 EL_SAVE_FLAGS
745 if test "$enable_perl" = "yes"; then
746         PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
747         PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
748         LIBS="$PERL_LIBS $LIBS"
749         CFLAGS="$PERL_CFLAGS $CFLAGS"
750         CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
751         AC_TRY_LINK([
752 #include <EXTERN.h>
753 #include <perl.h>
754 #include <perlapi.h>
756                     [PerlInterpreter *my_perl = perl_alloc();],
757                     cf_result=yes, cf_result=no)
760 if test "$cf_result" != "yes"; then
761         EL_RESTORE_FLAGS
762 else
763         EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
765         CFLAGS="$CFLAGS_X"
766         AC_SUBST(PERL_LIBS)
767         AC_SUBST(PERL_CFLAGS)
770 if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
771 dnl ===================================================================
772 dnl Check for Python
773 dnl ===================================================================
774 enable_python="no";
776 AC_ARG_WITH(python, [  --with-python=[DIR]     enable Python support],
777             [ if test "x$withval" != xno; then enable_python=yes; fi ])
779 EL_SAVE_FLAGS
780 cf_result=no
782 AC_MSG_CHECKING([for Python])
784 if test "$enable_python" = "yes"; then
785         AC_MSG_RESULT(yes);
787         if test -d "$withval"; then
788                 PYTHON_PATH="$withval:$PATH"
789         else
790                 PYTHON_PATH="$PATH"
791         fi
793         AC_PATH_PROG(PYTHON, python, no, $PYTHON_PATH)
795         if test "$PYTHON" != no; then
796                 cf_result="yes";
798                 PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; print "-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True))'`"
799                 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"))'`"
800                 LIBS="$PYTHON_LIBS $LIBS"
801                 CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
802                 AC_TRY_LINK([#include <Python.h>],
803                     [Py_Initialize();],
804                     cf_result=yes, cf_result=no)
806                 if test "$cf_result" != "yes"; then
807                         EL_RESTORE_FLAGS
808                 else
809                         EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python])
810                         AC_SUBST(PYTHON_LIBS)
811                         AC_SUBST(PYTHON_CFLAGS)
812                         cat <<EOF
813 ***********************************************************************
814 The Python support is incomplete and not so well integrated to ELinks
815 yet. That means, e.g.., that you have no Python console and there might
816 not be all the necessary hooks. Also, the Python interface is not too
817 well tested (success stories heartily welcomed!).
818 ***********************************************************************
820                 fi
821         else
822                 if test -n "$withval" && test "x$withval" != xno; then
823                         AC_MSG_ERROR([Python not found])
824                 else
825                         AC_MSG_WARN([Python support disabled])
826                 fi
827         fi
828 else
829         AC_MSG_RESULT(no);
833 dnl ===================================================================
834 dnl Check for Lua, optional even if installed.
835 dnl ===================================================================
837 dnl Do this the long way, as FreeBSD reportedly needs -L<dir> for
838 dnl anything other than /usr/lib, and Lua is very often in /usr/local/lib.
840 AC_ARG_WITH(lua, [  --without-lua           disable Lua support],
841             [if test "$withval" = no; then disable_lua=yes; fi])
842 AC_MSG_CHECKING([for Lua])
844 EL_SAVE_FLAGS
845 cf_result=no
847 if test -z "$disable_lua"; then
848         if test ! -d "$withval"; then
849                 withval="";
850         fi
851         for luadir in "$withval" "" /usr /usr/local; do
852                 for suffix in "" 50 51; do
853                         if test "$cf_result" = no; then
854                                 LUA_LIBS="-llua$suffix -llualib$suffix -lm"
856                                 if test ! -z "$luadir"; then
857                                         LUA_LIBS="-L$luadir/lib $LUA_LIBS"
858                                         LUA_CFLAGS="-I$luadir/include -I$luadir/include/lua$suffix"
859                                 fi
861                                 LIBS="$LUA_LIBS $LIBS_X"
862                                 CFLAGS="$CFLAGS_X $LUA_CFLAGS"
863                                 CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
865                                 # Check that it is a compatible Lua version
866                                 AC_TRY_LINK([   #include <lua.h>
867                                                 #include <lualib.h>],
868                                             [   lua_State *L = lua_open();
869                                                 luaopen_base(L);
870                                                 luaopen_table(L);
871                                                 luaopen_io(L);
872                                                 luaopen_string(L);
873                                                 luaopen_math(L);
874                                                 lua_pushboolean(L, 1);
875                                                 lua_close(L);],
876                                             cf_result=yes, cf_result=no)
877                         fi
878                 done
879         done
882 AC_MSG_RESULT($cf_result)
884 if test "$cf_result" != yes; then
885         EL_RESTORE_FLAGS
886 else
887         EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
888         AC_CHECK_HEADERS(lauxlib.h)
890         CFLAGS="$CFLAGS_X"
891         AC_SUBST(LUA_LIBS)
892         AC_SUBST(LUA_CFLAGS)
896 dnl ===================================================================
897 dnl Check for Ruby, optional even if installed.
898 dnl ===================================================================
900 EL_CONFIG_SCRIPTING_RUBY
902 dnl ===================================================================
903 dnl Setup global scripting
904 dnl ===================================================================
906 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])
907 AC_SUBST(CONFIG_SCRIPTING_GUILE)
908 AC_SUBST(CONFIG_SCRIPTING_LUA)
909 AC_SUBST(CONFIG_SCRIPTING_PERL)
910 AC_SUBST(CONFIG_SCRIPTING_PYTHON)
911 AC_SUBST(CONFIG_SCRIPTING_RUBY)
912 AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
913 AC_SUBST(CONFIG_SCRIPTING)
916 dnl ===================================================================
917 dnl Check for SSL support.
918 dnl ===================================================================
920 dnl We by default use OpenSSL, and we always prefer it. However, when GNUTLS
921 dnl is enabled, we won't try to use OpenSSL anymore.
923 dnl For wiping SSL hooks..
924 #ifdef CONFIG_SSL
926 disable_openssl=""
927 disable_gnutls=""
928 enable_gnutls=""
930 AC_ARG_WITH(gnutls, [  --without-gnutls        disable GNUTLS SSL support],
931             [if test "$with_gnutls" = no;  then disable_gnutls=yes; fi])
932 AC_ARG_WITH(gnutls, [  --with-gnutls[=DIR]     enable GNUTLS SSL support],
933             [if test "$with_gnutls" != no;  then enable_gnutls=yes; fi])
934 gnutls_withval="$withval"
936 if test "$enable_gnutls" = yes; then
937         disable_openssl=yes;
940 AC_ARG_WITH(openssl, [  --without-openssl       disable OpenSSL support],
941             [if test "$with_openssl" = no;  then disable_openssl=yes; fi])
942 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    enable OpenSSL support (default)])
943 openssl_withval="$withval"
945 dnl ---- OpenSSL
947 AC_MSG_CHECKING([for OpenSSL])
949 EL_SAVE_FLAGS
950 cf_result="no"
952 if test "$disable_openssl" = yes; then
953         cf_result="not used"
954 else
955         for ssldir in "$openssl_withval" "" /usr /usr/local/openssl \
956                          /usr/lib/openssl /usr/local/ssl \
957                          /usr/local/www /usr/lib/ssl /usr/local \
958                          /usr/pkg /opt /opt/openssl; do
959                 if test "$cf_result" = no; then
960                         if test -d "$ssldir"; then
961                                 OPENSSL_CFLAGS="-I$ssldir/include"
962                                 LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
963                                 CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
964                                 CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
965 #                               # FIXME: This created serious portability problems. --pasky
966 #                               if test "$CC" == "gcc"; then
967 #                                       # I'm not sure about compatibility here. --pasky
968 #                                       LIBS="$LIBS -R$ssldir/lib"
969 #                               fi
970                         else
971                                 LIBS="-lssl -lcrypto $LIBS_X"
972                         fi
973                         AC_TRY_LINK([#include <openssl/ssl.h>],
974                                     [OpenSSL_add_all_algorithms()],
975                                     cf_result=yes, cf_result=no)
976                         if test "$cf_result" != yes; then
977                                 AC_TRY_LINK([#include <openssl/ssl.h>],
978                                             [SSLeay_add_ssl_algorithms()],
979                                             cf_result=yes, cf_result=no)
980                         fi
981                 fi
982         done
984         if test "$cf_result" != yes; then
985                 if test -n "$openssl_withval" && test "x$openssl_withval" != xno; then
986                         AC_MSG_ERROR([OpenSSL not found])
987                 fi
988                 EL_RESTORE_FLAGS
989         else
990                 EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
992                 CFLAGS="$CFLAGS_X"
993                 AC_SUBST(OPENSSL_CFLAGS)
994         fi
997 AC_MSG_RESULT($cf_result)
999 CONFIG_GNUTLS_OPENSSL_COMPAT=no
1000 dnl ---- GNU TLS
1001 dnl We can't have AC_MSG_CHECKING here, because AC_PATH_PROG prints its own and
1002 dnl it looks ugly then.
1004 if test "$cf_result" = yes; then
1005         cf_result="not used"
1007 else
1008         EL_SAVE_FLAGS
1009         cf_result="no"
1011         if test -z "$disable_gnutls"; then
1012                 # Sure, we maybe _could_ use their macro, but how to ensure
1013                 # that the ./configure script won't fail if the macro won't be
1014                 # found..? :( --pasky
1016                 GNUTLS_PATH="$PATH:/usr/local/gnutls:/opt:/opt/gnutls"
1018                 if test -d "$gnutls_withval"; then
1019                         GNUTLS_PATH="$gnutls_withval:$GNUTLS_PATH"
1020                 fi
1022                 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no, $GNUTLS_PATH)
1024                 if test "$LIBGNUTLS_CONFIG" = "no" ; then
1025                         cf_result=no
1026                 else
1027                         GNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG --cflags`
1028                         GNUTLS_LIBS=`$LIBGNUTLS_CONFIG --libs`
1030                         LIBS="$GNUTLS_LIBS $LIBS_X"
1031                         CFLAGS="$CFLAGS_X $GNUTLS_CFLAGS"
1032                         CPPFLAGS="$CPPFLAGS_X $GNUTLS_CFLAGS"
1034                         # Verify if it's really usable.  gnutls_session was
1035                         # renamed to gnutls_session_t before GNU TLS 1.2.0
1036                         # (on 2004-06-13); ELinks now requires this.
1037                         AC_TRY_LINK([#include <gnutls/gnutls.h>],
1038                                     [gnutls_session_t dummy;
1039                                      gnutls_check_version(NULL)],
1040                                     cf_result=yes, cf_result=no)
1041                 fi
1043                 if test "$cf_result" = yes; then
1044                         EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
1046                         CFLAGS="$CFLAGS_X"
1047                         AC_SUBST(GNUTLS_CFLAGS)
1049                         # Verify if the MD5 compatibility layer is usable.
1050                         CONFIG_GNUTLS_OPENSSL_COMPAT=yes
1051                         EL_CHECK_OPTIONAL_LIBRARY(CONFIG_GNUTLS_OPENSSL_COMPAT,
1052                                                   [GNU TLS OpenSSL compatibility],
1053                                                   gnutls/openssl.h, gnutls-openssl,
1054                                                   MD5_Init)
1055                 else
1056                         if test -n "$gnutls_withval" && test "x$gnutls_withval" != xno; then
1057                                 AC_MSG_ERROR([GNUTLS (1.2 or later) not found.  ELinks no longer supports GNUTLS 1.1.])
1058                         fi
1059                         EL_RESTORE_FLAGS
1060                 fi
1061         fi
1064 AC_MSG_CHECKING([for GNU TLS (1.2 or later)])
1065 AC_MSG_RESULT($cf_result)
1067 dnl Final SSL setup
1069 EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS], [SSL])
1070 AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
1071 AC_SUBST(CONFIG_OPENSSL)
1072 AC_SUBST(CONFIG_GNUTLS)
1074 #endif
1076 AC_MSG_CHECKING([whether to be or not to be])
1077 AC_MSG_RESULT([needs to be determined experimentally])
1079 dnl ===================================================================
1080 dnl Check for IPv6 support and related functions.
1081 dnl ===================================================================
1083 EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
1084 EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
1085 EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
1087 AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1088 if test "$HAVE_GETADDRINFO" != yes; then
1089         AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
1090         if test "$HAVE_GETADDRINFO" = yes; then
1091                 LIBS="$LIBS -linet6"
1092         fi
1096 dnl ===================================================================
1097 dnl Checking for X11 (window title restoring).
1098 dnl ===================================================================
1100 AC_PATH_X
1101 if test x"$no_x" != xyes; then
1102         if test -n "$x_includes"; then
1103                 X_CFLAGS="-I$x_includes"
1104                 CPPFLAGS="$CPPFLAGS -I$x_includes"
1105         fi
1106         if test -n "$x_libraries"; then
1107                 LDFLAGS="$LDFLAGS -L$x_libraries"
1108         fi
1109         LIBS="-lX11 $LIBS"
1110         EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
1111         AC_SUBST(X_CFLAGS)
1115 dnl ===================================================================
1116 dnl Backtraces displaying support.
1117 dnl ===================================================================
1119 AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
1120 # possible checks for other system-specific means go here
1123 dnl ===================================================================
1124 dnl SMB protocol support.
1125 dnl ===================================================================
1127 AC_CHECK_PROG(HAVE_SMBCLIENT, smbclient, yes, no)
1130 dnl ===================================================================
1131 dnl Gettext grey zone. Beware.
1132 dnl ===================================================================
1134 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"
1136 AM_GNU_GETTEXT
1138 dnl AC_MSG_CHECKING([how many characters your English alphabet has])
1139 dnl # f33r d4 l33t... I hope it's portable. :)
1140 dnl cf_result=$((48#z - 48#a + 1));
1141 dnl AC_MSG_RESULT($cf_result)
1144 dnl ===================================================================
1145 dnl Compile-time features control
1146 dnl ===================================================================
1148 EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
1149               [  --disable-cookies       disable cookie support])
1151 EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
1152               [  --disable-formhist      disable form history support])
1154 EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
1155               [  --disable-globhist      disable global history support])
1158 EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
1159               [  --disable-mailcap       disable mailcap support])
1161 EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
1162               [  --disable-mimetypes     disable mimetypes files support])
1165 EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
1166               [HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
1167               [IPv6],
1168               [  --disable-ipv6          disable IPv6 support])
1170 EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
1171               [  --enable-bittorrent     enable BitTorrent protocol support])
1173 EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
1174               [  --disable-data          disable data protocol support])
1176 EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
1177               [  --disable-uri-rewrite   disable URI rewrite support])
1179 EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
1180               [  --enable-cgi            enable local CGI support])
1182 EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
1183               [  --enable-finger         enable finger protocol support])
1185 dnl ===================================================================
1186 dnl FSP protocol
1187 dnl ===================================================================
1188 EL_SAVE_FLAGS
1190 if test "x${enable_fsp}" != xno; then
1191         AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1193         if test "$HAVE_FSPLIB" = yes; then
1194                 AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1195                 if test "$HAVE_FSPLIB" = yes; then
1196                         LIBS="$LIBS -lfsplib"
1197                 else
1198                         AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
1199                         if test "$HAVE_FSPLIB" = yes; then
1200                                 LIBS="$LIBS -lfsp"
1201                         fi
1202                 fi
1203         fi
1206 EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
1207               [  --enable-fsp            enable FSP protocol support])
1209 if test "x$CONFIG_FSP" = xno; then
1210         EL_RESTORE_FLAGS
1213 EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
1214               [  --disable-ftp           disable ftp protocol support])
1216 EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
1217               [  --enable-gopher         enable gopher protocol support])
1219 EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
1220               [  --enable-nntp           enable nntp protocol support])
1222 EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [SMB protocol],
1223               [  --disable-smb           disable SMB protocol support (requires smbclient)])
1226 EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
1227               [  --disable-mouse         disable mouse support])
1229 # GPM mouse is Linux specific, so ...
1230 CONFIG_SYSMOUSE=yes
1231 EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
1232               [CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
1233               [BSD sysmouse],
1234               [  --disable-sysmouse      disable BSD sysmouse support])
1236 EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
1237               [  --enable-88-colors      enable 88 color support])
1239 EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
1240               [  --enable-256-colors     enable 256 color support])
1242 EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
1243               [  --enable-true-color     enable true color support])
1245 EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
1246               [  --enable-exmode         enable exmode (CLI) interface])
1248 EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
1249               [  --disable-leds          disable LEDs support])
1251 EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
1252               [  --disable-marks         disable document marks support])
1255 EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
1256               [  --disable-css           disable Cascading Style Sheet support])
1258 EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
1259               [  --enable-html-highlight HTML highlighting using DOM engine])
1261 dnl Everything in the tree already uses CONFIG_DOM
1262 dnl so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
1263 EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
1265 EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
1266               [  --disable-backtrace     disable backtrace support])
1268 EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
1269               [  --enable-no-root        enable prevention of usage by root])
1272 EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
1273               [  --enable-debug          enable leak debug and internal error checking])
1275 EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
1276               [  --enable-fastmem        enable direct use of system allocation functions, not usable with --enable-debug])
1278 EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
1279               [  --enable-own-libc       force use of internal functions instead of those of system libc])
1281 EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
1282               [  --enable-small          reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
1284 EL_ARG_ENABLE(CONFIG_UTF_8, utf-8, [UTF-8],
1285               [  --enable-utf-8          enable UTF-8 support])
1288 AC_ARG_ENABLE(weehoofooboomookerchoo,
1289               [
1290     Also check out the features.conf file for more information about features!
1291               ],
1292               [AC_MSG_ERROR(Are you strange, or what?)])
1295 dnl == EMX hack
1297 test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
1298 test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
1301 dnl ===================================================================
1302 dnl Export directory paths
1303 dnl ===================================================================
1305 # Set up the ``entry points'' if they were not supplied by builder
1306 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1307 test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
1309 # Create CONFDIR #define for config.h
1311 # XXX: This may be dependent on a particular version of autoconf. Whatever,
1312 # it's autoconf fault to force us to do such hacks ;p.
1313 if test x"$sysconfdir" = x"\${prefix}/etc"; then
1314   # sysconfdir is set to its default value... fine, let's append /elinks/
1315   # XXX: We can't modify listing of the default in ./configure --help :-(
1316   sysconfdir_n=`eval echo "$sysconfdir"`
1317   sysconfdir=$sysconfdir_n
1318   (echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
1319         sysconfdir="$sysconfdir/elinks"
1322 CONFDIR=$sysconfdir
1323 AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
1324 AC_SUBST(CONFDIR)
1326 # Create LOCALEDIR #define for config.h
1327 LOCALEDIR=`eval echo "$datadir/locale"`
1328 while echo "$LOCALEDIR" | grep "\\$"
1330         LOCALEDIR=`eval echo "$LOCALEDIR"`
1331 done > /dev/null 2> /dev/null
1332 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
1333 AC_SUBST(LOCALEDIR)
1335 # Create LIBDIR #define for config.h
1336 LIBDIR=`eval echo "$libdir"`
1337 AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
1338 AC_SUBST(LIBDIR)
1340 EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
1341 EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
1343 dnl ===================================================================
1344 dnl A little fine tuning of gcc specific options (continued)
1345 dnl ===================================================================
1347 if test "x$ac_cv_prog_gcc" = "xyes"; then
1348   if test "$CONFIG_DEBUG" = "yes"; then
1349     dnl We want to see all warnings and live with none (in debug mode).
1350     CFLAGS="$CFLAGS -Werror"
1351   fi
1353   case "`$CC -dumpversion`" in
1354     3.0|3.1|3.2)
1355       # These should be ok using -Werror
1356       ;;
1357     3.*)
1358       # If gcc is version 3.3 (or higher?) it emits lots of false positive
1359       # "dereferencing type-punned pointer will break strict-aliasing rules"
1360       # warnings. Disable them by not doing any strict-aliasing. The
1361       # alternative is just too ugly. Thanks gcc guys!! ;)
1362       CFLAGS="$CFLAGS -fno-strict-aliasing"
1363       ;;
1364     4.*)
1365       # Do not show warnings related to (char * | unsigned char *) type
1366       # difference.
1367       CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign"
1368       ;;
1369     *)
1370       # These should be ok using -Werror
1371       ;;
1372   esac
1375 # CFLAGS doesn't contain all compile flags. Some will be added only when
1376 # needed in the respective source directory. To get all compile flags
1377 # easily just add CPPFLAGS.
1378 ALL_CFLAGS="$CFLAGS $CPPFLAGS"
1380 EL_LOG_CONFIG(ALL_CFLAGS, [Compiler options (CFLAGS)], [])
1381 EL_LOG_CONFIG(LIBS, [Linker options (LIBS)], [])
1383 dnl ===================================================================
1384 dnl Colored make output
1385 dnl ===================================================================
1387 if test $(`which tput` colors) -ge 4; then
1388         MAKE_COLOR=1
1389         AC_SUBST(MAKE_COLOR)
1392 dnl ===================================================================
1393 dnl Generated files
1394 dnl ===================================================================
1396 AC_OUTPUT([ \
1397  Makefile.config \
1398  contrib/elinks.spec \
1399  contrib/lua/hooks.lua \
1400  contrib/conv/w3m2links.awk \
1401  doc/man/man1/elinks.1 \
1402  src/intl/gettext/ref-add.sed \
1403  src/intl/gettext/ref-del.sed
1406 abs_srcdir="$(cd "$srcdir" && pwd)"
1407 # builddir is always absolute!
1408 if test "$abs_srcdir" != "$builddir"; then
1409         # Bootstrap the Makefile creation
1410         echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
1411         "$MAKE" "SRC=$abs_srcdir" init
1413         # Make cg-status ignore this build directory
1414         echo "*" > "$builddir/.gitignore"
1417 dnl ===================================================================
1418 dnl Configuration summary
1419 dnl ===================================================================
1421 AC_MSG_RESULT(The following feature summary has been saved to features.log)
1422 cat features.log