Back to the Main Page.

ax_dirname

Download the M4 Source.

Synopsis

AX_DIRNAME(PATHNAME)

Version

    0.5.65   :   guidod

Author

Description

Parts of the implementation have been taken from AS_DIRNAME from the main autoconf package in generation 2.5x. However, we do only use "sed" to cut out the dirname, and we do additionally clean up some dir/.. parts in the resulting pattern.

this macro may be used in autoconf 2.13 scripts as well.

@$Id: ax_dirname.m4,v 1.1 2003/07/02 23:42:59 guidod Exp $

M4 Source Code

AC_DEFUN([AX_DIRNAME],
[echo X[]$1 |
    sed ['s/\/[^\/:][^\/:]*\/..\//\//g
          s/\/[^\/:][^\/:]*\/..\//\//g
          s/\/[^\/:][^\/:]*\/..\//\//g
          s/\/[^\/:][^\/:]*\/..\//\//g
          /^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
          /^X\(\/\/\)[^/].*/{ s//\1/; q; }
          /^X\(\/\/\)$/{ s//\1/; q; }
          /^X\(\/\).*/{ s//\1/; q; }
          s/.*/./; q']])