autogen.sh 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. #! /bin/sh
  2. #
  3. # autogen.sh
  4. #
  5. # Bootstrap the iODBC project so we do not need to maintain the
  6. # files generated by autoconf, automake and libtool
  7. #
  8. # The iODBC driver manager.
  9. #
  10. # Copyright (C) 1996-2021 OpenLink Software <[email protected]>
  11. # All Rights Reserved.
  12. #
  13. # This software is released under the terms of either of the following
  14. # licenses:
  15. #
  16. # - GNU Library General Public License (see LICENSE.LGPL)
  17. # - The BSD License (see LICENSE.BSD).
  18. #
  19. # Note that the only valid version of the LGPL license as far as this
  20. # project is concerned is the original GNU Library General Public License
  21. # Version 2, dated June 1991.
  22. #
  23. # While not mandated by the BSD license, any patches you make to the
  24. # iODBC source code may be contributed back into the iODBC project
  25. # at your discretion. Contributions will benefit the Open Source and
  26. # Data Access community as a whole. Submissions may be made at:
  27. #
  28. # http://www.iodbc.org
  29. #
  30. #
  31. # GNU Library Generic Public License Version 2
  32. # ============================================
  33. # This library is free software; you can redistribute it and/or
  34. # modify it under the terms of the GNU Library General Public
  35. # License as published by the Free Software Foundation; only
  36. # Version 2 of the License dated June 1991.
  37. #
  38. # This library is distributed in the hope that it will be useful,
  39. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  40. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  41. # Library General Public License for more details.
  42. #
  43. # You should have received a copy of the GNU Library General Public
  44. # License along with this library; if not, write to the Free
  45. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  46. #
  47. #
  48. # The BSD License
  49. # ===============
  50. # Redistribution and use in source and binary forms, with or without
  51. # modification, are permitted provided that the following conditions
  52. # are met:
  53. #
  54. # 1. Redistributions of source code must retain the above copyright
  55. # notice, this list of conditions and the following disclaimer.
  56. # 2. Redistributions in binary form must reproduce the above copyright
  57. # notice, this list of conditions and the following disclaimer in
  58. # the documentation and/or other materials provided with the
  59. # distribution.
  60. # 3. Neither the name of OpenLink Software Inc. nor the names of its
  61. # contributors may be used to endorse or promote products derived
  62. # from this software without specific prior written permission.
  63. #
  64. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  65. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  66. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  67. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
  68. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  69. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  70. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  71. # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  72. # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  73. # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  74. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  75. #
  76. # ----------------------------------------------------------------------
  77. # Globals
  78. # ----------------------------------------------------------------------
  79. DIE=0
  80. ELINES=3
  81. # ----------------------------------------------------------------------
  82. # Color settings
  83. # ----------------------------------------------------------------------
  84. B=`tput bold 2>/dev/null`
  85. N=`tput sgr0 2>/dev/null`
  86. ERROR="${B}** ERROR **${N}"
  87. WARNING="${B}* WARNING *${N}"
  88. # ----------------------------------------------------------------------
  89. # Functions
  90. # ----------------------------------------------------------------------
  91. CHECK() {
  92. for PROG in $*
  93. do
  94. VERSION=`$PROG --version 2>/dev/null | head -1 | sed -e "s/$PROG //"`
  95. if test \! -z "$VERSION"
  96. then
  97. echo "Using $PROG $VERSION"
  98. USE_PROG=$PROG
  99. break
  100. fi
  101. done
  102. if test -z "$VERSION"
  103. then
  104. echo
  105. echo "${ERROR} : You must have \`${B}${PROG}${N}' installed on your system."
  106. echo
  107. DIE=1
  108. fi
  109. }
  110. CHECK_WARN() {
  111. for PROG in $*
  112. do
  113. VERSION=`$PROG --version 2>/dev/null | head -1 | sed -e "s/$PROG //"`
  114. if test \! -z "$VERSION"
  115. then
  116. echo "Using $PROG $VERSION"
  117. USE_PROG=$PROG
  118. break
  119. fi
  120. done
  121. if test -z "$VERSION"
  122. then
  123. echo
  124. echo "${WARNING} : You may need \`${B}${PROG}${N}' installed on your system."
  125. echo
  126. fi
  127. }
  128. RUN() {
  129. PROG=$1; shift
  130. ARGS=$*
  131. echo "Running ${B}${PROG}${N} ..."
  132. $PROG $ARGS 2>> autogen.log
  133. if test $? -ne 0
  134. then
  135. echo
  136. echo "${ERROR}"
  137. tail -$ELINES autogen.log
  138. echo
  139. echo "autogen.sh script aborting (see autogen.log for details) ..."
  140. exit 1
  141. fi
  142. }
  143. #
  144. # Check availability of build tools
  145. #
  146. echo
  147. echo "${B}Checking build environment${N} ..."
  148. CHECK libtoolize glibtoolize; LIBTOOLIZE=$USE_PROG
  149. CHECK aclocal
  150. CHECK autoheader
  151. CHECK automake
  152. CHECK autoconf
  153. CHECK_WARN gtk-config
  154. if test "$DIE" -eq 1
  155. then
  156. echo
  157. echo "Please read the ${B}README_GIT${N} file for a list of packages you need"
  158. echo "to install on your system before bootstrapping this project."
  159. echo
  160. echo "autogen.sh script aborting ..."
  161. exit 1
  162. fi
  163. #
  164. # Generate the build scripts
  165. #
  166. > autogen.log
  167. echo
  168. echo "${B}Generating build scripts${N} ..."
  169. touch ChangeLog
  170. RUN $LIBTOOLIZE --force --copy
  171. RUN aclocal -I admin #--warnings=all
  172. RUN autoheader --warnings=all
  173. RUN automake --copy --add-missing --warnings=all
  174. RUN autoconf --warnings=all,no-obsolete
  175. echo
  176. echo "Please check the ${B}INSTALL${N} and ${B}README${N} files for instructions to"
  177. echo "configure, build and install iODBC on your system."
  178. echo
  179. echo "Certain build targets are only enabled in maintainer mode:"
  180. echo
  181. echo " ./configure --enable-maintainer-mode ..."
  182. echo
  183. echo "autogen.sh script completed successfully."
  184. exit 0