#!/bin/sh # xapian-config. Generated from xapian-config.in by configure. # # Copyright (C) 2002,2003,2004,2005,2006 Olly Betts # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 # USA PROG_NAME=xapian-config PROG_DESC="report information about the installed version of xapian" # ${prefix} and ${exec_prefix} are used in some @-substitutions, and # ${prefix} is usually used in the exec_prefix @-substitution. prefix="/usr" exec_prefix="/usr" # Show usage information and exit with the specified exit status. show_usage() { cat <&2 # Cached value. Note that this a return code, so 0 means uninstalled! is_uninstalled_cache= # Check if this is an uninstalled xapian-config. is_uninstalled() { if [ -z "$uninstalled_cache" ]; then [ -n "$builddir" -a -f "${builddir}Makefile" ] is_uninstalled_cache=$? fi return $is_uninstalled_cache } # Any extra ldflags needed. set_F_to_extra_ldflags() { F= [ -n "" ] && F=" " } # -L option required (if any). set_L_to_library_path() { L= [ /usr/lib != "/usr/lib64" ] && L="-L/usr/lib64 " } # -I options for compiling against an uninstalled xapian. set_I_for_uninstalled() { I= # version.h is generated by configure, so we also need builddir # in the include path if it's different to srcdir. [ "/builddir/build/BUILD/xapian-core-1.0.2" != "/builddir/build/BUILD/xapian-core-1.0.2" ] && I="-I/builddir/build/BUILD/xapian-core-1.0.2/include " I="$I-I/builddir/build/BUILD/xapian-core-1.0.2/include" } # Extract dependency_libs recursively from a libtool .la file, converting # .la references into appropriate -L and -l options. extract_dependency_libs() { deps= # Multiple whitespace (space or tab). mws='[ ][ ]*' la='\(/[^ ]*\)\(/lib\)\([^ ]*\).la' pat='\(.* \)'"$la"'\( .*\)' extract_dependency_libs_ "$1" dependency_libs=`echo "$deps"|sed 's/ */ /g;s/^ //;s/ $//'` } # Internal helper function for extract_dependency_libs. extract_dependency_libs_() { dependency_libs= eval `grep ^dependency_libs= "$1"` dependency_libs=`echo " $dependency_libs "|sed "s/$mws/ /g"` while true ; do file=`echo "$dependency_libs"|sed "s,$pat"',\2\3\4.la,'` case $file in *.la) # Replace "/path/to/libfoo.la" with "-L/path/to -lfoo". deps="$deps "`echo "$dependency_libs"|sed "s,$pat"',\1-L\2 -l\4,'` # Put the trailing part in $1 which is a local variable. set "`echo "$dependency_libs"|sed "s,$pat"',\5,'`" # And expand any dependency libs from libfoo.la. extract_dependency_libs_ "$file" # Set dependency_libs to the trailing part, ready for the # next pass of the loop which checks for more .la files. dependency_libs=$1 ;; *) deps=$deps$dependency_libs break ;; esac done } builddir=`echo $0|sed 's![^/]*$!!'` xo_lib_xapian=no while [ 0 != "$#" ] ; do arg=$1 shift case $arg in --help) echo "$PROG_NAME - $PROG_DESC" echo show_usage 0 ;; --version) echo "$PROG_NAME - xapian-core 1.0.2" exit 0 ;; --cxxflags) if is_uninstalled ; then set_I_for_uninstalled else # Adding -I/usr/include to CXXFLAGS causes problems with certain # versions of GCC on some platforms where GCC generates "fixed" # versions of vendor supplied include headers at install time. # Normally these are used instead of those in /usr/include, but if # you explicitly pass -I/usr/include you get the non-fixed # versions. More recent GCC versions simply ignore -I/usr/include # but we want to support older versions too. case "/usr/include" in /usr/include|/usr/include/c++) I= ;; *) I="-I/usr/include" ;; esac fi cxxflags= [ -n "" ] && cxxflags=" " [ -n "" ] && cxxflags="${cxxflags} " echo "$cxxflags$I" ;; --swigflags) if is_uninstalled ; then # version.h is generated by configure, so we also need builddir # in the include path if it's different to srcdir. set_I_for_uninstalled else I="-I/usr/include" fi echo "$I" ;; --from-xo-lib-xapian) # Top Secret option which allows us to give a more helpful error # message if we're asked to link with an uninstalled libxapian # and libtool isn't in use. xo_lib_xapian=yes ;; --libs) if is_uninstalled ; then if [ no = "$xo_lib_xapian" ]; then echo "$0: Use libtool and '$PROG_NAME --ltlibs'" 1>&2 else configure_ac='configure.in (or configure.ac)' # If ac_top_srcdir isn't passed to us, we just end up looking # in the current directory, which is a sensible fallback. if [ -r "${ac_top_srcdir}configure.ac" ]; then configure_ac=configure.ac elif [ -r "${ac_top_srcdir}configure.in" ]; then configure_ac=configure.in fi echo "$0: Add AC_PROG_LIBTOOL to your $configure_ac" 1>&2 fi echo "to link with an uninstalled libxapian." 1>&2 exit 1 fi set_F_to_extra_ldflags set_L_to_library_path D= case "linux-gnu" in linux* | k*bsd*-gnu) # We don't need dependency_libs, but upstream libtool doesn't know this # yet. ;; *) # Only pull in dependency_libs if libtool would. if [ no != "unknown" ]; then extract_dependency_libs "/usr/lib64/libxapian.la" [ -n "$dependency_libs" ] && D=" $dependency_libs" fi ;; esac echo "$F$L-lxapian$D" ;; --ltlibs) set_F_to_extra_ldflags if is_uninstalled ; then # Don't check if libxapian.la exists yet - it won't unless # the xapian-core tree has been built! [ ./ != "$builddir" ] && F="$F$builddir" echo "${F}libxapian.la" continue fi if [ -f "/usr/lib64/libxapian.la" ]; then echo "${F}/usr/lib64/libxapian.la" continue fi # If we need to pull in dependency_libs, we need libxapian.la. Otherwise # we can cope with out it, which is useful as some Linux distros have an # unhelpful policy of not packaging .la files. case "linux-gnu" in linux* | k*bsd*-gnu) # We don't need dependency_libs, but upstream libtool doesn't know this # yet. ;; *) # If libtool wouldn't pull in dependency_libs, we can cope with letting # libtool link without the .la file. if [ no != "unknown" ]; then echo "$0: Can't find libxapian.la to link against." 1>&2 exit 1 fi ;; esac set_L_to_library_path echo "$F$L-lxapian" ;; -*) echo "$0: Unrecognized option: $arg" 1>&2 show_usage 1 1>&2 ;; *) show_usage 1 1>&2 ;; esac done exit 0