/[autoconf]/autoconf/lib/autotest/general.m4
ViewVC logotype

Diff of /autoconf/lib/autotest/general.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.151 by dprice, Thu Aug 14 13:49:06 2003 UTC revision 1.152 by dprice, Tue Aug 19 18:21:40 2003 UTC
# Line 66  Line 66 
66  # Defined below:  # Defined below:
67  #  - DEFAULTS  #  - DEFAULTS
68  #    Overall initialization, value of $at_groups_all.  #    Overall initialization, value of $at_groups_all.
69    #  - PARSE_ARGS_BEGIN
70    #    Setup defaults required for option processing.
71  #  - PARSE_ARGS  #  - PARSE_ARGS
72  #    Option processing.  After AT_INIT, user options can be entered here as  #    Option processing.  After AT_INIT, user options can be entered here as
73  #    cases of a case statement.  #    cases of a case statement.
74  #  - PARSE_ARGS_END  #  - PARSE_ARGS_END
75  #    Finish up the option processing.  #    Finish up the option processing.
76  #  - HELP  #  - HELP
77  #    Start printing the help message.  User help can be appended to this as  #    Start printing the help message.
78  #    self-contained cat'd here-docs.  #  - HELP_MODES
79    #    Modes help text.  Additional modes can be appended as self-contained
80    #    cat'd here-docs as generated by AS_HELP_STRING.
81    #  - HELP_TUNING
82    #    TUning help text.  Additional tuning options can be appended as
83    #    self-contained cat'd here-docs as generated by AS_HELP_STRING.
84    #  - HELP_OTHER
85    #    User help can be appended to this as self-contained cat'd here-docs.
86  #  - HELP_END  #  - HELP_END
87  #    Finish up the help texts.  #    Finish up the help texts.
88  #  - PREPARE_TESTS  #  - PREPARE_TESTS
# Line 89  Line 98 
98  #    The code for each test, the ``normal'' diversion  #    The code for each test, the ``normal'' diversion
99    
100  m4_define([_m4_divert(DEFAULTS)],           100)  m4_define([_m4_divert(DEFAULTS)],           100)
101  m4_define([_m4_divert(PARSE_ARGS)],         200)  m4_define([_m4_divert(PARSE_ARGS_BEGIN)],   200)
102  m4_define([_m4_divert(PARSE_ARGS_END)],     201)  m4_define([_m4_divert(PARSE_ARGS)],         201)
103    m4_define([_m4_divert(PARSE_ARGS_END)],     202)
104  m4_define([_m4_divert(HELP)],               300)  m4_define([_m4_divert(HELP)],               300)
105  m4_define([_m4_divert(HELP_MODES)],         301)  m4_define([_m4_divert(HELP_MODES)],         301)
106  m4_define([_m4_divert(HELP_TUNING)],        302)  m4_define([_m4_divert(HELP_TUNING)],        302)
# Line 889  m4_wrap([m4_divert_pop([KILL])[]]) Line 899  m4_wrap([m4_divert_pop([KILL])[]])
899  ])# AT_INIT  ])# AT_INIT
900    
901    
902    # _AT_ARG_OPTION(OPTIONS,HELP-TEXT,[ARGS],[ACTION-IF-GIVEN],
903    #                [ACTION-IF-NOT-GIVEN])
904    # ---------------------------------------------------------------------------
905    # Internal implementation of AT_ARG_OPTION & AT_ARG_OPTION_ARG
906    m4_defun([_AT_ARG_OPTION],
907    [m4_divert_once([HELP_OTHER],
908    [cat <<_ATEOF
909    
910    Other options:
911    _ATEOF
912    ])dnl m4_divert_once HELP_OTHER
913    m4_divert_text([HELP_OTHER],
914    [cat <<_ATEOF
915    $2
916    _ATEOF])dnl
917    dnl Turn our options into our desired strings
918    m4_ifdef([AT_first_option],[m4_undefine([AT_first_option])])dnl
919    m4_ifdef([AT_case],[m4_undefine([AT_case])])dnl
920    m4_ifdef([AT_case_no],[m4_undefine([AT_case_no])])dnl
921    m4_ifdef([AT_case_arg],[m4_undefine([AT_case_arg])])dnl
922    m4_foreach([AT_option], m4_split(m4_normalize([$1]),[[ \|]+]),
923    [m4_define_default([AT_first_option],AT_option)dnl
924    m4_append([AT_case],m4_if(m4_len(AT_option),1,[],[-])[-]AT_option, [ | ])dnl
925    m4_append([AT_case_no],[--no]AT_option, [ | ])dnl
926    m4_append([AT_case_arg],m4_if(m4_len(AT_option),1,[],[-])[-]AT_option[=*], [ | ])dnl
927    ])dnl m4_foreach AT_option
928    dnl keep track so we or the user may process ACTION-IF-NOT-GIVEN
929    m4_divert_once([PARSE_ARGS_BEGIN],
930    [
931    ##
932    ## Set up package specific options.
933    ##
934    ])dnl
935    m4_divert_text([PARSE_ARGS_BEGIN],
936    [dnl Provide a default value for options without arguments.
937    m4_ifvaln([$3],,[at_arg_[]m4_bpatsubst([AT_first_option], -, _)=false])dnl
938    at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)=false
939    ])dnl m4_divert_text DEFAULTS
940    m4_ifval([$3],[m4_divert_once([PARSE_ARGS_END],
941    [
942    ##
943    ## Verify our last option didn't require an argument
944    ##
945    AS_IF([test -n "$at_prev"],[AS_ERROR([`$at_prev' requires an argument.])])])])
946    m4_divert_text([PARSE_ARGS],
947    [dnl Parse the options and args when necessary.
948    m4_ifvaln([$3],
949    [    AT_case )
950            at_prev=--m4_bpatsubst([AT_first_option], -, _)
951            ;;
952        AT_case_arg )
953            at_arg_[]m4_bpatsubst([AT_first_option], -, _)=$at_optarg
954            at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)=:
955            $4
956            ;;],
957    [    AT_case )
958            at_optarg=:
959            at_arg_[]m4_bpatsubst([AT_first_option], -, _)=:
960            at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)=:
961            m4_ifval([$4],[$4])dnl
962            ;;
963        AT_case_no )
964            at_optarg=false
965            at_arg_[]m4_bpatsubst([AT_first_option], -, _)=false
966            at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)=:
967            m4_ifval([$4],[$4])dnl
968            ;;])dnl m4_ifvaln $3
969    ])dnl m4_divert_text PARSE_ARGS
970    m4_ifvaln([$5],
971    [m4_divert_once([PARSE_ARGS_END],
972    [
973    ##
974    ## Process package specific options when _not_ supplied.
975    ##])dnl m4_divert_once PARSE_ARGS_END
976    m4_divert_text([PARSE_ARGS_END],
977    [
978    AS_IF([$at_arg_given_[]m4_bpatsubst([AT_first_option], -, _)],,[$5])dnl
979    ])dnl m4_divert_text PARSE_ARGS_END
980    ])dnl m4_ifvaln $5
981    ])dnl _AT_ARG_OPTION
982    
983    
984    # AT_ARG_OPTION(OPTIONS,HELP-TEXT,[ACTION-IF-GIVEN],[ACTION-IF-NOT-GIVEN])
985    # ------------------------------------------------------------------------
986    # Accept a set of OPTIONS with arguments.  Add HELP-TEXT to the HELP_OTHER
987    # diversion.
988    #
989    # Preceding dashes should not be passed into OPTIONS.  Users will be required
990    # to pass `--' before long options and `-' before single character options.
991    #
992    # $at_arg_OPTION will be set to `:' if this option is received, `false' if
993    # if --noOPTION is received, and `false' by default.
994    #
995    # Run ACTION-IF-GIVEN each time an option in OPTIONS is encountered with
996    # $at_optarg set to `:' or `false' as appropriate.  $opt_arg is actually
997    # just a copy of $at_arg_OPTION.
998    #
999    # ACTION-IF-NOT-GIVEN will be run once after option parsing is complete
1000    # if no option from OPTIONS was found.
1001    m4_defun([AT_ARG_OPTION],[_AT_ARG_OPTION([$1],[$2],,[$3],[$4])])
1002    
1003    
1004    # AT_ARG_OPTION_ARG(OPTIONS,HELP-TEXT,[ACTION-IF-GIVEN],[ACTION-IF-NOT-GIVEN])
1005    # ---------------------------------------------------------------------------
1006    # Accept a set of OPTIONS with arguments, seperated by commas.  Add HELP-TEXT
1007    # to the HELP_OTHER diversion.
1008    #
1009    # Preceding dashes should not be passed into OPTIONS.  Users will be required
1010    # to pass `--' before long options and `-' before single character options.
1011    #
1012    # By default, any argument to these options will be assigned to the shell
1013    # variable $at_arg_OPTION, where OPTION is the first option in OPTIONS with
1014    # any `-' characters replaced with `_'.
1015    #
1016    # Run ACTION-IF-GIVEN each time an option in OPTIONS is encountered with
1017    # $at_optarg set.  $at_optarg is actually just a copy of $at_arg_OPTION.
1018    #
1019    # ACTION-IF-NOT-GIVEN will be run once after option parsing is complete
1020    # if no option from OPTIONS was found.
1021    m4_defun([AT_ARG_OPTION_ARG],[_AT_ARG_OPTION([$1],[$2],1,[$3],[$4])])
1022    
1023    
1024  # AT_TESTED(PROGRAMS)  # AT_TESTED(PROGRAMS)
1025  # -------------------  # -------------------
1026  # Specify the list of programs exercised by the test suite.  Their  # Specify the list of programs exercised by the test suite.  Their

Legend:
Removed from v.1.151  
changed lines
  Added in v.1.152

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26