"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.1/configure" (12 Feb 2021, 12429 Bytes) of package /linux/privat/cb2bib-2.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure": 2.0.0_vs_2.0.1.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


    1 #!/bin/sh
    2 #------------------------------------------------------------------------------
    3 # cb2Bib configuration script:
    4 # - Checks for QTDIR
    5 #   -- If set, checks for qmake at QTDIR
    6 #   -- If not set, checks for qmake at PATH and other usual locations
    7 # - Manages Installation directory data
    8 # - Runs qmake
    9 #
   10 # Modifications for the cb2Bib Gentoo build descriptions
   11 # by Hugo Mildenberger and Andreas K. Huettel
   12 # Copyright 2009 Hugo Mildenberger and Andreas K. Huettel
   13 # - December 2009: do not use temporary files, fix sed regular
   14 #   expression, set both enable/disable for options, and add 
   15 #   call to qmake option.
   16 #
   17 # Modifications for the cb2Bib Debian distribution package
   18 # by Filippo Rusconi
   19 # Copyright 2009 Filippo Rusconi
   20 # - June 2009: replace ' ' with ':' along with use of IFS=: as
   21 #   word-splitting delimiter for PATH-related tasks (Thanks Lionel
   22 #   Mamane).
   23 # - September 2009: protect all shell variables against spaces.
   24 #
   25 #------------------------------------------------------------------------------
   26 # ( originally based upon 'shell script to configure doxygen',
   27 #   http://www.stack.nl/~dimitri/doxygen/
   28 #   Copyright (C) 1997-2001 by Dimitri van Heesch )
   29 #
   30 # Permission to use, copy, modify, and distribute this software and its
   31 # documentation under the terms of the GNU General Public License is hereby
   32 # granted. No representations are made about the suitability of this software
   33 # for any purpose. It is provided "as is" without express or implied warranty
   34 # See the GNU General Public License for more details
   35 #------------------------------------------------------------------------------
   36 
   37 platform=`uname -s`
   38 
   39 echo
   40 echo "Configuration script for cb2Bib (Unix/Linux/MacOSX)"
   41 echo
   42 f_prefix=/usr
   43 f_bindir=/usr/bin
   44 f_datadir=/usr/share/cb2bib
   45 f_desktopdatadir=/usr/share/applications
   46 f_icondir=/usr/share/pixmaps
   47 
   48 f_qmake=NO
   49 f_make=NO
   50 f_enable_cbpoll=NO
   51 f_enable_lz4=y
   52 f_enable_lzo=NO
   53 f_enable_lzsse=NO
   54 f_enable_qt_zlib=NO
   55 f_enable_avx2=NO
   56 f_disable_qmake_call=NO
   57 
   58 while test -n "$1";  do
   59   case $1 in
   60     --prefix | -prefix)
   61        shift; f_prefix="$1" ; f_bindir="$1/bin" ; f_datadir="$1/share/cb2bib" ; f_desktopdatadir="$1/share/applications" ; f_icondir="$1/share/pixmaps"
   62        ;;
   63     --bindir | -bindir)
   64        shift; unset f_prefix ; f_bindir="$1"
   65        ;;
   66     --datadir | -datadir)
   67        shift; unset f_prefix ; f_datadir="$1/cb2bib"
   68        ;;
   69     --desktopdatadir | -desktopdatadir)
   70        shift; unset f_prefix ; f_desktopdatadir="$1"
   71        ;;
   72     --icondir | -icondir)
   73        shift; unset f_prefix ; f_icondir="$1"
   74        ;;
   75     --qmakepath | -qmakepath)
   76        shift; unset f_qmake ; f_qmake="$1"
   77        ;;
   78     -h | --help | -help)
   79        f_help=y
   80        ;;
   81     --enable-cbpoll | -enable-cbpoll)
   82        f_enable_cbpoll=y
   83        ;;
   84     --disable-cbpoll | -disable-cbpoll)
   85        f_enable_cbpoll=NO
   86        ;;
   87     --enable-lzo | -enable-lzo)
   88        f_enable_lz4=NO ; f_enable_lzo=y ; f_enable_lzsse=NO ; f_enable_qt_zlib=NO
   89        ;;
   90     --enable-lzsse | -enable-lzsse)
   91        f_enable_lz4=NO ; f_enable_lzO=NO ; f_enable_lzsse=y ; f_enable_qt_zlib=NO
   92        ;;
   93     --enable-qt-zlib | -enable-qt-zlib)
   94        f_enable_lz4=NO ; f_enable_lzO=NO ; f_enable_lzsse=NO ; f_enable_qt_zlib=y
   95        ;;
   96     --enable-lz4 | -enable-lz4)
   97        f_enable_lz4=y ; f_enable_lzO=NO ; f_enable_lzsse=NO ; f_enable_qt_zlib=NO
   98        ;;
   99     --enable-avx2 | -enable-avx2)
  100        f_enable_avx2=y
  101        ;;
  102     --enable-qmake-call | -enable-qmake-call)
  103        f_disable_qmake_call=NO
  104        ;;
  105     --disable-qmake-call | -disable-qmake-call)
  106        f_disable_qmake_call=y
  107        ;;
  108     *)
  109        echo "-----------------------------------------------------------------------"
  110        echo Error: Unknown argument $1
  111        echo "-----------------------------------------------------------------------"
  112        echo ""
  113        f_help=y
  114        f_error=y
  115        ;;
  116   esac
  117   shift
  118 done
  119 
  120 if test "$f_help" = y; then
  121   cat <<EOF
  122 Usage: $0 [--help] [--prefix dir] [--bindir dir] [--datadir dir] ...
  123 
  124 Options:
  125 
  126   General:
  127   --help                Print this help
  128   --qmakepath dir       qmake fullpath name
  129                         [example: --qmakepath /usr/bin/qmake]
  130   --prefix dir          Installation prefix directory
  131                         [default: /usr]
  132   --bindir dir          Executable installation directory
  133                         [default: /usr/bin]
  134   --datadir dir         Data installation directory
  135                         [default: /usr/share/cb2bib]
  136   --enable-lz4          Enable linking with LZ4 library [default]
  137   --enable-lzo          Enable linking with LZO library
  138   --enable-qt-zlib      Enable linking with Qt's ZLIB library
  139   --enable-lzsse        Enable linking with LZSSE library
  140                         [see ./src/c2b/lzsse4/README.txt]
  141   --enable-avx2         Enable using AVX2 instructions
  142   --enable-qmake-call   Enable configure to call qmake [default]
  143   --disable-qmake-call  Disable configure to call qmake
  144 
  145 
  146   Unix/Linux only:
  147   --desktopdatadir dir  Desktop data installation directory
  148                         [default: /usr/share/applications]
  149   --icondir dir         Icon installation directory
  150                         [default: /usr/share/pixmaps]
  151   --enable-cbpoll       Enable clipboard poll
  152   --disable-cbpoll      Disable clipboard poll [default]
  153 
  154 EOF
  155   test "$f_error" = y && exit 1
  156   exit 0;
  157 fi
  158 
  159 echo "-----------------------------------------------------------------------"
  160 echo "Platform: $platform"
  161 echo "-----------------------------------------------------------------------"
  162 echo "Setting installation directories..."
  163 if test "$f_prefix"; then
  164   echo "Setting installation relative to dir: $f_prefix"
  165 fi
  166 if test "$f_bindir"; then
  167   echo "Setting installation executable to dir: $f_bindir"
  168 fi
  169 if test "$f_datadir"; then
  170   echo "Setting installation cb2Bib data files relative to dir: $f_datadir"
  171 fi
  172 if test "$f_desktopdatadir"; then
  173   echo "Setting installation desktop data files to dir: $f_desktopdatadir"
  174 fi
  175 if test "$f_icondir"; then
  176   echo "Setting installation icon file to dir: $f_icondir"
  177 fi
  178 echo "-----------------------------------------------------------------------"
  179 
  180 echo
  181 echo "-----------------------------------------------------------------------"
  182 echo "cb2Bib Info:"
  183 echo "-----------------------------------------------------------------------"
  184 echo "- This version requires Qt 5.7.0 or later."
  185 echo " "
  186 echo "- Set the environment variable QTDIR if this script cannot determine"
  187 echo "  the right Qt qmake."
  188 echo "- QTDIR will only be used during configuration; it can later be reset"
  189 echo "  to its original value."
  190 echo " "
  191 echo "- Alternatively, set Qt5 qmake's fullpath name with"
  192 echo "  --qmakepath flag."
  193 echo "-----------------------------------------------------------------------"
  194 
  195 #- check for qt ---------------------------------------------------------------
  196 
  197 echo
  198 echo "Checking for Qt/qmake:"
  199   if test "$f_qmake" != NO; then
  200     echo -n "Checking for qmake tool... "
  201     if test ! -x "$f_qmake"; then
  202       echo "Specified $f_qmake could not be found."
  203       exit 2
  204     else
  205       echo "using $f_qmake."
  206     fi
  207   elif test -z "$QTDIR"; then
  208     echo "Environment variable QTDIR not set, checking elsewhere for qmake..."
  209     echo -n "Checking for qmake tool... "
  210     if test "$f_qmake" = NO; then
  211       qmake_name="qmake-qt5"
  212       qmake_dirs="/usr/bin:/usr/lib64/qt5/bin:/usr/lib/qt5/bin:/usr/bin:/usr/lib/qt/bin:/usr/share/qt/bin:/Developer/Tools/Qt:$PATH"
  213       qmake_prog=NO
  214       IFS=:
  215       for j in $qmake_dirs; do
  216         if test -x "$j/$qmake_name"; then
  217           qmake_prog="$j/$qmake_name"
  218           break 1
  219         fi
  220       done
  221       unset IFS
  222       f_qmake="$qmake_prog" 
  223     fi
  224     if test "$f_qmake" = NO; then
  225       qmake_name="qmake"
  226       qmake_dirs="/usr/lib/x86_64-linux-gnu/qt5/bin:/usr/lib/i386-linux-gnu/qt5/bin:/usr/lib/arm-linux-gnueabi/qt5/bin:/usr/lib/mips-linux-gnu/qt5/bin:/usr/lib/powerpc-linux-gnu/qt5/bin:/usr/lib/powerpc64le-linux-gnu/qt5/bin:/usr/lib64/qt5/bin:/usr/lib/qt5/bin:/Developer/Tools/Qt:$PATH"
  227       qmake_prog=NO
  228       IFS=:
  229       for j in $qmake_dirs; do
  230         if test -x "$j/$qmake_name"; then
  231           qmake_prog="$j/$qmake_name"
  232           break 1
  233         fi
  234       done
  235       unset IFS
  236       f_qmake="$qmake_prog" 
  237     fi
  238     if test "$f_qmake" = NO; then
  239       echo "not found!"
  240       echo
  241       echo "Please, check if required Qt/qmake is properly installed."
  242       echo "If so, set QTDIR environment variable to your Qt root directory."
  243       exit 2
  244     fi
  245     echo "using $f_qmake."
  246   else
  247     echo "Using QTDIR environment variable for Qt directory location."
  248     echo "Checking for Qt tools at $QTDIR..."
  249     echo -n "Checking for qmake tool... "
  250     if test ! -x "$QTDIR/bin/qmake"; then
  251       echo "QTDIR is set, but the qmake could not be found in $QTDIR/bin."
  252       exit 2
  253     else
  254       f_qmake="$QTDIR/bin/qmake"
  255       echo "using $QTDIR/bin/qmake."
  256     fi
  257   fi
  258   "$f_qmake" -v
  259 
  260 
  261 #------------------------------------------------------------------------------
  262 # Set directories for binaries search
  263 #------------------------------------------------------------------------------
  264 bin_dirs="/usr/bin:/usr/local/bin:/bin:/sbin:$PATH"
  265 #------------------------------------------------------------------------------
  266 
  267 
  268 # - check for make ------------------------------------------------------------
  269 
  270 echo
  271 echo "Checking for additional tools:"
  272 echo -n "Checking for make..."
  273 if test "$f_make" = NO; then
  274   make_names="gmake:make"
  275   make_prog=NO
  276   IFS=:
  277   for i in $make_names; do
  278     for j in $bin_dirs ; do
  279       if test -x "$j/$i"; then
  280         if test -n "`$j/$i --version 2>/dev/null | grep GNU`"; then
  281           make_prog="$j/$i"
  282           break 2
  283         fi
  284       fi
  285     done
  286   done
  287   unset IFS
  288   f_make="$make_prog" 
  289 fi
  290 
  291 if test "$f_make" != NO; then
  292   echo "using $f_make."
  293 else
  294   echo "not found."
  295 fi
  296 
  297 #- Setting dirs and start qmake -----------------------------------------------
  298 
  299 echo
  300 sed -i -e 's%^.*cb2bibdata\.path .*$%cb2bibdata.path = '$f_datadir'%g' \
  301        -e 's%^.*cb2bibdoc\.path .*$%cb2bibdoc.path = '$f_datadir'/doc%g' \
  302        -e 's%^.*target\.path .*$%target.path = '$f_bindir'%g' \
  303        -e 's%^.*script\.path .*$%script.path = '$f_bindir'%g' \
  304        -e 's%^.*desktop\.path .*$%desktop.path = '$f_desktopdatadir'%g' \
  305        -e 's%^.*icons\.path .*$%icons.path = '$f_icondir'%g' src/src.pro
  306 sed -i 's%^const QLatin1String C2B_DATA_DIR.*$%const QLatin1String C2B_DATA_DIR("'$f_datadir'/");%g' src/c2b/cb2bib_parameters.h
  307 
  308 f_configs=
  309 if test "$f_enable_cbpoll" = y; then
  310   echo "Setting clipboardPoll enabled"
  311   f_configs="$f_configs -config enable_cbpoll"
  312 fi
  313 if test "$f_enable_lz4" = y; then
  314   echo "Setting LZ4 enabled"
  315   f_configs="$f_configs -config use_lz4"
  316 fi
  317 if test "$f_enable_lzo" = y; then
  318   echo "Setting LZO enabled"
  319   f_configs="$f_configs -config use_lzo"
  320 fi
  321 if test "$f_enable_lzsse" = y; then
  322   echo "Setting LZSSE enabled"
  323   f_configs="$f_configs -config use_lzsse"
  324 fi
  325 if test "$f_enable_qt_zlib" = y; then
  326   echo "Setting Qt ZLIB enabled"
  327   f_configs="$f_configs -config use_qt_zlib"
  328 fi
  329 if test "$f_enable_avx2" = y; then
  330   echo "Setting AVX2 enabled"
  331   f_configs="$f_configs -config use_avx2"
  332 fi
  333 
  334 if test "$f_disable_qmake_call" = NO; then
  335   echo ""
  336   echo "Running $f_qmake $f_configs -o Makefile"
  337   "$f_qmake" $f_configs -o Makefile
  338 else
  339   echo ""
  340   echo "Writing qmake flags to file 'qmake-additional-args'"
  341   echo $f_configs > qmake-additional-args
  342 fi
  343 
  344 echo " "
  345 if test "$f_make" = NO; then
  346   echo "-----------------------------------------------------------------------"
  347   echo "Configuration ended. 'make' not found."
  348   echo "Build toolchain might not be completed."
  349   echo "-----------------------------------------------------------------------"
  350   exit 1
  351 else
  352   echo "-----------------------------------------------------------------------"
  353   echo "- NOTE: Type 'make distclean' or, preferably, untar again to set other"
  354   echo "  configure flags."
  355   echo "-----------------------------------------------------------------------"
  356   echo " "
  357   echo "-----------------------------------------------------------------------"
  358   if test "$f_disable_qmake_call" = NO; then
  359     echo "Configuration ended. Type 'make' and 'make install'."
  360   else
  361     echo "Configuration ended. Run qmake, and type 'make' and 'make install'."
  362   fi
  363   echo "-----------------------------------------------------------------------"
  364   echo " "
  365 fi