w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

acinclude.m4 (29041B)


      1 dnl w3m autoconf macros
      2 #
      3 # ----------------------------------------------------------------
      4 # AC_W3M_VERSION
      5 # ----------------------------------------------------------------
      6 AC_DEFUN([AC_W3M_VERSION],
      7 [AC_SUBST(CURRENT_VERSION)
      8  cvsver=`$AWK '\$[1] ~ /Id:/ { print \$[3]}' $srcdir/ChangeLog`
      9  sed -e 's/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c
     10  CURRENT_VERSION=`sed -n 's/.*define CURRENT_VERSION *"w3m\/\(.*\)".*$/\1/p' version.c`])
     11 #
     12 # ----------------------------------------------------------------
     13 # AC_W3M_COLOR
     14 # ----------------------------------------------------------------
     15 AC_DEFUN([AC_W3M_COLOR],
     16 [AC_SUBST(USE_COLOR)
     17 AC_MSG_CHECKING(if color escape sequence for kterm/pxvt is enabled)
     18 AC_ARG_ENABLE(color,
     19  [  --disable-color		disable color for vt100 terminal],,
     20  [enable_color="yes"])
     21 test x"$enable_color" = xyes && AC_DEFINE(USE_COLOR)
     22 AC_MSG_RESULT($enable_color)])
     23 #
     24 # ----------------------------------------------------------------
     25 # AC_W3M_ANSI_COLOR
     26 # ----------------------------------------------------------------
     27 AC_DEFUN([AC_W3M_ANSI_COLOR],
     28 [AC_SUBST(USE_ANSI_COLOR)
     29 AC_MSG_CHECKING(if ansi color escape sequence support is enabled)
     30 AC_ARG_ENABLE(ansi_color,
     31  [   --disable-ansi-color		disable ansi color escape sequence],,
     32  [enable_ansi_color="$enable_color"])
     33  test x"$enable_ansi_color" = xyes && AC_DEFINE(USE_ANSI_COLOR)
     34  AC_MSG_RESULT($enable_ansi_color)])
     35 #
     36 # ----------------------------------------------------------------
     37 # AC_W3M_BG_COLOR
     38 # ----------------------------------------------------------------
     39 AC_DEFUN([AC_W3M_BG_COLOR],
     40 [AC_SUBST(USE_BG_COLOR)
     41 AC_MSG_CHECKING(if background color support is enabled)
     42 AC_ARG_ENABLE(bgcolor,
     43  [   --disable-bgcolor		disable to set background color],,
     44  [enable_bgcolor="$enable_color"])
     45  test x"$enable_bgcolor" = xyes && AC_DEFINE(USE_BG_COLOR)
     46 AC_MSG_RESULT($enable_bgcolor)])
     47 #
     48 # ----------------------------------------------------------------
     49 # AC_W3M_MENU
     50 # ----------------------------------------------------------------
     51 AC_DEFUN([AC_W3M_MENU],
     52 [AC_SUBST(USE_MENU)
     53 AC_MSG_CHECKING(if popup menu is enabled)
     54 AC_ARG_ENABLE(menu,
     55  [  --disable-menu		disable popup menu],,
     56  [enable_menu="yes"])
     57  test x"$enable_menu" = xyes && AC_DEFINE(USE_MENU)
     58  AC_MSG_RESULT($enable_menu)])
     59 #
     60 # ----------------------------------------------------------------
     61 # AC_W3M_MOUSE
     62 # ----------------------------------------------------------------
     63 AC_DEFUN([AC_W3M_MOUSE],
     64 [AC_SUBST(USE_MOUSE)
     65 AC_MSG_CHECKING(if mouse operation enabled)
     66 AC_ARG_ENABLE(mouse,
     67  [  --disable-mouse		disable mouse operation],,
     68  [enable_mouse="yes"])
     69 test x"$enable_mouse" = xyes && AC_DEFINE(USE_MOUSE)
     70 AC_MSG_RESULT($enable_mouse)])
     71 #
     72 # ----------------------------------------------------------------
     73 # AC_W3M_COOKIE
     74 # ----------------------------------------------------------------
     75 AC_DEFUN([AC_W3M_COOKIE],
     76 [AC_SUBST(USE_COOKIE)
     77 AC_MSG_CHECKING(if cookie is enabled)
     78 AC_ARG_ENABLE(cookie,
     79  [  --disable-cookie		disable cookie],,
     80  [enable_cookie="yes"])
     81 test x"$enable_cookie" = xyes && AC_DEFINE(USE_COOKIE)
     82 AC_MSG_RESULT($enable_cookie)])
     83 #
     84 # ----------------------------------------------------------------
     85 # AC_W3M_DICT
     86 # ----------------------------------------------------------------
     87 AC_DEFUN([AC_W3M_DICT],
     88 [AC_SUBST(USE_DICT)
     89 AC_MSG_CHECKING(if dictionary lookup is enabled)
     90 AC_ARG_ENABLE(dict,
     91  [  --disable-dict		disable dictionary lookup (see README.dict)],,
     92  [enable_dict="yes"])
     93  test x"$enable_dict" = xyes && AC_DEFINE(USE_DICT)
     94  AC_MSG_RESULT($enable_dict)])
     95 #
     96 # ----------------------------------------------------------------
     97 # AC_W3M_HISTORY
     98 # ----------------------------------------------------------------
     99 AC_DEFUN([AC_W3M_HISTORY],
    100 [AC_SUBST(USE_HISTORY)
    101 AC_MSG_CHECKING(if URL history is enabled)
    102 AC_ARG_ENABLE(history,
    103  [  --disable-history		disable URL history],,
    104  [enable_history="yes"])
    105  test x"$enable_history" = xyes && AC_DEFINE(USE_HISTORY)
    106  AC_MSG_RESULT($enable_history)])
    107 #
    108 # ----------------------------------------------------------------
    109 # AC_W3M_NNTP
    110 # ----------------------------------------------------------------
    111 AC_DEFUN([AC_W3M_NNTP],
    112 [AC_SUBST(USE_NNTP)
    113  AC_MSG_CHECKING(if nntp is enabled)
    114  AC_ARG_ENABLE(nntp,
    115   [  --disable-nntp		disable NNTP],,
    116   [enable_nntp="yes"])
    117  test x"$enable_nntp" = xyes && AC_DEFINE(USE_NNTP)
    118  AC_MSG_RESULT($enable_nntp)])
    119 # 
    120 # ----------------------------------------------------------------
    121 # AC_W3M_GOPHER
    122 # ----------------------------------------------------------------
    123 AC_DEFUN([AC_W3M_GOPHER],
    124 [AC_SUBST(USE_GOPHER)
    125  AC_MSG_CHECKING(if gopher is enabled)
    126  AC_ARG_ENABLE(gopher,
    127   [  --enable-gopher		enable GOPHER],,
    128   [enable_gopher="no"])
    129  test x"$enable_gopher" = xyes &&  AC_DEFINE(USE_GOPHER)
    130  AC_MSG_RESULT($enable_gopher)])
    131 #
    132 # ----------------------------------------------------------------
    133 # AC_W3M_M17N
    134 # ----------------------------------------------------------------
    135 # m17n enable?
    136 AC_DEFUN([AC_W3M_M17N],
    137 [AC_SUBST(USE_M17N)
    138 AC_SUBST(USE_UNICODE)
    139 AC_SUBST(WCTARGET)
    140 AC_SUBST(WCCFLAGS)
    141 AC_SUBST(DISPLAY_CHARSET)
    142 AC_SUBST(SYSTEM_CHARSET)
    143 AC_SUBST(DOCUMENT_CHARSET)
    144 AC_SUBST(POSUBST)
    145 AC_SUBST(POLANG)
    146 WCTARGET=""; WCCFLAGS=""; wcinclude=""; wclib=""
    147 AC_MSG_CHECKING(if m17n support is enabled)
    148 AC_ARG_ENABLE(m17n,
    149  [  --disable-m17n		do not use m17n],,
    150  [enable_m17n="yes"])
    151 AC_MSG_RESULT($enable_m17n)
    152 if test x"$enable_m17n" = xno; then
    153   w3m_lang="en"
    154   WCTARGET=""
    155   WCCFLAGS=""
    156   wcinclude=""
    157   wclib=""
    158   display_charset='WC_CES_US_ASCII'
    159   system_charset='WC_CES_US_ASCII'
    160   document_charset='WC_CES_US_ASCII'
    161 else
    162  AC_DEFINE(USE_M17N)
    163  WCTARGET="libwc/libwc.a"
    164  WCCFLAGS='-I$(srcdir) -I$(srcdir)/..'
    165  wcinclude='-I$(srcdir)/libwc'
    166  wclib="-L./libwc -lwc"
    167  AC_MSG_CHECKING(if unicode support is enabled)
    168  AC_ARG_ENABLE(unicode,
    169   [   --disable-unicode		do not use unicode],,
    170   [enable_unicode="yes"])
    171  AC_MSG_RESULT($enable_unicode)
    172  if test x"$enable_m17n" = xyes; then
    173   charset=US-ASCII
    174  else
    175   charset=$enable_m17n
    176  fi
    177  if test x"$enable_unicode" = xyes; then
    178     WCCFLAGS="-DUSE_UNICODE $WCCFLAGS"
    179     if test x"$charset" = xUS-ASCII; then
    180      charset=UTF-8
    181     fi
    182     AC_DEFINE(USE_UNICODE)
    183  fi
    184  AC_MSG_CHECKING(if message l10n)
    185  AC_ARG_ENABLE(messagel10n,
    186    [   --enable-messagel10n=LL	message l10n instead of NLS],,
    187    [enable_messagel10n="no"])
    188  if test x$enable_messagel10n = xyes; then
    189   enable_messagel10n="ja";
    190  fi
    191  AC_MSG_RESULT($enable_messagel10n)
    192  if test x$enable_messagel10n = xno; then
    193     :
    194  else
    195     POSUBST="\$(top_srcdir)/posubst"
    196     POLANG="$enable_messagel10n"
    197  fi
    198  AC_MSG_CHECKING(if japanese support is enabled)
    199  AC_ARG_ENABLE(japanese,
    200    [   --enable-japanese=CODE	support Japanese CODE=(S|E|J|U)],,
    201    [enable_japanese="no"])
    202  AC_MSG_RESULT($enable_japanese)
    203  if test x"$enable_japanese" = xno; then
    204    w3m_lang="en"
    205  else
    206    w3m_lang="ja"
    207    case "$enable_japanese" in
    208    E*) charset=EUC-JP;;
    209    S*) charset=Shift_JIS;;
    210    J*) charset=ISO-2022-JP;;
    211    U*) charset=UTF-8;;
    212    esac 
    213  fi
    214  display_charset=$charset
    215  AC_MSG_CHECKING(which charset is used for display)
    216  AC_ARG_WITH(charset,
    217   [  --with-charset=CHARSET],
    218   [test x"with_charset" = xyes || display_charset="$with_charset"])
    219  AC_MSG_RESULT($display_charset)
    220  display_charset=`awk '$[1] == "'$display_charset'" {print $[2]}' $srcdir/charset-list`
    221  case "$display_charset" in
    222    WC_CES_ISO_2022_JP*)
    223      system_charset=WC_CES_EUC_JP
    224      document_charset=WC_CES_EUC_JP
    225      ;;
    226    WC_CES_SHIFT_JIS)
    227      system_charset=$display_charset
    228      # for auto-detect
    229      document_charset=WC_CES_EUC_JP
    230      ;;
    231    WC_CES_ISO_2022_CN|WC_CES_HZ_GB_2312)
    232      system_charset=WC_CES_EUC_CN
    233      document_charset=WC_CES_EUC_CN
    234      ;;
    235    WC_CES_BIG5)
    236      system_charset=$display_charset
    237      # for auto-detect
    238      document_charset=WC_CES_EUC_TW
    239      ;;
    240   WC_CES_ISO_2022_KR)
    241      system_charset=WC_CES_EUC_KR
    242      document_charset=WC_CES_EUC_KR
    243      ;;
    244   *)
    245      system_charset=$display_charset
    246      document_charset=$display_charset
    247      ;;
    248  esac
    249 fi
    250 W3M_LANGDEF=`echo $w3m_lang | tr 'a-z' 'A-Z'`
    251 W3M_LANG=$W3M_LANGDEF
    252 AC_DEFINE_UNQUOTED(W3M_LANG, $W3M_LANG)
    253 AC_DEFINE_UNQUOTED(WCTARGET, "$WCTARGET")
    254 AC_DEFINE_UNQUOTED(WCCFLAGS, "$WCCFLAGS")
    255 CFLAGS="$CFLAGS $wcinclude"
    256 W3M_LIBS="$W3M_LIBS $wclib"
    257 AC_DEFINE_UNQUOTED(DISPLAY_CHARSET, $display_charset)
    258 AC_DEFINE_UNQUOTED(SYSTEM_CHARSET, $system_charset)
    259 AC_DEFINE_UNQUOTED(DOCUMENT_CHARSET, $document_charset)])
    260 #
    261 # ----------------------------------------------------------------
    262 # AC_W3M_KEYMAP
    263 # ----------------------------------------------------------------
    264 AC_DEFUN([AC_W3M_KEYMAP],
    265 [AC_SUBST(KEYMAP_FILE)
    266  AC_MSG_CHECKING(default keymap)
    267  AC_ARG_ENABLE(keymap,
    268   [  --enable-keymap[=w3m|lynx]	default keybind style(w3m or lynx)],,
    269   [enable_keymap="w3m"])
    270  AC_MSG_RESULT($enable_keymap)
    271  case x"$enable_keymap" in
    272  xw3m)
    273   KEYMAP_FILE="keybind";;
    274  xlynx)
    275   KEYMAP_FILE="keybind_lynx";;
    276  *)
    277   AC_MSG_ERROR([keymap should be either w3m or lynx.]);;
    278  esac
    279  AC_SUBST(HELP_FILE)
    280  HELP_FILE=w3mhelp-${enable_keymap}_$w3m_lang.html
    281  AC_DEFINE_UNQUOTED(HELP_FILE, "$HELP_FILE")
    282  AC_SUBST(KEYBIND)
    283  AC_DEFINE_UNQUOTED(KEYBIND, $enable_keymap)])
    284 #
    285 # ----------------------------------------------------------------
    286 # AC_W3M_MIGEMO
    287 # ----------------------------------------------------------------
    288 AC_DEFUN([AC_W3M_MIGEMO],
    289 [AC_SUBST(USE_MIGEMO)
    290  AC_SUBST(DEF_MIGEMO_COMMAND)
    291  migemo_command="migemo -t egrep /usr/local/share/migemo/migemo-dict"
    292  AC_MSG_CHECKING(if migemo is supported with)
    293  AC_ARG_WITH(migemo,
    294   [  --with-migemo=MIGEMO_COMMAND	migemo command],
    295   [test x"$with_migemo" = xyes || migemo_command="$with_migemo"])
    296  if test "${with_migemo+set}" = set -a "$with_migemo" != "no"; then
    297    AC_DEFINE(USE_MIGEMO)
    298  fi
    299  AC_MSG_RESULT($migemo_command)
    300  AC_DEFINE_UNQUOTED(DEF_MIGEMO_COMMAND, "$migemo_command")])
    301 #
    302 # ----------------------------------------------------------------
    303 # AC_W3M_EDITOR
    304 # ----------------------------------------------------------------
    305 AC_DEFUN([AC_W3M_EDITOR],
    306 [AC_SUBST(DEF_EDITOR)
    307 w3m_editor="/usr/bin/vi"
    308 AC_MSG_CHECKING(which editor is used by default)
    309 AC_ARG_WITH(editor,
    310  [  --with-editor=EDITOR		default editor (/usr/bin/vi)],
    311  [w3m_editor="$with_editor"])
    312 AC_MSG_RESULT($w3m_editor)
    313 AC_DEFINE_UNQUOTED(DEF_EDITOR, "$w3m_editor")])
    314 #
    315 # ----------------------------------------------------------------
    316 # AC_W3M_MAILER
    317 # ----------------------------------------------------------------
    318 AC_DEFUN([AC_W3M_MAILER],
    319 [AC_SUBST(DEF_MAILER)
    320 w3m_mailer="/usr/bin/mail"
    321 AC_MSG_CHECKING(which mailer is used by default)
    322 AC_ARG_WITH(mailer,
    323  [  --with-mailer=MAILER		default mailer (/usr/bin/mail)],
    324  [w3m_mailer="$with_mailer"])
    325 AC_MSG_RESULT($w3m_mailer)
    326 AC_DEFINE_UNQUOTED(DEF_MAILER, "$w3m_mailer")])
    327 #
    328 # ----------------------------------------------------------------
    329 # AC_W3M_EXT_BROWSER
    330 # ----------------------------------------------------------------
    331 AC_DEFUN([AC_W3M_EXT_BROWSER],
    332 [AC_SUBST(DEF_EXT_BROWSER)
    333 w3m_browser="/usr/bin/mozilla"
    334 AC_MSG_CHECKING(which external browser is used by default)
    335 AC_ARG_WITH(browser,
    336  [  --with-browser=BROWSER	default browser (/usr/bin/mozilla)],
    337  [w3m_browser="$with_browser"])
    338 AC_MSG_RESULT($w3m_browser)
    339 AC_DEFINE_UNQUOTED(DEF_EXT_BROWSER, "$w3m_browser")])
    340 #
    341 # ----------------------------------------------------------------
    342 # AC_W3M_HELP_CGI
    343 # ----------------------------------------------------------------
    344 AC_DEFUN([AC_W3M_HELP_CGI],
    345 [AC_SUBST(USE_HELP_CGI)
    346  AC_MSG_CHECKING(if help cgi is enabled)
    347  AC_ARG_ENABLE(help_cgi,
    348   [  --disable-help-cgi		disable help cgi],,
    349   [enable_help_cgi="yes"])
    350  test x"$enable_help_cgi" = xyes && AC_DEFINE(USE_HELP_CGI)
    351  AC_MSG_RESULT($enable_help_cgi)])
    352 # 
    353 # ----------------------------------------------------------------
    354 # AC_W3M_EXTERNAL_URI_LOADER
    355 # ----------------------------------------------------------------
    356 AC_DEFUN([AC_W3M_EXTERNAL_URI_LOADER],
    357 [AC_SUBST(USE_EXTERNAL_URI_LOADER)
    358  AC_MSG_CHECKING(if external URI loader is enabled)
    359  AC_ARG_ENABLE(external_uri_loader,
    360  [  --disable-external-uri-loader	disable external URI loader],,
    361  [enable_external_uri_loader="yes"])
    362  test x"$enable_external_uri_loader" = xyes && AC_DEFINE(USE_EXTERNAL_URI_LOADER)
    363  AC_MSG_RESULT($enable_external_uri_loader)])
    364 # 
    365 # ----------------------------------------------------------------
    366 # AC_W3M_W3MMAILER
    367 # ----------------------------------------------------------------
    368 AC_DEFUN([AC_W3M_W3MMAILER],
    369 [AC_SUBST(USE_W3MMAILER)
    370  AC_MSG_CHECKING(if w3mmail is used)
    371  AC_ARG_ENABLE(w3mmailer,
    372  [   --disable-w3mmailer		disable w3mmailer],,
    373  [enable_w3mmailer="$enable_external_uri_loader"])
    374  test x"$enable_external_uri_loader" = xno && enable_w3mmailer=no
    375  test x"$enable_w3mmailer" = xyes && AC_DEFINE(USE_W3MMAILER)
    376  AC_MSG_RESULT($enable_w3mmailer)])
    377 #
    378 # ----------------------------------------------------------------
    379 # AC_W3M_EXTLIBS(libs)
    380 # ----------------------------------------------------------------
    381 AC_DEFUN([AC_W3M_EXTLIBS],
    382 [lib=$1
    383  AC_MSG_CHECKING(for -l$lib)
    384  extlib="not found"
    385  for dir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib /lib64 /usr/lib64
    386  do
    387    if test -f $dir/lib$lib.a -o -f $dir/lib$lib.so ; then 
    388     LIBS="$LIBS -l$lib"
    389     extlib="found at $dir"
    390     break
    391    fi
    392  done
    393  AC_MSG_RESULT($extlib)])
    394 #
    395 # ----------------------------------------------------------------
    396 # AC_W3M_TERMLIB
    397 # ----------------------------------------------------------------
    398 AC_DEFUN([AC_W3M_TERMLIB],
    399 [AC_MSG_CHECKING(terminal library)
    400 AC_ARG_WITH(termlib,
    401  [  --with-termlib[=LIBS]		terminal library
    402 				LIBS is space separated list of:
    403 				  terminfo mytinfo termcap ncurses curses],,
    404  [with_termlib="yes"])
    405  AC_MSG_RESULT($with_termlib)
    406  test x"$with_termlib" = xyes && with_termlib="terminfo mytinfo termlib termcap ncurses curses"
    407  for lib in $with_termlib; do
    408    AC_CHECK_LIB($lib, tgetent, [W3M_LIBS="$W3M_LIBS -l$lib"; break])
    409  done
    410 ])
    411 #
    412 # ----------------------------------------------------------------
    413 # AC_W3M_GC
    414 # ----------------------------------------------------------------
    415 AC_DEFUN([AC_W3M_GC],
    416 [AC_MSG_CHECKING(GC library exists)
    417 AC_SUBST(LIBGC)
    418 AC_ARG_WITH(gc,
    419  [  --with-gc[=PREFIX]	  	libgc PREFIX],
    420  [test x"$with_gc" = xno && AC_MSG_ERROR([You can not build w3m without gc])],
    421  [with_gc="yes"])
    422  AC_MSG_RESULT($with_gc)
    423  test x"$with_gc" = xyes && with_gc="/usr /usr/local ${HOME}"
    424  unset ac_cv_header_gc_h
    425  AC_CHECK_HEADER(gc.h)
    426  if test x"$ac_cv_header_gc_h" = xno; then
    427    AC_MSG_CHECKING(GC header location)
    428    AC_MSG_RESULT($with_gc)
    429    gcincludedir=no
    430    for dir in $with_gc; do
    431      for inc in include include/gc; do
    432        cppflags="$CPPFLAGS"
    433        CPPFLAGS="$CPPFLAGS -I$dir/$inc"
    434        AC_MSG_CHECKING($dir/$inc)
    435        unset ac_cv_header_gc_h
    436        AC_CHECK_HEADER(gc.h, [gcincludedir="$dir/$inc"; CFLAGS="$CFLAGS -I$dir/$inc"; break])
    437        CPPFLAGS="$cppflags"
    438      done
    439      if test x"$gcincludedir" != xno; then
    440        break;
    441      fi
    442    done
    443    if test x"$gcincludedir" = xno; then
    444      AC_MSG_ERROR([gc.h not found])
    445    fi
    446  fi
    447  unset ac_cv_lib_gc_GC_init
    448  AC_CHECK_LIB(gc, GC_init, [LIBGC="-lgc"])
    449  if test x"$ac_cv_lib_gc_GC_init" = xno; then
    450     AC_MSG_CHECKING(GC library location)
    451     AC_MSG_RESULT($with_gc)
    452     gclibdir=no
    453     for dir in $with_gc; do
    454       ldflags="$LDFLAGS"
    455       LDFLAGS="$LDFLAGS -L$dir/lib"
    456       AC_MSG_CHECKING($dir)
    457       unset ac_cv_lib_gc_GC_init
    458       AC_CHECK_LIB(gc, GC_init, [gclibdir="$dir/lib"; LIBGC="-L$dir/lib -lgc"; break])
    459       LDFLAGS="$ldflags"
    460     done
    461     if test x"$gclibdir" = xno; then
    462       AC_MSG_ERROR([libgc not found])
    463     fi
    464  fi])
    465 #
    466 # ----------------------------------------------------------------
    467 # AC_W3M_SSL_DIGEST_AUTH
    468 # ----------------------------------------------------------------
    469 AC_DEFUN([AC_W3M_SSL_DIGEST_AUTH],
    470 [AC_SUBST(USE_SSL)
    471 AC_SUBST(USE_SSL_VERIFY)
    472 AC_MSG_CHECKING(if SSL is suported)
    473 AC_ARG_WITH(ssl,
    474  [  --with-ssl[=PREFIX]		support https protocol],,
    475  [with_ssl="yes"])
    476 AC_MSG_RESULT($with_ssl)
    477 if test x"$with_ssl" != xno; then
    478   PKG_CHECK_MODULES(SSL, openssl,,[
    479     AC_MSG_CHECKING(for SSL library/header)
    480     test x"$with_ssl" = xyes && with_ssl="/usr/openssl /usr/ssl /usr /usr/local/openssl /usr/local/ssl /usr/local"
    481     AC_MSG_RESULT($with_ssl)
    482     for dir in $with_ssl
    483     do
    484        if test -f "$dir/include/openssl/ssl.h"; then
    485           SSL_CFLAGS="$SSL_CFLAGS -I$dir/include/openssl"
    486           if test "$dir" != "/usr"; then
    487              SSL_CFLAGS="$SSL_CFLAGS -I$dir/include"
    488           fi
    489        elif test "$dir" != "/usr" -a -f "$dir/include/ssl.h"; then
    490           SSL_CFLAGS="$SSL_CFLAGS -I$dir/include"
    491        fi
    492        if test "$dir" != "/usr" -a -f "$dir/lib/libssl.a"; then
    493 	  SSL_LIBS="$SSL_LIBS -L$dir/lib"
    494        fi
    495     done
    496   ])
    497   AC_CHECK_LIB(ssl, SSL_new,
    498 	[w3m_ssl="found"; CFLAGS="$CFLAGS $SSL_CFLAGS" W3M_LIBS="$W3M_LIBS $SSL_LIBS -lssl -lcrypto"],
    499 	[w3m_ssl="not found"],
    500 	[$SSL_LIBS -lcrypto])
    501 
    502   if test x"$w3m_ssl" = xfound; then
    503     AC_DEFINE(USE_SSL)
    504     AC_MSG_CHECKING(if SSL certificate verify is enabled)
    505     AC_ARG_ENABLE(sslverify,
    506       [   --disable-sslverify		verify SSL certificate],,
    507       [enable_sslverify="yes"])
    508     test x"$enable_sslverify" = xyes && AC_DEFINE(USE_SSL_VERIFY)
    509     AC_MSG_RESULT($enable_sslverify)
    510   fi
    511 fi
    512 AC_SUBST(USE_DIGEST_AUTH)
    513 AC_MSG_CHECKING(if digest auth is enabled)
    514 AC_ARG_ENABLE(digest_auth,
    515  [  --disable-digest-auth		disable digest auth],,
    516  [enable_digest_auth="yes"])
    517 if test x"$enable_digest_auth" = xyes -a x"$w3m_ssl" = xfound; then
    518   AC_DEFINE(USE_DIGEST_AUTH)
    519 else
    520   enable_digest_auth="no"
    521 fi
    522 AC_MSG_RESULT($enable_digest_auth)
    523 ])
    524 #
    525 # ----------------------------------------------------------------
    526 # AC_W3M_ALARM
    527 # ----------------------------------------------------------------
    528 AC_DEFUN([AC_W3M_ALARM],
    529 [AC_SUBST(USE_ALARM)
    530  AC_MSG_CHECKING(if alarm is enabled)
    531  AC_ARG_ENABLE(alarm,
    532  [  --disable-alarm		disable alarm],,
    533  [enable_alarm="yes"])
    534  AC_MSG_RESULT($enable_alarm)
    535  if test x"$enable_alarm" = xyes; then
    536    AC_TRY_COMPILE(
    537     [#include <unistd.h>
    538 #include <signal.h>],
    539     [int sa = SIGALRM;
    540      void (*a) = alarm;],
    541    [AC_DEFINE(USE_ALARM)])
    542  fi])
    543 #
    544 # ----------------------------------------------------------------
    545 # AC_W3M_CHECK_VER(name, version, major, minor, micro, 
    546 #		action-if-ok, message-if-badver, action-if-nover)
    547 # ----------------------------------------------------------------
    548 AC_DEFUN([AC_W3M_CHECK_VER],
    549 [version="$2"
    550  if test x"$version" != x; then
    551    AC_MSG_CHECKING($1 version)
    552    AC_MSG_RESULT($version)
    553    set -- `echo "$version" | sed 's/[[^0-9]]/ /g'`
    554    if test "$[1]" -ne "$3" -o "$[2]" -lt "$4" || test "$[2]" -eq "$4" -a "$[3]" -lt "$5"; then
    555      AC_MSG_WARN([$1 is too old. Install $1 (version >= $3.$4.$5)])
    556      $7
    557    else
    558      $6
    559    fi
    560  else
    561    AC_MSG_WARN([$1 is not installed.  Install $1 (version >= $3.$4.$5)])
    562    $7
    563  fi])
    564 #
    565 # ----------------------------------------------------------------
    566 # AC_W3M_IMAGE
    567 # ----------------------------------------------------------------
    568 AC_DEFUN([AC_W3M_IMAGE],
    569 [AC_SUBST(USE_IMAGE)
    570  AC_SUBST(USE_W3MIMG_X11)
    571  AC_SUBST(USE_W3MIMG_FB)
    572  AC_SUBST(USE_W3MIMG_WIN)
    573  AC_SUBST(IMGLINK)
    574  AC_SUBST(W3MIMGDISPLAY_SETUID)
    575  AC_SUBST(INSTALL_W3MIMGDISPLAY)
    576  INSTALL_W3MIMGDISPLAY='${INSTALL_PROGRAM}'
    577  AC_DEFINE(INSTALL_W3MIMGDISPLAY, $INSTALL_W3MIMGDISPLAY)
    578  AC_SUBST(USE_GDKPIXBUF)
    579  AC_SUBST(USE_GTK2)
    580  AC_SUBST(USE_IMLIB)
    581  AC_SUBST(USE_IMLIB2)
    582  AC_SUBST(IMGTARGETS)
    583  AC_SUBST(IMGOBJS)
    584  AC_SUBST(IMGX11CFLAGS)
    585  AC_SUBST(IMGX11LDFLAGS)
    586  AC_SUBST(IMGFBCFLAGS)
    587  AC_SUBST(IMGFBLDFLAGS)
    588  AC_SUBST(IMGWINCFLAGS)
    589  AC_SUBST(IMGWINLDFLAGS)
    590  AC_MSG_CHECKING(if image is enabled)
    591  AC_ARG_ENABLE(image,
    592  [  --enable-image[=DEVS]		enable inline image handler for DEVS
    593 				 DEVS may be comma separeted: x11,fb,fb+s,win
    594 				 default: autodetected.
    595 				 'no' means disable inline image],,
    596  [enable_image="yes"])
    597  AC_MSG_RESULT($enable_image)
    598  if test x"$enable_image" != xno; then
    599   IMGOBJS=w3mimg.o
    600   if test x"$enable_image" = xyes; then
    601     enable_image=x11
    602     case "`uname -s`" in
    603     Linux|linux|LINUX) 
    604 	if test -c /dev/fb0; then
    605 	  enable_image=x11,fb
    606         fi;;
    607     CYGWIN*)
    608 	enable_image=x11,win;;
    609     esac
    610   fi   
    611   save_ifs="$IFS"; IFS=",";
    612   set x $enable_image; shift
    613   IFS="$save_ifs"
    614   for img in "$[]@"; do
    615     case $img in
    616       x11) x11=yes;;
    617       fb)  fb=yes;;
    618       fb+s) fb=yes
    619            AC_DEFINE(W3MIMGDISPLAY_SETUID)
    620            INSTALL_W3MIMGDISPLAY='${INSTALL} -o root -m 4755 -s'
    621            AC_DEFINE(INSTALL_W3MIMGDISPLAY, $INSTALL_W3MIMGDISPLAY);;
    622       win) win=yes;;
    623     esac
    624   done
    625   enable_image=yes
    626   AC_DEFINE(USE_IMAGE)
    627   AC_MSG_CHECKING(image library)
    628   AC_ARG_WITH(imagelib,
    629    [  --with-imagelib=IMAGELIBS		image library
    630 				 IMAGELIBS may be space separeted list of: 
    631 				    gtk2 gdk-pixbuf imlib imlib2],,
    632 
    633    [with_imagelib="yes"])
    634   if test x"$with_imagelib" = xyes; then
    635     with_imagelib="gtk2 gdk-pixbuf imlib imlib2"
    636   fi
    637   AC_MSG_RESULT($with_imagelib)
    638   with_imlib=no
    639   with_imlib2=no
    640   with_gdkpixbuf=no
    641   with_gtk2=no
    642   for imagelib in $with_imagelib
    643   do
    644    case "$imagelib" in
    645    imlib)
    646      with_imlib="yes"
    647      if test x"$IMLIB_CONFIG" = x; then
    648        IMLIB_CONFIG=imlib-config
    649      fi;;
    650    imlib2)
    651      with_imlib2="yes"
    652      if test x"$IMLIB2_CONFIG" = x; then
    653        IMLIB2_CONFIG=imlib2-config
    654      fi;;
    655    gdk-pixbuf)
    656      with_gdkpixbuf="yes"
    657      if test x"$GDKPIXBUF_CONFIG" = x; then
    658        GDKPIXBUF_CONFIG=gdk-pixbuf-config
    659      fi;;
    660    gtk2)
    661      with_gtk2="yes"
    662      if test x"$PKG_CONFIG" = x; then
    663        PKG_CONFIG=pkg-config
    664      else
    665        PKG_CONFIG=:
    666      fi;;
    667    esac
    668   done
    669   IMGTARGETS=""
    670   IMGLINK='$(CC)'
    671   if test x"$with_gtk2" = xyes; then
    672    AC_W3M_CHECK_VER([GdkPixbuf],
    673 	[`$PKG_CONFIG --modversion gdk-pixbuf-2.0 2>/dev/null`],
    674 	2, 0, 0,
    675 	[have_gdkpixbuf="yes"; have_gtk2="yes"],
    676 	[have_gdkpixbuf="no"; have_gtk2="no"])
    677   fi
    678   if test x"$with_gdkpixbuf" = xyes; then
    679    if test x"$have_gdkpixbuf" != xyes; then
    680     AC_W3M_CHECK_VER([GdkPixbuf],
    681 	[`$GDKPIXBUF_CONFIG --version 2>/dev/null`],
    682 	0, 16, 0,
    683 	[have_gdkpixbuf="yes"],
    684 	[have_gdkpixbuf="no"])
    685    fi
    686   fi
    687   if test x"$with_imlib" = xyes; then
    688    AC_W3M_CHECK_VER([Imlib],
    689 	[`$IMLIB_CONFIG --version 2>/dev/null`],
    690 	1, 9, 8,
    691 	[have_imlib="yes"],
    692 	[have_imlib="no"])
    693   fi
    694   if test x"$with_imlib2" = xyes; then
    695    AC_W3M_CHECK_VER([Imlib2],
    696 	[`$IMLIB2_CONFIG --version 2>/dev/null`],
    697 	1, 0, 5,
    698 	[have_imlib2="yes"],
    699 	[have_imlib2="no"])
    700   fi
    701   if test x"$x11" = xyes; then
    702    if test x"$have_gtk2" = xyes; then
    703      AC_DEFINE(USE_W3MIMG_X11)
    704      IMGOBJS="$IMGOBJS x11/x11_w3mimg.o"
    705      IMGTARGETS="x11"    
    706      AC_DEFINE(USE_GDKPIXBUF)
    707      AC_DEFINE(USE_GTK2)
    708      IMGX11CFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`"
    709      IMGX11LDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 gtk+-2.0`"
    710    elif test x"$have_gdkpixbuf" = xyes; then
    711      AC_DEFINE(USE_W3MIMG_X11)
    712      IMGOBJS="$IMGOBJS x11/x11_w3mimg.o"
    713      IMGTARGETS="x11"    
    714      AC_DEFINE(USE_GDKPIXBUF)
    715      IMGX11CFLAGS="`${GDKPIXBUF_CONFIG} --cflags`"
    716      IMGX11LDFLAGS="`${GDKPIXBUF_CONFIG} --libs` -lgdk_pixbuf_xlib"
    717    elif test x"$have_imlib" = xyes; then
    718      AC_DEFINE(USE_W3MIMG_X11)
    719      IMGOBJS="$IMGOBJS x11/x11_w3mimg.o"
    720      IMGTARGETS="x11"    
    721      AC_DEFINE(USE_IMLIB)
    722      IMGX11CFLAGS="`${IMLIB_CONFIG} --cflags`"
    723      IMGX11LDFLAGS="`${IMLIB_CONFIG} --libs`"
    724      IMGTARGETS="x11"    
    725    elif test x"$have_imlib2" = xyes; then
    726      AC_DEFINE(USE_W3MIMG_X11)
    727      IMGOBJS="$IMGOBJS x11/x11_w3mimg.o"
    728      IMGTARGETS="x11"    
    729      AC_DEFINE(USE_IMLIB2)
    730      IMGX11CFLAGS="`${IMLIB2_CONFIG} --cflags`"
    731      IMGX11LDFLAGS="`${IMLIB2_CONFIG} --libs`"
    732    else
    733      AC_MSG_WARN([unable to build w3mimgdisplay with X11 support])
    734    fi
    735   fi
    736   if test x"$fb" = xyes; then
    737    if test x"$have_gtk2" = xyes; then
    738      AC_DEFINE(USE_W3MIMG_FB)
    739      IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o"
    740      IMGTARGETS="${IMGTARGETS} fb"
    741      AC_DEFINE(USE_GDKPIXBUF)
    742      AC_DEFINE(USE_GTK2)
    743      IMGFBCFLAGS="`${PKG_CONFIG} --cflags gdk-pixbuf-2.0 gtk+-2.0`"
    744      IMGFBLDFLAGS="`${PKG_CONFIG} --libs gdk-pixbuf-2.0 gtk+-2.0`"
    745    elif test x"$have_gdkpixbuf" = xyes; then
    746      AC_DEFINE(USE_W3MIMG_FB)
    747      IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o"
    748      IMGTARGETS="${IMGTARGETS} fb"
    749      AC_DEFINE(USE_GDKPIXBUF)
    750      IMGFBCFLAGS="`${GDKPIXBUF_CONFIG} --cflags`"
    751      IMGFBLDFLAGS="`${GDKPIXBUF_CONFIG} --libs`"
    752    elif test x"$have_imlib2" = xyes; then
    753      AC_DEFINE(USE_W3MIMG_FB)
    754      IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o"
    755      IMGTARGETS="${IMGTARGETS} fb"
    756      AC_DEFINE(USE_IMLIB2)
    757      IMGOBJS="$IMGOBJS fb/fb_w3mimg.o fb/fb.o fb/fb_img.o"
    758      IMGFBCFLAGS="`${IMLIB2_CONFIG} --cflags`"
    759      IMGFBLDFLAGS="`${IMLIB2_CONFIG} --libs`"
    760    else
    761      AC_MSG_WARN([unable to build w3mimgdisplay with FB support])
    762    fi
    763   fi
    764   if test x"$win" = xyes; then
    765     AC_DEFINE(USE_W3MIMG_WIN)
    766     IMGOBJS="$IMGOBJS win/win_w3mimg.o"
    767     IMGTARGETS="${IMGTARGETS} win"
    768     IMGWINCFLAGS="-I/usr/include/w32api"
    769     IMGWINLDFLAGS="-lgdiplus -lgdi32 -luser32"
    770     IMGLINK='$(CXX)'
    771   fi
    772   AC_DEFINE(IMGTARGETS, "$IMGTARGETS")
    773   AC_DEFINE(IMGOBJS, "$IMGOBJS")
    774   AC_DEFINE(IMGX11CFLAGS, "$IMGX11CFLAGS")
    775   AC_DEFINE(IMGX11LDFLAGS, "$IMGX11LDFLAGS")
    776   AC_DEFINE(IMGFBCFLAGS, "$IMGFBCFLAGS")
    777   AC_DEFINE(IMGFBLDFLAGS, "$IMGFBLDFLAGS")
    778   AC_DEFINE(IMGLINK, "$IMGLINK")
    779   AC_DEFINE(IMGWINCFLAGS, "$IMGWINCFLAGS")
    780   AC_DEFINE(IMGWINLDFLAGS, "$IMGWINLDFLAGS")
    781  fi])
    782 # ----------------------------------------------------------------
    783 # AC_W3M_XFACE
    784 # ----------------------------------------------------------------
    785 AC_DEFUN([AC_W3M_XFACE],
    786 [AC_SUBST(USE_XFACE)
    787  AC_MSG_CHECKING(if xface is enabled)
    788  AC_ARG_ENABLE(xface,
    789   [   --disable-xface		disable xface support],,
    790   [enable_xface="$enable_image"])
    791  test x"$enable_xface" = xyes && AC_DEFINE(USE_XFACE)
    792  AC_MSG_RESULT($enable_xface)
    793  AC_CHECK_PROG(uncompface, uncompface, "yes", "no")
    794  test "$uncompface" = "no" && AC_MSG_WARN([uncompface is not installed.])
    795 ])
    796 #
    797 # ----------------------------------------------------------------
    798 # AC_W3M_IPv6
    799 # ----------------------------------------------------------------
    800 AC_DEFUN([AC_W3M_IPv6],
    801 [AC_MSG_CHECKING(if IPv6 support is enabled)
    802 AC_ARG_ENABLE(ipv6,
    803  [  --disable-ipv6		disable IPv6],,
    804  [enable_ipv6="yes"])
    805 AC_MSG_RESULT($enable_ipv6)
    806 
    807 if test x"$enable_ipv6" = xyes; then
    808  AC_MSG_CHECKING(if IPv6 API available)
    809  AC_SUBST(INET6)
    810  AC_CHECK_FUNC(getaddrinfo, 
    811 	[enable_ipv6="yes"],
    812 	[enable_ipv6="no"])
    813  if test x"$enable_ipv6" = xno; then
    814     AC_MSG_CHECKING(for libinet6)
    815     for dir in /usr/local/v6/lib /usr/local/lib /usr/lib
    816     do
    817 	if test -f $dir/libinet6.a; then
    818 	  if test $dir != "/usr/lib"; then
    819 		W3M_LIBS="$W3M_LIBS -L$dir"
    820 	  fi
    821 	  AC_CHECK_LIB(inet6, getaddrinfo,
    822 		[enable_ipv6="yes"
    823 	         use_libinet6="found"; W3M_LIBS="$W3M_LIBS -linet6"; break],
    824 		[use_libinet6="not found"])
    825 	fi
    826     done
    827     AC_MSG_RESULT($use_libinet6)
    828  fi
    829  if test x"$enable_ipv6" = xyes; then
    830     AC_SUBST(HAVE_OLD_SS_FAMILY)
    831     AC_MSG_CHECKING(if struct sockaddr_storage has an ss_family member)
    832     AC_TRY_COMPILE([
    833 #include <sys/types.h>
    834 #include <sys/socket.h>
    835       ], [
    836 	struct sockaddr_storage ss;
    837 	int i = ss.ss_family;
    838       ],
    839       [AC_MSG_RESULT(yes)],
    840       [AC_TRY_COMPILE([
    841 #include <sys/types.h>
    842 #include <sys/socket.h>
    843 	],
    844 	[
    845 	struct sockaddr_storage ss;
    846 	int i = ss.__ss_family;
    847 	],
    848 	[AC_MSG_RESULT(no, but __ss_family exists)
    849 	 AC_DEFINE(HAVE_OLD_SS_FAMILY)],
    850 	[AC_MSG_RESULT(no)
    851 	 AC_MSG_WARN(IPv6 support is disabled)
    852 	 enable_ipv6="no"])
    853       ])
    854  fi
    855  if test x"$enable_ipv6" = xyes; then
    856     AC_DEFINE(INET6)
    857  fi
    858 fi])
    859 #
    860 # ----------------------------------------------------------------
    861 # AC_W3M_SYS_ERRLIST
    862 # ----------------------------------------------------------------
    863 AC_DEFUN([AC_W3M_SYS_ERRLIST],
    864 [AC_SUBST(HAVE_SYS_ERRLIST)
    865 AC_MSG_CHECKING(for sys_errlist)
    866 AC_TRY_COMPILE(
    867 changequote(<<,>>)dnl
    868 <<extern char *sys_errlist[];>>,
    869 <<printf(sys_errlist[0]);>>,
    870 changequote([,])dnl
    871 [have_sys_errlist="yes"; AC_DEFINE(HAVE_SYS_ERRLIST)],
    872 [have_sys_errlist="no"])
    873 AC_MSG_RESULT($have_sys_errlist)])
    874 #
    875 # ----------------------------------------------------------------
    876 # AC_W3M_SIGSETJMP
    877 # ----------------------------------------------------------------
    878 AC_DEFUN([AC_W3M_SIGSETJMP],
    879 [AC_SUBST(HAVE_SIGSETJMP)
    880 AC_MSG_CHECKING(for sigsetjmp)
    881 AC_TRY_COMPILE(
    882 [#include <setjmp.h>],
    883 [ jmp_buf env;
    884    if (sigsetjmp(env, 1) != 0) { exit(0); } siglongjmp(env, 1);],
    885 [have_sigsetjmp="yes"; AC_DEFINE(HAVE_SIGSETJMP)],
    886 [have_sigsetjmp="no"])
    887 AC_MSG_RESULT($have_sigsetjmp)])
    888 #
    889 # ----------------------------------------------------------------
    890 # AC_W3M_SIGNAL_RETURN
    891 # ----------------------------------------------------------------
    892 AC_DEFUN([AC_W3M_SIGNAL],
    893 [AC_TYPE_SIGNAL
    894  AC_SUBST(RETSIGTYPE)
    895  AC_SUBST(SIGNAL_RETURN)
    896  if test x"$ac_cv_type_signal" = xvoid; then
    897   AC_DEFINE(SIGNAL_RETURN,return)
    898  else
    899   AC_DEFINE(SIGNAL_RETURN,return 0)
    900  fi])