"Fossies" - the Fresh Open Source Software Archive

Member "dnotify-0.18.0/autogen.sh" (6 Oct 2004, 6124 Bytes) of package /linux/privat/old/dnotify-0.18.0.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. Alternatively you can here view or download the uninterpreted source code file.

    1 #! /bin/sh
    2 # A script to clean or rebuild files created by autoconf, automake,
    3 # libtool, gettext and gnulib. Run autogen.sh --help for usage.
    4 #
    5 # This software is copyrighted work licensed under the terms of the
    6 # GNU General Public License. Please consult the file `COPYING' for
    7 # details.
    8 #
    9 # Author: Oskar Liljeblad <oskar@osk.mine.nu>
   10 # Version: 2
   11 
   12 set -e
   13 
   14 GNULIBTOOL=/usr/share/gnulib/gnulib-tool
   15 GNULIBPATH=/usr/share/gnulib
   16 GETTEXTPATH=/usr/share/gettext
   17 
   18 function m4extract () {
   19   local file="$1"
   20   local macro="$2"
   21   local arg="$3"
   22 
   23   local res
   24   res="`m4 --trace=$macro -de -D$macro=$arg $file 2>&1 >/dev/null`"
   25   res="`echo $res | sed 's/^.* -> \(.*\)$/\1/;s/^\[//;s/\]$//;p;d'`"
   26   echo "$res"
   27 }
   28 
   29 function contains () {
   30   local find="$1"
   31   shift
   32   for str in "$@"; do
   33     if [ "$str" = "$find" ]; then
   34       return 0
   35     fi
   36   done
   37   return 1
   38 }
   39 
   40 function expand_module_dependencies () {
   41   local knownlist="$@"
   42   local checklist="$@"
   43 
   44   while [ -n "$checklist" ]; do
   45     newlist=`$GNULIBTOOL --extract-dependencies $checklist`
   46     checklist=""
   47     for module in $newlist; do
   48       if ! contains $module $knownlist; then
   49          knownlist="$knownlist $module"
   50          checklist="$checklist $module"
   51       fi
   52     done
   53   done
   54 
   55   echo $knownlist
   56 }
   57 
   58 if contains --help "$@"; then
   59   echo "Usage: $0 --clean|--generate|--help"
   60   exit
   61 fi
   62 
   63 package="`m4extract configure.ac AC_INIT '$1'`"
   64 if [ "$package" = "" ]; then
   65   echo "Cannot get package name from configure.ac!"
   66   exit 1
   67 fi
   68 
   69 modulelist=modules.gnulib
   70 if [ -f $modulelist ]; then
   71   modules=`cat modules.gnulib | egrep -v '^[[:space:]]*#'`
   72   modules=`expand_module_dependencies $modules`
   73   filelist=`$GNULIBTOOL --extract-filelist $modules | sort | uniq`
   74 else
   75   modules=""
   76   filelist=""
   77 fi
   78 
   79 if contains --clean "$@"; then
   80   cleanup=1
   81   if contains --generate "$@"; then
   82     regenerate=1
   83   else
   84     regenerate=0
   85   fi
   86 else
   87   cleanup=0
   88   regenerate=1
   89 fi
   90 
   91 if [ "$cleanup" = "1" ]; then
   92   if [ -f Makefile ]; then
   93     make maintainer-clean || :
   94   fi
   95   echo Removing generated files
   96   # Generated by autoheader
   97   rm -f config.h.in config.h.in~
   98   # Generated by aclocal
   99   rm -f aclocal.m4
  100   # Added by automake -a
  101   rm -f COPYING INSTALL compile config.guess config.sub depcomp install-sh missing
  102   # Generated by automake
  103   for file in `m4extract configure.ac AC_CONFIG_FILES '$1'`; do
  104     if [ -f "$file.am" ]; then
  105       rm -f "$file.in"
  106     fi
  107   done
  108   # Generated by autoconf
  109   rm -f configure
  110   # Added by libtoolize
  111   rm -f ltmain.sh
  112   # Added by gettextize
  113   rm -f ABOUT-NLS config.rpath mkinstalldirs
  114   if [ "`m4extract configure.ac AM_GNU_GETTEXT '$1'`" != "" ]; then
  115     if [ -d po ]; then
  116       for file in /usr/share/gettext/po/*; do
  117         rm -f po/`basename $file`
  118       done
  119     fi
  120     if [ -d intl ]; then
  121       rm -rf intl
  122     fi
  123     # Generated by make at build time
  124     if [ -d po ]; then
  125       rm -f po/$package.pot
  126     fi
  127   fi
  128   # Added by gnulib
  129   if [ -f $modulelist ]; then
  130     rm -f m4/Makefile.am
  131     rm -f lib/Makefile.am
  132     echo Removing gnulib files
  133     for file in $filelist; do
  134        if [ "${file:0:3}" = "m4/" -o "${file:0:4}" = "lib/" ]; then
  135         rm -f "$file"
  136       fi
  137     done
  138   fi
  139 fi
  140 
  141 if [ "$regenerate" = "1" ]; then
  142   if [ -f $modulelist ]; then
  143     echo "Adding symbolic links to gnulib files"
  144     mkdir -p m4 lib
  145     for file in $filelist; do
  146       if [ "${file:0:3}" = "m4/" -o "${file:0:4}" = "lib/" ]; then
  147         rm -f $file
  148         ln -s $GNULIBPATH/$file $file
  149       fi
  150     done
  151 
  152     echo "Creating m4/Makefile.am"
  153     (cat m4/Makefile.am.head &&
  154      for file in $filelist; do
  155        if [ "${file:0:3}" = "m4/" ]; then
  156          echo "EXTRA_DIST += ${file:3}"
  157        fi
  158      done) > m4/Makefile.am
  159 
  160     echo "Creating lib/Makefile.am"
  161     (cat lib/Makefile.am.head &&
  162      $GNULIBTOOL --extract-automake-snippet --lib libgnu $modules |
  163      sed -e "s,lib_SOURCES,libgnu_la_SOURCES,g" -e "s,lib_OBJECTS,libgnu_la_OBJECTS,g") > lib/Makefile.am
  164   fi
  165 
  166   if [ "`m4extract configure.ac AM_GNU_GETTEXT '$1'`" != "" ]; then
  167     #echo "Running gettextize"
  168     #gettextize --no-changelog
  169     mkdir -p po
  170     echo "Installing gettext files"
  171     for file in mkinstalldirs config.rpath ABOUT-NLS; do
  172       rm -f $file
  173       ln -s $GETTEXTPATH/$file $file
  174     done
  175     for file in $GETTEXTPATH/po/*; do
  176       base=`basename "$file"`
  177       rm -f po/$base
  178       ln -s $file po/$base
  179     done
  180     mkdir -p intl
  181     for file in $GETTEXTPATH/intl/*; do
  182       base=`basename "$file"`
  183       if [ "$base" = "plural.c" ]; then
  184         cp $file intl/$base
  185         touch intl/$base
  186       elif [ "$base" != "COPYING.LIB-2.0" -a "$base" != "COPYING.LIB-2.1" ]; then
  187         rm -f intl/$base
  188         ln -s $file intl/$base
  189       fi
  190     done
  191     if [ -d lib ]; then
  192       echo "Updating po/POTFILES.in"
  193       (cat po/POTFILES.in \
  194         | grep -v '^lib/'; \
  195        ls lib/*.[ch]) > po/POTFILES.in.tmp && mv po/POTFILES.in.tmp po/POTFILES.in
  196     fi
  197     #echo "Updating AM_GNU_GETTEXT_VERSION in configure.ac"
  198     #newver=`sed 's/.* gettext-\([0-9].*\)/\1/' < $GETTEXTPATH/intl/VERSION`
  199     #cat configure.ac |
  200     #  sed "s/^AM_GNU_GETTEXT_VERSION(.*)/AM_GNU_GETTEXT_VERSION($newver)/" > configure.ac.tmp \
  201     # && mv configure.ac.tmp configure.ac
  202   fi
  203 
  204   if [ -f $modulelist ]; then
  205     echo "Updating gnulib commands in configure.ac"
  206     (state=0
  207      cat configure.ac | while IFS="" read line; do
  208        if [ $state = 0 ]; then
  209          echo "$line"
  210          if [ "$line" = "# Gnulib" ]; then
  211            echo gl_USE_SYSTEM_EXTENSIONS
  212            $GNULIBTOOL --extract-autoconf-snippet --lib libgnu $modules | \
  213        grep -v '^[ \t]*$' | \
  214        grep -v '^AM_GNU_GETTEXT(\[external\])$'
  215            state=1
  216          fi
  217        elif [ $state = 1 ]; then
  218          if [ "$line" = "" ]; then
  219            echo
  220            state=0
  221          fi
  222        fi
  223      done) > configure.ac.tmp \
  224       && mv configure.ac.tmp configure.ac
  225   fi
  226 
  227   echo "Running autoreconf -is"
  228   autoreconf -is
  229 
  230   #echo "Running autoheader"
  231   #autoheader
  232   #echo "Running aclocal"
  233   #aclocal -I m4
  234   #echo "Running automake"
  235   #automake -a
  236   #echo "Running autoconf"
  237   #autoconf
  238 fi