1
dnl @synopsis AX_PAX_TAR
3
dnl Most people will not know about the "tar"-wars a long while back.
4
dnl In the end the proponents of cpio lost just as all the oldish
5
dnl tar formats were dumped in favor of a new format that based on
6
dnl the successful "ustar" format. The extensions did mostly cover
7
dnl a portable definition of filenames and such stuff.
9
dnl The most interesting thing however is that the opengroup (the.
10
dnl UNIX standardization body) did not document the tool for the
11
dnl portable tar format under the name of "tar" but instead it did
12
dnl use the name "pax" which stands for "portable archiver". Even
13
dnl more so, the "pax" utitility is required to understand the old
14
dnl tar and cpio formats but it will default to a "tar"-like variant.
15
dnl The "pax" tool has been in the Unix standard ever since UNIX92.
17
dnl Interestingly gnu-tar will use the pax features as soon as they
18
dnl are required - but you can not be sure if gnu-tar is available,
19
dnl and it is quite likely that the system tar will default to the
20
dnl old format of the system in whatever it was. On any currrent
21
dnl Unix system however one should be able to find "pax", so one
22
dnl should prefer that one as the most portable tool.
24
dnl The downside is however that the commandline options of "pax"
25
dnl are different from "tar"/"gtar". That's why we define two
26
dnl subst'ed names here - PAX_TAR_CREATE and PAX_TAR_EXTRACT, For
27
dnl extra portability the first argument should be "*.tar" file
28
dnl name but you should be aware that in most cases the "pax" tool
29
dnl is invoked. Nota bene: do not use "*.pax" as the file name
30
dnl extension because some file managers interpret it as a TeX file.
33
dnl @author Guido U. Draheim <guidod@gmx.de>
34
dnl @version 2009-05-22
35
dnl @license GPLWithACException
37
AC_DEFUN([_AX_PAX_TAR_TOOL],[
38
if test -z "$ac_cv_pax_tar_tool"; then
39
AC_PATH_PROG([PAX],[pax], :)
40
if test "$ac_cv_path_PAX" != ":"; then
41
ac_cv_pax_tar_tool="pax"
43
AC_PATH_PROG([GNUTAR],[gnutar], :)
44
if test "$ac_cv_path_GNUTAR" != ":"; then
45
ac_cv_pax_tar_tool="gnutar"
47
AC_PATH_PROG([GTAR],[gtar], :)
48
if test "$ac_cv_path_GTAR" != ":"; then
49
ac_cv_pax_tar_tool="gtar"
51
AC_PATH_PROG([TAR],[tar], :)
52
if test "$ac_cv_path_TAR" != ":"; then
53
ac_cv_pax_tar_tool="tar"
56
AC_MSG_CHECKING([for portable tar tool])
57
AC_MSG_RESULT([$ac_cv_pax_tar_tool])
61
AC_DEFUN([_AX_PAX_TAR_CREATE],[
63
AC_MSG_CHECKING([for invokation create portable tar archives])
64
if test "$ac_cv_pax_tar_tool" = "gnutar"; then
65
ax_pax_tar_create="'$ac_cv_path_GNUTAR' cf"
66
elif test "$ac_cv_pax_tar_tool" = "gtar"; then
67
ax_pax_tar_create="'$ac_cv_path_GTAR' cf"
68
elif test "$ac_cv_pax_tar_tool" = "pax"; then
69
ax_pax_tar_create="'$ac_cv_path_PAX' -w -f"
70
dnl BSD PAX has the nuisiance to prompt for a new archive on errors
71
if "$ac_cv_path_PAX" --help 2>&1 | grep "pax.*-[[a-zA-Z]]*O" ; then
72
ax_pax_tar_extract="'$ac_cv_path_PAX' -w -O -f"
74
elif test "$ac_cv_pax_tar_tool" = "tar"; then
75
ax_pax_tar_create="'$ac_cv_path_TAR' cf"
77
ax_pax_tar_create=": 'unknown pax tar tool $ac_cv_pax_tar_tool'"
79
AC_MSG_RESULT([$ax_pax_tar_create])
82
AC_DEFUN([_AX_PAX_TAR_EXTRACT],[
84
AC_MSG_CHECKING([for invokation extract portable tar archives])
85
if test "$ac_cv_pax_tar_tool" = "gnutar"; then
86
ax_pax_tar_extract="'$ac_cv_path_GNUTAR' xf"
87
elif test "$ac_cv_pax_tar_tool" = "gtar"; then
88
ax_pax_tar_extract="'$ac_cv_path_GTAR' xf"
89
elif test "$ac_cv_pax_tar_tool" = "pax"; then
90
ax_pax_tar_extract="'$ac_cv_path_PAX' -r -f"
91
dnl BSD PAX has the nuisiance to prompt for a new archive on errors
92
if "$ac_cv_path_PAX" --help 2>&1 | grep "pax.*-[[a-zA-Z]]*O" ; then
93
ax_pax_tar_extract="'$ac_cv_path_PAX' -r -O -f"
95
elif test "$ac_cv_pax_tar_tool" = "tar"; then
96
ax_pax_tar_extract="'$ac_cv_path_TAR' xf"
98
ax_pax_tar_extract=": 'unknown pax tar tool $ac_cv_pax_tar_tool'"
100
AC_MSG_RESULT([$ax_pax_tar_extract])
103
AC_DEFUN([AX_PAX_TAR_CREATE],[dnl
106
$1="$ax_pax_tar_create"
109
PAX_TAR_CREATE="$ax_pax_tar_create"
110
AC_SUBST([PAX_TAR_CREATE])
114
AC_DEFUN([AX_PAX_TAR_EXTRACT],[dnl
117
$1="$ax_pax_tar_extract"
120
PAX_TAR_EXTRACT="$ax_pax_tar_extract"
121
AC_SUBST([PAX_TAR_EXTRACT])