view libinterp/config-features.sh @ 21182:82a44483dbff

move octave_config_features function out of header file * oct-conf-features.h: New file. * module.mk: Generate octave-conf-features.cc instead of oct-conf-features.h. * toplev.cc (Foctave_config_info): Call octave::config::features. * config-features.sh: Adapt to use of namespace. Make internal data static and initialized only once.
author John W. Eaton <jwe@octave.org>
date Wed, 03 Feb 2016 15:10:15 -0500
parents a65b906e25bc
children
line wrap: on
line source

#! /bin/sh

## Attempt to get traditional sort behavior based on byte values.
LC_ALL="C"
export LC_ALL

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

conffile=$1

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

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "oct-conf-features.h"
#include "ov.h"

namespace octave
{
  namespace config
  {
    octave_scalar_map
    features (void)
    {
      static bool initialized = false;

      static octave_scalar_map m;

      if (! initialized)
        {
EOF

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

cat << EOF

          initialized = true;
        }

      return m;
    }
  };
};
EOF