"Fossies" - the Fresh Open Source Software Archive

Member "bup-0.30/config/configure" (28 Sep 2019, 4013 Bytes) of package /linux/privat/bup-0.30.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 #!/usr/bin/env bash
    2 
    3 bup_find_prog()
    4 {
    5     # Prints prog path to stdout or nothing.
    6     local name="$1" result="$2"
    7     TLOGN "checking for $name"
    8     if ! [ "$result" ]; then
    9         result=`acLookFor "$name"`
   10     fi
   11     TLOG " ($result)"
   12     echo "$result"
   13 }
   14 
   15 bup_try_c_code()
   16 {
   17     local code="$1" tmpdir rc
   18     if test -z "$code"; then
   19         AC_FAIL "No code provided to test compile"
   20     fi
   21     tmpdir="$(mktemp -d "bup-try-c-compile-XXXXXXX")" || exit $?
   22     echo "$code" > "$tmpdir/test.c" || exit $?
   23     $AC_CC -Wall -Werror -c -o "$tmpdir/test" "$tmpdir/test.c"
   24     rc=$?
   25     rm -r "$tmpdir" || exit $?
   26     return $rc
   27 }
   28 
   29 TARGET=bup
   30 
   31 . ./configure.inc
   32 
   33 AC_INIT $TARGET
   34 
   35 if ! AC_PROG_CC; then
   36     LOG " You need to have a functional C compiler to build $TARGET"
   37     exit 1
   38 fi
   39 
   40 MAKE="$(bup_find_prog make "$MAKE")"
   41 if test -z "$MAKE"; then
   42     MAKE="$(bup_find_prog gmake "$GMAKE")"
   43 fi
   44 
   45 if test -z "$MAKE"; then
   46     AC_FAIL "ERROR: unable to find make"
   47 fi
   48 
   49 if ! ($MAKE --version | grep "GNU Make"); then
   50     AC_FAIL "ERROR: $MAKE is not GNU Make"
   51 fi
   52 
   53 MAKE_VERSION=`$MAKE --version | grep "GNU Make" | awk '{print $3}'`
   54 if [ -z "$MAKE_VERSION" ]; then
   55     AC_FAIL "ERROR: $MAKE --version does not return sensible output?"
   56 fi
   57 expr "$MAKE_VERSION" '>=' '3.81' || AC_FAIL "ERROR: $MAKE must be >= version 3.81"
   58 
   59 AC_SUB bup_make "$MAKE"
   60 
   61 bup_python="$PYTHON"
   62 test -z "$bup_python" && bup_python="$(bup_find_prog python2.7 '')"
   63 test -z "$bup_python" && bup_python="$(bup_find_prog python2.6 '')"
   64 test -z "$bup_python" && bup_python="$(bup_find_prog python2 '')"
   65 test -z "$bup_python" && bup_python="$(bup_find_prog python '')"
   66 if test -z "$bup_python"; then
   67     AC_FAIL "ERROR: unable to find python"
   68 else
   69     AC_SUB bup_python "$bup_python"
   70 fi
   71 
   72 if test -z "$(bup_find_prog git '')"; then
   73     AC_FAIL "ERROR: unable to find git"
   74 fi
   75 
   76 # For stat.
   77 AC_CHECK_HEADERS sys/stat.h
   78 AC_CHECK_HEADERS sys/types.h
   79 
   80 # For stat and mincore.
   81 AC_CHECK_HEADERS unistd.h
   82 
   83 # For mincore.
   84 AC_CHECK_HEADERS sys/mman.h
   85 
   86 # For FS_IOC_GETFLAGS and FS_IOC_SETFLAGS.
   87 AC_CHECK_HEADERS linux/fs.h
   88 AC_CHECK_HEADERS sys/ioctl.h
   89 
   90 # On GNU/kFreeBSD utimensat is defined in GNU libc, but won't work.
   91 if [ -z "$OS_GNU_KFREEBSD" ]; then
   92     AC_CHECK_FUNCS utimensat
   93 fi
   94 AC_CHECK_FUNCS utimes
   95 AC_CHECK_FUNCS lutimes
   96 
   97 
   98 AC_CHECK_FUNCS mincore
   99 
  100 mincore_incore_code="
  101 #if 0$ac_defined_HAVE_UNISTD_H
  102 #include <unistd.h>
  103 #endif
  104 #if 0$ac_defined_HAVE_SYS_MMAN_H
  105 #include <sys/mman.h>
  106 #endif
  107 int main(int argc, char **argv)
  108 {
  109     if (MINCORE_INCORE)
  110       return 0;
  111 }
  112 "
  113 
  114 mincore_buf_type_code()
  115 {
  116     local vec_type="$1"
  117     echo "
  118 #include <sys/mman.h>
  119 int main(int argc, char **argv)
  120 {
  121     void *x = 0;
  122     $vec_type *buf = 0;
  123     return mincore(x, 0, buf);
  124 }" || exit $?
  125 }
  126 
  127 if test "$ac_defined_HAVE_MINCORE"; then
  128     TLOGN "checking for MINCORE_INCORE"
  129     if bup_try_c_code "$mincore_incore_code"; then
  130         AC_DEFINE BUP_HAVE_MINCORE_INCORE 1
  131         TLOG ' (found)'
  132     else
  133         TLOG ' (not found)'
  134     fi
  135 
  136     TLOGN "checking mincore buf type"
  137     if bup_try_c_code "$(mincore_buf_type_code char)"; then
  138         AC_DEFINE BUP_MINCORE_BUF_TYPE 'char'
  139         TLOG ' (char)'
  140     elif bup_try_c_code "$(mincore_buf_type_code 'unsigned char')"; then
  141         AC_DEFINE BUP_MINCORE_BUF_TYPE 'unsigned char'
  142         TLOG ' (unsigned char)'
  143     else
  144         AC_FAIL "ERROR: unexpected mincore definition; please notify bup-list@googlegroups.com"
  145     fi
  146 fi
  147 
  148 
  149 AC_CHECK_FIELD stat st_atim sys/types.h sys/stat.h unistd.h
  150 AC_CHECK_FIELD stat st_mtim sys/types.h sys/stat.h unistd.h
  151 AC_CHECK_FIELD stat st_ctim sys/types.h sys/stat.h unistd.h
  152 
  153 AC_CHECK_FIELD stat st_atimensec sys/types.h sys/stat.h unistd.h
  154 AC_CHECK_FIELD stat st_mtimensec sys/types.h sys/stat.h unistd.h
  155 AC_CHECK_FIELD stat st_ctimensec sys/types.h sys/stat.h unistd.h
  156 
  157 AC_CHECK_FIELD tm tm_gmtoff time.h
  158 
  159 __config_files="$__config_files config.vars.sh"
  160 
  161 AC_OUTPUT config.vars
  162 
  163 printf 'bup_make=%q\n' "$MAKE" > config.vars.sh
  164 printf 'bup_python=%q\n' "$bup_python" >> config.vars.sh