view libinterp/config-features.sh @ 16170:2a4f83826024

new way to test for features in Octave scripts * __have_feature__.m: New file. * test.m, geometryimages.m, sparseimages.m: Use it. Delete tests for testif and xfail. * config-features.sh: New file. * libinterp/Makefile.am (EXTRA_DIST): Include config-features.sh in the list. (oct-conf-features.h): New target. (BUILT_NODISTFILES, nodist_liboctinterp_la_SOURCES): Include oct-conf-features.h in the list.
author John W. Eaton <jwe@octave.org>
date Sat, 02 Mar 2013 07:41:50 -0500
parents
children
line wrap: on
line source

#! /bin/sh

set -e
AWK=${AWK:-awk}

conffile=$1

cat << EOF
// DO NOT EDIT!  Generated automatically from $conffile by Make."

#include "oct-map.h"
#include "ov.h"

octave_scalar_map
octave_config_features (void)
{
  octave_scalar_map m;

EOF

$AWK \
  '/#define HAVE_/ {
     sub (/HAVE_/, "", $2);
     printf ("  m.assign (\"%s\", octave_value (true));\n", $2);
   }
   /\/\* #undef HAVE_/ {
     sub (/HAVE_/, "", $3);
     printf ("  m.assign (\"%s\", octave_value (false));\n", $3);
   } {
   }' $conffile

cat << EOF

  return m;
}
EOF