Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
6.7 KiB

  1. #!/bin/sh
  2. # configure script for zlib. This script is needed only if
  3. # you wish to build a shared library and your system supports them,
  4. # of if you need special compiler, flags or install directory.
  5. # Otherwise, you can just use directly "make test; make install"
  6. #
  7. # To create a shared library, use "configure --shared"; by default a static
  8. # library is created. If the primitive shared library support provided here
  9. # does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz
  10. #
  11. # To impose specific compiler or flags or install directory, use for example:
  12. # prefix=$HOME CC=cc CFLAGS="-O4" ./configure
  13. # or for csh/tcsh users:
  14. # (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
  15. # LDSHARED is the command to be used to create a shared library
  16. # Incorrect settings of CC or CFLAGS may prevent creating a shared library.
  17. # If you have problems, try without defining CC and CFLAGS before reporting
  18. # an error.
  19. LIBS=libz.a
  20. SHAREDLIB=libz.so
  21. VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
  22. AR=${AR-"ar rc"}
  23. RANLIB=${RANLIB-"ranlib"}
  24. prefix=${prefix-/usr/local}
  25. exec_prefix=${exec_prefix-'${prefix}'}
  26. libdir=${libdir-'${exec_prefix}/lib'}
  27. includedir=${includedir-'${prefix}/include'}
  28. shared_ext='.so'
  29. shared=0
  30. gcc=0
  31. old_cc="$CC"
  32. old_cflags="$CFLAGS"
  33. while test $# -ge 1
  34. do
  35. case "$1" in
  36. -h* | --h*)
  37. echo 'usage:'
  38. echo ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]'
  39. echo ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]'
  40. exit 0;;
  41. -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
  42. -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
  43. -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;;
  44. -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;;
  45. -p* | --p*) prefix="$2"; shift; shift;;
  46. -e* | --e*) exec_prefix="$2"; shift; shift;;
  47. -l* | --l*) libdir="$2"; shift; shift;;
  48. -i* | --i*) includedir="$2"; shift; shift;;
  49. -s* | --s*) shared=1; shift;;
  50. esac
  51. done
  52. test=ztest$$
  53. cat > $test.c <<EOF
  54. extern int getchar();
  55. int hello() {return getchar();}
  56. EOF
  57. test -z "$CC" && echo Checking for gcc...
  58. cc=${CC-gcc}
  59. cflags=${CFLAGS-"-O3"}
  60. # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
  61. case "$cc" in
  62. *gcc*) gcc=1;;
  63. esac
  64. if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
  65. CC="$cc"
  66. SFLAGS=${CFLAGS-"-fPIC -O3"}
  67. CFLAGS="$cflags"
  68. case `(uname -s || echo unknown) 2>/dev/null` in
  69. Linux | linux) LDSHARED=${LDSHARED-"gcc -shared -Wl,-soname,libz.so.1"};;
  70. *) LDSHARED=${LDSHARED-"gcc -shared"};;
  71. esac
  72. else
  73. # find system name and corresponding cc options
  74. CC=${CC-cc}
  75. case `(uname -sr || echo unknown) 2>/dev/null` in
  76. HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
  77. CFLAGS=${CFLAGS-"-O"}
  78. # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
  79. LDSHARED=${LDSHARED-"ld -b"}
  80. shared_ext='.sl'
  81. SHAREDLIB='libz.sl';;
  82. IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
  83. CFLAGS=${CFLAGS-"-ansi -O2"}
  84. LDSHARED=${LDSHARED-"cc -shared"};;
  85. OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
  86. CFLAGS=${CFLAGS-"-O -std1"}
  87. LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,$SHAREDLIB -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};;
  88. OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
  89. CFLAGS=${CFLAGS-"-O -std1"}
  90. LDSHARED=${LDSHARED-"cc -shared"};;
  91. QNX*) SFLAGS=${CFLAGS-"-4 -O"}
  92. CFLAGS=${CFLAGS-"-4 -O"}
  93. LDSHARED=${LDSHARED-"cc"}
  94. RANLIB=${RANLIB-"true"}
  95. AR="cc -A";;
  96. SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
  97. CFLAGS=${CFLAGS-"-O3"}
  98. LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};;
  99. SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."}
  100. CFLAGS=${CFLAGS-"-fast -xcg89"}
  101. LDSHARED=${LDSHARED-"cc -G"};;
  102. SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
  103. CFLAGS=${CFLAGS-"-O2"}
  104. LDSHARED=${LDSHARED-"ld"};;
  105. UNIX_System_V\ 4.2.0)
  106. SFLAGS=${CFLAGS-"-KPIC -O"}
  107. CFLAGS=${CFLAGS-"-O"}
  108. LDSHARED=${LDSHARED-"cc -G"};;
  109. UNIX_SV\ 4.2MP)
  110. SFLAGS=${CFLAGS-"-Kconform_pic -O"}
  111. CFLAGS=${CFLAGS-"-O"}
  112. LDSHARED=${LDSHARED-"cc -G"};;
  113. # send working options for other systems to [email protected]
  114. *) SFLAGS=${CFLAGS-"-O"}
  115. CFLAGS=${CFLAGS-"-O"}
  116. LDSHARED=${LDSHARED-"cc -shared"};;
  117. esac
  118. fi
  119. if test $shared -eq 1; then
  120. echo Checking for shared library support...
  121. # we must test in two steps (cc then ld), required at least on SunOS 4.x
  122. if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
  123. test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
  124. CFLAGS="$SFLAGS"
  125. LIBS="$SHAREDLIB.$VER"
  126. echo Building shared library $SHAREDLIB.$VER with $CC.
  127. elif test -z "$old_cc" -a -z "$old_cflags"; then
  128. echo No shared library suppport.
  129. shared=0;
  130. else
  131. echo 'No shared library suppport; try without defining CC and CFLAGS'
  132. shared=0;
  133. fi
  134. fi
  135. if test $shared -eq 0; then
  136. LDSHARED="$CC"
  137. echo Building static library $LIBS version $VER with $CC.
  138. fi
  139. cat > $test.c <<EOF
  140. #include <unistd.h>
  141. int main() { return 0; }
  142. EOF
  143. if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
  144. CFLAGS="$CFLAGS -DHAVE_UNISTD_H"
  145. echo "Checking for unistd.h... Yes."
  146. else
  147. echo "Checking for unistd.h... No."
  148. fi
  149. cat > $test.c <<EOF
  150. #include <errno.h>
  151. int main() { return 0; }
  152. EOF
  153. if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
  154. echo "Checking for errno.h... Yes."
  155. else
  156. echo "Checking for errno.h... No."
  157. CFLAGS="$CFLAGS -DNO_ERRNO_H"
  158. fi
  159. cat > $test.c <<EOF
  160. #include <sys/types.h>
  161. #include <sys/mman.h>
  162. #include <sys/stat.h>
  163. caddr_t hello() {
  164. return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
  165. }
  166. EOF
  167. if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
  168. CFLAGS="$CFLAGS -DUSE_MMAP"
  169. echo Checking for mmap support... Yes.
  170. else
  171. echo Checking for mmap support... No.
  172. fi
  173. CPP=${CPP-"$CC -E"}
  174. case $CFLAGS in
  175. *ASMV*)
  176. if test "`nm $test.o | grep _hello`" = ""; then
  177. CPP="$CPP -DNO_UNDERLINE"
  178. echo Checking for underline in external names... No.
  179. else
  180. echo Checking for underline in external names... Yes.
  181. fi;;
  182. esac
  183. rm -f $test.[co] $test$shared_ext
  184. # udpate Makefile
  185. sed < Makefile.in "
  186. /^CC *=/s%=.*%=$CC%
  187. /^CFLAGS *=/s%=.*%=$CFLAGS%
  188. /^CPP *=/s%=.*%=$CPP%
  189. /^LDSHARED *=/s%=.*%=$LDSHARED%
  190. /^LIBS *=/s%=.*%=$LIBS%
  191. /^SHAREDLIB *=/s%=.*%=$SHAREDLIB%
  192. /^AR *=/s%=.*%=$AR%
  193. /^RANLIB *=/s%=.*%=$RANLIB%
  194. /^VER *=/s%=.*%=$VER%
  195. /^prefix *=/s%=.*%=$prefix%
  196. /^exec_prefix *=/s%=.*%=$exec_prefix%
  197. /^libdir *=/s%=.*%=$libdir%
  198. /^includedir *=/s%=.*%=$includedir%
  199. " > Makefile