Bibletime – a bible study tool
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.

194 lines
5.5KB

  1. ## -*- autoconf -*-
  2. dnl -------------------------------------------------------------------------------
  3. dnl Check wheter to use static linking, first parameter is the result (YES/NO)
  4. dnl -------------------------------------------------------------------------------
  5. AC_DEFUN(AC_CHECK_STATIC_LINKING,
  6. [
  7. $1="NO"
  8. AC_MSG_CHECKING(whether to use static linking)
  9. AC_ARG_ENABLE(static-linking,
  10. [ --enable-static-linking use static linking],
  11. USE_STATIC_LINKING=$enableval, USE_STATIC_LINKING="no")
  12. if test "$USE_STATIC_LINKING" = "yes"; then
  13. BT_LDFLAGS="-all-static -Wl,-Bstatic";
  14. AC_SUBST(BT_LDFLAGS)
  15. CPPFLAGS="-DSTATIC_BUILD $CPPFLAGS";
  16. $1="YES";
  17. else
  18. $1="NO";
  19. fi
  20. AC_MSG_RESULT($USE_STATIC_LINKING)
  21. ])
  22. dnl -------------------------------------------------------------------------------
  23. dnl Checks the type of the distribution
  24. dnl Possible names for the distributions are SuSE, RedHat, Mandrake
  25. dnl -------------------------------------------------------------------------------
  26. AC_DEFUN(AC_CHECK_DISTRIBUTION,
  27. [
  28. AC_MSG_CHECKING([for the used Linux distribution])
  29. AC_ARG_WITH(distribution,
  30. [ --with-distribution=TYPE The name of your *NIX distribution, e.g. SuSE [auto] ],
  31. [
  32. ac_distribution=$withval
  33. ],ac_distribution=auto
  34. )
  35. AC_ARG_WITH(distribution-version,
  36. [ --with-distribution-version=VERSION Version of your *NIX distribution, e.g. 7.2 [auto] ],
  37. [
  38. ac_distribution_version=$withval
  39. ],ac_distribution_version=auto
  40. )
  41. AC_ARG_WITH(rpm-prefix,
  42. [ --with-rpm-prefix=DIR The directory which should be used as PREFIX
  43. in the RPM spec file [auto] ],
  44. [
  45. ac_rpm_prefix=$withval
  46. ],ac_rpm_prefix=auto
  47. )
  48. AC_ARG_WITH(rpm-group,
  49. [ --with-rpm-group=DIR The group which will be used for the RPM system [auto] ],
  50. [
  51. ac_rpm_group=$withval
  52. ],ac_rpm_group=auto
  53. )
  54. if test "$ac_distribution" != "auto"; then
  55. DISTRIBUTION=[$ac_distribution]
  56. fi
  57. if test "$ac_distribution" = "auto"; then
  58. AC_CACHE_VAL(DISTRIBUTION, [
  59. if test -f "/etc/SuSE-release"; then
  60. DISTRIBUTION="SuSE"
  61. elif test -f "/etc/mandrake-release"; then
  62. DISTRIBUTION="Mandrake"
  63. elif test -f "/etc/redhat-release"; then
  64. DISTRIBUTION="Red Hat"
  65. elif test -f "/etc/debian_version"; then
  66. DISTRIBUTION="Debian"
  67. fi
  68. ])
  69. fi
  70. if test "$ac_distribution_version" != "auto"; then
  71. DISTRIBUTION_VERSION=[$ac_distribution_version]
  72. fi
  73. if test "$ac_distribution_version" = "auto"; then
  74. AC_CACHE_VAL(DISTRIBUTION_VERSION, [
  75. if test -f "/etc/SuSE-release" && test "$DISTRIBUTION" = "SuSE"; then
  76. DISTRIBUTION_VERSION=[`grep "VERSION =" /etc/SuSE-release | sed 's/VERSION = //'`];
  77. elif test -f "/etc/mandrake-release" && test "$DISTRIBUTION" = "Mandrake"; then
  78. DISTRIBUTION_VERSION=[`grep "Mandrake" /etc/mandrake-release | sed 's/[a-zA-Z()]*//g' | awk '{print $1}'`]
  79. elif test -f "/etc/redhat-release" && test "$DISTRIBUTION" = "Red Hat"; then
  80. DISTRIBUTION_VERSION=[`grep "Red Hat" /etc/redhat-release | sed 's/[a-zA-Z()]*//g' | awk '{print $1}'`]
  81. elif test -f "/etc/debian_version" && test "$DISTRIBUTION" = "Debian"; then
  82. DISTRIBUTION_VERSION=[`cat /etc/debian_version`]
  83. fi
  84. ])
  85. fi
  86. if test "$ac_rpm_prefix" != "auto"; then
  87. RPM_PREFIX=[$ac_rpm_prefix]
  88. fi
  89. if test "$ac_rpm_prefix" = "auto"; then
  90. AC_CACHE_VAL(RPM_PREFIX, [
  91. if test "$DISTRIBUTION" = "SuSE"; then
  92. RPM_PREFIX="/opt/trinity"
  93. elif test "$DISTRIBUTION" = "Mandrake"; then
  94. RPM_PREFIX="/usr"
  95. elif test "$DISTRIBUTION" = "Red Hat"; then
  96. RPM_PREFIX="/usr"
  97. elif test "$DISTRIBUTION" = "Debian"; then
  98. RPM_PREFIX="/usr"
  99. fi
  100. ])
  101. fi
  102. if test "$ac_rpm_group" != "auto"; then
  103. RPM_GROUP=[$ac_rpm_group]
  104. fi
  105. if test "$ac_rpm_prefix" = "auto"; then
  106. AC_CACHE_VAL(RPM_GROUP,
  107. [
  108. if test "$DISTRIBUTION" = "SuSE"; then
  109. RPM_GROUP="X11/KDE/Applications"
  110. elif test "$DISTRIBUTION" = "Mandrake"; then
  111. RPM_GROUP="Graphical desktop/KDE"
  112. elif test "$DISTRIBUTION" = "Red Hat"; then
  113. RPM_GROUP="Graphical desktop/KDE"
  114. elif test "$DISTRIBUTION" = "Debian"; then
  115. RPM_GROUP="Graphical desktop/KDE"
  116. fi
  117. ])
  118. fi
  119. if test -n "$DISTRIBUTION" && test "$DISTRIBUTION" != "unknown"; then
  120. AC_DEFINE_UNQUOTED(DISTRIBUTION, ${DISTRIBUTION}, [The type of your distribution])
  121. fi
  122. if test -n "$DISTRIBUTION_VERSION" && test "$DISTRIBUTION_VERSION" != "unknown"; then
  123. AC_DEFINE_UNQUOTED(DISTRIBUTION_VERSION, ${DISTRIBUTION_VERSION}, [The version of your distribution])
  124. fi
  125. AC_SUBST(DISTRIBUTION)
  126. AC_SUBST(DISTRIBUTION_VERSION)
  127. AC_SUBST(RPM_PREFIX)
  128. AC_SUBST(RPM_GROUP)
  129. AC_MSG_RESULT([$DISTRIBUTION $DISTRIBUTION_VERSION])
  130. AC_MSG_CHECKING([for RPM installation prefix])
  131. AC_MSG_RESULT([$RPM_PREFIX])
  132. AC_MSG_CHECKING([for the correct RPM group])
  133. AC_MSG_RESULT([$RPM_GROUP])
  134. ])
  135. dnl MY_CURL
  136. dnl -------
  137. dnl set my_cv_curl_vers to the version of libcurl or NONE
  138. dnl if libcurl is not found or is too old
  139. dnl This function comes from cURL's webpage
  140. AC_DEFUN(AC_CHECK_CURL,[
  141. AC_CACHE_VAL(my_cv_curl_vers,[
  142. my_cv_curl_vers=NONE
  143. dnl check is the plain-text version of the required version
  144. check="7.9"
  145. dnl check_hex must be UPPERCASE if any hex letters are present
  146. check_hex="070900"
  147. AC_MSG_CHECKING([for curl >= $check])
  148. if eval curl-config --version 2>/dev/null >/dev/null; then
  149. ver=`curl-config --version | sed -e "s/libcurl //g"`
  150. hex_ver=`curl-config --vernum | tr 'a-f' 'A-F'`
  151. ok=`echo "ibase=16; if($hex_ver>=$check_hex) $hex_ver else 0" | bc`
  152. if test x$ok != x0; then
  153. my_cv_curl_vers="$ver"
  154. AC_MSG_RESULT([$my_cv_curl_vers])
  155. else
  156. AC_MSG_RESULT(FAILED)
  157. AC_MSG_ERROR([$ver is too old. Please install libcurl version $check or higher.]);
  158. fi
  159. else
  160. AC_MSG_RESULT(FAILED)
  161. AC_MSG_ERROR([curl-config was not found. Please install libcurl version $check or higher.])
  162. fi
  163. ])
  164. ])