kusano fc6ab3
#!/bin/sh
kusano fc6ab3
# configure script for zlib.
kusano fc6ab3
#
kusano fc6ab3
# Normally configure builds both a static and a shared library.
kusano fc6ab3
# If you want to build just a static library, use: ./configure --static
kusano fc6ab3
#
kusano fc6ab3
# To impose specific compiler or flags or install directory, use for example:
kusano fc6ab3
#    prefix=$HOME CC=cc CFLAGS="-O4" ./configure
kusano fc6ab3
# or for csh/tcsh users:
kusano fc6ab3
#    (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
kusano fc6ab3
kusano fc6ab3
# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
kusano fc6ab3
# If you have problems, try without defining CC and CFLAGS before reporting
kusano fc6ab3
# an error.
kusano fc6ab3
kusano fc6ab3
# start off configure.log
kusano fc6ab3
echo -------------------- >> configure.log
kusano fc6ab3
echo $0 $* >> configure.log
kusano fc6ab3
date >> configure.log
kusano fc6ab3
kusano fc6ab3
# set command prefix for cross-compilation
kusano fc6ab3
if [ -n "${CHOST}" ]; then
kusano fc6ab3
    uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
kusano fc6ab3
    CROSS_PREFIX="${CHOST}-"
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# destination name for static library
kusano fc6ab3
STATICLIB=libz.a
kusano fc6ab3
kusano fc6ab3
# extract zlib version numbers from zlib.h
kusano fc6ab3
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
kusano fc6ab3
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
kusano fc6ab3
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
kusano fc6ab3
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
kusano fc6ab3
kusano fc6ab3
# establish commands for library building
kusano fc6ab3
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
kusano fc6ab3
    AR=${AR-"${CROSS_PREFIX}ar"}
kusano fc6ab3
    test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
kusano fc6ab3
else
kusano fc6ab3
    AR=${AR-"ar"}
kusano fc6ab3
    test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
kusano fc6ab3
fi
kusano fc6ab3
ARFLAGS=${ARFLAGS-"rc"}
kusano fc6ab3
if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
kusano fc6ab3
    RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
kusano fc6ab3
    test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
kusano fc6ab3
else
kusano fc6ab3
    RANLIB=${RANLIB-"ranlib"}
kusano fc6ab3
fi
kusano fc6ab3
if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
kusano fc6ab3
    NM=${NM-"${CROSS_PREFIX}nm"}
kusano fc6ab3
    test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
kusano fc6ab3
else
kusano fc6ab3
    NM=${NM-"nm"}
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# set defaults before processing command line options
kusano fc6ab3
LDCONFIG=${LDCONFIG-"ldconfig"}
kusano fc6ab3
LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
kusano fc6ab3
ARCHS=
kusano fc6ab3
prefix=${prefix-/usr/local}
kusano fc6ab3
exec_prefix=${exec_prefix-'${prefix}'}
kusano fc6ab3
libdir=${libdir-'${exec_prefix}/lib'}
kusano fc6ab3
sharedlibdir=${sharedlibdir-'${libdir}'}
kusano fc6ab3
includedir=${includedir-'${prefix}/include'}
kusano fc6ab3
mandir=${mandir-'${prefix}/share/man'}
kusano fc6ab3
shared_ext='.so'
kusano fc6ab3
shared=1
kusano fc6ab3
solo=0
kusano fc6ab3
cover=0
kusano fc6ab3
zprefix=0
kusano fc6ab3
zconst=0
kusano fc6ab3
build64=0
kusano fc6ab3
gcc=0
kusano fc6ab3
old_cc="$CC"
kusano fc6ab3
old_cflags="$CFLAGS"
kusano fc6ab3
OBJC='$(OBJZ) $(OBJG)'
kusano fc6ab3
PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
kusano fc6ab3
kusano fc6ab3
# leave this script, optionally in a bad way
kusano fc6ab3
leave()
kusano fc6ab3
{
kusano fc6ab3
  if test "$*" != "0"; then
kusano fc6ab3
    echo "** $0 aborting." | tee -a configure.log
kusano fc6ab3
  fi
kusano fc6ab3
  rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
kusano fc6ab3
  echo -------------------- >> configure.log
kusano fc6ab3
  echo >> configure.log
kusano fc6ab3
  echo >> configure.log
kusano fc6ab3
  exit $1
kusano fc6ab3
}
kusano fc6ab3
kusano fc6ab3
# process command line options
kusano fc6ab3
while test $# -ge 1
kusano fc6ab3
do
kusano fc6ab3
case "$1" in
kusano fc6ab3
    -h* | --help)
kusano fc6ab3
      echo 'usage:' | tee -a configure.log
kusano fc6ab3
      echo '  configure [--const] [--zprefix] [--prefix=PREFIX]  [--eprefix=EXPREFIX]' | tee -a configure.log
kusano fc6ab3
      echo '    [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
kusano fc6ab3
      echo '    [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
kusano fc6ab3
        exit 0 ;;
kusano fc6ab3
    -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
kusano fc6ab3
    -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
kusano fc6ab3
    -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
kusano fc6ab3
    --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
kusano fc6ab3
    -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
kusano fc6ab3
    -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
kusano fc6ab3
    -p* | --prefix) prefix="$2"; shift; shift ;;
