view libinterp/build-env-features.sh @ 21277:1bca6c72d2b1

maint: Use consistent coding style for build helper shell scripts * mk-octave-config-h.sh: Keep if-then on a single line. * move-if-change: Insert a space in interpreter directive for consistency. * build-env-features.sh, config-images.sh, config-module.sh, config-ops.sh, find-defun-files.sh, find-files-with-tests.sh, mk-errno-list, libinterp/mk-pkg-add, scripts/mk-pkg-add, mkbuiltins, mkdefs, mkdocs, mkf77def.in, mkops: Initialize environment variable defaults consistently. Use shift only when the argument list is not empty. Remove unnecessary quotes and semicolons on variable assignments. Insert/remove blank lines for consistency.
author Mike Miller <mtmiller@octave.org>
date Tue, 16 Feb 2016 18:36:00 -0800
parents a55b8ece1ecd
children 40de9f8f23a6
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 "build-env.h"
#include "ov.h"

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

      static octave_scalar_map m;

      if (! initialized)
        {
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 | sort

cat << EOF

          initialized = true;
        }

      return m;
    }
  };
};
EOF