+# If this target does not have fork, skip this test.
+
+proc dg-require-fork { args } {
+ if { ![check_fork_available] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
+
+# If this target does not have mkfifo, skip this test.
+
+proc dg-require-mkfifo { args } {
+ if { ![check_mkfifo_available] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
+
+# If this target does not use __cxa_atexit, skip this test.
+
+proc dg-require-cxa-atexit { args } {
+ if { ![ check_cxa_atexit_available ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
+
+# If the host is remote rather than the same as the build system, skip
+# this test. Some tests are incompatible with DejaGnu's handling of
+# remote hosts, which involves copying the source file to the host and
+# compiling it with a relative path and "-o a.out".
+
+proc dg-require-host-local { args } {
+ if [ is_remote host ] {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
+
+# Add any target-specific flags needed for accessing the given list
+# of features. This must come after all dg-options.
+
+proc dg-add-options { args } {
+ upvar dg-extra-tool-flags extra-tool-flags
+
+ foreach arg [lrange $args 1 end] {
+ if { [info procs add_options_for_$arg] != "" } {
+ set extra-tool-flags \
+ [eval [list add_options_for_$arg ${extra-tool-flags}]]
+ } else {
+ error "Unrecognized option type: $arg"
+ }
+ }
+}
+
+# Compare flags for a test directive against flags that will be used to
+# compile the test: multilib flags, flags for torture options, and either
+# the default flags for this group of tests or flags specified with a
+# previous dg-options directive.