kusano fc6ab3
    -e* | --eprefix) exec_prefix="$2"; shift; shift ;;
kusano fc6ab3
    -l* | --libdir) libdir="$2"; shift; shift ;;
kusano fc6ab3
    -i* | --includedir) includedir="$2"; shift; shift ;;
kusano fc6ab3
    -s* | --shared | --enable-shared) shared=1; shift ;;
kusano fc6ab3
    -t | --static) shared=0; shift ;;
kusano fc6ab3
    --solo) solo=1; shift ;;
kusano fc6ab3
    --cover) cover=1; shift ;;
kusano fc6ab3
    -z* | --zprefix) zprefix=1; shift ;;
kusano fc6ab3
    -6* | --64) build64=1; shift ;;
kusano fc6ab3
    -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
kusano fc6ab3
    --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
kusano fc6ab3
    --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
kusano fc6ab3
    -c* | --const) zconst=1; shift ;;
kusano fc6ab3
    *)
kusano fc6ab3
      echo "unknown option: $1" | tee -a configure.log
kusano fc6ab3
      echo "$0 --help for help" | tee -a configure.log
kusano fc6ab3
      leave 1;;
kusano fc6ab3
    esac
kusano fc6ab3
done
kusano fc6ab3
kusano fc6ab3
# temporary file name
kusano fc6ab3
test=ztest$$
kusano fc6ab3
kusano fc6ab3
# put arguments in log, also put test file in log if used in arguments
kusano fc6ab3
show()
kusano fc6ab3
{
kusano fc6ab3
  case "$*" in
kusano fc6ab3
    *$test.c*)
kusano fc6ab3
      echo === $test.c === >> configure.log
kusano fc6ab3
      cat $test.c >> configure.log
kusano fc6ab3
      echo === >> configure.log;;
kusano fc6ab3
  esac
kusano fc6ab3
  echo $* >> configure.log
kusano fc6ab3
}
kusano fc6ab3
kusano fc6ab3
# check for gcc vs. cc and set compile and link flags based on the system identified by uname
kusano fc6ab3
cat > $test.c <
kusano fc6ab3
extern int getchar();
kusano fc6ab3
int hello() {return getchar();}
kusano fc6ab3
EOF
kusano fc6ab3
kusano fc6ab3
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
kusano fc6ab3
cc=${CC-${CROSS_PREFIX}gcc}
kusano fc6ab3
cflags=${CFLAGS-"-O3"}
kusano fc6ab3
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
kusano fc6ab3
case "$cc" in
kusano fc6ab3
  *gcc*) gcc=1 ;;
kusano fc6ab3
  *clang*) gcc=1 ;;
kusano fc6ab3
esac
kusano fc6ab3
case `$cc -v 2>&1` in
kusano fc6ab3
  *gcc*) gcc=1 ;;
kusano fc6ab3
esac
kusano fc6ab3
kusano fc6ab3
show $cc -c $test.c
kusano fc6ab3
if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
kusano fc6ab3
  echo ... using gcc >> configure.log
kusano fc6ab3
  CC="$cc"
kusano fc6ab3
  CFLAGS="${CFLAGS--O3} ${ARCHS}"
kusano fc6ab3
  SFLAGS="${CFLAGS--O3} -fPIC"
kusano fc6ab3
  LDFLAGS="${LDFLAGS} ${ARCHS}"
kusano fc6ab3
  if test $build64 -eq 1; then
kusano fc6ab3
    CFLAGS="${CFLAGS} -m64"
kusano fc6ab3
    SFLAGS="${SFLAGS} -m64"
kusano fc6ab3
  fi
kusano fc6ab3
  if test "${ZLIBGCCWARN}" = "YES"; then
kusano fc6ab3
    if test "$zconst" -eq 1; then
kusano fc6ab3
      CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
kusano fc6ab3
    else
kusano fc6ab3
      CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
kusano fc6ab3
    fi
kusano fc6ab3
  fi
kusano fc6ab3
  if test -z "$uname"; then
kusano fc6ab3
    uname=`(uname -s || echo unknown) 2>/dev/null`
kusano fc6ab3
  fi
kusano fc6ab3
  case "$uname" in
