buildconf 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/sh
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. #
  18. # buildconf: Build the support scripts needed to compile from a
  19. # checked-out version of the source code.
  20. # Verify that the builder has the right config tools installed
  21. #
  22. build/buildcheck.sh || exit 1
  23. libtoolize=`build/PrintPath glibtoolize libtoolize15 libtoolize14 libtoolize`
  24. if [ "x$libtoolize" = "x" ]; then
  25. echo "libtoolize not found in path"
  26. exit 1
  27. fi
  28. # Create the libtool helper files
  29. #
  30. # Note: we copy (rather than link) them to simplify distribution.
  31. # Note: APR supplies its own config.guess and config.sub -- we do not
  32. # rely on libtool's versions
  33. #
  34. echo "Copying libtool helper files ..."
  35. # Remove any libtool files so one can switch between libtool 1.3
  36. # and libtool 1.4 by simply rerunning the buildconf script.
  37. (cd build ; rm -f ltconfig ltmain.sh libtool.m4)
  38. $libtoolize --copy --automake
  39. if [ -f libtool.m4 ]; then
  40. ltfile=`pwd`/libtool.m4
  41. else
  42. ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
  43. < $libtoolize`"
  44. ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
  45. # Expecting the code above to be very portable, but just in case...
  46. if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
  47. ltpath=`dirname $libtoolize`
  48. ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
  49. fi
  50. fi
  51. if [ ! -f $ltfile ]; then
  52. echo "$ltfile not found"
  53. exit 1
  54. fi
  55. echo "buildconf: Using libtool.m4 at ${ltfile}."
  56. cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' > build/libtool.m4
  57. # libtool.m4 from 1.6 requires ltsugar.m4
  58. if [ -f ltsugar.m4 ]; then
  59. rm -f build/ltsugar.m4
  60. mv ltsugar.m4 build/ltsugar.m4
  61. fi
  62. # Clean up any leftovers
  63. rm -f aclocal.m4 libtool.m4
  64. #
  65. # Generate the autoconf header and ./configure
  66. #
  67. echo "Creating include/arch/unix/apr_private.h.in ..."
  68. ${AUTOHEADER:-autoheader}
  69. echo "Creating configure ..."
  70. ### do some work to toss config.cache?
  71. ${AUTOCONF:-autoconf}
  72. # Remove autoconf 2.5x's cache directory
  73. rm -rf autom4te*.cache
  74. echo "Generating 'make' outputs ..."
  75. build/gen-build.py make
  76. # Create RPM Spec file
  77. if [ -f `which cut` ]; then
  78. echo rebuilding rpm spec file
  79. ( REVISION=`build/get-version.sh all include/apr_version.h APR`
  80. VERSION=`echo $REVISION | cut -d- -s -f1`
  81. RELEASE=`echo $REVISION | cut -d- -s -f2`
  82. if [ "x$VERSION" = "x" ]; then
  83. VERSION=$REVISION
  84. RELEASE=1
  85. fi
  86. cat ./build/rpm/apr.spec.in | \
  87. sed -e "s/APR_VERSION/$VERSION/" \
  88. -e "s/APR_RELEASE/$RELEASE/" \
  89. > apr.spec )
  90. fi
  91. exit 0