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.
 
 
 

226 lines
6.6 KiB

  1. dnl Copyright (c) 2009 - 2019 Thomas Schmitt
  2. dnl Provided under the terms of the GNU General Public License version 2 or later.
  3. AC_DEFUN([LIBBURNIA_SET_FLAGS],
  4. [
  5. case $target_os in
  6. freebsd* | netbsd*)
  7. LDFLAGS="$LDFLAGS -L/usr/local/lib"
  8. CPPFLAGS="$CPPFLAGS -I/usr/local/include"
  9. ;;
  10. esac
  11. ])
  12. AC_DEFUN([TARGET_SHIZZLE],
  13. [
  14. ARCH=""
  15. LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig
  16. AC_MSG_CHECKING([target operating system])
  17. LIBBURNIA_SUPP_ACL=none
  18. LIBBURNIA_SUPP_FATTR=none
  19. LIBBURNIA_LDCONFIG_CMD="echo 'No ldconfig run performed. If needed, configure manually for:'"
  20. case $target in
  21. *-*-linux*)
  22. ARCH=linux
  23. LIBBURN_ARCH_LIBS=
  24. LIBBURNIA_SUPP_ACL=libacl
  25. LIBBURNIA_SUPP_FATTR=xattr
  26. LIBBURNIA_LDCONFIG_CMD=ldconfig
  27. ;;
  28. *-*-freebsd*)
  29. ARCH=freebsd
  30. LIBBURNIA_SUPP_ACL=libacl
  31. LIBBURNIA_SUPP_FATTR=extattr
  32. LIBBURN_ARCH_LIBS=-lcam
  33. # This may later be overridden by configure --enable-libdir-pkgconfig
  34. LIBBURNIA_PKGCONFDIR=$(echo "$libdir" | sed 's/\/lib$/\/libdata/')/pkgconfig
  35. ;;
  36. *)
  37. ARCH=
  38. LIBBURN_ARCH_LIBS=
  39. # AC_ERROR([You are attempting to compile for an unsupported platform])
  40. ;;
  41. esac
  42. AC_MSG_RESULT([$ARCH])
  43. ])
  44. dnl LIBBURNIA_CHECK_ICONV is by Thomas Schmitt, libburnia project
  45. dnl It is based on gestures from:
  46. dnl iconv.m4 serial AM7 (gettext-0.18)
  47. dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc.
  48. dnl This file is free software; the Free Software Foundation
  49. dnl gives unlimited permission to copy and/or distribute it,
  50. dnl with or without modifications, as long as this notice is preserved.
  51. dnl From Bruno Haible.
  52. dnl
  53. AC_DEFUN([LIBBURNIA_CHECK_ICONV],
  54. [
  55. dnl Check whether it is allowed to link with -liconv
  56. AC_MSG_CHECKING([for iconv() in separate -liconv ])
  57. libburnia_liconv="no"
  58. libburnia_save_LIBS="$LIBS"
  59. LIBS="$LIBS -liconv"
  60. AC_TRY_LINK([#include <stdlib.h>
  61. #include <iconv.h>],
  62. [iconv_t cd = iconv_open("","");
  63. iconv(cd,NULL,NULL,NULL,NULL);
  64. iconv_close(cd);],
  65. [libburnia_liconv="yes"],
  66. [LIBS="$libburnia_save_LIBS"]
  67. )
  68. AC_MSG_RESULT([$libburnia_liconv])
  69. if test x"$libburnia_save_LIBS" = x"$LIBS"
  70. then
  71. dnl GNU iconv has no function iconv() but libiconv() and a macro iconv()
  72. dnl It is not tested whether this is detected by above macro.
  73. AC_CHECK_LIB(iconv, libiconv, , )
  74. fi
  75. dnl Check for iconv(..., const char **inbuf, ...)
  76. AC_MSG_CHECKING([for const qualifier with iconv() ])
  77. AC_TRY_COMPILE([
  78. #include <stdlib.h>
  79. #include <iconv.h>
  80. size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
  81. ], [], [libburnia_iconv_const=""], [libburnia_iconv_const="const"]
  82. )
  83. AC_DEFINE_UNQUOTED([ICONV_CONST], [$libburnia_iconv_const])
  84. test -z "$libburnia_iconv_const" && libburnia_iconv_const="no"
  85. AC_MSG_RESULT([$libburnia_iconv_const])
  86. ])
  87. dnl LIBBURNIA_ASSERT_ICONV is by Thomas Schmitt, libburnia project
  88. dnl
  89. AC_DEFUN([LIBBURNIA_ASSERT_ICONV],
  90. [
  91. if test x$LIBISOFS_ASSUME_ICONV = x
  92. then
  93. dnl Check for the essential gestures of libisofs/util.c
  94. AC_MSG_CHECKING([for iconv() to be accessible now ])
  95. AC_TRY_LINK([
  96. #include <stdlib.h>
  97. #include <wchar.h>
  98. #include <string.h>
  99. #include <errno.h>
  100. #include <ctype.h>
  101. #include <stdio.h>
  102. #include <limits.h>
  103. #include <iconv.h>
  104. #include <locale.h>
  105. #include <langinfo.h>
  106. #include <unistd.h>],
  107. [iconv_t cd = iconv_open("","");
  108. iconv(cd,NULL,NULL,NULL,NULL);
  109. iconv_close(cd);
  110. ], [iconv_test="yes"], [iconv_test="no"]
  111. )
  112. AC_MSG_RESULT([$iconv_test])
  113. if test x$iconv_test = xno
  114. then
  115. echo >&2
  116. echo "Cannot get function iconv() to work. Configuration aborted." >&2
  117. echo "Check whether your system needs a separate libiconv installed." >&2
  118. echo "If it is installed but not found, try something like" >&2
  119. echo ' export LDFLAGS="$LDFLAGS -L/usr/local/lib"' >&2
  120. echo ' export CPPFLAGS="$CPPFLAGS -I/usr/local/include"' >&2
  121. echo ' export LIBS="$LIBS -liconv"' >&2
  122. echo "You may override this test by exporting variable" >&2
  123. echo " LIBISOFS_ASSUME_ICONV=yes" >&2
  124. echo >&2
  125. (exit 1); exit 1;
  126. fi
  127. fi
  128. ])
  129. dnl LIBISOFS_ASSERT_VERS_LIBS is by Thomas Schmitt, libburnia project
  130. dnl It tests whether -Wl,--version-script=... works with the compiler
  131. AC_DEFUN([LIBISOFS_ASSERT_VERS_LIBS],
  132. [
  133. libburnia_save_LDFLAGS="$LDFLAGS"
  134. LDFLAGS="$LDFLAGS -Wl,--version-script=$srcdir/libisofs/libisofs.ver"
  135. AC_TRY_LINK([#include <stdio.h>], [printf("Hello\n");],
  136. [vers_libs_test="yes"], [vers_libs_test="no"])
  137. if test x$vers_libs_test = xyes
  138. then
  139. LIBLDFLAGS="-Wl,--version-script=$srcdir/libisofs/libisofs.ver"
  140. fi
  141. LDFLAGS="$libburnia_save_LDFLAGS"
  142. AC_SUBST(LIBLDFLAGS)
  143. ])
  144. dnl LIBBURNIA_SET_PKGCONFIG determines the install directory for the *.pc file.
  145. dnl Important: Must be performed _after_ TARGET_SHIZZLE
  146. dnl
  147. AC_DEFUN([LIBBURNIA_SET_PKGCONFIG],
  148. [
  149. ### for testing --enable-libdir-pkgconfig on Linux
  150. ### LIBBURNIA_PKGCONFDIR="$libdir"data/pkgconfig
  151. if test "x$LIBBURNIA_PKGCONFDIR" = "x$libdir"/pkgconfig
  152. then
  153. dummy=dummy
  154. else
  155. AC_ARG_ENABLE(libdir-pkgconfig,
  156. [ --enable-libdir-pkgconfig Install to $libdir/pkgconfig on any OS, default=no],
  157. , enable_libdir_pkgconfig="no")
  158. AC_MSG_CHECKING([for --enable-libdir-pkgconfig])
  159. if test "x$enable_libdir_pkgconfig" = xyes
  160. then
  161. LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig
  162. fi
  163. AC_MSG_RESULT([$enable_libdir_pkgconfig])
  164. fi
  165. libburnia_pkgconfig_override="no"
  166. AC_ARG_ENABLE(pkgconfig-path,
  167. [ --enable-pkgconfig-path=DIR Absolute path of directory for libisofs-*.pc],
  168. libburnia_pkgconfig_override="yes" , enable_pkgconfig_path="none")
  169. AC_MSG_CHECKING([for overridden pkgconfig directory path])
  170. if test "x$enable_pkgconfig_path" = xno
  171. then
  172. libburnia_pkgconfig_override="no"
  173. fi
  174. if test "x$enable_pkgconfig_path" = x -o "x$enable_pkgconfig_path" = xyes
  175. then
  176. libburnia_pkgconfig_override="invalid argument"
  177. fi
  178. if test "x$libburnia_pkgconfig_override" = xyes
  179. then
  180. LIBBURNIA_PKGCONFDIR="$enable_pkgconfig_path"
  181. AC_MSG_RESULT([$LIBBURNIA_PKGCONFDIR])
  182. else
  183. AC_MSG_RESULT([$libburnia_pkgconfig_override])
  184. fi
  185. AC_SUBST(LIBBURNIA_PKGCONFDIR)
  186. dnl For debugging only
  187. ### AC_MSG_RESULT([LIBBURNIA_PKGCONFDIR = $LIBBURNIA_PKGCONFDIR])
  188. ])
  189. dnl LIBBURNIA_TRY_TIMEZONE is by Thomas Schmitt, libburnia project
  190. dnl It tests whether the global variable exists and is suitable for
  191. dnl integer arithmetics.
  192. AC_DEFUN([LIBBURNIA_TRY_TIMEZONE],
  193. [
  194. echo -n "checking for timezone variable ... "
  195. AC_TRY_LINK([ #include <time.h> ], [long int i; i = 1 - timezone; ],
  196. [LIBBURNIA_TIMEZONE="timezone"], [LIBBURNIA_TIMEZONE="0"]
  197. )
  198. echo "$LIBBURNIA_TIMEZONE"
  199. ])