PageRenderTime 42ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/bzflag-2.4.0/src/other/curl/buildconf

#
Shell | 396 lines | 357 code | 5 blank | 34 comment | 6 complexity | 01c1d44352ba30cc39b654dd025f0867 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, LGPL-2.1, LGPL-2.0
  1. #!/bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  10. #
  11. # This software is licensed as described in the file COPYING, which
  12. # you should have received as part of this distribution. The terms
  13. # are also available at http://curl.haxx.se/docs/copyright.html.
  14. #
  15. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. # copies of the Software, and permit persons to whom the Software is
  17. # furnished to do so, under the terms of the COPYING file.
  18. #
  19. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  20. # KIND, either express or implied.
  21. #
  22. ###########################################################################
  23. die(){
  24. echo "$@"
  25. exit
  26. }
  27. #--------------------------------------------------------------------------
  28. # findtool works as 'which' but we use a different name to make it more
  29. # obvious we aren't using 'which'! ;-)
  30. #
  31. findtool(){
  32. file="$1"
  33. old_IFS=$IFS; IFS=':'
  34. for path in $PATH
  35. do
  36. IFS=$old_IFS
  37. # echo "checks for $file in $path" >&2
  38. if test -f "$path/$file"; then
  39. echo "$path/$file"
  40. return
  41. fi
  42. done
  43. IFS=$old_IFS
  44. }
  45. #--------------------------------------------------------------------------
  46. # removethis() removes all files and subdirectories with the given name,
  47. # inside and below the current subdirectory at invocation time.
  48. #
  49. removethis(){
  50. if test "$#" = "1"; then
  51. find . -depth -name $1 -print > buildconf.tmp.$$
  52. while read fdname
  53. do
  54. if test -f "$fdname"; then
  55. rm -f "$fdname"
  56. elif test -d "$fdname"; then
  57. rm -f -r "$fdname"
  58. fi
  59. done < buildconf.tmp.$$
  60. rm -f buildconf.tmp.$$
  61. fi
  62. }
  63. #--------------------------------------------------------------------------
  64. # Ensure that buildconf runs from the subdirectory where configure.ac lives
  65. #
  66. if test ! -f configure.ac ||
  67. test ! -f src/main.c ||
  68. test ! -f lib/urldata.h ||
  69. test ! -f include/curl/curl.h; then
  70. echo "Can not run buildconf from outside of curl's source subdirectory!"
  71. echo "Change to the subdirectory where buildconf is found, and try again."
  72. exit 1
  73. fi
  74. #--------------------------------------------------------------------------
  75. # autoconf 2.57 or newer
  76. #
  77. need_autoconf="2.57"
  78. ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
  79. if test -z "$ac_version"; then
  80. echo "buildconf: autoconf not found."
  81. echo " You need autoconf version $need_autoconf or newer installed."
  82. exit 1
  83. fi
  84. old_IFS=$IFS; IFS='.'; set $ac_version; IFS=$old_IFS
  85. if test "$1" = "2" -a "$2" -lt "57" || test "$1" -lt "2"; then
  86. echo "buildconf: autoconf version $ac_version found."
  87. echo " You need autoconf version $need_autoconf or newer installed."
  88. echo " If you have a sufficient autoconf installed, but it"
  89. echo " is not named 'autoconf', then try setting the"
  90. echo " AUTOCONF environment variable."
  91. exit 1
  92. fi
  93. echo "buildconf: autoconf version $ac_version (ok)"
  94. am4te_version=`${AUTOM4TE:-autom4te} --version 2>/dev/null|head -n 1| sed -e 's/autom4te\(.*\)/\1/' -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
  95. if test -z "$am4te_version"; then
  96. echo "buildconf: autom4te not found. Weird autoconf installation!"
  97. exit 1
  98. fi
  99. if test "$am4te_version" = "$ac_version"; then
  100. echo "buildconf: autom4te version $am4te_version (ok)"
  101. else
  102. echo "buildconf: autom4te version $am4te_version (ERROR: does not match autoconf version)"
  103. exit 1
  104. fi
  105. #--------------------------------------------------------------------------
  106. # autoheader 2.50 or newer
  107. #
  108. ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
  109. if test -z "$ah_version"; then
  110. echo "buildconf: autoheader not found."
  111. echo " You need autoheader version 2.50 or newer installed."
  112. exit 1
  113. fi
  114. old_IFS=$IFS; IFS='.'; set $ah_version; IFS=$old_IFS
  115. if test "$1" = "2" -a "$2" -lt "50" || test "$1" -lt "2"; then
  116. echo "buildconf: autoheader version $ah_version found."
  117. echo " You need autoheader version 2.50 or newer installed."
  118. echo " If you have a sufficient autoheader installed, but it"
  119. echo " is not named 'autoheader', then try setting the"
  120. echo " AUTOHEADER environment variable."
  121. exit 1
  122. fi
  123. echo "buildconf: autoheader version $ah_version (ok)"
  124. #--------------------------------------------------------------------------
  125. # automake 1.7 or newer
  126. #
  127. need_automake="1.7"
  128. am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'`
  129. if test -z "$am_version"; then
  130. echo "buildconf: automake not found."
  131. echo " You need automake version $need_automake or newer installed."
  132. exit 1
  133. fi
  134. old_IFS=$IFS; IFS='.'; set $am_version; IFS=$old_IFS
  135. if test "$1" = "1" -a "$2" -lt "7" || test "$1" -lt "1"; then
  136. echo "buildconf: automake version $am_version found."
  137. echo " You need automake version $need_automake or newer installed."
  138. echo " If you have a sufficient automake installed, but it"
  139. echo " is not named 'automake', then try setting the"
  140. echo " AUTOMAKE environment variable."
  141. exit 1
  142. fi
  143. echo "buildconf: automake version $am_version (ok)"
  144. acloc_version=`${ACLOCAL:-aclocal} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'`
  145. if test -z "$acloc_version"; then
  146. echo "buildconf: aclocal not found. Weird automake installation!"
  147. exit 1
  148. fi
  149. if test "$acloc_version" = "$am_version"; then
  150. echo "buildconf: aclocal version $acloc_version (ok)"
  151. else
  152. echo "buildconf: aclocal version $acloc_version (ERROR: does not match automake version)"
  153. exit 1
  154. fi
  155. #--------------------------------------------------------------------------
  156. # libtool check
  157. #
  158. LIBTOOL_WANTED_MAJOR=1
  159. LIBTOOL_WANTED_MINOR=4
  160. LIBTOOL_WANTED_PATCH=2
  161. LIBTOOL_WANTED_VERSION=1.4.2
  162. # this approach that tries 'glibtool' first is some kind of work-around for
  163. # some BSD-systems I believe that use to provide the GNU libtool named
  164. # glibtool, with 'libtool' being something completely different.
  165. libtool=`findtool glibtool 2>/dev/null`
  166. if test ! -x "$libtool"; then
  167. libtool=`findtool ${LIBTOOL:-libtool}`
  168. fi
  169. if test -z "$LIBTOOLIZE"; then
  170. # set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
  171. # $libtool is already the full path
  172. libtoolize="${libtool}ize"
  173. else
  174. libtoolize=`findtool $LIBTOOLIZE`
  175. fi
  176. lt_pver=`$libtool --version 2>/dev/null|head -n 1`
  177. lt_qver=`echo $lt_pver|sed -e "s/([^)]*)//g" -e "s/^[^0-9]*//g"`
  178. lt_version=`echo $lt_qver|sed -e "s/[- ].*//" -e "s/\([a-z]*\)$//"`
  179. if test -z "$lt_version"; then
  180. echo "buildconf: libtool not found."
  181. echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
  182. exit 1
  183. fi
  184. old_IFS=$IFS; IFS='.'; set $lt_version; IFS=$old_IFS
  185. lt_major=$1
  186. lt_minor=$2
  187. lt_patch=$3
  188. lt_status="good"
  189. if test "$lt_major" = "$LIBTOOL_WANTED_MAJOR"; then
  190. if test "$lt_minor" -lt "$LIBTOOL_WANTED_MINOR"; then
  191. lt_status="bad"
  192. elif test -n "$LIBTOOL_WANTED_PATCH"; then
  193. if test "$lt_minor" -gt "$LIBTOOL_WANTED_MINOR"; then
  194. lt_status="good"
  195. elif test -n "$lt_patch"; then
  196. if test "$lt_patch" -lt "$LIBTOOL_WANTED_PATCH"; then
  197. lt_status="bad"
  198. fi
  199. else
  200. lt_status="bad"
  201. fi
  202. fi
  203. fi
  204. if test $lt_status != "good"; then
  205. echo "buildconf: libtool version $lt_version found."
  206. echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
  207. exit 1
  208. fi
  209. echo "buildconf: libtool version $lt_version (ok)"
  210. if test -f "$libtoolize"; then
  211. echo "buildconf: libtoolize found"
  212. else
  213. echo "buildconf: libtoolize not found. Weird libtool installation!"
  214. exit 1
  215. fi
  216. #--------------------------------------------------------------------------
  217. # m4 check
  218. #
  219. m4=`${M4:-m4} --version 2>/dev/null|head -n 1`;
  220. m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
  221. if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
  222. echo "buildconf: GNU m4 version $m4_version (ok)"
  223. else
  224. echo "buildconf: m4 version $m4 found. You need a GNU m4 installed!"
  225. exit 1
  226. fi
  227. #--------------------------------------------------------------------------
  228. # perl check
  229. #
  230. PERL=`findtool ${PERL:-perl}`
  231. #--------------------------------------------------------------------------
  232. # Remove files generated on previous buildconf/configure run.
  233. #
  234. for fname in .deps \
  235. .libs \
  236. *.la \
  237. *.lo \
  238. *.a \
  239. *.o \
  240. Makefile \
  241. Makefile.in \
  242. aclocal.m4 \
  243. aclocal.m4.bak \
  244. ares_build.h \
  245. ares_config.h \
  246. ares_config.h.in \
  247. autom4te.cache \
  248. compile \
  249. config.guess \
  250. curl_config.h \
  251. curl_config.h.in \
  252. config.log \
  253. config.lt \
  254. config.status \
  255. config.sub \
  256. configure \
  257. curl-config \
  258. curlbuild.h \
  259. depcomp \
  260. libcares.pc \
  261. libcurl.pc \
  262. libtool \
  263. libtool.m4 \
  264. ltmain.sh \
  265. ltoptions.m4 \
  266. ltsugar.m4 \
  267. ltversion.m4 \
  268. lt~obsolete.m4 \
  269. stamp-h1 \
  270. stamp-h2 \
  271. stamp-h3 ; do
  272. removethis "$fname"
  273. done
  274. #--------------------------------------------------------------------------
  275. # run the correct scripts now
  276. #
  277. echo "buildconf: running libtoolize"
  278. $libtoolize --copy --automake --force || die "The libtoolize command failed"
  279. if test ! -f m4/curl-functions.m4; then
  280. echo "buildconf: cURL m4 macros not found"
  281. exit 1
  282. fi
  283. echo "buildconf: running aclocal"
  284. ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS || die "The aclocal command line failed"
  285. if test -n "$PERL"; then
  286. echo "buildconf: running aclocal hack to convert all mv to mv -f"
  287. $PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
  288. else
  289. echo "buildconf: perl not found"
  290. exit 1
  291. fi
  292. echo "buildconf: running autoheader"
  293. ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
  294. echo "buildconf: cp lib/curl_config.h.in src/curl_config.h.in"
  295. cp lib/curl_config.h.in src/curl_config.h.in
  296. echo "buildconf: running autoconf"
  297. ${AUTOCONF:-autoconf} || die "The autoconf command failed"
  298. if test -d ares; then
  299. cd ares
  300. echo "buildconf: running in ares"
  301. ./buildconf
  302. cd ..
  303. fi
  304. echo "buildconf: running automake"
  305. ${AUTOMAKE:-automake} -a -c || die "The automake command failed"
  306. #--------------------------------------------------------------------------
  307. # Depending on the libtool and automake versions being used, config.guess
  308. # might not be installed in the subdirectory until automake has finished.
  309. # So we can not attempt to use it until this very last buildconf stage.
  310. #
  311. if test ! -f ./config.guess; then
  312. echo "buildconf: config.guess not found"
  313. else
  314. buildhost=`./config.guess 2>/dev/null|head -n 1`
  315. case $buildhost in
  316. *-*-hpux*)
  317. need_lt_major=1
  318. need_lt_minor=5
  319. need_lt_patch=24
  320. need_lt_check="yes"
  321. ;;
  322. esac
  323. if test ! -z "$need_lt_check"; then
  324. if test -z "$lt_major"; then
  325. lt_status="bad"
  326. elif test "$lt_major" -gt "$need_lt_major"; then
  327. lt_status="good"
  328. elif test "$lt_major" -lt "$need_lt_major"; then
  329. lt_status="bad"
  330. elif test -z "$lt_minor"; then
  331. lt_status="bad"
  332. elif test "$lt_minor" -gt "$need_lt_minor"; then
  333. lt_status="good"
  334. elif test "$lt_minor" -lt "$need_lt_minor"; then
  335. lt_status="bad"
  336. elif test -z "$lt_patch"; then
  337. lt_status="bad"
  338. elif test "$lt_patch" -gt "$need_lt_patch"; then
  339. lt_status="good"
  340. elif test "$lt_patch" -lt "$need_lt_patch"; then
  341. lt_status="bad"
  342. else
  343. lt_status="good"
  344. fi
  345. if test "$lt_status" != "good"; then
  346. need_lt_version="$need_lt_major.$need_lt_minor.$need_lt_patch"
  347. echo "buildconf: libtool version $lt_version found."
  348. echo " $buildhost requires libtool $need_lt_version or newer installed."
  349. rm -f configure
  350. exit 1
  351. fi
  352. fi
  353. fi
  354. #--------------------------------------------------------------------------
  355. # Finished succesfully.
  356. #
  357. echo "buildconf: OK"
  358. exit 0