libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

bootstrap (2256B)


      1 #!/bin/sh
      2 
      3 # This is more portable than `which' but comes with
      4 # the caveat of not(?) properly working on busybox's ash:
      5 have_command()
      6 {
      7     command -v "$1" >/dev/null 2>&1
      8 }
      9 
     10 unset bs_srcdir
     11 if test X"`dirname / 2>/dev/null`" = X"/"; then
     12   bs_scrdir=`dirname $0`
     13 else
     14   case $0 in
     15     */*) bs_scrdir=`echo $0 | ${SED-sed} -n -e 's|/[^/]*$||p'` ;;
     16     *) bs_scrdir='.' ;;
     17   esac
     18 fi
     19 
     20 test -n "$bs_scrdir" && cd "$bs_scrdir" || echo "Warning: cannot detect sources directory" 1>&2
     21 
     22 if test ! -f './configure.ac'; then
     23   echo "Error: no 'configure.ac' found. Wrong sources directory?" 1>&2
     24   exit 2
     25 fi
     26 if test ! -f './src/include/microhttpd.h'; then
     27   echo "Error: src/include/libmicrohttpd.h not found. Wrong sources directory?" 1>&2
     28   exit 2
     29 fi
     30 
     31 if have_command uncrustify; then
     32     if test -f uncrustify.cfg; then
     33       echo "Uncrustify configuration already exists, skipping installation from the upstream file."
     34     else
     35       echo "Installing libmicrohttpd uncrustify configuration"
     36       ln -s contrib/uncrustify.cfg uncrustify.cfg || \
     37         cp contrib/uncrustify.cfg uncrustify.cfg || \
     38         echo "Failed to install uncrustify configuration file" 1>&2
     39     fi
     40     if test -f uncrustify.cfg; then
     41       if test -d '.git'; then
     42         if test -f .git/hooks/pre-commit; then
     43           echo "Pre-commit git hook already exists, skipping installation from the upstream file."
     44         else
     45           echo "Installing uncrustify pre-commit git hook"
     46           ln -s ../../contrib/uncrustify_precommit .git/hooks/pre-commit || \
     47             cp ../../contrib/uncrustify_precommit .git/hooks/pre-commit || \
     48             echo "Failed to install pre-commit git hook" 1>&2
     49         fi
     50       else
     51         echo "No '.git' directory found, skipping installation of pre-commit git hook."
     52       fi
     53     fi
     54 else
     55     echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development."
     56 fi
     57 
     58 WANT_AUTOCONF=latest
     59 WANT_AUTOMAKE=latest
     60 export WANT_AUTOCONF
     61 export WANT_AUTOMAKE
     62 
     63 aclocal -I m4 --install && \
     64   libtoolize -c -i -v && \
     65   autoconf && \
     66   autoheader && \
     67   automake -a -c --gnu || \
     68   echo "Trying with autoreconf..." &&
     69   autoreconf -vi ${1+"$@"} || \
     70   echo "*** Failed to build autoconf output files ***" >&2