kusano fc6ab3
  Linux* | linux* | GNU | GNU/* | solaris*)
kusano fc6ab3
        LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
kusano fc6ab3
  *BSD | *bsd* | DragonFly)
kusano fc6ab3
        LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"}
kusano fc6ab3
        LDCONFIG="ldconfig -m" ;;
kusano fc6ab3
  CYGWIN* | Cygwin* | cygwin* | OS/2*)
kusano fc6ab3
        EXE='.exe' ;;
kusano fc6ab3
  MINGW* | mingw*)
kusano fc6ab3
# temporary bypass
kusano fc6ab3
        rm -f $test.[co] $test $test$shared_ext
kusano fc6ab3
        echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
kusano fc6ab3
        leave 1
kusano fc6ab3
        LDSHARED=${LDSHARED-"$cc -shared"}
kusano fc6ab3
        LDSHAREDLIBC=""
kusano fc6ab3
        EXE='.exe' ;;
kusano fc6ab3
  QNX*)  # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
kusano fc6ab3
         # (alain.bonnefoy@icbt.com)
kusano fc6ab3
                 LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
kusano fc6ab3
  HP-UX*)
kusano fc6ab3
         LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
kusano fc6ab3
         case `(uname -m || echo unknown) 2>/dev/null` in
kusano fc6ab3
         ia64)
kusano fc6ab3
                 shared_ext='.so'
kusano fc6ab3
                 SHAREDLIB='libz.so' ;;
kusano fc6ab3
         *)
kusano fc6ab3
                 shared_ext='.sl'
kusano fc6ab3
                 SHAREDLIB='libz.sl' ;;
kusano fc6ab3
         esac ;;
kusano fc6ab3
  Darwin* | darwin*)
kusano fc6ab3
             shared_ext='.dylib'
kusano fc6ab3
             SHAREDLIB=libz$shared_ext
kusano fc6ab3
             SHAREDLIBV=libz.$VER$shared_ext
kusano fc6ab3
             SHAREDLIBM=libz.$VER1$shared_ext
kusano fc6ab3
             LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
kusano fc6ab3
             if libtool -V 2>&1 | grep Apple > /dev/null; then
kusano fc6ab3
                 AR="libtool"
kusano fc6ab3
             else
kusano fc6ab3
                 AR="/usr/bin/libtool"
kusano fc6ab3
             fi
kusano fc6ab3
             ARFLAGS="-o" ;;
kusano fc6ab3
  *)             LDSHARED=${LDSHARED-"$cc -shared"} ;;
kusano fc6ab3
  esac
kusano fc6ab3
else
kusano fc6ab3
  # find system name and corresponding cc options
kusano fc6ab3
  CC=${CC-cc}
kusano fc6ab3
  gcc=0
kusano fc6ab3
  echo ... using $CC >> configure.log
kusano fc6ab3
  if test -z "$uname"; then
kusano fc6ab3
    uname=`(uname -sr || echo unknown) 2>/dev/null`
kusano fc6ab3
  fi
kusano fc6ab3
  case "$uname" in
kusano fc6ab3
  HP-UX*)    SFLAGS=${CFLAGS-"-O +z"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O"}
kusano fc6ab3
#            LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"ld -b"}
kusano fc6ab3
         case `(uname -m || echo unknown) 2>/dev/null` in
kusano fc6ab3
         ia64)
kusano fc6ab3
             shared_ext='.so'
kusano fc6ab3
             SHAREDLIB='libz.so' ;;
kusano fc6ab3
         *)
kusano fc6ab3
             shared_ext='.sl'
kusano fc6ab3
             SHAREDLIB='libz.sl' ;;
kusano fc6ab3
         esac ;;
kusano fc6ab3
  IRIX*)     SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-ansi -O2"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
kusano fc6ab3
  OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O -std1"}
kusano fc6ab3
             LDFLAGS="${LDFLAGS} -Wl,-rpath,."
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -shared  -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
kusano fc6ab3
  OSF1*)     SFLAGS=${CFLAGS-"-O -std1"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O -std1"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
kusano fc6ab3
  QNX*)      SFLAGS=${CFLAGS-"-4 -O"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-4 -O"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc"}
kusano fc6ab3
             RANLIB=${RANLIB-"true"}
kusano fc6ab3
             AR="cc"
kusano fc6ab3
             ARFLAGS="-A" ;;
kusano fc6ab3
  SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O3"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
kusano fc6ab3
  SunOS\ 5* | solaris*)
kusano fc6ab3
         LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
kusano fc6ab3
         SFLAGS=${CFLAGS-"-fast -KPIC"}
kusano fc6ab3
         CFLAGS=${CFLAGS-"-fast"}
kusano fc6ab3
         if test $build64 -eq 1; then
kusano fc6ab3
             # old versions of SunPRO/Workshop/Studio don't support -m64,
kusano fc6ab3
             # but newer ones do.  Check for it.
kusano fc6ab3
             flag64=`$CC -flags | egrep -- '^-m64'`
kusano fc6ab3
             if test x"$flag64" != x"" ; then
kusano fc6ab3
                 CFLAGS="${CFLAGS} -m64"
kusano fc6ab3
                 SFLAGS="${SFLAGS} -m64"
kusano fc6ab3
             else
kusano fc6ab3
                 case `(uname -m || echo unknown) 2>/dev/null` in
kusano fc6ab3
                   i86*)
kusano fc6ab3
                     SFLAGS="$SFLAGS -xarch=amd64"
kusano fc6ab3
                     CFLAGS="$CFLAGS -xarch=amd64" ;;
kusano fc6ab3
                   *)
kusano fc6ab3
                     SFLAGS="$SFLAGS -xarch=v9"
kusano fc6ab3
                     CFLAGS="$CFLAGS -xarch=v9" ;;
kusano fc6ab3
                 esac
kusano fc6ab3
             fi
kusano fc6ab3
         fi
kusano fc6ab3
         ;;
kusano fc6ab3
  SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O2"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"ld"} ;;
kusano fc6ab3
  SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
kusano fc6ab3
  UNIX_System_V\ 4.2.0)
kusano fc6ab3
             SFLAGS=${CFLAGS-"-KPIC -O"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -G"} ;;
kusano fc6ab3
  UNIX_SV\ 4.2MP)
kusano fc6ab3
             SFLAGS=${CFLAGS-"-Kconform_pic -O"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -G"} ;;
kusano fc6ab3
  OpenUNIX\ 5)
kusano fc6ab3
             SFLAGS=${CFLAGS-"-KPIC -O"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -G"} ;;
kusano fc6ab3
  AIX*)  # Courtesy of dbakker@arrayasolutions.com
kusano fc6ab3
             SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"xlc -G"} ;;
kusano fc6ab3
  # send working options for other systems to zlib@gzip.org
kusano fc6ab3
  *)         SFLAGS=${CFLAGS-"-O"}
kusano fc6ab3
             CFLAGS=${CFLAGS-"-O"}
kusano fc6ab3
             LDSHARED=${LDSHARED-"cc -shared"} ;;
kusano fc6ab3
  esac
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# destination names for shared library if not defined above
kusano fc6ab3
SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
kusano fc6ab3
SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
kusano fc6ab3
SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
kusano fc6ab3
kusano fc6ab3
echo >> configure.log
kusano fc6ab3
kusano fc6ab3
# define functions for testing compiler and library characteristics and logging the results
kusano fc6ab3
kusano fc6ab3
cat > $test.c <
kusano fc6ab3
#error error
kusano fc6ab3
EOF
kusano fc6ab3
if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
kusano fc6ab3
  try()
kusano fc6ab3
  {
kusano fc6ab3
    show $*
kusano fc6ab3
    test "`( $* ) 2>&1 | tee -a configure.log`" = ""
kusano fc6ab3
  }
kusano fc6ab3
  echo - using any output from compiler to indicate an error >> configure.log
kusano fc6ab3
else
kusano fc6ab3
try()
kusano fc6ab3
{
kusano fc6ab3
  show $*
kusano fc6ab3
  ( $* ) >> configure.log 2>&1
kusano fc6ab3
  ret=$?
kusano fc6ab3
  if test $ret -ne 0; then
kusano fc6ab3
    echo "(exit code "$ret")" >> configure.log
kusano fc6ab3
  fi
kusano fc6ab3
  return $ret
kusano fc6ab3
}
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
tryboth()
kusano fc6ab3
{
kusano fc6ab3
  show $*
kusano fc6ab3
  got=`( $* ) 2>&1`
kusano fc6ab3
  ret=$?
kusano fc6ab3
  printf %s "$got" >> configure.log
kusano fc6ab3
  if test $ret -ne 0; then
kusano fc6ab3
    return $ret
kusano fc6ab3
  fi
kusano fc6ab3
  test "$got" = ""
kusano fc6ab3
}
kusano fc6ab3
kusano fc6ab3
cat > $test.c << EOF
kusano fc6ab3
int foo() { return 0; }
kusano fc6ab3
EOF
kusano fc6ab3
echo "Checking for obsessive-compulsive compiler options..." >> configure.log
kusano fc6ab3
if try $CC -c $CFLAGS $test.c; then
kusano fc6ab3
  :
kusano fc6ab3
else
kusano fc6ab3
  echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
kusano fc6ab3
  leave 1
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
echo >> configure.log
kusano fc6ab3
kusano fc6ab3
# see if shared library build supported
kusano fc6ab3
cat > $test.c <
kusano fc6ab3
extern int getchar();
kusano fc6ab3
int hello() {return getchar();}
kusano fc6ab3
EOF
kusano fc6ab3
if test $shared -eq 1; then
kusano fc6ab3
  echo Checking for shared library support... | tee -a configure.log
kusano fc6ab3
  # we must test in two steps (cc then ld), required at least on SunOS 4.x
kusano fc6ab3
  if try $CC -w -c $SFLAGS $test.c &&
kusano fc6ab3
     try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
kusano fc6ab3
    echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
kusano fc6ab3
  elif test -z "$old_cc" -a -z "$old_cflags"; then
kusano fc6ab3
    echo No shared library support. | tee -a configure.log
kusano fc6ab3
    shared=0;
kusano fc6ab3
  else
kusano fc6ab3
    echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
kusano fc6ab3
    shared=0;
kusano fc6ab3
  fi
kusano fc6ab3
fi
kusano fc6ab3
if test $shared -eq 0; then
kusano fc6ab3
  LDSHARED="$CC"
kusano fc6ab3
  ALL="static"
kusano fc6ab3
  TEST="all teststatic"
kusano fc6ab3
  SHAREDLIB=""
kusano fc6ab3
  SHAREDLIBV=""
kusano fc6ab3
  SHAREDLIBM=""
kusano fc6ab3
  echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
kusano fc6ab3
else
kusano fc6ab3
  ALL="static shared"
kusano fc6ab3
  TEST="all teststatic testshared"
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# check for underscores in external names for use by assembler code
kusano fc6ab3
CPP=${CPP-"$CC -E"}
kusano fc6ab3
case $CFLAGS in
kusano fc6ab3
  *ASMV*)
kusano fc6ab3
    echo >> configure.log
kusano fc6ab3
    show "$NM $test.o | grep _hello"
kusano fc6ab3
    if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
kusano fc6ab3
      CPP="$CPP -DNO_UNDERLINE"
kusano fc6ab3
      echo Checking for underline in external names... No. | tee -a configure.log
kusano fc6ab3
    else
kusano fc6ab3
      echo Checking for underline in external names... Yes. | tee -a configure.log
kusano fc6ab3
    fi ;;
kusano fc6ab3
esac
kusano fc6ab3
kusano fc6ab3
echo >> configure.log
kusano fc6ab3
kusano fc6ab3
# check for large file support, and if none, check for fseeko()
kusano fc6ab3
cat > $test.c <
kusano fc6ab3
#include <sys types.h=""></sys>
kusano fc6ab3
off64_t dummy = 0;
kusano fc6ab3
EOF
kusano fc6ab3
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
kusano fc6ab3
  CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
kusano fc6ab3
  SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
kusano fc6ab3
  ALL="${ALL} all64"
kusano fc6ab3
  TEST="${TEST} test64"
kusano fc6ab3
  echo "Checking for off64_t... Yes." | tee -a configure.log
kusano fc6ab3
  echo "Checking for fseeko... Yes." | tee -a configure.log
kusano fc6ab3
else
kusano fc6ab3
  echo "Checking for off64_t... No." | tee -a configure.log
kusano fc6ab3
  echo >> configure.log
kusano fc6ab3
  cat > $test.c <
kusano fc6ab3
#include <stdio.h></stdio.h>
kusano fc6ab3
int main(void) {
kusano fc6ab3
  fseeko(NULL, 0, 0);
kusano fc6ab3
  return 0;
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
  if try $CC $CFLAGS -o $test $test.c; then
kusano fc6ab3
    echo "Checking for fseeko... Yes." | tee -a configure.log
kusano fc6ab3
  else
kusano fc6ab3
    CFLAGS="${CFLAGS} -DNO_FSEEKO"
kusano fc6ab3
    SFLAGS="${SFLAGS} -DNO_FSEEKO"
kusano fc6ab3
    echo "Checking for fseeko... No." | tee -a configure.log
kusano fc6ab3
  fi
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
echo >> configure.log
kusano fc6ab3
kusano fc6ab3
# check for strerror() for use by gz* functions
kusano fc6ab3
cat > $test.c <
kusano fc6ab3
#include <string.h></string.h>
kusano fc6ab3
#include <errno.h></errno.h>
kusano fc6ab3
int main() { return strlen(strerror(errno)); }
kusano fc6ab3
EOF
kusano fc6ab3
if try $CC $CFLAGS -o $test $test.c; then
kusano fc6ab3
  echo "Checking for strerror... Yes." | tee -a configure.log
kusano fc6ab3
else
kusano fc6ab3
  CFLAGS="${CFLAGS} -DNO_STRERROR"
kusano fc6ab3
  SFLAGS="${SFLAGS} -DNO_STRERROR"
kusano fc6ab3
  echo "Checking for strerror... No." | tee -a configure.log
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# copy clean zconf.h for subsequent edits
kusano fc6ab3
cp -p zconf.h.in zconf.h
kusano fc6ab3
kusano fc6ab3
echo >> configure.log
kusano fc6ab3
kusano fc6ab3
# check for unistd.h and save result in zconf.h
kusano fc6ab3
cat > $test.c <
kusano fc6ab3
#include <unistd.h></unistd.h>
kusano fc6ab3
int main() { return 0; }
kusano fc6ab3
EOF
kusano fc6ab3
if try $CC -c $CFLAGS $test.c; then
kusano fc6ab3
  sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
kusano fc6ab3
  mv zconf.temp.h zconf.h
kusano fc6ab3
  echo "Checking for unistd.h... Yes." | tee -a configure.log
kusano fc6ab3
else
kusano fc6ab3
  echo "Checking for unistd.h... No." | tee -a configure.log
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
echo >> configure.log
kusano fc6ab3
kusano fc6ab3
# check for stdarg.h and save result in zconf.h
kusano fc6ab3
cat > $test.c <
kusano fc6ab3
#include <stdarg.h></stdarg.h>
kusano fc6ab3
int main() { return 0; }
kusano fc6ab3
EOF
kusano fc6ab3
if try $CC -c $CFLAGS $test.c; then
kusano fc6ab3
  sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
kusano fc6ab3
  mv zconf.temp.h zconf.h
kusano fc6ab3
  echo "Checking for stdarg.h... Yes." | tee -a configure.log
kusano fc6ab3
else
kusano fc6ab3
  echo "Checking for stdarg.h... No." | tee -a configure.log
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# if the z_ prefix was requested, save that in zconf.h
kusano fc6ab3
if test $zprefix -eq 1; then
kusano fc6ab3
  sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
kusano fc6ab3
  mv zconf.temp.h zconf.h
kusano fc6ab3
  echo >> configure.log
kusano fc6ab3
  echo "Using z_ prefix on all symbols." | tee -a configure.log
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
kusano fc6ab3
if test $solo -eq 1; then
kusano fc6ab3
  sed '/#define ZCONF_H/a\
kusano fc6ab3
#define Z_SOLO
kusano fc6ab3
kusano fc6ab3
' < zconf.h > zconf.temp.h
kusano fc6ab3
  mv zconf.temp.h zconf.h
kusano fc6ab3
OBJC='$(OBJZ)'
kusano fc6ab3
PIC_OBJC='$(PIC_OBJZ)'
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
kusano fc6ab3
if test $cover -eq 1; then
kusano fc6ab3
  CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
kusano fc6ab3
  if test -n "$GCC_CLASSIC"; then
kusano fc6ab3
    CC=$GCC_CLASSIC
kusano fc6ab3
  fi
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
echo >> configure.log
kusano fc6ab3
kusano fc6ab3
# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
kusano fc6ab3
# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
kusano fc6ab3
# return value.  The most secure result is vsnprintf() with a return value.  snprintf() with a
kusano fc6ab3
# return value is secure as well, but then gzprintf() will be limited to 20 arguments.
kusano fc6ab3
cat > $test.c <
kusano fc6ab3
#include <stdio.h></stdio.h>
kusano fc6ab3
#include <stdarg.h></stdarg.h>
kusano fc6ab3
#include "zconf.h"
kusano fc6ab3
int main()
kusano fc6ab3
{
kusano fc6ab3
#ifndef STDC
kusano fc6ab3
  choke me
kusano fc6ab3
#endif
kusano fc6ab3
  return 0;
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
if try $CC -c $CFLAGS $test.c; then
kusano fc6ab3
  echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
kusano fc6ab3
kusano fc6ab3
  echo >> configure.log
kusano fc6ab3
  cat > $test.c <
kusano fc6ab3
#include <stdio.h></stdio.h>
kusano fc6ab3
#include <stdarg.h></stdarg.h>
kusano fc6ab3
int mytest(const char *fmt, ...)
kusano fc6ab3
{
kusano fc6ab3
  char buf[20];
kusano fc6ab3
  va_list ap;
kusano fc6ab3
  va_start(ap, fmt);
kusano fc6ab3
  vsnprintf(buf, sizeof(buf), fmt, ap);
kusano fc6ab3
  va_end(ap);
kusano fc6ab3
  return 0;
kusano fc6ab3
}
kusano fc6ab3
int main()
kusano fc6ab3
{
kusano fc6ab3
  return (mytest("Hello%d\n", 1));
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
  if try $CC $CFLAGS -o $test $test.c; then
kusano fc6ab3
    echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
kusano fc6ab3
kusano fc6ab3
    echo >> configure.log
kusano fc6ab3
    cat >$test.c <
kusano fc6ab3
#include <stdio.h></stdio.h>
kusano fc6ab3
#include <stdarg.h></stdarg.h>
kusano fc6ab3
int mytest(const char *fmt, ...)
kusano fc6ab3
{
kusano fc6ab3
  int n;
kusano fc6ab3
  char buf[20];
kusano fc6ab3
  va_list ap;
kusano fc6ab3
  va_start(ap, fmt);
kusano fc6ab3
  n = vsnprintf(buf, sizeof(buf), fmt, ap);
kusano fc6ab3
  va_end(ap);
kusano fc6ab3
  return n;
kusano fc6ab3
}
kusano fc6ab3
int main()
kusano fc6ab3
{
kusano fc6ab3
  return (mytest("Hello%d\n", 1));
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
kusano fc6ab3
    if try $CC -c $CFLAGS $test.c; then
kusano fc6ab3
      echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
kusano fc6ab3
    else
kusano fc6ab3
      CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
kusano fc6ab3
      SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
kusano fc6ab3
      echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
kusano fc6ab3
      echo "  WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
kusano fc6ab3
      echo "  can build but will be open to possible string-format security" | tee -a configure.log
kusano fc6ab3
      echo "  vulnerabilities." | tee -a configure.log
kusano fc6ab3
    fi
kusano fc6ab3
  else
kusano fc6ab3
    CFLAGS="$CFLAGS -DNO_vsnprintf"
kusano fc6ab3
    SFLAGS="$SFLAGS -DNO_vsnprintf"
kusano fc6ab3
    echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
kusano fc6ab3
    echo "  WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
kusano fc6ab3
    echo "  can build but will be open to possible buffer-overflow security" | tee -a configure.log
kusano fc6ab3
    echo "  vulnerabilities." | tee -a configure.log
kusano fc6ab3
kusano fc6ab3
    echo >> configure.log
kusano fc6ab3
    cat >$test.c <
kusano fc6ab3
#include <stdio.h></stdio.h>
kusano fc6ab3
#include <stdarg.h></stdarg.h>
kusano fc6ab3
int mytest(const char *fmt, ...)
kusano fc6ab3
{
kusano fc6ab3
  int n;
kusano fc6ab3
  char buf[20];
kusano fc6ab3
  va_list ap;
kusano fc6ab3
  va_start(ap, fmt);
kusano fc6ab3
  n = vsprintf(buf, fmt, ap);
kusano fc6ab3
  va_end(ap);
kusano fc6ab3
  return n;
kusano fc6ab3
}
kusano fc6ab3
int main()
kusano fc6ab3
{
kusano fc6ab3
  return (mytest("Hello%d\n", 1));
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
kusano fc6ab3
    if try $CC -c $CFLAGS $test.c; then
kusano fc6ab3
      echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
kusano fc6ab3
    else
kusano fc6ab3
      CFLAGS="$CFLAGS -DHAS_vsprintf_void"
kusano fc6ab3
      SFLAGS="$SFLAGS -DHAS_vsprintf_void"
kusano fc6ab3
      echo "Checking for return value of vsprintf()... No." | tee -a configure.log
kusano fc6ab3
      echo "  WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
kusano fc6ab3
      echo "  can build but will be open to possible string-format security" | tee -a configure.log
kusano fc6ab3
      echo "  vulnerabilities." | tee -a configure.log
kusano fc6ab3
    fi
kusano fc6ab3
  fi
kusano fc6ab3
else
kusano fc6ab3
  echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
kusano fc6ab3
kusano fc6ab3
  echo >> configure.log
kusano fc6ab3
  cat >$test.c <
kusano fc6ab3
#include <stdio.h></stdio.h>
kusano fc6ab3
int mytest()
kusano fc6ab3
{
kusano fc6ab3
  char buf[20];
kusano fc6ab3
  snprintf(buf, sizeof(buf), "%s", "foo");
kusano fc6ab3
  return 0;
kusano fc6ab3
}
kusano fc6ab3
int main()
kusano fc6ab3
{
kusano fc6ab3
  return (mytest());
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
kusano fc6ab3
  if try $CC $CFLAGS -o $test $test.c; then
kusano fc6ab3
    echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
kusano fc6ab3
kusano fc6ab3
    echo >> configure.log
kusano fc6ab3
    cat >$test.c <
kusano fc6ab3
#include <stdio.h></stdio.h>
kusano fc6ab3
int mytest()
kusano fc6ab3
{
kusano fc6ab3
  char buf[20];
kusano fc6ab3
  return snprintf(buf, sizeof(buf), "%s", "foo");
kusano fc6ab3
}
kusano fc6ab3
int main()
kusano fc6ab3
{
kusano fc6ab3
  return (mytest());
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
kusano fc6ab3
    if try $CC -c $CFLAGS $test.c; then
kusano fc6ab3
      echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
kusano fc6ab3
    else
kusano fc6ab3
      CFLAGS="$CFLAGS -DHAS_snprintf_void"
kusano fc6ab3
      SFLAGS="$SFLAGS -DHAS_snprintf_void"
kusano fc6ab3
      echo "Checking for return value of snprintf()... No." | tee -a configure.log
kusano fc6ab3
      echo "  WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
kusano fc6ab3
      echo "  can build but will be open to possible string-format security" | tee -a configure.log
kusano fc6ab3
      echo "  vulnerabilities." | tee -a configure.log
kusano fc6ab3
    fi
kusano fc6ab3
  else
kusano fc6ab3
    CFLAGS="$CFLAGS -DNO_snprintf"
kusano fc6ab3
    SFLAGS="$SFLAGS -DNO_snprintf"
kusano fc6ab3
    echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
kusano fc6ab3
    echo "  WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
kusano fc6ab3
    echo "  can build but will be open to possible buffer-overflow security" | tee -a configure.log
kusano fc6ab3
    echo "  vulnerabilities." | tee -a configure.log
kusano fc6ab3
kusano fc6ab3
    echo >> configure.log
kusano fc6ab3
    cat >$test.c <
kusano fc6ab3
#include <stdio.h></stdio.h>
kusano fc6ab3
int mytest()
kusano fc6ab3
{
kusano fc6ab3
  char buf[20];
kusano fc6ab3
  return sprintf(buf, "%s", "foo");
kusano fc6ab3
}
kusano fc6ab3
int main()
kusano fc6ab3
{
kusano fc6ab3
  return (mytest());
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
kusano fc6ab3
    if try $CC -c $CFLAGS $test.c; then
kusano fc6ab3
      echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
kusano fc6ab3
    else
kusano fc6ab3
      CFLAGS="$CFLAGS -DHAS_sprintf_void"
kusano fc6ab3
      SFLAGS="$SFLAGS -DHAS_sprintf_void"
kusano fc6ab3
      echo "Checking for return value of sprintf()... No." | tee -a configure.log
kusano fc6ab3
      echo "  WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
kusano fc6ab3
      echo "  can build but will be open to possible string-format security" | tee -a configure.log
kusano fc6ab3
      echo "  vulnerabilities." | tee -a configure.log
kusano fc6ab3
    fi
kusano fc6ab3
  fi
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# see if we can hide zlib internal symbols that are linked between separate source files
kusano fc6ab3
if test "$gcc" -eq 1; then
kusano fc6ab3
  echo >> configure.log
kusano fc6ab3
  cat > $test.c <
kusano fc6ab3
#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
kusano fc6ab3
int ZLIB_INTERNAL foo;
kusano fc6ab3
int main()
kusano fc6ab3
{
kusano fc6ab3
  return 0;
kusano fc6ab3
}
kusano fc6ab3
EOF
kusano fc6ab3
  if tryboth $CC -c $CFLAGS $test.c; then
kusano fc6ab3
    CFLAGS="$CFLAGS -DHAVE_HIDDEN"
kusano fc6ab3
    SFLAGS="$SFLAGS -DHAVE_HIDDEN"
kusano fc6ab3
    echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
kusano fc6ab3
  else
kusano fc6ab3
    echo "Checking for attribute(visibility) support... No." | tee -a configure.log
kusano fc6ab3
  fi
kusano fc6ab3
fi
kusano fc6ab3
kusano fc6ab3
# show the results in the log
kusano fc6ab3
echo >> configure.log
kusano fc6ab3
echo ALL = $ALL >> configure.log
kusano fc6ab3
echo AR = $AR >> configure.log
kusano fc6ab3
echo ARFLAGS = $ARFLAGS >> configure.log
kusano fc6ab3
echo CC = $CC >> configure.log
kusano fc6ab3
echo CFLAGS = $CFLAGS >> configure.log
kusano fc6ab3
echo CPP = $CPP >> configure.log
kusano fc6ab3
echo EXE = $EXE >> configure.log
kusano fc6ab3
echo LDCONFIG = $LDCONFIG >> configure.log
kusano fc6ab3
echo LDFLAGS = $LDFLAGS >> configure.log
kusano fc6ab3
echo LDSHARED = $LDSHARED >> configure.log
kusano fc6ab3
echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
kusano fc6ab3
echo OBJC = $OBJC >> configure.log
kusano fc6ab3
echo PIC_OBJC = $PIC_OBJC >> configure.log
kusano fc6ab3
echo RANLIB = $RANLIB >> configure.log
kusano fc6ab3
echo SFLAGS = $SFLAGS >> configure.log
kusano fc6ab3
echo SHAREDLIB = $SHAREDLIB >> configure.log
kusano fc6ab3
echo SHAREDLIBM = $SHAREDLIBM >> configure.log
kusano fc6ab3
echo SHAREDLIBV = $SHAREDLIBV >> configure.log
kusano fc6ab3
echo STATICLIB = $STATICLIB >> configure.log
kusano fc6ab3
echo TEST = $TEST >> configure.log
kusano fc6ab3
echo VER = $VER >> configure.log
kusano fc6ab3
echo Z_U4 = $Z_U4 >> configure.log
kusano fc6ab3
echo exec_prefix = $exec_prefix >> configure.log
kusano fc6ab3
echo includedir = $includedir >> configure.log
kusano fc6ab3
echo libdir = $libdir >> configure.log
kusano fc6ab3
echo mandir = $mandir >> configure.log
kusano fc6ab3
echo prefix = $prefix >> configure.log
kusano fc6ab3
echo sharedlibdir = $sharedlibdir >> configure.log
kusano fc6ab3
echo uname = $uname >> configure.log
kusano fc6ab3
kusano fc6ab3
# udpate Makefile with the configure results
kusano fc6ab3
sed < Makefile.in "
kusano fc6ab3
/^CC *=/s#=.*#=$CC#
kusano fc6ab3
/^CFLAGS *=/s#=.*#=$CFLAGS#
kusano fc6ab3
/^SFLAGS *=/s#=.*#=$SFLAGS#
kusano fc6ab3
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
kusano fc6ab3
/^LDSHARED *=/s#=.*#=$LDSHARED#
kusano fc6ab3
/^CPP *=/s#=.*#=$CPP#
kusano fc6ab3
/^STATICLIB *=/s#=.*#=$STATICLIB#
kusano fc6ab3
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
kusano fc6ab3
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
kusano fc6ab3
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
kusano fc6ab3
/^AR *=/s#=.*#=$AR#
kusano fc6ab3
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
kusano fc6ab3
/^RANLIB *=/s#=.*#=$RANLIB#
kusano fc6ab3
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
kusano fc6ab3
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
kusano fc6ab3
/^EXE *=/s#=.*#=$EXE#
kusano fc6ab3
/^prefix *=/s#=.*#=$prefix#
kusano fc6ab3
/^exec_prefix *=/s#=.*#=$exec_prefix#
kusano fc6ab3
/^libdir *=/s#=.*#=$libdir#
kusano fc6ab3
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
kusano fc6ab3
/^includedir *=/s#=.*#=$includedir#
kusano fc6ab3
/^mandir *=/s#=.*#=$mandir#
kusano fc6ab3
/^OBJC *=/s#=.*#= $OBJC#
kusano fc6ab3
/^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
kusano fc6ab3
/^all: */s#:.*#: $ALL#
kusano fc6ab3
/^test: */s#:.*#: $TEST#
kusano fc6ab3
" > Makefile
kusano fc6ab3
kusano fc6ab3
# create zlib.pc with the configure results
kusano fc6ab3
sed < zlib.pc.in "
kusano fc6ab3
/^CC *=/s#=.*#=$CC#
kusano fc6ab3
/^CFLAGS *=/s#=.*#=$CFLAGS#
kusano fc6ab3
/^CPP *=/s#=.*#=$CPP#
kusano fc6ab3
/^LDSHARED *=/s#=.*#=$LDSHARED#
kusano fc6ab3
/^STATICLIB *=/s#=.*#=$STATICLIB#
kusano fc6ab3
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
kusano fc6ab3
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
kusano fc6ab3
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
kusano fc6ab3
/^AR *=/s#=.*#=$AR#
kusano fc6ab3
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
kusano fc6ab3
/^RANLIB *=/s#=.*#=$RANLIB#
kusano fc6ab3
/^EXE *=/s#=.*#=$EXE#
kusano fc6ab3
/^prefix *=/s#=.*#=$prefix#
kusano fc6ab3
/^exec_prefix *=/s#=.*#=$exec_prefix#
kusano fc6ab3
/^libdir *=/s#=.*#=$libdir#
kusano fc6ab3
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
kusano fc6ab3
/^includedir *=/s#=.*#=$includedir#
kusano fc6ab3
/^mandir *=/s#=.*#=$mandir#
kusano fc6ab3
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
kusano fc6ab3
" | sed -e "
kusano fc6ab3
s/\@VERSION\@/$VER/g;
kusano fc6ab3
" > zlib.pc
kusano fc6ab3
kusano fc6ab3
# done
kusano fc6ab3
leave 0