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.
 
 
 
 
 
 

405 lines
12 KiB

  1. dnl Copyright (C) 2008 - 2019 Thomas Schmitt <scdbackup@gmx.net>
  2. dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc.
  3. dnl Provided under GPL version 2 or later.
  4. AC_DEFUN([LIBBURNIA_SET_FLAGS],
  5. [
  6. case $target_os in
  7. freebsd*)
  8. LDFLAGS="$LDFLAGS -L/usr/local/lib"
  9. CPPFLAGS="$CPPFLAGS -I/usr/local/include"
  10. ;;
  11. netbsd*)
  12. LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/pkg/lib"
  13. CPPFLAGS="$CPPFLAGS -I/usr/local/include -I/usr/pkg/include"
  14. ;;
  15. solaris*)
  16. LDFLAGS="$LDFLAGS -L/usr/local/lib"
  17. esac
  18. ])
  19. AC_DEFUN([TARGET_SHIZZLE],
  20. [
  21. ARCH=""
  22. LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig
  23. AC_MSG_CHECKING([target operating system])
  24. LIBBURNIA_SUPP_ACL=none
  25. LIBBURNIA_SUPP_FATTR=none
  26. LIBBURNIA_LDCONFIG_CMD="echo 'No ldconfig run performed. If needed, configure manually for:'"
  27. case $target in
  28. *-*-linux*)
  29. ARCH=linux
  30. LIBBURN_ARCH_LIBS=
  31. LIBBURNIA_SUPP_ACL=libacl
  32. LIBBURNIA_SUPP_FATTR=xattr
  33. LIBBURNIA_LDCONFIG_CMD=ldconfig
  34. ;;
  35. *-*-freebsd*)
  36. ARCH=freebsd
  37. LIBBURN_ARCH_LIBS=-lcam
  38. LIBBURNIA_SUPP_ACL=libacl
  39. LIBBURNIA_SUPP_FATTR=extattr
  40. # This may later be overridden by configure --enable-libdir-pkgconfig
  41. LIBBURNIA_PKGCONFDIR=$(echo "$libdir" | sed 's/\/lib$/\/libdata/')/pkgconfig
  42. ;;
  43. *-kfreebsd*-gnu*)
  44. ARCH=freebsd
  45. LIBBURN_ARCH_LIBS=-lcam
  46. ;;
  47. *-solaris*)
  48. ARCH=solaris
  49. LIBBURN_ARCH_LIBS=-lvolmgt
  50. ;;
  51. *)
  52. ARCH=
  53. LIBBURN_ARCH_LIBS=
  54. # AC_ERROR([You are attempting to compile for an unsupported platform])
  55. ;;
  56. esac
  57. AC_MSG_RESULT([$ARCH])
  58. ])
  59. dnl LIBBURNIA_CHECK_ICONV is by Thomas Schmitt, libburnia project
  60. dnl It is based on gestures from:
  61. dnl iconv.m4 serial AM7 (gettext-0.18)
  62. dnl Copyright (C) 2000-2002, 2007-2009 Free Software Foundation, Inc.
  63. dnl This file is free software; the Free Software Foundation
  64. dnl gives unlimited permission to copy and/or distribute it,
  65. dnl with or without modifications, as long as this notice is preserved.
  66. dnl From Bruno Haible.
  67. dnl
  68. AC_DEFUN([LIBBURNIA_CHECK_ICONV],
  69. [
  70. dnl Check whether it is allowed to link with -liconv
  71. AC_MSG_CHECKING([for iconv() in separate -liconv ])
  72. libburnia_liconv="no"
  73. libburnia_save_LIBS="$LIBS"
  74. LIBS="$LIBS -liconv"
  75. AC_TRY_LINK([#include <stdlib.h>
  76. #include <iconv.h>],
  77. [iconv_t cd = iconv_open("","");
  78. iconv(cd,NULL,NULL,NULL,NULL);
  79. iconv_close(cd);],
  80. [libburnia_liconv="yes"],
  81. [LIBS="$libburnia_save_LIBS"]
  82. )
  83. AC_MSG_RESULT([$libburnia_liconv])
  84. if test x"$libburnia_save_LIBS" = x"$LIBS"
  85. then
  86. dnl GNU iconv has no function iconv() but libiconv() and a macro iconv()
  87. dnl It is not tested whether this is detected by above macro.
  88. AC_CHECK_LIB(iconv, libiconv, , )
  89. fi
  90. dnl Check for iconv(..., const char **inbuf, ...)
  91. AC_MSG_CHECKING([for const qualifier with iconv() ])
  92. AC_TRY_COMPILE([
  93. #include <stdlib.h>
  94. #include <iconv.h>
  95. size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
  96. ], [], [libburnia_iconv_const=""], [libburnia_iconv_const="const"]
  97. )
  98. if test x$libburnia_iconv_const = xconst
  99. then
  100. AC_DEFINE_UNQUOTED([ICONV_CONST], [const])
  101. else
  102. AC_DEFINE_UNQUOTED([ICONV_CONST], [])
  103. fi
  104. test -z "$libburnia_iconv_const" && libburnia_iconv_const="no"
  105. AC_MSG_RESULT([$libburnia_iconv_const])
  106. ])
  107. dnl LIBBURNIA_ASSERT_ICONV is by Thomas Schmitt, libburnia project
  108. dnl
  109. AC_DEFUN([LIBBURNIA_ASSERT_ICONV],
  110. [
  111. if test x$XORRISO_ASSUME_ICONV = x
  112. then
  113. dnl Check for the essential gestures of libisofs/util.c
  114. AC_MSG_CHECKING([for iconv() to be accessible now ])
  115. AC_TRY_LINK([
  116. #include <stdlib.h>
  117. #include <wchar.h>
  118. #include <string.h>
  119. #include <errno.h>
  120. #include <ctype.h>
  121. #include <stdio.h>
  122. #include <limits.h>
  123. #include <iconv.h>
  124. #include <locale.h>
  125. #include <langinfo.h>
  126. #include <unistd.h>],
  127. [iconv_t cd = iconv_open("","");
  128. iconv(cd,NULL,NULL,NULL,NULL);
  129. iconv_close(cd);
  130. ], [iconv_test="yes"], [iconv_test="no"]
  131. )
  132. AC_MSG_RESULT([$iconv_test])
  133. if test x$iconv_test = xno
  134. then
  135. echo >&2
  136. echo "Cannot get function iconv() to work. Configuration aborted." >&2
  137. echo "Check whether your system needs a separate libiconv installed." >&2
  138. echo "If it is installed but not found, try something like" >&2
  139. echo ' export LDFLAGS="$LDFLAGS -L/usr/local/lib"' >&2
  140. echo ' export CPPFLAGS="$CPPFLAGS -I/usr/local/include"' >&2
  141. echo ' export LIBS="$LIBS -liconv"' >&2
  142. echo "You may override this test by exporting variable" >&2
  143. echo " XORRISO_ASSUME_ICONV=yes" >&2
  144. echo >&2
  145. (exit 1); exit 1;
  146. fi
  147. fi
  148. ])
  149. dnl LIBBURNIA_TRY_EDITLINE is by Thomas Schmitt, libburnia project
  150. dnl It performs the actual test compilation for editline.
  151. dnl Variable LIBS has to be set by the caller.
  152. AC_DEFUN([LIBBURNIA_TRY_EDITLINE],
  153. [
  154. AC_TRY_LINK([
  155. #include <ctype.h>
  156. #include <sys/types.h>
  157. #include <unistd.h>
  158. #include <stdlib.h>
  159. #include <stdio.h>
  160. #include <string.h>
  161. #include <histedit.h>],
  162. [EditLine *editline_handle; History *editline_history; HistEvent ev; int count;
  163. editline_handle= el_init("dummy", stdin, stdout, stderr);
  164. el_set(editline_handle, EL_EDITOR, "emacs");
  165. editline_history= history_init();
  166. history(editline_history, &ev, H_SETSIZE, 1000);
  167. el_gets(editline_handle, &count);
  168. ], [editline_test="yes"], [editline_test="no"]
  169. )
  170. ])
  171. dnl LIBBURNIA_ASSERT_EDITLINE is by Thomas Schmitt, libburnia project
  172. dnl It disables xorriso editline if not all needed functions are present
  173. AC_DEFUN([LIBBURNIA_ASSERT_EDITLINE],
  174. [
  175. if test x$XORRISO_ASSUME_EDITLINE = x
  176. then
  177. dnl Check for the essential gestures of xorriso/text_io.c
  178. AC_MSG_CHECKING([for desired functions in libedit])
  179. libburnia_save_LIBS="$LIBS"
  180. LIBS="$LIBS -ledit"
  181. LIBBURNIA_TRY_EDITLINE
  182. if test x$editline_test = xno
  183. then
  184. LIBS="$libburnia_save_LIBS"
  185. LIBS="$LIBS -ledit"
  186. LIBBURNIA_TRY_EDITLINE
  187. fi
  188. if test x$editline_test = xno
  189. then
  190. READLINE_DEF=
  191. LIBS="$libburnia_save_LIBS"
  192. fi
  193. AC_MSG_RESULT([$editline_test $editline_msg])
  194. fi
  195. ])
  196. dnl LIBBURNIA_TRY_READLINE is by Thomas Schmitt, libburnia project
  197. dnl It performs the actual test compilation for readline.
  198. dnl Variable LIBS has to be set by the caller.
  199. AC_DEFUN([LIBBURNIA_TRY_READLINE],
  200. [
  201. AC_TRY_LINK([
  202. #include <ctype.h>
  203. #include <sys/types.h>
  204. #include <unistd.h>
  205. #include <stdlib.h>
  206. #include <stdio.h>
  207. #include <string.h>
  208. #include <readline/readline.h>
  209. #include <readline/history.h>],
  210. [HIST_ENTRY **hl;
  211. readline("");
  212. add_history("");
  213. hl= history_list();
  214. ], [readline_test="yes"], [readline_test="no"]
  215. )
  216. ])
  217. dnl LIBBURNIA_ASSERT_READLINE is by Thomas Schmitt, libburnia project
  218. dnl It disables xorriso readline if not all needed functions are present
  219. AC_DEFUN([LIBBURNIA_ASSERT_READLINE],
  220. [
  221. if test x$XORRISO_ASSUME_READLINE = x
  222. then
  223. dnl Check for the essential gestures of xorriso/text_io.c
  224. AC_MSG_CHECKING([for desired functions in libreadline])
  225. readline_msg=
  226. libburnia_save_LIBS="$LIBS"
  227. LIBS="$LIBS -lreadline"
  228. LIBBURNIA_TRY_READLINE
  229. if test x$readline_test = xno
  230. then
  231. LIBS="$libburnia_save_LIBS"
  232. LIBS="$LIBS -lreadline -lcurses"
  233. LIBBURNIA_TRY_READLINE
  234. if test x$readline_test = xyes
  235. then
  236. readline_msg=", with -lcurses"
  237. fi
  238. fi
  239. if test x$readline_test = xno
  240. then
  241. READLINE_DEF=
  242. LIBS="$libburnia_save_LIBS"
  243. fi
  244. AC_MSG_RESULT([$readline_test $readline_msg])
  245. fi
  246. ])
  247. dnl LIBISOBURN_ASSERT_VERS_LIBS is by Thomas Schmitt, libburnia project
  248. dnl It tests whether -Wl,--version-script=... works with the compiler
  249. AC_DEFUN([LIBISOBURN_ASSERT_VERS_LIBS],
  250. [
  251. libburnia_save_LDFLAGS="$LDFLAGS"
  252. LDFLAGS="$LDFLAGS -Wl,--version-script=$srcdir/libisoburn/libisoburn.ver"
  253. AC_TRY_LINK([#include <stdio.h>], [printf("Hello\n");],
  254. [vers_libs_test="yes"], [vers_libs_test="no"])
  255. if test x$vers_libs_test = xyes
  256. then
  257. LIBLDFLAGS="-Wl,--version-script=$srcdir/libisoburn/libisoburn.ver"
  258. fi
  259. LDFLAGS="$libburnia_save_LDFLAGS"
  260. AC_SUBST(LIBLDFLAGS)
  261. ])
  262. dnl LIBBURNIA_SET_PKGCONFIG is by Thomas Schmitt, libburnia project
  263. dnl It determines the install directory for the *.pc file.
  264. dnl Important: Must be performed _after_ TARGET_SHIZZLE
  265. dnl
  266. AC_DEFUN([LIBBURNIA_SET_PKGCONFIG],
  267. [
  268. ### for testing --enable-libdir-pkgconfig on Linux
  269. ### LIBBURNIA_PKGCONFDIR="$libdir"data/pkgconfig
  270. if test "x$LIBBURNIA_PKGCONFDIR" = "x$libdir"/pkgconfig
  271. then
  272. dummy=dummy
  273. else
  274. AC_ARG_ENABLE(libdir-pkgconfig,
  275. [ --enable-libdir-pkgconfig Install to $libdir/pkgconfig on any OS, default=no],
  276. , enable_libdir_pkgconfig="no")
  277. AC_MSG_CHECKING([for --enable-libdir-pkgconfig])
  278. if test "x$enable_libdir_pkgconfig" = xyes
  279. then
  280. LIBBURNIA_PKGCONFDIR="$libdir"/pkgconfig
  281. fi
  282. AC_MSG_RESULT([$enable_libdir_pkgconfig])
  283. fi
  284. libburnia_pkgconfig_override="no"
  285. AC_ARG_ENABLE(pkgconfig-path,
  286. [ --enable-pkgconfig-path=DIR Absolute path of directory for libisofs-*.pc],
  287. libburnia_pkgconfig_override="yes" , enable_pkgconfig_path="none")
  288. AC_MSG_CHECKING([for overridden pkgconfig directory path])
  289. if test "x$enable_pkgconfig_path" = xno
  290. then
  291. libburnia_pkgconfig_override="no"
  292. fi
  293. if test "x$enable_pkgconfig_path" = x -o "x$enable_pkgconfig_path" = xyes
  294. then
  295. libburnia_pkgconfig_override="invalid argument"
  296. fi
  297. if test "x$libburnia_pkgconfig_override" = xyes
  298. then
  299. LIBBURNIA_PKGCONFDIR="$enable_pkgconfig_path"
  300. AC_MSG_RESULT([$LIBBURNIA_PKGCONFDIR])
  301. else
  302. AC_MSG_RESULT([$libburnia_pkgconfig_override])
  303. fi
  304. AC_SUBST(LIBBURNIA_PKGCONFDIR)
  305. dnl For debugging only
  306. ### AC_MSG_RESULT([LIBBURNIA_PKGCONFDIR = $LIBBURNIA_PKGCONFDIR])
  307. ])
  308. dnl LIBBURNIA_TRY_TIMEZONE is by Thomas Schmitt, libburnia project
  309. dnl It tests whether the global variable exists and is suitable for
  310. dnl integer arithmetics.
  311. AC_DEFUN([LIBBURNIA_TRY_TIMEZONE],
  312. [
  313. echo -n "checking for timezone variable ... "
  314. AC_TRY_LINK([ #include <time.h> ], [long int i; i = 1 - timezone; ],
  315. [LIBBURNIA_TIMEZONE="timezone"], [LIBBURNIA_TIMEZONE="0"]
  316. )
  317. echo "$LIBBURNIA_TIMEZONE"
  318. ])
  319. dnl LIBBURNIA_CHECK_ARCH_LIBS is by Thomas Schmitt, libburnia project
  320. dnl It tests whether the OS dependent libraries are available.
  321. dnl With libisoburn they are needed only for the case that indirect linking
  322. dnl does not work. So it is worth a try to omit them.
  323. dnl $1 = "mandatory" or "optional" define the action if test linking fails.
  324. AC_DEFUN([LIBBURNIA_CHECK_ARCH_LIBS],
  325. [
  326. libburnia_save_LIBS="$LIBS"
  327. if test "x$LIBBURN_ARCH_LIBS" = x
  328. then
  329. dummy=dummy
  330. else
  331. LIBS="$LIBS $LIBBURN_ARCH_LIBS"
  332. AC_TRY_LINK([#include <stdio.h>], [printf("Hello\n");],
  333. [archlibs_test="yes"], [archlibs_test="no"])
  334. LIBS="$libburnia_save_LIBS"
  335. if test x$archlibs_test = xno
  336. then
  337. if test x"$1" = xmandatory
  338. then
  339. echo >&2
  340. echo "FATAL: Test linking with mandatory library options failed: $LIBBURN_ARCH_LIBS" >&2
  341. echo >&2
  342. (exit 1); exit 1;
  343. else
  344. echo "disabled linking with $LIBBURN_ARCH_LIBS (because not found)"
  345. LIBBURN_ARCH_LIBS=""
  346. fi
  347. else
  348. echo "enabled linking with $LIBBURN_ARCH_LIBS"
  349. fi
  350. fi
  351. ])
  352. dnl LIBBURNIA_CHECK_LINUX_SCSI is by Thomas Schmitt, libburnia project
  353. dnl
  354. AC_DEFUN([LIBBURNIA_CHECK_LINUX_SCSI],
  355. [
  356. dnl Check whether it is a Linux without scsi/scsi.h
  357. AH_TEMPLATE([Libburn_use_sg_dummY],
  358. [Define to compile without OS specific SCSI features])
  359. AC_MSG_CHECKING([for missing scsi/scsi.h on Linux])
  360. AC_TRY_COMPILE([
  361. #ifdef __linux
  362. #include <scsi/scsi.h>
  363. #endif
  364. ],
  365. [;],
  366. [AC_MSG_RESULT([no])],
  367. [AC_DEFINE([Libburn_use_sg_dummY], [yes])
  368. AC_MSG_RESULT([yes])]
  369. )
  370. ])