diff options
author | Ito Hiroyuki <ZXB01226@nifty.com> | 2010-12-21 10:13:55 +0000 |
---|---|---|
committer | Ito Hiroyuki <ZXB01226@nifty.com> | 2010-12-21 10:13:55 +0000 |
commit | 40feb310a3399b674b4f8924465cee1ea441ffde (patch) | |
tree | 2df2f0c81b76925e8fbf681848cdd0d762e54d72 | |
parent | add documents about some options for w3mimgdisplay. (diff) | |
download | w3m-40feb310a3399b674b4f8924465cee1ea441ffde.tar.gz w3m-40feb310a3399b674b4f8924465cee1ea441ffde.zip |
w3mimgdisplay supports Windows console (http://www.j10n.org/files/w3m-cvs-1.1040-misc.patch).
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | Makefile.in | 8 | ||||
-rw-r--r-- | acinclude.m4 | 28 | ||||
-rw-r--r-- | config.h.in | 1 | ||||
-rwxr-xr-x | configure | 2615 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | doc-jp/README.img | 5 | ||||
-rw-r--r-- | doc/README.img | 13 | ||||
-rw-r--r-- | entity.h | 2 | ||||
-rw-r--r-- | image.c | 9 | ||||
-rw-r--r-- | w3mimg/Makefile.in | 11 | ||||
-rw-r--r-- | w3mimg/w3mimg.c | 6 | ||||
-rw-r--r-- | w3mimg/w3mimg.h | 17 | ||||
-rw-r--r-- | w3mimg/win/Makefile.in | 31 | ||||
-rw-r--r-- | w3mimg/win/win_w3mimg.cpp | 1063 | ||||
-rw-r--r-- | w3mimgdisplay.c | 4 |
16 files changed, 2997 insertions, 843 deletions
@@ -1,3 +1,24 @@ +2010-12-21 Ito Hiroyuki <ZXB01226 at nifty.com> + + +2010-12-20 AIDA Shinra <shinra@j10n.org> + + * [w3m-dev 04425] Re: Windows$BHG(Bw3mimg$B!"B>(B + * w3mimgdisplay: supports Windows console (http://www.j10n.org/files/w3m-cvs-1.1040-misc.patch). + * image.c: ditto. + * configure.ac: ditto. + * config.h.in: ditto. + * acinclude.m4: ditto. + * Makefile.in: ditto. + * w3mimg/w3mimg.h: ditto. + * w3mimg/w3mimg.c: ditto. + * w3mimg/Makefile.in: ditto. + * doc/README.img: ditto. + * doc-jp/README.img: ditto. + * w3mimgdisplay.c (main): call "w_op->close(w_op)" before exit. + * w3mimg/win/win_w3mimg.cpp: added. + * w3mimg/win/Makefile.in: added. + 2010-12-20 Ito Hiroyuki <ZXB01226@nifty.com> * doc/README.img: add documents about some options. @@ -9232,4 +9253,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.1043 2010/12/20 10:22:06 htrb Exp $ +$Id: ChangeLog,v 1.1044 2010/12/21 10:13:55 htrb Exp $ diff --git a/Makefile.in b/Makefile.in index 3254ebf..0137211 100644 --- a/Makefile.in +++ b/Makefile.in @@ -58,10 +58,12 @@ MAKE_ARGS = PERL='$(PERL)' MKDIR='$(MKDIR)' \ CONF_DIR='$(CONF_DIR)' \ RC_DIR='$(RC_DIR)' DESTDIR='$(DESTDIR)' KEYBIND_SRC='$(KEYBIND_SRC)' -IMGCFLAGS = @IMGX11CFLAGS@ @IMGFBCFLAGS@ -IMGLDFLAGS = @IMGX11LDFLAGS@ @IMGFBLDFLAGS@ +IMGCFLAGS = @IMGX11CFLAGS@ @IMGFBCFLAGS@ @IMGWINCFLAGS@ +IMGLDFLAGS = @IMGX11LDFLAGS@ @IMGFBLDFLAGS@ @IMGWINLDFLAGS@ CC0 = @CC@ +CXX = @CXX@ +IMGLINK = @IMGLINK@ CC = @POSUBST@ $(CC0) CPP = @CPP@ RANLIB=@RANLIB@ @@ -197,7 +199,7 @@ dummy.o: entity.c $(CC) $(CFLAGS) -DDUMMY -c -o $@ $? $(IMGDISPLAY): w3mimgdisplay.o $(ALIB) w3mimg/w3mimg.a - $(CC) $(CFLAGS) -o $(IMGDISPLAY) w3mimgdisplay.o w3mimg/w3mimg.a $(LDFLAGS) $(LIBS) $(IMGLDFLAGS) + $(IMGLINK) $(CFLAGS) -o $(IMGDISPLAY) w3mimgdisplay.o w3mimg/w3mimg.a $(LDFLAGS) $(LIBS) $(IMGLDFLAGS) w3mimgdisplay.o: w3mimgdisplay.c w3mimg/w3mimg.h $(CC) $(CFLAGS) $(IMGCFLAGS) -o $@ -c $(srcdir)/w3mimgdisplay.c diff --git a/acinclude.m4 b/acinclude.m4 index 7ebc76c..e4ccc3d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -569,6 +569,8 @@ AC_DEFUN([AC_W3M_IMAGE], [AC_SUBST(USE_IMAGE) AC_SUBST(USE_W3MIMG_X11) AC_SUBST(USE_W3MIMG_FB) + AC_SUBST(USE_W3MIMG_WIN) + AC_SUBST(IMGLINK) AC_SUBST(W3MIMGDISPLAY_SETUID) AC_SUBST(INSTALL_W3MIMGDISPLAY) INSTALL_W3MIMGDISPLAY='${INSTALL_PROGRAM}' @@ -583,10 +585,12 @@ AC_DEFUN([AC_W3M_IMAGE], AC_SUBST(IMGX11LDFLAGS) AC_SUBST(IMGFBCFLAGS) AC_SUBST(IMGFBLDFLAGS) + AC_SUBST(IMGWINCFLAGS) + AC_SUBST(IMGWINLDFLAGS) AC_MSG_CHECKING(if image is enabled) AC_ARG_ENABLE(image, [ --enable-image[=DEVS] enable inline image handler for DEVS - DEVS may be comma separeted: x11,fb,fb+s + DEVS may be comma separeted: x11,fb,fb+s,win default: autodetected. 'no' means disable inline image],, [enable_image="yes"]) @@ -600,10 +604,14 @@ AC_DEFUN([AC_W3M_IMAGE], if test -c /dev/fb0; then enable_image=x11,fb fi;; + CYGWIN*) + enable_image=x11,win;; esac fi save_ifs="$IFS"; IFS=","; - for img in $enable_image; do + set x $enable_image; shift + IFS="$save_ifs" + for img in "$[]@"; do case $img in x11) x11=yes;; fb) fb=yes;; @@ -611,9 +619,9 @@ AC_DEFUN([AC_W3M_IMAGE], AC_DEFINE(W3MIMGDISPLAY_SETUID) INSTALL_W3MIMGDISPLAY='${INSTALL} -o root -m 4755 -s' AC_DEFINE(INSTALL_W3MIMGDISPLAY, $INSTALL_W3MIMGDISPLAY);; + win) win=yes;; esac done - IFS="$save_ifs" enable_image=yes AC_DEFINE(USE_IMAGE) AC_MSG_CHECKING(image library) @@ -659,6 +667,7 @@ AC_DEFUN([AC_W3M_IMAGE], esac done IMGTARGETS="" + IMGLINK='$(CC)' if test x"$with_gtk2" = xyes; then AC_W3M_CHECK_VER([GdkPixbuf], [`$PKG_CONFIG --modversion gdk-pixbuf-2.0 2>/dev/null`], @@ -752,12 +761,23 @@ AC_DEFUN([AC_W3M_IMAGE], AC_MSG_WARN([unable to build w3mimgdisplay with FB support]) fi fi + if test x"$win" = xyes; then + AC_DEFINE(USE_W3MIMG_WIN) + IMGOBJS="$IMGOBJS win/win_w3mimg.o" + IMGTARGETS="${IMGTARGETS} win" + IMGWINCFLAGS="-I/usr/include/w32api" + IMGWINLDFLAGS="-lgdiplus -lgdi32 -luser32" + IMGLINK='$(CXX)' + fi AC_DEFINE(IMGTARGETS, "$IMGTARGETS") AC_DEFINE(IMGOBJS, "$IMGOBJS") AC_DEFINE(IMGX11CFLAGS, "$IMGX11CFLAGS") AC_DEFINE(IMGX11LDFLAGS, "$IMGX11LDFLAGS") AC_DEFINE(IMGFBCFLAGS, "$IMGFBCFLAGS") - AC_DEFINE(IMGFBLDFLAGS, "$IMGLDFLAGS") + AC_DEFINE(IMGFBLDFLAGS, "$IMGFBLDFLAGS") + AC_DEFINE(IMGLINK, "$IMGLINK") + AC_DEFINE(IMGWINCFLAGS, "$IMGWINCFLAGS") + AC_DEFINE(IMGWINLDFLAGS, "$IMGWINLDFLAGS") fi]) # ---------------------------------------------------------------- # AC_W3M_XFACE diff --git a/config.h.in b/config.h.in index 03585ea..2f41eed 100644 --- a/config.h.in +++ b/config.h.in @@ -69,6 +69,7 @@ #undef USE_IMAGE #undef USE_W3MIMG_X11 #undef USE_W3MIMG_FB +#undef USE_W3MIMG_WIN #undef W3MIMGDISPLAY_SETUID #undef USE_IMLIB #undef USE_GDKPIXBUF @@ -1,13 +1,13 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for w3m 0.5.2. +# Generated by GNU Autoconf 2.67 for w3m 0.5.2. # # Report bugs to <satodai@w3m.jp>. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -319,7 +319,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -359,19 +359,19 @@ else fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -533,7 +533,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -557,6 +557,7 @@ PACKAGE_STRING='w3m 0.5.2' PACKAGE_BUGREPORT='satodai@w3m.jp' PACKAGE_URL='' +gt_needs= # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> @@ -604,8 +605,6 @@ RETSIGTYPE HAVE_SIGSETJMP HAVE_SYS_ERRLIST USE_BINMODE_STREAM -EGREP -GREP LIBGC AUXBIN_TARGETS USE_SYSMOUSE @@ -613,6 +612,8 @@ USE_W3M USE_DIGEST_AUTH SSL_LIBS SSL_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH PKG_CONFIG USE_SSL_VERIFY USE_SSL @@ -639,6 +640,8 @@ HELP_FILE KEYMAP_FILE uncompface USE_XFACE +IMGWINLDFLAGS +IMGWINCFLAGS IMGFBLDFLAGS IMGFBCFLAGS IMGX11LDFLAGS @@ -651,6 +654,8 @@ USE_GTK2 USE_GDKPIXBUF INSTALL_W3MIMGDISPLAY W3MIMGDISPLAY_SETUID +IMGLINK +USE_W3MIMG_WIN USE_W3MIMG_FB USE_W3MIMG_X11 USE_IMAGE @@ -665,12 +670,21 @@ LIBINTL INTLLIBS LTLIBICONV LIBICONV +INTL_MACOSX_LIBS +EGREP +GREP +XGETTEXT_EXTRA_OPTIONS MSGMERGE +XGETTEXT_015 XGETTEXT +GMSGFMT_015 +MSGFMT_015 GMSGFMT MSGFMT +GETTEXT_MACRO_VERSION USE_NLS -MKINSTALLDIRS +mkdir_p +MKDIR_P POLANG POSUBST DOCUMENT_CHARSET @@ -700,14 +714,17 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP -OBJEXT -EXEEXT ac_ct_CC -CPPFLAGS -LDFLAGS CFLAGS CC AWK +OBJEXT +EXEEXT +ac_ct_CXX +CPPFLAGS +LDFLAGS +CXXFLAGS +CXX W3M_LANG W3M VERSION @@ -795,12 +812,20 @@ with_gc ac_precious_vars='build_alias host_alias target_alias -CC -CFLAGS +CXX +CXXFLAGS LDFLAGS LIBS CPPFLAGS -CPP' +CCC +CC +CFLAGS +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +SSL_CFLAGS +SSL_LIBS' # Initialize some variables set by options. @@ -863,8 +888,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -909,7 +935,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -935,7 +961,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1139,7 +1165,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1155,7 +1181,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1185,8 +1211,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) @@ -1194,7 +1220,7 @@ Try \`$0 --help' for more information." # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1212,13 +1238,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1241,7 +1267,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1255,8 +1281,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1271,9 +1297,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. @@ -1312,11 +1338,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1356,7 +1382,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1425,7 +1451,7 @@ Optional Features: --disable-ansi-color disable ansi color escape sequence --disable-bgcolor disable to set background color --enable-image=DEVS enable inline image handler for DEVS - DEVS may be comma separeted: x11,fb,fb+s + DEVS may be comma separeted: x11,fb,fb+s,win default: autodetected. 'no' means disable inline image --disable-xface disable xface support @@ -1468,14 +1494,23 @@ Optional Packages: --with-gc=PREFIX libgc PREFIX Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags + CXX C++ compiler command + CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> + CC C compiler command + CFLAGS C compiler flags CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + SSL_CFLAGS C compiler flags for SSL, overriding pkg-config + SSL_LIBS linker flags for SSL, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1544,9 +1579,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF w3m configure 0.5.2 -generated by GNU Autoconf 2.65 +generated by GNU Autoconf 2.67 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1557,6 +1592,44 @@ fi ## Autoconf initialization. ## ## ------------------------ ## +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. @@ -1616,7 +1689,7 @@ $as_echo "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { + test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : @@ -1678,6 +1751,48 @@ fi } # ac_fn_c_try_link +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -1686,7 +1801,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1753,10 +1868,10 @@ $as_echo "$ac_res" >&6; } ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1792,7 +1907,7 @@ if ac_fn_c_try_cpp "$LINENO"; then : else ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } @@ -1815,17 +1930,15 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( cat <<\_ASBOX -## ----------------------------- ## +( $as_echo "## ----------------------------- ## ## Report this to satodai@w3m.jp ## -## ----------------------------- ## -_ASBOX +## ----------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1838,48 +1951,6 @@ fi } # ac_fn_c_check_header_mongrel -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1889,7 +1960,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1920,7 +1991,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" @@ -2147,7 +2218,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by w3m $as_me 0.5.2, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2257,11 +2328,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -2295,11 +2364,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do @@ -2312,11 +2379,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do @@ -2330,11 +2395,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo @@ -2389,7 +2452,12 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2404,7 +2472,11 @@ do { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } fi done @@ -2425,6 +2497,7 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi +gt_needs="$gt_needs " # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2480,7 +2553,7 @@ if $ac_cache_corrupted; then $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## @@ -2515,6 +2588,513 @@ $as_echo "#define W3M w3m" >>confdefs.h W3M_LANG=${LC_ALL:-$LANG} ac_config_headers="$ac_config_headers config.h" +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 +$as_echo_n "checking whether the C++ compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C++ compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 +$as_echo_n "checking for C++ compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <stdio.h> +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C++ compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -2857,8 +3437,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -2885,257 +3465,6 @@ $as_echo "$ac_try_echo"; } >&5 test $ac_status = 0; } done -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <stdio.h> -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : @@ -3390,7 +3719,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -3406,11 +3735,11 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi @@ -3449,7 +3778,7 @@ else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. @@ -3465,18 +3794,18 @@ else ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext +rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -3487,16 +3816,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -3616,7 +3951,7 @@ fi $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -3624,7 +3959,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -3875,7 +4210,7 @@ test -n "$MAN" || MAN="/usr/bin/man" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } @@ -3886,16 +4221,16 @@ else test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -3920,7 +4255,7 @@ else ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi @@ -3928,7 +4263,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -4131,18 +4466,53 @@ cat >>confdefs.h <<_ACEOF _ACEOF if test x$enable_messagel10n = xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - case "$ac_aux_dir" in - /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; - *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; - esac - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 @@ -4160,6 +4530,9 @@ $as_echo "$USE_NLS" >&6; } + GETTEXT_MACRO_VERSION=0.18 + + # Prepare PATH_SEPARATOR. @@ -4208,7 +4581,8 @@ else test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" break 2 @@ -4272,6 +4646,17 @@ fi + case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; + *) MSGFMT_015=$MSGFMT ;; + esac + + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac + + # Prepare PATH_SEPARATOR. # The user is always right. @@ -4319,7 +4704,8 @@ else test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" break 2 @@ -4343,6 +4729,12 @@ fi rm -f messages.po + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac + + # Prepare PATH_SEPARATOR. # The user is always right. @@ -4390,7 +4782,8 @@ else test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then - if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + echo "$as_me: trying $ac_dir/$ac_word..." >&5 + if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" break 2 fi @@ -4412,31 +4805,13 @@ $as_echo "no" >&6; } fi - if test "$GMSGFMT" != ":"; then - if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && - (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $GMSGFMT program is not GNU msgfmt; ignore it" >&5 -$as_echo "found $GMSGFMT program is not GNU msgfmt; ignore it" >&6; } - GMSGFMT=":" - fi - fi + test -n "$localedir" || localedir='${datadir}/locale' + + + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && - (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then - : ; - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5 -$as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; } - XGETTEXT=":" - fi - rm -f messages.po - fi - ac_config_commands="$ac_config_commands default-1" + ac_config_commands="$ac_config_commands po-directories" @@ -4495,7 +4870,7 @@ $as_echo_n "checking for ld used by GCC... " >&6; } # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; @@ -4529,9 +4904,9 @@ else # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; + test "$with_gnu_ld" != no && break ;; *) - test "$with_gnu_ld" != yes && break ;; + test "$with_gnu_ld" != yes && break ;; esac fi done @@ -4549,7 +4924,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${acl_cv_prog_gnu_ld+set}" = set; then : @@ -4569,6 +4944,7 @@ with_gnu_ld=$acl_cv_prog_gnu_ld + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 $as_echo_n "checking for shared library run path origin... " >&6; } if test "${acl_cv_rpath+set}" = set; then : @@ -4585,12 +4961,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 $as_echo "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" - libext="$acl_cv_libext" - shlibext="$acl_cv_shlibext" - hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - hardcode_direct="$acl_cv_hardcode_direct" - hardcode_minus_L="$acl_cv_hardcode_minus_L" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; : @@ -4601,6 +4979,206 @@ fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + + + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 +$as_echo_n "checking for 64-bit host... " >&6; } +if test "${gl_cv_solaris_64bit+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _LP64 +sixtyfour bits +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sixtyfour bits" >/dev/null 2>&1; then : + gl_cv_solaris_64bit=yes +else + gl_cv_solaris_64bit=no +fi +rm -f conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 +$as_echo "$gl_cv_solaris_64bit" >&6; } + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + + + + + + + + @@ -4640,7 +5218,11 @@ if test "${with_libiconv_prefix+set}" = set; then : else additional_includedir="$withval/include" - additional_libdir="$withval/lib" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi fi fi @@ -4649,6 +5231,8 @@ fi LIBICONV= LTLIBICONV= INCICONV= + LIBICONV_PREFIX= + HAVE_LIBICONV= rpathdirs= ltrpathdirs= names_already_handled= @@ -4682,22 +5266,52 @@ fi found_la= found_so= found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done fi fi fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do @@ -4713,21 +5327,44 @@ fi case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done fi fi fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi ;; esac if test "X$found_dir" != "X"; then @@ -4738,7 +5375,9 @@ fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= @@ -4751,10 +5390,10 @@ fi if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi - if test "$hardcode_direct" = yes; then + if test "$acl_hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do @@ -4786,7 +5425,7 @@ fi if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi - if test "$hardcode_minus_L" != no; then + if test "$acl_hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" @@ -4803,8 +5442,18 @@ fi fi additional_includedir= case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi additional_includedir="$basedir/include" ;; esac @@ -4814,7 +5463,7 @@ fi if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in - linux*) haveit=yes;; + linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi @@ -4853,12 +5502,14 @@ fi case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in - linux*) haveit=yes;; + linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi @@ -4955,21 +5606,21 @@ fi done done if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then + if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" + eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" + eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done @@ -4999,17 +5650,92 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 -$as_echo_n "checking whether NLS is requested... " >&6; } - # Check whether --enable-nls was given. -if test "${enable_nls+set}" = set; then : - enableval=$enable_nls; USE_NLS=$enableval + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 +$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } +if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then : + $as_echo_n "(cached) " >&6 else - USE_NLS=yes + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <CoreFoundation/CFPreferences.h> +int +main () +{ +CFPreferencesCopyAppValue(NULL, NULL) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFPreferencesCopyAppValue=yes +else + gt_cv_func_CFPreferencesCopyAppValue=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 +$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + +$as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 +$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } +if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gt_save_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <CoreFoundation/CFLocale.h> +int +main () +{ +CFLocaleCopyCurrent(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gt_cv_func_CFLocaleCopyCurrent=yes +else + gt_cv_func_CFLocaleCopyCurrent=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gt_save_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 +$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } + if test $gt_cv_func_CFLocaleCopyCurrent = yes; then + +$as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h + + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" + fi + - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 -$as_echo "$USE_NLS" >&6; } @@ -5018,45 +5744,67 @@ $as_echo "$USE_NLS" >&6; } LTLIBINTL= POSUB= + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no - - - + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 $as_echo_n "checking for GNU gettext in libc... " >&6; } -if test "${gt_cv_func_gnugettext1_libc+set}" = set; then : +if eval "test \"\${$gt_func_gnugettext_libc+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <libintl.h> +$gt_revision_test_code extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; int main () { bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_domain_bindings +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - gt_cv_func_gnugettext1_libc=yes + eval "$gt_func_gnugettext_libc=yes" else - gt_cv_func_gnugettext1_libc=no + eval "$gt_func_gnugettext_libc=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext1_libc" >&5 -$as_echo "$gt_cv_func_gnugettext1_libc" >&6; } +eval ac_res=\$$gt_func_gnugettext_libc + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } - if test "$gt_cv_func_gnugettext1_libc" != "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then @@ -5144,6 +5892,123 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 $as_echo "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +$as_echo_n "checking for working iconv... " >&6; } +if test "${am_cv_func_iconv_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + if test "$cross_compiling" = yes; then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <iconv.h> +#include <string.h> +int main () +{ + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\263"; + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + return 1; + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + return 1; + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + am_cv_func_iconv_works=yes +else + am_cv_func_iconv_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + LIBS="$am_save_LIBS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +$as_echo "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then $as_echo "#define HAVE_ICONV 1" >>confdefs.h @@ -5164,6 +6029,11 @@ $as_echo "$LIBICONV" >&6; } + + + + + use_additional=yes acl_save_prefix="$prefix" @@ -5199,7 +6069,11 @@ if test "${with_libintl_prefix+set}" = set; then : else additional_includedir="$withval/include" - additional_libdir="$withval/lib" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi fi fi @@ -5208,6 +6082,8 @@ fi LIBINTL= LTLIBINTL= INCINTL= + LIBINTL_PREFIX= + HAVE_LIBINTL= rpathdirs= ltrpathdirs= names_already_handled= @@ -5241,22 +6117,52 @@ fi found_la= found_so= found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi if test $use_additional = yes; then - if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then - found_dir="$additional_libdir" - found_so="$additional_libdir/lib$name.$shlibext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" - fi - else - if test -f "$additional_libdir/lib$name.$libext"; then - found_dir="$additional_libdir" - found_a="$additional_libdir/lib$name.$libext" - if test -f "$additional_libdir/lib$name.la"; then - found_la="$additional_libdir/lib$name.la" + dir="$additional_libdir" + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done fi fi fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBINTL; do @@ -5272,21 +6178,44 @@ fi case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` - if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then - found_dir="$dir" - found_so="$dir/lib$name.$shlibext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" - fi - else - if test -f "$dir/lib$name.$libext"; then + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then found_dir="$dir" - found_a="$dir/lib$name.$libext" - if test -f "$dir/lib$name.la"; then - found_la="$dir/lib$name.la" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done fi fi fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi ;; esac if test "X$found_dir" != "X"; then @@ -5297,7 +6226,9 @@ fi if test "X$found_dir" != "X"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then - if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else haveit= @@ -5310,10 +6241,10 @@ fi if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi - if test "$hardcode_direct" = yes; then + if test "$acl_hardcode_direct" = yes; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else - if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" haveit= for x in $rpathdirs; do @@ -5345,7 +6276,7 @@ fi if test -z "$haveit"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" fi - if test "$hardcode_minus_L" != no; then + if test "$acl_hardcode_minus_L" != no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" @@ -5362,8 +6293,18 @@ fi fi additional_includedir= case "$found_dir" in - */lib | */lib/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'intl'; then + LIBINTL_PREFIX="$basedir" + fi additional_includedir="$basedir/include" ;; esac @@ -5373,7 +6314,7 @@ fi if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in - linux*) haveit=yes;; + linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi @@ -5412,12 +6353,14 @@ fi case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - if test "X$additional_libdir" != "X/usr/lib"; then + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= - if test "X$additional_libdir" = "X/usr/local/lib"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in - linux*) haveit=yes;; + linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi @@ -5514,21 +6457,21 @@ fi done done if test "X$rpathdirs" != "X"; then - if test -n "$hardcode_libdir_separator"; then + if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" - eval flag=\"$hardcode_libdir_flag_spec\" + eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" - eval flag=\"$hardcode_libdir_flag_spec\" + eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" done @@ -5540,9 +6483,14 @@ fi done fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 $as_echo_n "checking for GNU gettext in libintl... " >&6; } -if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then : +if eval "test \"\${$gt_func_gnugettext_libintl+set}\"" = set; then : $as_echo_n "(cached) " >&6 else gt_save_CPPFLAGS="$CPPFLAGS" @@ -5552,44 +6500,46 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <libintl.h> +$gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif -const char *_nl_expand_alias (); +const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - gt_cv_func_gnugettext1_libintl=yes + eval "$gt_func_gnugettext_libintl=yes" else - gt_cv_func_gnugettext1_libintl=no + eval "$gt_func_gnugettext_libintl=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <libintl.h> +$gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif -const char *_nl_expand_alias (); +const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); -return (int) gettext ("") + _nl_msg_cat_cntr + *_nl_expand_alias (0) +return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } @@ -5597,7 +6547,7 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" - gt_cv_func_gnugettext1_libintl=yes + eval "$gt_func_gnugettext_libintl=yes" fi rm -f core conftest.err conftest.$ac_objext \ @@ -5606,12 +6556,13 @@ rm -f core conftest.err conftest.$ac_objext \ CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_gnugettext1_libintl" >&5 -$as_echo "$gt_cv_func_gnugettext1_libintl" >&6; } +eval ac_res=\$$gt_func_gnugettext_libintl + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } fi - if test "$gt_cv_func_gnugettext1_libc" = "yes" \ - || { test "$gt_cv_func_gnugettext1_libintl" = "yes" \ + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes @@ -5623,6 +6574,14 @@ $as_echo "$gt_cv_func_gnugettext1_libintl" >&6; } + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then @@ -5641,7 +6600,7 @@ $as_echo "$USE_NLS" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 $as_echo_n "checking where the gettext function comes from... " >&6; } if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" else gt_source="libc" @@ -5656,7 +6615,7 @@ $as_echo "$gt_source" >&6; } if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then - if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 $as_echo_n "checking how to link with libintl... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 @@ -5763,6 +6722,8 @@ $as_echo "$enable_bgcolor" >&6; } + + INSTALL_W3MIMGDISPLAY='${INSTALL_PROGRAM}' $as_echo "#define INSTALL_W3MIMGDISPLAY \$INSTALL_W3MIMGDISPLAY" >>confdefs.h @@ -5776,6 +6737,8 @@ $as_echo "$enable_bgcolor" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if image is enabled" >&5 $as_echo_n "checking if image is enabled... " >&6; } # Check whether --enable-image was given. @@ -5796,10 +6759,14 @@ $as_echo "$enable_image" >&6; } if test -c /dev/fb0; then enable_image=x11,fb fi;; + CYGWIN*) + enable_image=x11,win;; esac fi save_ifs="$IFS"; IFS=","; - for img in $enable_image; do + set x $enable_image; shift + IFS="$save_ifs" + for img in "$@"; do case $img in x11) x11=yes;; fb) fb=yes;; @@ -5809,9 +6776,9 @@ $as_echo "$enable_image" >&6; } INSTALL_W3MIMGDISPLAY='${INSTALL} -o root -m 4755 -s' $as_echo "#define INSTALL_W3MIMGDISPLAY \$INSTALL_W3MIMGDISPLAY" >>confdefs.h ;; + win) win=yes;; esac done - IFS="$save_ifs" enable_image=yes $as_echo "#define USE_IMAGE 1" >>confdefs.h @@ -5862,6 +6829,7 @@ $as_echo "$with_imagelib" >&6; } esac done IMGTARGETS="" + IMGLINK='$(CC)' if test x"$with_gtk2" = xyes; then version="`$PKG_CONFIG --modversion gdk-pixbuf-2.0 2>/dev/null`" if test x"$version" != x; then @@ -6029,6 +6997,15 @@ $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with X11 support" >&2;} $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with FB support" >&2;} fi fi + if test x"$win" = xyes; then + $as_echo "#define USE_W3MIMG_WIN 1" >>confdefs.h + + IMGOBJS="$IMGOBJS win/win_w3mimg.o" + IMGTARGETS="${IMGTARGETS} win" + IMGWINCFLAGS="-I/usr/include/w32api" + IMGWINLDFLAGS="-lgdiplus -lgdi32 -luser32" + IMGLINK='$(CXX)' + fi $as_echo "#define IMGTARGETS \"\$IMGTARGETS\"" >>confdefs.h $as_echo "#define IMGOBJS \"\$IMGOBJS\"" >>confdefs.h @@ -6039,7 +7016,13 @@ $as_echo "$as_me: WARNING: unable to build w3mimgdisplay with FB support" >&2;} $as_echo "#define IMGFBCFLAGS \"\$IMGFBCFLAGS\"" >>confdefs.h - $as_echo "#define IMGFBLDFLAGS \"\$IMGLDFLAGS\"" >>confdefs.h + $as_echo "#define IMGFBLDFLAGS \"\$IMGFBLDFLAGS\"" >>confdefs.h + + $as_echo "#define IMGLINK \"\$IMGLINK\"" >>confdefs.h + + $as_echo "#define IMGWINCFLAGS \"\$IMGWINCFLAGS\"" >>confdefs.h + + $as_echo "#define IMGWINLDFLAGS \"\$IMGWINLDFLAGS\"" >>confdefs.h fi if test x"$enable_image" != xno; then @@ -6119,7 +7102,7 @@ $as_echo "$enable_keymap" >&6; } xlynx) KEYMAP_FILE="keybind_lynx";; *) - as_fn_error "keymap should be either w3m or lynx." "$LINENO" 5;; + as_fn_error $? "keymap should be either w3m or lynx." "$LINENO" 5 ;; esac HELP_FILE=w3mhelp-${enable_keymap}_$w3m_lang.html @@ -6383,7 +7366,7 @@ do { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -l$lib" >&5 $as_echo_n "checking for -l$lib... " >&6; } extlib="not found" - for dir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib + for dir in /lib /usr/lib /usr/local/lib /usr/ucblib /usr/ccslib /usr/ccs/lib /lib64 /usr/lib64 do if test -f $dir/lib$lib.a -o -f $dir/lib$lib.so ; then LIBS="$LIBS -l$lib" @@ -6541,25 +7524,14 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if SSL is suported" >&5 -$as_echo_n "checking if SSL is suported... " >&6; } -# Check whether --with-ssl was given. -if test "${with_ssl+set}" = set; then : - withval=$with_ssl; -else - with_ssl="yes" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_ssl" >&5 -$as_echo "$with_ssl" >&6; } -if test x"$with_ssl" != xno; then - succeeded=no - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : @@ -6585,7 +7557,6 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" ;; esac fi @@ -6599,55 +7570,149 @@ $as_echo "no" >&6; } fi +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done + done +IFS=$as_save_IFS - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openssl" >&5 -$as_echo_n "checking for openssl... " >&6; } + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi - if $PKG_CONFIG --exists "openssl" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - succeeded=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking SSL_CFLAGS" >&5 -$as_echo_n "checking SSL_CFLAGS... " >&6; } - SSL_CFLAGS=`$PKG_CONFIG --cflags "openssl"` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SSL_CFLAGS" >&5 -$as_echo "$SSL_CFLAGS" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking SSL_LIBS" >&5 -$as_echo_n "checking SSL_LIBS... " >&6; } - SSL_LIBS=`$PKG_CONFIG --libs "openssl"` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SSL_LIBS" >&5 -$as_echo "$SSL_LIBS" >&6; } - else - SSL_CFLAGS="" - SSL_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - SSL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "openssl"` + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi - fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if SSL is suported" >&5 +$as_echo_n "checking if SSL is suported... " >&6; } +# Check whether --with-ssl was given. +if test "${with_ssl+set}" = set; then : + withval=$with_ssl; +else + with_ssl="yes" +fi - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_ssl" >&5 +$as_echo "$with_ssl" >&6; } +if test x"$with_ssl" != xno; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 +$as_echo_n "checking for SSL... " >&6; } + +if test -n "$SSL_CFLAGS"; then + pkg_cv_SSL_CFLAGS="$SSL_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "openssl") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SSL_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SSL_LIBS"; then + pkg_cv_SSL_LIBS="$SSL_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5 + ($PKG_CONFIG --exists --print-errors "openssl") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SSL_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "openssl" 2>&1` + else + SSL_PKG_ERRORS=`$PKG_CONFIG --print-errors "openssl" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SSL_PKG_ERRORS" >&5 - if test $succeeded = yes; then - : - else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL library/header" >&5 $as_echo_n "checking for SSL library/header... " >&6; } @@ -6669,8 +7734,37 @@ $as_echo "$with_ssl" >&6; } fi done - fi +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL library/header" >&5 +$as_echo_n "checking for SSL library/header... " >&6; } + test x"$with_ssl" = xyes && with_ssl="/usr/openssl /usr/ssl /usr /usr/local/openssl /usr/local/ssl /usr/local" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_ssl" >&5 +$as_echo "$with_ssl" >&6; } + for dir in $with_ssl + do + if test -f "$dir/include/openssl/ssl.h"; then + SSL_CFLAGS="$SSL_CFLAGS -I$dir/include/openssl" + if test "$dir" != "/usr"; then + SSL_CFLAGS="$SSL_CFLAGS -I$dir/include" + fi + elif test "$dir" != "/usr" -a -f "$dir/include/ssl.h"; then + SSL_CFLAGS="$SSL_CFLAGS -I$dir/include" + fi + if test "$dir" != "/usr" -a -f "$dir/lib/libssl.a"; then + SSL_LIBS="$SSL_LIBS -L$dir/lib" + fi + done + +else + SSL_CFLAGS=$pkg_cv_SSL_CFLAGS + SSL_LIBS=$pkg_cv_SSL_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_new in -lssl" >&5 $as_echo_n "checking for SSL_new in -lssl... " >&6; } if test "${ac_cv_lib_ssl_SSL_new+set}" = set; then : @@ -6848,8 +7942,7 @@ if test "x$ac_cv_lib_gpm_Gpm_Open" = x""yes; then : fi - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <sys/consio.h> MOUSE_GETINFO @@ -6867,9 +7960,9 @@ if ac_fn_c_try_cpp "$LINENO"; then : $as_echo "#define USE_SYSMOUSE 1" >>confdefs.h fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking terminal library" >&5 @@ -6889,7 +7982,7 @@ $as_echo "$with_termlib" >&6; } as_ac_Lib=`$as_echo "ac_cv_lib_$lib''_tgetent" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -l$lib" >&5 $as_echo_n "checking for tgetent in -l$lib... " >&6; } -if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Lib+set}\"" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6924,143 +8017,12 @@ fi eval ac_res=\$$as_ac_Lib { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Lib - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : W3M_LIBS="$W3M_LIBS -l$lib"; break fi done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : @@ -7180,8 +8142,7 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -7197,7 +8158,7 @@ $as_echo_n "checking GC library exists... " >&6; } # Check whether --with-gc was given. if test "${with_gc+set}" = set; then : - withval=$with_gc; test x"$with_gc" = xno && as_fn_error "You can not build w3m without gc" "$LINENO" 5 + withval=$with_gc; test x"$with_gc" = xno && as_fn_error $? "You can not build w3m without gc" "$LINENO" 5 else with_gc="yes" fi @@ -7238,7 +8199,7 @@ fi fi done if test x"$gcincludedir" = xno; then - as_fn_error "gc.h not found" "$LINENO" 5 + as_fn_error $? "gc.h not found" "$LINENO" 5 fi fi unset ac_cv_lib_gc_GC_init @@ -7337,7 +8298,7 @@ fi LDFLAGS="$ldflags" done if test x"$gclibdir" = xno; then - as_fn_error "libgc not found" "$LINENO" 5 + as_fn_error $? "libgc not found" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zError in -lz" >&5 @@ -7406,7 +8367,7 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$as_ac_Header+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7433,8 +8394,7 @@ fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF @@ -7787,9 +8747,8 @@ else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long long) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long long) +See \`config.log' for more details" "$LINENO" 5 ; } else ac_cv_sizeof_long_long=0 fi @@ -7811,8 +8770,7 @@ for ac_func in strcasecmp strcasestr strchr memcpy strerror bcopy setpgrp chdir do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -7945,7 +8903,7 @@ if test "${ac_cv_func_setpgrp_void+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : - as_fn_error "cannot check setpgrp when cross compiling" "$LINENO" 5 + as_fn_error $? "cannot check setpgrp when cross compiling" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7995,7 +8953,7 @@ else int main () { -char* cs = nl_langinfo(CODESET); +char* cs = nl_langinfo(CODESET); return !cs; ; return 0; } @@ -8128,7 +9086,7 @@ _ACEOF cvsver=`$AWK '\$1 ~ /Id:/ { print \$3}' $srcdir/ChangeLog` sed -e 's/define CURRENT_VERSION "\(.*\)+cvs/define CURRENT_VERSION "\1+cvs-'$cvsver'/' $srcdir/version.c.in > version.c CURRENT_VERSION=`sed -n 's/.*define CURRENT_VERSION *"w3m\/\(.*\)".*$/\1/p' version.c` -ac_config_files="$ac_config_files Makefile posubst po/Makefile.in scripts/Makefile scripts/dirlist.cgi scripts/w3mhelp.cgi scripts/w3mmail.cgi scripts/xface2xpm scripts/multipart/Makefile scripts/multipart/multipart.cgi scripts/w3mman/Makefile scripts/w3mman/w3mman scripts/w3mman/w3mman.1 scripts/w3mman/w3mman2html.cgi libwc/Makefile w3mimg/Makefile w3mimg/fb/Makefile w3mimg/x11/Makefile w3mhelp-w3m_en.html w3mhelp-w3m_ja.html w3mhelp-lynx_en.html w3mhelp-lynx_ja.html" +ac_config_files="$ac_config_files Makefile posubst po/Makefile.in scripts/Makefile scripts/dirlist.cgi scripts/w3mhelp.cgi scripts/w3mmail.cgi scripts/xface2xpm scripts/multipart/Makefile scripts/multipart/multipart.cgi scripts/w3mman/Makefile scripts/w3mman/w3mman scripts/w3mman/w3mman.1 scripts/w3mman/w3mman2html.cgi libwc/Makefile w3mimg/Makefile w3mimg/fb/Makefile w3mimg/x11/Makefile w3mimg/win/Makefile w3mhelp-w3m_en.html w3mhelp-w3m_ja.html w3mhelp-lynx_en.html w3mhelp-lynx_ja.html" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -8213,6 +9171,7 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' @@ -8374,19 +9333,19 @@ export LANGUAGE (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -8582,7 +9541,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p @@ -8636,7 +9595,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by w3m $as_me 0.5.2, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -8702,16 +9661,17 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ w3m config.status 0.5.2 -configured by $0, generated by GNU Autoconf 2.65, +configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF @@ -8722,11 +9682,16 @@ ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -8748,6 +9713,7 @@ do $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; @@ -8760,7 +9726,7 @@ do ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' + as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; @@ -8769,7 +9735,7 @@ Try \`$0 --help' for more information.";; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" @@ -8815,7 +9781,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it - # from automake. + # from automake < 1.5. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" @@ -8830,7 +9796,7 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "posubst") CONFIG_FILES="$CONFIG_FILES posubst" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; @@ -8849,12 +9815,13 @@ do "w3mimg/Makefile") CONFIG_FILES="$CONFIG_FILES w3mimg/Makefile" ;; "w3mimg/fb/Makefile") CONFIG_FILES="$CONFIG_FILES w3mimg/fb/Makefile" ;; "w3mimg/x11/Makefile") CONFIG_FILES="$CONFIG_FILES w3mimg/x11/Makefile" ;; + "w3mimg/win/Makefile") CONFIG_FILES="$CONFIG_FILES w3mimg/win/Makefile" ;; "w3mhelp-w3m_en.html") CONFIG_FILES="$CONFIG_FILES w3mhelp-w3m_en.html" ;; "w3mhelp-w3m_ja.html") CONFIG_FILES="$CONFIG_FILES w3mhelp-w3m_ja.html" ;; "w3mhelp-lynx_en.html") CONFIG_FILES="$CONFIG_FILES w3mhelp-lynx_en.html" ;; "w3mhelp-lynx_ja.html") CONFIG_FILES="$CONFIG_FILES w3mhelp-lynx_ja.html" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done @@ -8892,7 +9859,7 @@ $debug || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -8909,7 +9876,7 @@ if test "x$ac_cr" = x; then fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi @@ -8923,18 +9890,18 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -9023,20 +9990,28 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi @@ -9064,7 +10039,7 @@ for ac_last_try in false false :; do if test -z "$ac_t"; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -9149,7 +10124,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" @@ -9162,7 +10137,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -9190,7 +10165,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -9217,7 +10192,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -9291,6 +10266,11 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 @@ -9345,25 +10325,26 @@ s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # @@ -9374,19 +10355,19 @@ which seems to be undefined. Please make sure it is defined." >&2;} $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 + || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; @@ -9397,7 +10378,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} case $ac_file$ac_mode in - "default-1":C) + "po-directories":C) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in @@ -9417,6 +10398,9 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" @@ -9430,12 +10414,13 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi - ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` - # Hide the ALL_LINGUAS assigment from automake. + ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. + # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES @@ -9516,7 +10501,7 @@ _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. @@ -9537,7 +10522,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 diff --git a/configure.ac b/configure.ac index 7792a07..33d2357 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ W3M_LANG=${LC_ALL:-$LANG} dnl AM_INIT_AUTOMAKE(w3m, 0.4) AC_CONFIG_HEADER(config.h) dnl Checks for programs. -dnl AC_PROG_CXX +AC_PROG_CXX AC_PROG_AWK AC_PROG_CC AC_PROG_CPP @@ -184,7 +184,7 @@ scripts/multipart/Makefile scripts/multipart/multipart.cgi \ scripts/w3mman/Makefile scripts/w3mman/w3mman scripts/w3mman/w3mman.1 \ scripts/w3mman/w3mman2html.cgi \ libwc/Makefile \ -w3mimg/Makefile w3mimg/fb/Makefile w3mimg/x11/Makefile \ +w3mimg/Makefile w3mimg/fb/Makefile w3mimg/x11/Makefile w3mimg/win/Makefile \ w3mhelp-w3m_en.html w3mhelp-w3m_ja.html \ w3mhelp-lynx_en.html w3mhelp-lynx_ja.html]) diff --git a/doc-jp/README.img b/doc-jp/README.img index 301b520..d090bae 100644 --- a/doc-jp/README.img +++ b/doc-jp/README.img @@ -11,8 +11,8 @@ w3m ¤Ç¥¤¥ó¥é¥¤¥ó²èÁü¤òɽ¼¨ µ¡Ç½ - ¡¦X11 ¾å¤ÎüËö(xterm,kterm,rxvt,...)¤Þ¤¿¤Ï Linux ¤Î framebuffer ¾å¤Ë - ²èÁü(GIF,PNG,JPEG Åù)¤òɽ¼¨¤·¤Þ¤¹¡£ + ¡¦X11 ¾å¤ÎüËö(xterm,kterm,rxvt,...)¡¢ Linux ¤Î framebuffer ¾å¤Þ¤¿¤Ï + Windows üËö¾å¤Ë²èÁü(GIF,PNG,JPEG Åù)¤òɽ¼¨¤·¤Þ¤¹¡£ ¡¦img ¥¿¥°¤Ç»ØÄꤵ¤ì¤¿¥¤¥ó¥é¥¤¥ó²èÁü¤òɽ¼¨¤Ç¤¤Þ¤¹¡£ width,height °À¤Ë±þ¤¸¤ÆɬÍפÊÎΰè¤ò³ÎÊݤ·¤Æ¥ì¥ó¥À¥ê¥ó¥°¤·¤Þ¤¹¡£ align °À¤ËÂбþ¤·¤Æ¤¤¤Þ¤¹¡£ @@ -144,6 +144,7 @@ w3mimgdisplay ¤ÎÀßÄê ¤ÎŬÅö¤Ê¥¡¼¤òÏ¢ÂǤ·¤Æ¤¯¤À¤µ¤¤¡£ ¡¦framebuffer ÉÁ²è´Ø·¸¤Ë¤Ï¡¢²¼µ URI ¤Î¥³¡¼¥É¤òÍøÍѤ·¤Þ¤·¤¿¡£ http://www.sainet.or.jp/~yamasaki/download/fb-sample.tar.gz + ¡¦Windows ¤Ç¤Ïɸ½à¥³¥ó¥½¡¼¥ë¡¢Cygwin rxvt¡¢PuTTY¤ÇÆ°ºî³Îǧ¤·¤Æ¤¤¤Þ¤¹¡£ ¹¹¿·µÏ¿ diff --git a/doc/README.img b/doc/README.img index b572621..0c10114 100644 --- a/doc/README.img +++ b/doc/README.img @@ -12,7 +12,8 @@ Introduction Support * Display inline image (GIF,PNG,JPEG, etc.) on terminals - (xterm,rxvt, etc.) of X11 or Linux framebuffer device. + (xterm,rxvt, etc.) of X11, Linux framebuffer device or + terminals of Windows. * Support inline image of <img> tag. Support of attributes "width", "height", and "align". * Direct display of image file which header is "Content-type: image/*" @@ -42,7 +43,7 @@ Key functions keymap C-c STOP_IMAGE keyamp t SET_OPTION display_image=toggle -Comandline options +Commandline options -ppc <pixel> # of pixels per character. The default value is automatically @@ -70,7 +71,7 @@ Option panel ext_image_viewer Use external image viewer, when a command VIEW_IMAGE or view of image file which header is "Content-type: image/*". - The default is ON. If it is OFF, the image is directly displaied. + The default is ON. If it is OFF, the image is directly displayed. image_scale Scale of image (%). The default value is 100(%). imgdisplay @@ -140,6 +141,10 @@ Notice Some code in w3mimg/fb/fb.c was originally written by Mr. Yamasaki. http://www.sainet.or.jp/~yamasaki/download/fb-sample.tar.gz + On Windows, we check the behaver on standard console, Cygwin rxvt + and PuTTY. + + Change log 2002/02/04 @@ -157,7 +162,7 @@ Change log 2002/01/28 w3m-0.2.4-img-2.0 * Based on w3m-0.2.4+cvs-1.265. * pixel_per_char and pixel_per_line are automatically detected. - * The bckground color of terminal is automatically detected. + * The background color of terminal is automatically detected. * The source code to display images is moved to image.c 2002/01/08 w3m-0.2.4-img-1.18 @@ -1,4 +1,4 @@ -/* $Id: entity.h,v 1.4 2010/12/15 10:50:24 htrb Exp $ */ +/* $Id: entity.h,v 1.5 2010/12/21 10:13:55 htrb Exp $ */ #include "hash.h" static HashItem_si MyHashItem[] = { /* 0 */ {"otimes", 0x2297, &MyHashItem[1]}, @@ -1,4 +1,4 @@ -/* $Id: image.c,v 1.36 2003/07/07 15:49:03 ukai Exp $ */ +/* $Id: image.c,v 1.37 2010/12/21 10:13:55 htrb Exp $ */ #include "fm.h" #include <sys/types.h> @@ -115,10 +115,13 @@ openImgdisplay() static void closeImgdisplay() { - if (Imgdisplay_rf) - fclose(Imgdisplay_rf); if (Imgdisplay_wf) fclose(Imgdisplay_wf); + if (Imgdisplay_rf) { + /* sync with the child */ + getc(Imgdisplay_rf); /* EOF expected */ + fclose(Imgdisplay_rf); + } if (Imgdisplay_pid) kill(Imgdisplay_pid, SIGKILL); Imgdisplay_rf = NULL; diff --git a/w3mimg/Makefile.in b/w3mimg/Makefile.in index a197352..dfc550c 100644 --- a/w3mimg/Makefile.in +++ b/w3mimg/Makefile.in @@ -11,10 +11,11 @@ AR=ar RANLIB=@RANLIB@ RM=rm -IMGCFLAGS=@IMGX11CFLAGS@ @IMGFBCFLAGS@ +SUBDIRS=fb x11 win +IMGCFLAGS=@IMGX11CFLAGS@ @IMGFBCFLAGS@ @IMGWINCFLAGS@ IMGOBJS=@IMGOBJS@ -.PHONY: fb x11 +.PHONY: $(SUBDIRS) all: @IMGTARGETS@ w3mimg.a w3mimg.a: $(IMGOBJS) @@ -24,18 +25,18 @@ w3mimg.a: $(IMGOBJS) w3mimg.o: w3mimg.c $(CC) $(CFLAGS) -c $< -fb x11: +$(SUBDIRS): cd $@ && $(MAKE) CC="$(CC)" OPTS="$(OPTS)" clean: @-$(RM) -f *.o - @for dir in fb x11; do \ + @for dir in $(SUBDIRS); do \ (cd $$dir && $(MAKE) clean RM=$(RM)); \ done -$(RM) -f w3mimg.a distclean: clean - for subdir in fb x11; \ + for subdir in $(SUBDIRS); \ do \ (cd $$subdir && $(MAKE) distclean); \ done diff --git a/w3mimg/w3mimg.c b/w3mimg/w3mimg.c index 144a2d9..46b5cac 100644 --- a/w3mimg/w3mimg.c +++ b/w3mimg/w3mimg.c @@ -1,4 +1,4 @@ -/* $Id: w3mimg.c,v 1.5 2002/11/06 03:50:49 ukai Exp $ */ +/* $Id: w3mimg.c,v 1.6 2010/12/21 10:13:55 htrb Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -14,6 +14,10 @@ w3mimg_open() uid_t runner_uid = getuid(); uid_t owner_uid = geteuid(); #endif +#ifdef USE_W3MIMG_WIN + if (w_op == NULL) + w_op = w3mimg_winopen(); +#endif #ifdef USE_W3MIMG_X11 #ifdef W3MIMGDISPLAY_SETUID /* run in user privileges */ diff --git a/w3mimg/w3mimg.h b/w3mimg/w3mimg.h index 3807ca5..f6415a9 100644 --- a/w3mimg/w3mimg.h +++ b/w3mimg/w3mimg.h @@ -1,6 +1,13 @@ -/* $Id: w3mimg.h,v 1.8 2003/07/13 16:19:10 ukai Exp $ */ +/* $Id: w3mimg.h,v 1.9 2010/12/21 10:13:55 htrb Exp $ */ +#ifndef W3MIMG_W3MIMG_H +#define W3MIMG_W3MIMG_H + #include "config.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef USE_W3MIMG_FB #include "w3mimg/fb/fb.h" #include "w3mimg/fb/fb_img.h" @@ -42,5 +49,13 @@ extern w3mimg_op *w3mimg_x11open(); #ifdef USE_W3MIMG_FB extern w3mimg_op *w3mimg_fbopen(); #endif +#ifdef USE_W3MIMG_WIN +extern w3mimg_op *w3mimg_winopen(); +#endif extern w3mimg_op *w3mimg_open(); + +#ifdef __cplusplus +} +#endif +#endif /* W3MIMG_W3MIMG_H */ diff --git a/w3mimg/win/Makefile.in b/w3mimg/win/Makefile.in new file mode 100644 index 0000000..b760a3d --- /dev/null +++ b/w3mimg/win/Makefile.in @@ -0,0 +1,31 @@ +# +# w3mimg/win/Makefile +# +# +@SET_MAKE@ +SHELL=@SHELL@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = $(srcdir):. +CFLAGS=$(OPTS) -I../.. -I$(top_srcdir) -I$(srcdir) @CFLAGS@ @CPPFLAGS@ @DEFS@ $(IMGCFLAGS) +RM=rm +CC=@CC@ +CXX=@CXX@ + +IMGCFLAGS=@IMGWINCFLAGS@ +OBJS=win_w3mimg.o + +all: win_w3mimg.o + +win_w3mimg.o: win_w3mimg.cpp + $(CXX) $(CFLAGS) -c $< + +clean: + @-$(RM) -f *.o + +distclean: clean + -$(RM) -f Makefile + +# + + diff --git a/w3mimg/win/win_w3mimg.cpp b/w3mimg/win/win_w3mimg.cpp new file mode 100644 index 0000000..1864fcb --- /dev/null +++ b/w3mimg/win/win_w3mimg.cpp @@ -0,0 +1,1063 @@ +/* $Id: win_w3mimg.cpp,v 1.1 2010/12/21 10:13:55 htrb Exp $ */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include "config.h" +#include <assert.h> +#include <locale.h> + +#include <new> +#include <algorithm> + +#include "w3mimg/w3mimg.h" +#include <windows.h> +#include <gdiplus.h> +#include <unistd.h> +#include <sys/cygwin.h> +/* GDI+ can handle BMP, GIF, JPEG, PNG and TIFF by itself. */ + +#define OFFSET_X 2 +#define OFFSET_Y 2 +#define DEBUG +#define USE_GDIP_CACHED_BITMAP + +#ifdef DEBUG +#define THROW_NONE throw() +#else +#define THROW_NONE +#endif + +struct win_info { + HWND window; + Gdiplus::ARGB background_pixel; + ULONG_PTR gdiplus_token; + FILE *logfile; +}; + +struct window_list { + HWND *wnd; + size_t nwnd; + size_t capacity; +}; + +#ifdef USE_GDIP_CACHED_BITMAP +typedef Gdiplus::CachedBitmap *cache_handle; +#else +typedef HBITMAP cache_handle; +#endif +class win_image { +private: + win_image(const win_image &); // decl only + win_image &operator=(const win_image &); // decl only + + Gdiplus::Bitmap *gpbitmap; + unsigned int nframe; + unsigned int current; + unsigned long tick; + unsigned long loopcount; // zero = infinite + unsigned long *delay; // unit: millisecond + cache_handle *cache; + +public: + win_image() THROW_NONE; + ~win_image() THROW_NONE; + int load(w3mimg_op *wop, Gdiplus::Bitmap **p_gpbitmap, + int *wreturn, int *hreturn) THROW_NONE; + int show(w3mimg_op *wop, int sx, int sy, int sw, int sh, int x, int y) THROW_NONE; + int animate(w3mimg_op *wop) THROW_NONE; +}; + +static int win_init(w3mimg_op * wop) THROW_NONE; +static int win_finish(w3mimg_op * wop) THROW_NONE; +static int win_active(w3mimg_op * wop) THROW_NONE; +static void win_set_background(w3mimg_op * wop, char *background) THROW_NONE; +static void win_sync(w3mimg_op * wop) THROW_NONE; +static void win_close(w3mimg_op * wop) THROW_NONE; + +static int win_load_image(w3mimg_op * wop, W3MImage * img, char *fname, + int w, int h) THROW_NONE; +static int win_show_image(w3mimg_op * wop, W3MImage * img, + int sx, int sy, int sw, int sh, int x, int y) THROW_NONE; +static void win_free_image(w3mimg_op * wop, W3MImage * img) THROW_NONE; +static int win_get_image_size(w3mimg_op * wop, W3MImage * img, + char *fname, int *w, int *h) THROW_NONE; +static int win_clear(w3mimg_op * wop, int x, int y, int w, int h) THROW_NONE; + +static int window_alive(w3mimg_op *wop) THROW_NONE; +static Gdiplus::Bitmap *read_image_file(w3mimg_op *wop, const char *fname) THROW_NONE; +static BOOL CALLBACK store_to_window_list(HWND hWnd, LPARAM wndlist) THROW_NONE; +static void clear_window_list(struct window_list *wl) THROW_NONE; +static const char *gdip_strerror(Gdiplus::Status status) THROW_NONE; +static void gdip_perror(w3mimg_op *wop, Gdiplus::Status status, const char *func) THROW_NONE; +static char *win32_strerror_alloc(DWORD status) THROW_NONE; +static void win32_perror(w3mimg_op *wop, DWORD status, const char *func) THROW_NONE; +#if 0 /* unused */ +static WCHAR *mb2wstr_alloc(const char *) THROW_NONE; +static char *wstr2mb_alloc(const WCHAR *) THROW_NONE; +#endif + +#define PRELUDE(wop, xi) \ + assert(wop); \ + struct win_info *xi = static_cast<struct win_info *>(wop->priv); \ + assert(xi) + +win_image::win_image() THROW_NONE + : gpbitmap(NULL), nframe(0) +{} + +win_image::~win_image() THROW_NONE +{ + if (this->cache) { + for (size_t i = 0; i != this->nframe; ++i) { +#ifdef USE_GDIP_CACHED_BITMAP + delete this->cache[i]; +#else + if (this->cache[i]) + DeleteObject(this->cache[i]); +#endif + } + delete[] this->cache; + } + delete[] this->delay; + delete this->gpbitmap; +} + +int +win_image::load(w3mimg_op *wop, Gdiplus::Bitmap **p_gpbitmap, int *wreturn, int *hreturn) THROW_NONE +{ + PRELUDE(wop, xi); + Gdiplus::Bitmap *gpbitmap = *p_gpbitmap; + assert(gpbitmap); + Gdiplus::Status status = Gdiplus::Ok; + int retval = 0; + + Gdiplus::PropertyItem *loopcountbuf = NULL; + Gdiplus::PropertyItem *delaybuf = NULL; + unsigned long *delay = NULL; + cache_handle *cache = NULL; + + if (xi->logfile) { + fprintf(xi->logfile, "win_image::load(%p, %p, %p, %p) start\n", + wop, gpbitmap, wreturn, hreturn); + } + { + unsigned int width = gpbitmap->GetWidth(); + unsigned int height = gpbitmap->GetHeight(); + unsigned int nframe = gpbitmap->GetFrameCount(&Gdiplus::FrameDimensionTime); + unsigned long loopcount = 0; + + if (xi->logfile) + fprintf(xi->logfile, "win_image::load(): size[0]=%ux%u\n", width, height); + if (nframe == 0) { + // Not an animated picture + if (xi->logfile) + fprintf(xi->logfile, "win_image::load(): zero frame count\n"); + nframe = 1; + delay = new(std::nothrow) unsigned long[1]; + if (delay == NULL) + goto last; + delay[0] = 0; + } else { + unsigned int loopcountsize = gpbitmap->GetPropertyItemSize(PropertyTagLoopCount); + unsigned int delaysize = gpbitmap->GetPropertyItemSize(PropertyTagFrameDelay); + + // Get loop count + if (loopcountsize != 0) { + loopcountbuf = (Gdiplus::PropertyItem *)malloc(loopcountsize); + if (loopcountbuf == NULL) + goto last; + status = gpbitmap->GetPropertyItem(PropertyTagLoopCount, loopcountsize, loopcountbuf); + if (status != Gdiplus::Ok) + goto gdip_error; + if (loopcountbuf->type == PropertyTagTypeShort && + loopcountbuf->length >= sizeof(unsigned short)) { + loopcount = *(unsigned short *)loopcountbuf->value; + } else if (loopcountbuf->type == PropertyTagTypeLong && + loopcountbuf->length >= sizeof(unsigned long)) { + loopcount = *(unsigned long *)loopcountbuf->value; + } + } + if (xi->logfile) + fprintf(xi->logfile, "win_image::load(): loopcount=%lu\n", loopcount); + // Get delay times + if (delaysize != 0) { + delaybuf = (Gdiplus::PropertyItem *)malloc(delaysize); + if (delaybuf == NULL) + goto last; + status = gpbitmap->GetPropertyItem(PropertyTagFrameDelay, delaysize, delaybuf); + if (status != Gdiplus::Ok) + goto gdip_error; + delay = new(std::nothrow) unsigned long[nframe]; + if (delay == NULL) + goto last; + std::fill(delay, delay + nframe, 0); + if (delaybuf->type == PropertyTagTypeShort) { + unsigned int count = delaybuf->length / sizeof(unsigned short); + for (unsigned int i = 0; i != count; ++i) + delay[i] = ((unsigned short *)delaybuf->value)[i] * 10; + } else if (delaybuf->type == PropertyTagTypeLong) { + unsigned int count = delaybuf->length / sizeof(unsigned long); + for (unsigned int i = 0; i != count; ++i) + delay[i] = ((unsigned long *)delaybuf->value)[i] * 10; + } + } + if (xi->logfile) { + for (unsigned int i = 0; i != nframe; ++i) + fprintf(xi->logfile, "win_image::load(): delay[%u]=%lu\n", i, delay[i]); + } + // Get dimensions + for (unsigned int nextframe = 1; nextframe != nframe; ++nextframe) { + status = gpbitmap->SelectActiveFrame(&Gdiplus::FrameDimensionTime, nextframe); + if (status != Gdiplus::Ok) { + if (xi->logfile) + fprintf(xi->logfile, "win_image::load(): SelectActiveFrame() to %u failed = %d: %s\n", + nextframe, (int)status, gdip_strerror(status)); + goto last; + } + unsigned int iw = gpbitmap->GetWidth(); + unsigned int ih = gpbitmap->GetHeight(); + if (iw > width) + width = iw; + if (ih > height) + height = ih; + if (xi->logfile) + fprintf(xi->logfile, "win_image::load(): size[%u]=%ux%u\n", nextframe, iw, ih); + } + // Back to the top + status = gpbitmap->SelectActiveFrame(&Gdiplus::FrameDimensionTime, 0); + if (status != Gdiplus::Ok) { + if (xi->logfile) + fprintf(xi->logfile, "win_image::load(): SelectActiveFrame() to %u frame = %d: %s\n", + 1U, (int)status, gdip_strerror(status)); + goto last; + } + } + // Allocate cache array + cache = new(std::nothrow) cache_handle[nframe]; + if (cache == NULL) + goto last; + std::fill(cache, cache + nframe, (cache_handle)NULL); + // Sanity check + if (width > SHRT_MAX || height > SHRT_MAX) { + if (xi->logfile) + fprintf(xi->logfile, "win_image::load(): too big image: %ux%u\n", width, height); + goto last; + } + // Store the results + if (wreturn) + *wreturn = (int)width; + if (hreturn) + *hreturn = (int)height; + this->gpbitmap = gpbitmap; + *p_gpbitmap = NULL; // ownership transfer + this->nframe = nframe; + this->current = 0; + this->tick = 0; + this->loopcount = loopcount; + this->delay = delay; + delay = NULL; // ownership transfer + this->cache = cache; + cache = NULL; // ownership transfer + retval = 1; + } + goto last; + +gdip_error: + gdip_perror(wop, status, "win_image::load"); + goto last; +last: + delete[] cache; + delete[] delay; + free(delaybuf); + free(loopcountbuf); + if (xi->logfile) + fprintf(xi->logfile, "win_image::load() = %d\n", retval); + return retval; +} + +int +win_image::show(w3mimg_op *wop, int sx, int sy, int sw, int sh, int x, int y) THROW_NONE +{ + PRELUDE(wop, xi); + int retval = 0; + Gdiplus::Status status = Gdiplus::Ok; + cache_handle newcache = NULL; +#ifndef USE_GDIP_CACHED_BITMAP + HDC windc = NULL; + HDC memdc = NULL; +#endif + + if (xi->logfile) + fprintf(xi->logfile, "win_image::show(%p, %d, %d, %d, %d, %d, %d) start\n", + wop, sx, sy, sw, sh, x, y); + if (!window_alive(wop)) + goto last; + { + int xx = x + wop->offset_x; + int yy = y + wop->offset_y; + +#ifdef USE_GDIP_CACHED_BITMAP + // Prepare the Graphics object for painting + Gdiplus::Graphics graphics(xi->window); + if ((status = graphics.GetLastStatus()) != Gdiplus::Ok) + goto gdip_error; + Gdiplus::Rect clip(xx, yy, sw, sh); + status = graphics.SetClip(clip); + if (status != Gdiplus::Ok) + goto gdip_error; + + // Clear the area first as the picture may be transparent + status = graphics.Clear(Gdiplus::Color(xi->background_pixel)); + if (status != Gdiplus::Ok) + goto gdip_error; + + unsigned int retry_count = 2; + do { + if (this->cache[this->current] == NULL) { + // Cache the image + Gdiplus::CachedBitmap *newcache = new Gdiplus::CachedBitmap(this->gpbitmap, &graphics); + if (newcache == NULL) + goto last; + if ((status = newcache->GetLastStatus()) != Gdiplus::Ok) + goto gdip_error; + this->cache[this->current] = newcache; + newcache = NULL; // ownership transfer + --retry_count; + } + // Draw it + status = graphics.DrawCachedBitmap(this->cache[this->current], xx - sx, yy - sy); + if (status == Gdiplus::Ok) + break; + // maybe the user altered the display configuration + if (xi->logfile) + fprintf(xi->logfile, "win_image::show(): stale cache = %d: %s\n", + (int)status, gdip_strerror(status)); + delete this->cache[this->current]; + this->cache[this->current] = NULL; + if (retry_count == 0) + goto last; + } while (1); +#else /* !USE_GDIP_CACHED_BITMAP */ + // Prepare the GC for painting + windc = GetDC(xi->window); + if (windc == NULL) + goto win32_error; + // Prepare the GC for read/write access to the cached bitmap + memdc = CreateCompatibleDC(windc); + if (memdc == NULL) + goto win32_error; + unsigned int retry_count = 2; + do { + HGDIOBJ hbitmap_save; + if (this->cache[this->current] == NULL) { + unsigned int ow = gpbitmap->GetWidth(); + unsigned int oh = gpbitmap->GetHeight(); + // Cache the image + newcache = CreateCompatibleBitmap(windc, ow, oh); + if (newcache == NULL) + goto win32_error; + SetLastError(ERROR_SUCCESS); // SelectObject sometimes leave the error unchanged + hbitmap_save = SelectObject(memdc, newcache); + if (hbitmap_save == NULL || hbitmap_save == HGDI_ERROR) + goto win32_error; + Gdiplus::Graphics tmp_graphics(memdc); + if ((status = tmp_graphics.GetLastStatus()) != Gdiplus::Ok) + goto gdip_error; + status = tmp_graphics.Clear(Gdiplus::Color(xi->background_pixel)); + if (status != Gdiplus::Ok) + goto gdip_error; + status = tmp_graphics.DrawImage(this->gpbitmap, 0, 0, ow, oh); + if (status != Gdiplus::Ok) + goto gdip_error; + this->cache[this->current] = newcache; + newcache = NULL; // ownership transfer + --retry_count; + } else { + SetLastError(ERROR_SUCCESS); // SelectObject sometimes leave the error unchanged + hbitmap_save = SelectObject(memdc, this->cache[this->current]); + if (hbitmap_save == NULL || hbitmap_save == HGDI_ERROR) + goto stale_cache; + } + // Draw it + if (BitBlt(windc, xx, yy, sw, sh, memdc, sx, sy, SRCCOPY)) + break; + // maybe the user altered the display configuration +stale_cache: + if (xi->logfile) { + DWORD ecode = GetLastError(); + char *msg = win32_strerror_alloc(ecode); + fprintf(xi->logfile, "win_image::show(): stale cache = %u: %s\n", + (unsigned int)ecode, msg ? msg : "(unknown)"); + LocalFree(msg); + } + SetLastError(ERROR_SUCCESS); // SelectObject sometimes leave the error unchanged + hbitmap_save = SelectObject(memdc, hbitmap_save); + if (hbitmap_save == NULL || hbitmap_save == HGDI_ERROR) + goto win32_error; + DeleteObject(this->cache[this->current]); + this->cache[this->current] = NULL; + if (retry_count == 0) + goto last; + } while (1); +#endif /* !USE_GDIP_CACHED_BITMAP */ + + retval = 1; + } + goto last; +#ifndef USE_GDIP_CACHED_BITMAP +win32_error: + win32_perror(wop, GetLastError(), "win_image::show"); + goto last; +#endif +gdip_error: + gdip_perror(wop, status, "win_image::show"); + goto last; +last: +#ifdef USE_GDIP_CACHED_BITMAP + delete newcache; +#else + if (memdc) + DeleteDC(memdc); + if (windc) + ReleaseDC(xi->window, windc); + if (newcache) + DeleteObject(newcache); +#endif + if (xi->logfile) + fprintf(xi->logfile, "win_image::show() = %d\n", retval); + return retval; +} + +int +win_image::animate(w3mimg_op * wop) THROW_NONE +{ + PRELUDE(wop, xi); + int retval = 0; + Gdiplus::Status status = Gdiplus::Ok; + + if (xi->logfile) + fprintf(xi->logfile, "win_image::animate(%p) start\n", wop); + { + if (this->nframe <= 1) + goto animation_end; +#define UNIT_TICK 50 +#define MIN_DELAY (UNIT_TICK*2) + this->tick += UNIT_TICK; + if (this->tick >= MIN_DELAY && this->tick >= this->delay[this->current]) { + this->tick = 0; + unsigned int nextframe = this->current + 1; + if (nextframe >= this->nframe) { + if (this->loopcount == 1) // end of the loop + goto animation_end; + nextframe = 0; + } + status = this->gpbitmap->SelectActiveFrame(&Gdiplus::FrameDimensionTime, nextframe); + if (status != Gdiplus::Ok) + goto gdip_error; + this->current = nextframe; + if (nextframe == 0 && this->loopcount > 1) + --this->loopcount; + } +animation_end: + retval = 1; + } + goto last; +gdip_error: + gdip_perror(wop, status, "win_image::animate"); + goto last; +last: + if (xi->logfile) + fprintf(xi->logfile, "win_image::animate() = %d\n", retval); + return retval; +} + +static int +window_alive(w3mimg_op *wop) THROW_NONE +{ + PRELUDE(wop, xi); + if (xi->window == NULL) + return 0; + if (IsWindow(xi->window)) + return 1; + xi->window = NULL; + fputs("w3mimgdisplay: target window disappeared\n", stderr); + if (xi->logfile) + fputs("w3mimgdisplay: target window disappeared\n", xi->logfile); + return 0; +} + +static int +win_init(w3mimg_op *) THROW_NONE +{ + // nothing to do + return 1; +} + +static int +win_finish(w3mimg_op *) THROW_NONE +{ + // nothing to do + return 1; +} + +static int +win_clear(w3mimg_op *wop, int x, int y, int w, int h) THROW_NONE +{ + PRELUDE(wop, xi); + Gdiplus::Status status = Gdiplus::Ok; + int retval = 0; + + if (xi->logfile) + fprintf(xi->logfile, "win_clear(%p, %d, %d, %d, %d) start\n", + wop, x, y, w, h); + if (!window_alive(wop)) + goto last; + { + if (x < 0) + x = 0; + if (y < 0) + y = 0; + Gdiplus::SolidBrush brush(Gdiplus::Color(xi->background_pixel)); + if ((status = brush.GetLastStatus()) != Gdiplus::Ok) + goto gdip_error; + Gdiplus::Graphics graphics(xi->window); + if ((status = graphics.GetLastStatus()) != Gdiplus::Ok) + goto gdip_error; + status = graphics.FillRectangle(&brush, x + wop->offset_x, y + wop->offset_y, w, h); + if (status != Gdiplus::Ok) + goto gdip_error; + retval = 1; + } + goto last; +gdip_error: + gdip_perror(wop, status, "win_clear"); + goto last; +last: + if (xi->logfile) + fprintf(xi->logfile, "win_clear() = %d\n", retval); + return retval; +} + +static int +win_active(w3mimg_op * wop) THROW_NONE +{ + return window_alive(wop); +} + +static void +win_set_background(w3mimg_op * wop, char *background) THROW_NONE +{ + PRELUDE(wop, xi); + + HDC windc = NULL; + + if (xi->logfile) + fprintf(xi->logfile, "win_set_background(%p, \"%s\")\n", wop, background ? background : "(auto)"); + { + // Fallback value + // xi->background_pixel = Gdiplus::Color::White; + xi->background_pixel = Gdiplus::Color::Black; + + // Explicit + if (background) { + unsigned int r, g, b; + if (sscanf(background, "#%02x%02x%02x", &r, &g, &b) == 3) { + xi->background_pixel = Gdiplus::Color::MakeARGB((BYTE)255, (BYTE)r, (BYTE)g, (BYTE)b); + goto last; + } + } + + // Auto detect + if (xi->window == NULL || !IsWindow(xi->window)) + goto last; + windc = GetDC(xi->window); + if (windc == NULL) + goto win32_error; + COLORREF c = GetPixel(windc, + (wop->offset_x >= 1) ? (wop->offset_x - 1) : 0, + (wop->offset_y >= 1) ? (wop->offset_y - 1) : 0); + xi->background_pixel = Gdiplus::Color::MakeARGB( + (BYTE)255, GetRValue(c), GetGValue(c), GetBValue(c)); + } + goto last; +win32_error: + win32_perror(wop, GetLastError(), "win_set_background"); + goto last; +last: + if (xi->logfile) + fprintf(xi->logfile, "win_set_background() result = #%06x\n", + (unsigned int)xi->background_pixel); + if (windc) + ReleaseDC(xi->window, windc); +} + +static void +win_sync(w3mimg_op *) THROW_NONE +{ + // nothing to do + return; +} + +static void +win_close(w3mimg_op * wop) THROW_NONE +{ + PRELUDE(wop, xi); + + if (xi->gdiplus_token) + Gdiplus::GdiplusShutdown(xi->gdiplus_token); + if (xi->logfile) { + fprintf(xi->logfile, "win_close(%p)\n", wop); + fclose(xi->logfile); + } + delete xi; + delete wop; +} + +static Gdiplus::Bitmap * +read_image_file(w3mimg_op *wop, const char *fname) THROW_NONE +{ + PRELUDE(wop, xi); + Gdiplus::Status status = Gdiplus::Ok; + Gdiplus::Bitmap *retval = NULL; + + WCHAR *wfname = NULL; + Gdiplus::Bitmap *gpbitmap = NULL; + + if (xi->logfile) + fprintf(xi->logfile, "read_image_file(%p, \"%s\") start\n", wop, fname); + { + wfname = (WCHAR *)cygwin_create_path(CCP_POSIX_TO_WIN_W, fname); + if (wfname == NULL) + goto last; + gpbitmap = new Gdiplus::Bitmap(wfname); + if (gpbitmap == NULL) + goto last; + status = gpbitmap->GetLastStatus(); + switch (status) { + case Gdiplus::Ok: + break; + case Gdiplus::UnknownImageFormat: + case Gdiplus::FileNotFound: + goto last; // fail silently + default: + goto gdip_error; + } + retval = gpbitmap; + gpbitmap = NULL; // ownership transfer + } + goto last; +gdip_error: + gdip_perror(wop, status, "read_image_file"); +last: + delete gpbitmap; + free(wfname); + if (xi->logfile) + fprintf(xi->logfile, "read_image_file() = %p\n", retval); + return retval; +} + +static int +win_load_image(w3mimg_op * wop, W3MImage * img, char *fname, int w, int h) THROW_NONE +{ + PRELUDE(wop, xi); + int retval = 0; + Gdiplus::Bitmap *gpbitmap = NULL; + win_image *wimg = NULL; + + assert(img); + if (xi->logfile) { + fprintf(xi->logfile, "win_load_image(%p, %p, \"%s\", %d, %d) start\n", + wop, img, fname, w, h); + } + { + gpbitmap = read_image_file(wop, fname); + if (gpbitmap == NULL) + goto last; + int iw, ih; + wimg = new(std::nothrow) win_image; + if (!wimg->load(wop, &gpbitmap, &iw, &ih)) + goto last; + img->pixmap = wimg; + wimg = NULL; // ownership transfer + img->width = (0 <= w && w < iw) ? w : iw; + img->height = (0 <= h && h < ih) ? h : ih; + retval = 1; + } + goto last; +last: + delete wimg; + delete gpbitmap; + if (xi->logfile) + fprintf(xi->logfile, "win_load_image() = %d\n", retval); + return retval; +} + +static int +win_show_image(w3mimg_op * wop, W3MImage * img, int sx, int sy, int sw, + int sh, int x, int y) THROW_NONE +{ + PRELUDE(wop, xi); + int retval = 0; + + assert(img); + win_image *wimg = static_cast<win_image *>(img->pixmap); + assert(wimg); + + if (xi->logfile) + fprintf(xi->logfile, "win_show_image(%p, %p, %d, %d, %d, %d, %d, %d) start\n", + wop, img, sx, sy, sw, sh, x, y); + int sww = sw ? sw : img->width; + int shh = sh ? sh : img->height; + retval = wimg->show(wop, sx, sy, sww, shh, x, y) + && wimg->animate(wop); + if (xi->logfile) + fprintf(xi->logfile, "win_show_image() = %d\n", retval); + return retval; +} + +static void +win_free_image(w3mimg_op * wop, W3MImage * img) THROW_NONE +{ + PRELUDE(wop, xi); + + assert(img); + if (xi->logfile) + fprintf(xi->logfile, "win_free_image(%p, %p) pixmap=%p\n", wop, img, img->pixmap); + delete static_cast<win_image *>(img->pixmap); + img->pixmap = NULL; + img->width = 0; + img->height = 0; +} + +static int +win_get_image_size(w3mimg_op * wop, W3MImage *img_unused, char *fname, int *w, int *h) THROW_NONE +{ + PRELUDE(wop, xi); + int retval = 0; + Gdiplus::Bitmap *gpbitmap = NULL; + win_image *wimg = NULL; + + if (xi->logfile) { + fprintf(xi->logfile, "win_get_image_size(%p, %p, \"%s\", %p, %p) start\n", + wop, img_unused, fname, w, h); + } + { + gpbitmap = read_image_file(wop, fname); + if (gpbitmap == NULL) + goto last; + wimg = new(std::nothrow) win_image; + if (wimg == NULL) + goto last; + retval = wimg->load(wop, &gpbitmap, w, h);; + } + goto last; +last: + delete wimg; + delete gpbitmap; + if (xi->logfile) + fprintf(xi->logfile, "win_get_image_size() = %d\n", retval); + return retval; +} + +extern "C" w3mimg_op * +w3mimg_winopen() +{ + w3mimg_op *retval = NULL; + Gdiplus::Status status = Gdiplus::Ok; + + w3mimg_op *wop = NULL; + struct win_info *xi = NULL; + struct window_list children = { NULL, 0, 0 }; + + { + // Quit if running on X + const char *display_name; + if ((display_name = getenv("DISPLAY")) != NULL && + display_name[0] && strcmp(display_name, ":0") != 0) + return NULL; + + // Allocate the context objects + wop = new(std::nothrow) w3mimg_op(); // call the default ctor instead of "new w3mimg_op;" + if (wop == NULL) + return NULL; + wop->priv = xi = new(std::nothrow) win_info(); + if (xi == NULL) + goto last; + + // Debug logging + const char *logging_dir; + if ((logging_dir = getenv("W3MIMG_LOGDIR")) != NULL && + logging_dir[0]) { + size_t l = strlen(logging_dir) + sizeof "/w3mimgXXXXXXXXXX.log"; + char *fname = (char *)malloc(l); + snprintf(fname, l, "%s/w3mimg%d.log", logging_dir, (int)getpid()); + xi->logfile = fopen(fname, "a"); + if (xi->logfile) { + setvbuf(xi->logfile, NULL, _IONBF, 0); + fprintf(xi->logfile, "\nw3mimg_winopen() start pid=%d\n", (int)getpid()); + } + } + + // Look for the window to draw the image + xi->window = NULL; + const char *windowid; + if ((windowid = getenv("WINDOWID")) != NULL) + xi->window = FindWindowA(windowid, NULL); + if (!xi->window) + xi->window = GetForegroundWindow(); + if (!xi->window) + goto win32_error; + + WINDOWINFO winfo = WINDOWINFO(); + winfo.cbSize = sizeof winfo; + GetWindowInfo(xi->window, &winfo); + wop->width = (int)(winfo.rcClient.right - winfo.rcClient.left); + wop->height = (int)(winfo.rcClient.bottom - winfo.rcClient.top); + + // Search decendant windows and find out which is the text window + while (1) { + HWND p_window = xi->window; + + clear_window_list(&children); + EnumChildWindows(xi->window, &store_to_window_list, (LPARAM)&children); + for (unsigned int i = 0; i < children.nwnd; i++) { + int width, height; + + GetWindowInfo(children.wnd[i], &winfo); + width = (int)(winfo.rcClient.right - winfo.rcClient.left); + height = (int)(winfo.rcClient.bottom - winfo.rcClient.top); + if (width > wop->width * 0.7 && + height > wop->height * 0.7) { + /* maybe text window */ + wop->width = width; + wop->height = height; + xi->window = children.wnd[i]; + } + } + if (p_window == xi->window) + break; + } + + // Terminal may leave some border pixels + wop->offset_x = OFFSET_X; + wop->offset_y = OFFSET_Y; + + // Start up the GDI+ + Gdiplus::GdiplusStartupInput startup_input; /// default ctor + status = Gdiplus::GdiplusStartup(&xi->gdiplus_token, &startup_input, NULL); + if (status != Gdiplus::Ok) + goto gdip_error; + + // Fill the context object + wop->init = win_init; + wop->finish = win_finish; + wop->active = win_active; + wop->set_background = win_set_background; + wop->sync = win_sync; + wop->close = win_close; + wop->clear = win_clear; + + wop->load_image = win_load_image; + wop->show_image = win_show_image; + wop->free_image = win_free_image; + wop->get_image_size = win_get_image_size; + + retval = wop; // take care of the object lifetime + } + goto last; +win32_error: + win32_perror(wop, GetLastError(), "w3mimg_winopen"); + goto last; +gdip_error: + gdip_perror(wop, status, "w3mimg_winopen"); + goto last; +last: + if (xi && xi->logfile) + fprintf(xi->logfile, "w3mimg_winopen() = %p\n", retval); + clear_window_list(&children); + if (!retval) { + if (xi) { + if (xi->gdiplus_token) + Gdiplus::GdiplusShutdown(xi->gdiplus_token); + if (xi->logfile) + fclose(xi->logfile); + delete xi; + } + delete wop; + } + return retval; +} + +static BOOL CALLBACK +store_to_window_list(HWND hWnd, LPARAM wndlist) THROW_NONE +{ + struct window_list *wl = (struct window_list *)wndlist; + + if (wl->nwnd >= wl->capacity) { + size_t newsize = (wl->capacity < 4 ) ? 4 : (wl->capacity * 2); + HWND *newbuf = (HWND *)realloc(wl->wnd, newsize * sizeof newbuf[0]); + if (newbuf == NULL) { + clear_window_list(wl); + return FALSE; + } + wl->wnd = newbuf; + wl->capacity = newsize; + } + wl->wnd[wl->nwnd++] = hWnd; + return TRUE; +} + +static void +clear_window_list(struct window_list *wl) THROW_NONE +{ + free(wl->wnd); + wl->wnd = NULL; + wl->nwnd = 0; + wl->capacity = 0; +} + +static const char * +gdip_strerror(Gdiplus::Status status) THROW_NONE +{ + size_t i; + struct status_rec { + Gdiplus::Status code; + const char *str; + }; + static const struct status_rec table[] = { +#define ERRITEM(s) { Gdiplus::s, #s } + ERRITEM(Ok), + ERRITEM(GenericError), + ERRITEM(InvalidParameter), + ERRITEM(OutOfMemory), + ERRITEM(ObjectBusy), + ERRITEM(InsufficientBuffer), + ERRITEM(NotImplemented), + ERRITEM(Win32Error), + ERRITEM(WrongState), + ERRITEM(Aborted), + ERRITEM(FileNotFound), + ERRITEM(ValueOverflow), + ERRITEM(AccessDenied), + ERRITEM(UnknownImageFormat), + ERRITEM(FontFamilyNotFound), + ERRITEM(FontStyleNotFound), + ERRITEM(NotTrueTypeFont), + ERRITEM(UnsupportedGdiplusVersion), + ERRITEM(GdiplusNotInitialized), + ERRITEM(PropertyNotFound), + ERRITEM(PropertyNotSupported), + ERRITEM(ProfileNotFound), +#undef ERRITEM + }; + for (i = 0; i != sizeof table / sizeof table[0]; ++i) + if (table[i].code == status) + return table[i].str; + return "unknown"; +} + +static void +gdip_perror(w3mimg_op *wop, Gdiplus::Status status, const char *func) THROW_NONE +{ + const char *s = gdip_strerror(status); + fprintf(stderr, "w3mimgdisplay: GDI+ error %d: %s\n", (int)status, s); + if (wop && wop->priv) { + struct win_info *xi = (struct win_info *)wop->priv; + if (xi->logfile) { + fprintf(xi->logfile, "%s(): GDI+ error %d: %s\n", func, (int)status, s); + } + } +} + +// Don't free() the result; use LocalFree() instead +static char * +win32_strerror_alloc(DWORD status) THROW_NONE +{ + char *errbuf = NULL; + + FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, status, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), + (LPSTR)&errbuf, 0, NULL); + if (errbuf) { + size_t len = strlen(errbuf); + if (len > 0 && errbuf[len - 1] == '\n') + errbuf[len - 1] = '\0'; + } + return errbuf; +} + +static void +win32_perror(w3mimg_op *wop, DWORD status, const char *func) THROW_NONE +{ + char *errbuf = win32_strerror_alloc(status); + const char *s = errbuf ? errbuf : "(unknown)"; + + fprintf(stderr, "w3mimgdisplay: Win32 error %u: %s\n", (unsigned int)status, s); + if (wop && wop->priv) { + struct win_info *xi = (struct win_info *)wop->priv; + if (xi->logfile) { + fprintf(xi->logfile, "%s(): Win32 error %u: %s\n", + func, (unsigned int)status, s); + } + } + LocalFree(errbuf); +} + +#if 0 /* unused */ +static WCHAR * +mb2wstr_alloc(const char *s) THROW_NONE +{ + int len; + WCHAR *buf = NULL; + + len = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, s, -1, NULL, 0); + if (len <= 0) { + fprintf(stderr, "w3mimgdisplay: unable to convert string ecode=%u\n", + (unsigned int)GetLastError()); + goto error; + } + buf = (WCHAR *)malloc(len * sizeof(WCHAR)); /* including L'\0' */ + if (!buf) + goto error; + len = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, s, -1, buf, len); + if (len <= 0) { + fprintf(stderr, "w3mimgdisplay: unable to convert string ecode=%u\n", + (unsigned int)GetLastError()); + goto error; + } + return buf; +error: + free(buf); + return NULL; +} + +static char * +wstr2mb_alloc(const WCHAR *ws) THROW_NONE +{ + int len; + char *buf = NULL; + + len = WideCharToMultiByte(CP_OEMCP, WC_COMPOSITECHECK, ws, -1, NULL, 0, NULL, NULL); + if (len <= 0) { + fprintf(stderr, "w3mimgdisplay: unable to convert string ecode=%u\n", + (unsigned int)GetLastError()); + goto error; + } + buf = (char *)malloc(len); /* including '\0' */ + if (!buf) + goto error; + len = WideCharToMultiByte(CP_OEMCP, WC_COMPOSITECHECK, ws, -1, buf, len, NULL, NULL); + if (len <= 0) { + fprintf(stderr, "w3mimgdisplay: unable to convert string ecode=%u\n", + (unsigned int)GetLastError()); + goto error; + } + return buf; +error: + free(buf); + return NULL; +} +#endif /* unused */ diff --git a/w3mimgdisplay.c b/w3mimgdisplay.c index 78550e5..5486a47 100644 --- a/w3mimgdisplay.c +++ b/w3mimgdisplay.c @@ -1,4 +1,4 @@ -/* $Id: w3mimgdisplay.c,v 1.18 2003/07/13 16:20:42 ukai Exp $ */ +/* $Id: w3mimgdisplay.c,v 1.19 2010/12/21 10:13:55 htrb Exp $ */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> @@ -65,6 +65,7 @@ main(int argc, char **argv) if (defined_test) { printf("%d %d\n", w_op->width - w_op->offset_x, w_op->height - w_op->offset_y); + w_op->close(w_op); exit(0); } @@ -75,6 +76,7 @@ main(int argc, char **argv) if (w_op->get_image_size(w_op, &img, defined_size, &w, &h)) printf("%d %d\n", w, h); } + w_op->close(w_op); exit(0); } |