1 dnl Copyright © 2021 Nick Bowler
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
7 dnl DX_BASENAME(variable, string)
9 dnl If string, which must be a single shell word, contains a / character,
10 dnl variable is assigned to the portion of string that follows the last
11 dnl such character. Otherwise, variable is set to string.
12 AC_DEFUN([DX_BASENAME],
13 [AC_REQUIRE([_DX_BASENAME_SETUP])dnl
14 dx_fn_basename $1 $2])
16 AC_DEFUN_ONCE([_DX_BASENAME_SETUP], [m4_divert_push([INIT_PREPARE])dnl
18 _dx_tmp=; { _dx_tmp=${2##*/}; } 2>/dev/null
19 AS_CASE([$_dx_tmp], [""], [_dx_save_IFS=$IFS; IFS=/
20 for _dx_tmp in $][2; do :; done
22 AS_VAR_SET([$][1], [$_dx_tmp])