# getopts-m4sh.at -- test getopts.m4sh option parsers -*- Autotest -*- # # Copyright (C) 2010-2012 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2010 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #### AT_BANNER([Shell option parser generator.]) # _LT_AT_GETOPT_M4SH_SETUP # ------------------------ m4_define([_LT_AT_GETOPT_M4SH_SETUP], [m4_pattern_allow([AS_INIT]) m4_pattern_allow([m4_include]) AT_DATA([options.m4sh], [[AS_INIT[]m4_include([getopt.m4sh]) nl=' ' list= opts= M4SH_GETOPTS( [a!], [--append], [], [func_append list "$optarg$nl"], [f], [--force], [], [opts="$opts force"], [i], [--install], [], [opts="$opts install"], [l;], [--length], [], [], [p!], [--path], [], [func_dirname_and_basename "$optarg"], [v], [--verbose], [], [opts="$opts verbose"], [!], [--ltdl], [false],[opts="$opts ltdl=$optarg"], [test -z "$opt_length" || { for s in $opt_length; do func_len "$s" func_arith ${len-0} + $func_len_result; len=$func_arith_result done echo len=$len } test -z "$opt_path" || { func_stripname b_ .d "$func_basename_result" echo "$func_dirname_result:$func_stripname_result" } test -z "$list$opts" || echo "$list" $opts]) ]]) m4_pattern_forbid([m4_include]) m4_pattern_forbid([AS_INIT]) AT_CHECK([$M4SH --version || exit 77], [], [ignore], [ignore]) AT_CHECK([$M4SH -B $abs_top_srcdir/build-aux options.m4sh > t-options], [], [], [], [AT_CHECK([test 63 -eq "$at_status" && exit 77])]) $SED "s|@LN_S\@|$LN_S|g;s|@SED\@|$SED|g" t-options > options ])# _LT_AT_GETOPT_M4SH_SETUP ## ----------------------- ## ## Short option splitting. ## ## ----------------------- ## AT_SETUP([fallback short option splitting]) AT_DATA(expout, [[ force verbose install ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([lt_HAVE_XSI_OPS=no $SHELL ./options -fvi], 0, [expout]) AT_CLEANUP AT_SETUP([enhanced short option splitting]) AT_DATA(expout, [[ force verbose install ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([$SHELL ./options -fvi], 0, [expout]) AT_CLEANUP ## ---------------------- ## ## Long option splitting. ## ## ---------------------- ## AT_SETUP([fallback long option splitting]) AT_DATA(expout, [[ ltdl=long ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([lt_HAVE_XSI_OPS=no $SHELL ./options --ltdl=long], 0, [expout]) AT_CLEANUP AT_SETUP([enhanced long option splitting]) AT_DATA(expout, [[ ltdl=long ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([$SHELL ./options --ltdl=long], 0, [expout]) AT_CLEANUP ## ----------------- ## ## Option appending. ## ## ----------------- ## AT_SETUP([fallback option appending]) AT_DATA(expout, [[first --append second third ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([lt_HAVE_PLUSEQ_OP=no $SHELL ./options -a "first --append second" -athird], 0, [expout]) AT_CLEANUP AT_SETUP([enhanced option appending]) AT_DATA(expout, [[first --append second third ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([$SHELL ./options -a "first --append second" -athird], 0, [expout]) AT_CLEANUP ## ----------------- ## ## Shell arithmetic. ## ## ----------------- ## AT_SETUP([fallback arithmetic]) AT_DATA(expout, [[len=9 ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([lt_HAVE_ARITH_OP=no $SHELL ./options -l short --length long], 0, [expout]) AT_CLEANUP AT_SETUP([enhanced arithmetic]) AT_DATA(expout, [[len=9 ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([$SHELL ./options -l short --length long], 0, [expout]) AT_CLEANUP ## ------------- ## ## Path slicing. ## ## ------------- ## AT_SETUP([fallback path slicing]) AT_DATA(expout, [[a:c ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([lt_HAVE_XSI_OPS=no $SHELL ./options -p a/b_c.d], 0, [expout]) AT_CLEANUP AT_SETUP([enhanced path slicing]) AT_DATA(expout, [[a:c ]]) _LT_AT_GETOPT_M4SH_SETUP AT_CHECK([$SHELL ./options -p a/b_c.d], 0, [expout]) AT_CLEANUP