From 14cf112adabe301cb322b715b589cc090056f989 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 6 Jun 2011 10:32:22 +0200 Subject: [PATCH] changed the way we look for libiconv to make it work with macports + different mac mimeview defaults --- src/configure | 104 +++++++++++------------------------- src/configure.ac | 46 +++++++++------- src/sampleconf/mimeview.mac | 81 ++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 93 deletions(-) create mode 100644 src/sampleconf/mimeview.mac diff --git a/src/configure b/src/configure index eeb67005..30e4d95c 100755 --- a/src/configure +++ b/src/configure @@ -4341,12 +4341,8 @@ fi done -##### Look for iconv. We look for libiconv in ${libdir}, /opt/local/lib, -##### /usr/local/lib then in libc (Linux, solaris). Note that there is no -##### way to find libiconv in /usr/local if one exists in ${libdir} (can't -##### do because the link will always succeed in this case so that if we -##### put /usr/local/lib in front in this case, we may end up with using it -##### even if no libiconv in there. We'd need a --with-libiconv= option +##### Look for iconv. This can exist in either libc (ie: Linux, solaris) or +##### libiconv. We'd need a --with-libiconv= option ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4355,112 +4351,70 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu LIBICONV="" S_LDFLAGS=$LDFLAGS - +S_CPPFLAGS=$CPPFLAGS for dir in ${libdir} /opt/local/lib /usr/local/lib ;do - LDFLAGS="$S_LDFLAGS -L$dir" - unset ac_cv_lib_iconv_iconv_open + CPPFLAGS="$S_CPPFLAGS -I$dir/../include" + + LDFLAGS="$S_LDFLAGS -L$dir" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 -$as_echo_n "checking for iconv_open in -liconv... " >&6; } -if ${ac_cv_lib_iconv_iconv_open+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-liconv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char iconv_open (); +#include +#include int main () { -return iconv_open (); +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : - ac_cv_lib_iconv_iconv_open=yes -else - ac_cv_lib_iconv_iconv_open=no + LIBICONV="-L$dir";INCICONV=-I$dir/../include fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv_open" >&5 -$as_echo "$ac_cv_lib_iconv_iconv_open" >&6; } -if test "x$ac_cv_lib_iconv_iconv_open" = xyes; then : - LIBICONV="-L$dir -liconv";INCICONV=-I$dir/../include -fi - if test A"$LIBICONV" != A ; then break fi -done -if test A"$LIBICONV" = A; then - dir=${libdir} - LDFLAGS="$S_LDFLAGS -L$dir" - unset ac_cv_lib_iconv_iconv_open - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -lc" >&5 -$as_echo_n "checking for iconv_open in -lc... " >&6; } -if ${ac_cv_lib_c_iconv_open+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + LDFLAGS="$S_LDFLAGS -L$dir -liconv" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char iconv_open (); +#include +#include int main () { -return iconv_open (); +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : - ac_cv_lib_c_iconv_open=yes -else - ac_cv_lib_c_iconv_open=no + LIBICONV="-L$dir -liconv";INCICONV=-I$dir/../include fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_iconv_open" >&5 -$as_echo "$ac_cv_lib_c_iconv_open" >&6; } -if test "x$ac_cv_lib_c_iconv_open" = xyes; then : - LIBICONV=NONE;INCICONV=-I/usr/include -fi + if test A"$LIBICONV" != A ; then + break + fi -fi +done LDFLAGS=$S_LDFLAGS +CPPFLAGS=$S_CPPFLAGS + if test A"$LIBICONV" = A ; then as_fn_error $? "Cannot find iconv_open anywhere. Please install iconv" "$LINENO" 5 exit 1 fi -if test A"$LIBICONV" = ANONE ; then - LIBICONV="" -fi -#echo LIBICONV $LIBICONV -#echo INCICONV $INCICONV +echo LIBICONV $LIBICONV +echo INCICONV $INCICONV CPPFLAGS="$CPPFLAGS $INCICONV" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of inbuf parameter to iconv" >&5 @@ -4494,6 +4448,7 @@ $as_echo "#define RCL_ICONV_INBUF_CONST 1" >>confdefs.h fi +############# Putenv { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of string parameter to putenv" >&5 $as_echo_n "checking for type of string parameter to putenv... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4523,6 +4478,7 @@ $as_echo "#define PUTENV_ARG_CONST 1" >>confdefs.h fi + #### Look for Xapian # Extract the first word of "xapian-config", so it can be a program name with args. set dummy xapian-config; ac_word=$2 diff --git a/src/configure.ac b/src/configure.ac index ed24e2d1..c87c9ce1 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -198,40 +198,46 @@ fi AC_CHECK_FUNCS(mkdtemp) -##### Look for iconv. We look for libiconv in ${libdir}, /opt/local/lib, -##### /usr/local/lib then in libc (Linux, solaris). Note that there is no -##### way to find libiconv in /usr/local if one exists in ${libdir} (can't -##### do because the link will always succeed in this case so that if we -##### put /usr/local/lib in front in this case, we may end up with using it -##### even if no libiconv in there. We'd need a --with-libiconv= option +##### Look for iconv. This can exist in either libc (ie: Linux, solaris) or +##### libiconv. We'd need a --with-libiconv= option AC_LANG(C++) LIBICONV="" S_LDFLAGS=$LDFLAGS - +S_CPPFLAGS=$CPPFLAGS for dir in ${libdir} /opt/local/lib /usr/local/lib ;do + CPPFLAGS="$S_CPPFLAGS -I$dir/../include" + LDFLAGS="$S_LDFLAGS -L$dir" - unset ac_cv_lib_iconv_iconv_open - AC_CHECK_LIB(iconv, iconv_open, LIBICONV="-L$dir -liconv";INCICONV=-I$dir/../include) + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + LIBICONV="-L$dir";INCICONV=-I$dir/../include) if test A"$LIBICONV" != A ; then break fi + + LDFLAGS="$S_LDFLAGS -L$dir -liconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + LIBICONV="-L$dir -liconv";INCICONV=-I$dir/../include) + if test A"$LIBICONV" != A ; then + break + fi + done -if test A"$LIBICONV" = A; then - dir=${libdir} - LDFLAGS="$S_LDFLAGS -L$dir" - unset ac_cv_lib_iconv_iconv_open - AC_CHECK_LIB(c, iconv_open, LIBICONV=NONE;INCICONV=-I/usr/include) -fi - LDFLAGS=$S_LDFLAGS +CPPFLAGS=$S_CPPFLAGS + if test A"$LIBICONV" = A ; then AC_MSG_ERROR([Cannot find iconv_open anywhere. Please install iconv]) exit 1 fi -if test A"$LIBICONV" = ANONE ; then - LIBICONV="" -fi #echo LIBICONV $LIBICONV #echo INCICONV $INCICONV @@ -248,6 +254,7 @@ if test X$rcl_iconv_inbuf_const = X1 ; then fi +############# Putenv AC_MSG_CHECKING(for type of string parameter to putenv) AC_TRY_COMPILE([ #include @@ -258,6 +265,7 @@ if test X$rcl_putenv_string_const = X1 ; then AC_DEFINE(PUTENV_ARG_CONST, 1, [putenv parameter is const]) fi + #### Look for Xapian AC_PATH_PROG(XAPIAN_CONFIG, xapian-config, no) if test "$XAPIAN_CONFIG" = "no" ; then diff --git a/src/sampleconf/mimeview.mac b/src/sampleconf/mimeview.mac new file mode 100644 index 00000000..f8b1cf85 --- /dev/null +++ b/src/sampleconf/mimeview.mac @@ -0,0 +1,81 @@ +# @(#$Id: mimeview,v 1.16 2008-09-15 08:03:37 dockes Exp $ (C) 2004 J.F.Dockes + +## ########################################## +# External viewers, launched by the recoll GUI when you click on a result +# 'Open' link - MAC version +# On the MAC, we basically use "open" for everything... + +# Mime types which we should not uncompress if they are found gzipped or +# bzipped because the native viewer knows how to handle. These would be +# exceptions and the list is normally empty +#nouncompforviewmts = + +[view] +# Pseudo entry used if the 'use desktop' preference is set in the GUI +application/x-all = open %f + +[view] + +application/x-kword = kword %f +application/x-abiword = abiword %f + +application/pdf = open %f +application/postscript = open %f +application/x-dvi = open %f + +application/x-lyx = lyx %f +application/x-scribus = scribus %f + +application/msword = open %f +application/vnd.ms-excel = open %f +application/vnd.ms-powerpoint = open %f + +application/vnd.openxmlformats-officedocument.wordprocessingml.document = \ + open %f +application/vnd.openxmlformats-officedocument.wordprocessingml.template = \ + open %f +application/vnd.openxmlformats-officedocument.presentationml.template = \ + open %f +application/vnd.openxmlformats-officedocument.presentationml.presentation = \ + open %f +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet = \ + open %f +application/vnd.openxmlformats-officedocument.spreadsheetml.template =\ + open %f +application/vnd.sun.xml.calc = open %f +application/vnd.sun.xml.calc.template = open %f +application/vnd.sun.xml.draw = open %f +application/vnd.sun.xml.draw.template = open %f +application/vnd.sun.xml.impress = open %f +application/vnd.sun.xml.impress.template = open %f +application/vnd.sun.xml.math = open %f +application/vnd.sun.xml.writer = open %f +application/vnd.sun.xml.writer.global = open %f +application/vnd.sun.xml.writer.template = open %f +application/vnd.wordperfect = open %f + +application/x-chm = kchmviewer %f +application/x-fsdirectory = open %f +application/x-gnuinfo = xterm -e "info -f %f" + +application/x-flac = open %f +audio/mpeg = open %f +application/ogg = open %f + +image/jpeg = open %f +image/png = open %f +image/tiff = open %f +image/gif = open %f + +image/svg+xml = inkview %f +image/vnd.djvu = djview %f + +application/x-tex = open %f +text/x-tex = open %f +text/html = open %u +text/html|gnuinfo = rclshowinfo %F %(title) +text/plain = open %f +text/x-c = open %f +text/x-c+ = open %f +text/x-c++ = open %f +text/x-python = idle %f