[Pkg-octave-commit] [octave-miscellaneous] 01/03: Imported Upstream version 1.2.1
Thomas Weber
tweber at moszumanska.debian.org
Mon Jun 9 14:40:59 UTC 2014
This is an automated email from the git hooks/post-receive script.
tweber pushed a commit to branch master
in repository octave-miscellaneous.
commit 94b79c9d6a108e8556d977aa4de373cf2e8cf493
Author: Thomas Weber <tweber at debian.org>
Date: Mon Jun 9 12:22:42 2014 +0200
Imported Upstream version 1.2.1
---
DESCRIPTION | 4 +-
INDEX | 6 +-
NEWS | 18 +-
devel/README | 9 +
devel/listencanfork.c | 13 +
devel/server.cc | 824 +++++++++++
devel/server.txt | 118 ++
devel/stringmatch.c | 242 ++++
inst/apply.m | 102 --
inst/asci.m | 73 +-
inst/ascii.m | 93 ++
inst/chebyshevpoly.m | 17 +-
inst/map.m | 96 --
inst/physical_constant.py | 180 +++
inst/private/strsplit.m | 125 ++
inst/temp_name.m | 71 -
inst/units.m | 146 +-
src/Makefile | 2 +-
src/bootstrap | 6 +
src/configure | 3522 +++++++++++++++++++++++++++++++++++++++++++++
src/configure.ac | 20 +
src/partarray.cc | 231 ---
src/sample.cc | 0
23 files changed, 5325 insertions(+), 593 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index fe7af45..33cba1a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Name: Miscellaneous
-Version: 1.2.0
-Date: 2012-10-16
+Version: 1.2.1
+Date: 2014-06-05
Author: various authors
Maintainer: Octave-Forge community <octave-dev at lists.sourceforge.net>
Title: Miscellaneous functions
diff --git a/INDEX b/INDEX
index 52a8b09..148c954 100644
--- a/INDEX
+++ b/INDEX
@@ -1,6 +1,5 @@
miscellaneous >> Miscellaneous functions
miscellaneous
- apply
asci
cell2cell
chebyshevpoly
@@ -13,15 +12,14 @@ miscellaneous
infoskeleton
laguerrepoly
legendrepoly
- map
match
normc
normr
nze
- partarray
partcnt
partint
peano_curve
+ physical_constant
publish
read_options
reduce
@@ -29,8 +27,8 @@ miscellaneous
sample
slurp_file
solvesudoku
- temp_name
text_waitbar
+ textable
truncate
units
zagzig
diff --git a/NEWS b/NEWS
index 5ecc6a8..fe7632d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,21 @@
Summary of important user-visible changes for the miscellaneous package
------------------------------------------------------------------------
===============================================================================
-miscellaneous-1.2.0 Release Date: 2012-XX-XX Release Manager:
+miscellaneous-1.2.1 Release Date: 2014-06-05 Release Manager: Carnë Draug
+===============================================================================
+
+ ** The following functions have been deprecated in previous releases
+ of the miscellaneous package and have now been removed:
+
+ apply map partarray temp_name
+
+ ** units is now able to perform non-linear unit conversions such as conversion
+ between Fahrenheit and Celsius.
+
+ ** The function `asci' has been renamed `ascii'.
+
+===============================================================================
+miscellaneous-1.2.0 Release Date: 2012-10-16 Release Manager: Carnë Draug
===============================================================================
** New functions:
truncate: truncates a number to a given precision.
@@ -24,7 +38,7 @@ miscellaneous-1.2.0 Release Date: 2012-XX-XX Release Manager:
** Package is now dependent on the general (>= 1.3.1)
===============================================================================
-miscellaneous-1.1.0 Release Date: 2012-03-24 Release Manager:
+miscellaneous-1.1.0 Release Date: 2012-03-24 Release Manager: Carnë Draug
===============================================================================
** IMPORTANT NOTE:
diff --git a/devel/README b/devel/README
new file mode 100644
index 0000000..ffdbf5a
--- /dev/null
+++ b/devel/README
@@ -0,0 +1,9 @@
+On revision 10042 the files server.cc, listencanfork.c and stringmatch.c were
+removed from the src/ directory of the miscellaneous package since no one on the
+mailing list knew what to do with these files. The packages releases were also
+not properly configured to handle it's code and even Debian packages of
+miscellaneous do not include them.
+
+Looking at the code of server.cc, it seems to implement the functions server,
+listen and senderror. Some of these would conflict with the functions in the
+package sockets. Maybe this code should be merged with sockets.
diff --git a/devel/listencanfork.c b/devel/listencanfork.c
new file mode 100644
index 0000000..29c4208
--- /dev/null
+++ b/devel/listencanfork.c
@@ -0,0 +1,13 @@
+#if defined(__CYGWIN__)
+#include <windows.h>
+
+int listencanfork()
+{
+ OSVERSIONINFO osvi;
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ GetVersionEx (&osvi);
+ return (osvi.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS);
+}
+#else
+int listencanfork() { return 1; }
+#endif
diff --git a/devel/server.cc b/devel/server.cc
new file mode 100644
index 0000000..3118a6d
--- /dev/null
+++ b/devel/server.cc
@@ -0,0 +1,824 @@
+#define STATUS(x) do { if (debug) std::cout << x << std::endl << std::flush; } while (0)
+
+//#define HAVE_OCTAVE_30
+#include <iomanip>
+#include <iostream>
+#include <cstdio>
+#include <cctype>
+#include <cstdlib>
+//#include <unistd.h>
+//#include <stdint.h>
+#include <cerrno>
+// #include <string.h>
+#include <sys/types.h>
+
+#if (defined(_WIN32)||defined(_WIN64)) && !defined(__CYGWIN__)
+# define USE_WINSOCK
+# define CAN_FORK false
+# include <winsock.h>
+# include <io.h>
+ typedef int socklen_t;
+#else
+# define HAVE_FORK 1
+# define USE_SIGNALS
+# if defined(__CYGWIN__)
+# define CAN_FORK listencanfork()
+# else
+# define USE_DAEMONIZE
+# define CAN_FORK true
+# endif
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <sys/wait.h>
+# include <signal.h>
+# define closesocket close
+#endif
+
+
+#include <octave/oct.h>
+#include <octave/parse.h>
+#include <octave/variables.h>
+#if 0
+#include <octave/unwind-prot.h>
+#endif
+#include <octave/oct-syscalls.h>
+#include <octave/oct-time.h>
+#include <octave/lo-mappers.h>
+#include <octave/symtab.h>
+
+static bool debug = false;
+static char* context = NULL;
+
+static double timestamp = 0.0;
+inline void tic(void) { timestamp = octave_time().double_value(); }
+inline double toc(void) {return ceil(-1e6*(timestamp-octave_time().double_value()));}
+
+// XXX FIXME XXX --- surely this is part of the standard library?
+void
+lowercase (std::string& s)
+{
+ for (std::string::iterator i=s.begin(); i != s.end(); i++) *i = tolower(*i);
+}
+
+#if 0
+octave_value
+get_builtin_value (const std::string& nm)
+{
+ octave_value retval;
+
+ symbol_record *sr = fbi_sym_tab->lookup (nm);
+
+ if (sr)
+ {
+ octave_value sr_def = sr->def ();
+
+ if (sr_def.is_undefined ())
+ error ("get_builtin_value: undefined symbol `%s'", nm.c_str ());
+ else
+ retval = sr_def;
+ }
+ else
+ error ("get_builtin_value: unknown symbol `$s'", nm.c_str ());
+
+ return retval;
+}
+#endif
+
+#ifdef USE_WINSOCK
+ bool init_sockets()
+ {
+
+ WSADATA wsaData;
+ WORD version;
+ int error;
+
+ version = MAKEWORD( 2, 0 );
+
+ error = WSAStartup( version, &wsaData );
+
+ /* check for error */
+ if ( error != 0 )
+ {
+ /* error occured */
+ return false;
+ }
+
+ /* check for correct version */
+ if ( LOBYTE( wsaData.wVersion ) != 2 ||
+ HIBYTE( wsaData.wVersion ) != 0 )
+ {
+ /* incorrect WinSock version */
+ WSACleanup();
+ return false;
+ }
+ return true;
+ }
+
+ inline void end_sockets() { WSACleanup(); }
+ inline int socket_errno() { return WSAGetLastError(); }
+#else // !USE_WINSOCK
+# include <cerrno>
+ inline bool init_sockets() { return true; }
+ inline void end_sockets() { }
+ inline int socket_errno() { return errno; }
+#endif // !USE_WINSOCK
+inline void socket_error(const char *context)
+{
+ int err = socket_errno();
+ char errno_str[15];
+ snprintf(errno_str, sizeof(errno_str), " %d: ", err);
+ std::string msg = std::string(context) + std::string(errno_str)
+ + std::string (strerror(err));
+ error(msg.c_str());
+}
+
+#ifdef USE_SIGNALS
+static void
+sigchld_handler(int /* sig */)
+{
+ int status;
+ /* Reap all childrens */
+ STATUS("reaping all children");
+ while (waitpid(-1, &status, WNOHANG) > 0)
+ ;
+ STATUS("done reaping children");
+}
+
+/* Posix signal handling, based on the example from the
+ * Unix Programming FAQ
+ * Copyright (C) 2000 Andrew Gierth
+ */
+static void sigchld_setup(void)
+{
+ struct sigaction act;
+
+ /* Assign sig_chld as our SIGCHLD handler */
+ act.sa_handler = sigchld_handler;
+
+ /* We don't want to block any other signals in this example */
+ sigemptyset(&act.sa_mask);
+
+ /*
+ * We're only interested in children that have terminated, not ones
+ * which have been stopped (eg user pressing control-Z at terminal)
+ */
+ act.sa_flags = SA_NOCLDSTOP;
+
+ /*
+ * Make these values effective. If we were writing a real
+ * application, we would probably save the old value instead of
+ * passing NULL.
+ */
+ if (sigaction(SIGCHLD, &act, NULL) < 0)
+ error("listen could not set SIGCHLD");
+}
+#else
+inline void sigchld_setup(void) { }
+#endif
+
+
+#ifdef USE_DAEMONIZE
+
+static RETSIGTYPE
+sigterm_handler(int /* sig */)
+{
+ exit(0);
+}
+
+static void
+daemonize(void)
+{
+ if (fork()) exit(0); // Stop parent
+ // Show child PID
+ std::cout << "Octave pid: " << octave_syscalls::getpid() << std::endl;
+ std::cout.flush();
+ signal(SIGTERM,sigterm_handler);
+ signal(SIGQUIT,sigterm_handler);
+
+
+#if 1
+ const char err[] = "/dev/null";
+ const char out[] = "/dev/null";
+#else
+ const char err[] = "/tmp/octserver.err";
+ const char out[] = "/tmp/octserver.out";
+ std::cout << "redirecting to " << out << " and " << err << std::endl; std::cout.flush();
+#endif
+
+ // Exit silently if I/O redirect fails.
+ if (freopen("/dev/null", "r", stdin) == NULL
+ || freopen(out, "w", stdout) == NULL
+ || freopen(err, "w", stderr) == NULL) {
+ // std::cerr << "ioredirect failed" << std::endl; std::cerr.flush();
+ exit(0);
+ }
+ // std::cout << "ioredirect succeeded" << std::endl; std::cout.flush();
+ //debug = true;
+}
+
+#else
+// Don't daemonize on cygwin just yet.
+inline void daemonize(void) {}
+
+#endif // !DAEMONIZE
+
+
+
+static octave_value get_octave_value(char *name)
+{
+ octave_value def;
+
+ // Copy variable from octave
+#if defined(HAVE_TOP_LEVEL_SYM_TAB)
+ // Octave 3.0
+ symbol_record *sr = top_level_sym_tab->lookup (name);
+ if (sr) def = sr->def();
+#elif defined(HAVE_VARREF)
+ // Octave 2.x
+ def = symbol_table::varref (std::string (name), symbol_table::top_scope ());
+#else
+ // Octave 3.2
+ def = get_global_value(name);
+#endif
+
+ return def;
+}
+
+
+static void channel_error (const int channel, const char *str)
+{
+ STATUS("sending error !!!e (" << strlen(str) << ") " << str);
+
+ uint32_t len = strlen(str);
+ send(channel,"!!!e",4,0);
+ uint32_t t = htonl(len); send(channel,(const char *)&t,4,0);
+ send(channel,str,len,0);
+}
+
+static bool reads (const int channel, void * buf, int n)
+{
+ // STATUS("entering reads loop with size " << n); tic();
+ while (1) {
+ int chunk = recv(channel, (char *)buf, n, 0);
+ if (chunk == 0) STATUS("read socket returned 0");
+ if (chunk < 0) STATUS("read socket error " << socket_errno());
+ if (chunk <= 0) return false;
+ n -= chunk;
+ // if (n == 0) STATUS("done reads loop after " << toc() << "us");
+ if (n == 0) return true;
+ // STATUS("reading remaining " << n << " characters");
+ buf = (void *)((char *)buf + chunk);
+ }
+}
+
+static bool writes (const int channel, const void * buf, int n)
+{
+ // STATUS("entering writes loop");
+ while (1) {
+ int chunk = send(channel, (const char *)buf, n, 0);
+ if (chunk == 0) STATUS("write socket returned 0");
+ if (chunk < 0) STATUS("write socket: " << strerror(errno));
+ if (chunk <= 0) return false;
+ n -= chunk;
+ // if (n == 0) STATUS("done writes loop");
+ if (n == 0) return true;
+ buf = (void *)((char *)buf + chunk);
+ }
+}
+
+static void
+process_commands(int channel)
+{
+ // XXX FIXME XXX check read/write return values
+ assert(sizeof(uint32_t) == 4);
+ char command[5];
+ char def_context[16536];
+ bool ok;
+ STATUS("waiting for command");
+
+ // XXX FIXME XXX do we need to specify the context size?
+ // int bufsize=sizeof(def_context);
+ // socklen_t ol;
+ // ol=sizeof(bufsize);
+ // setsockopt(channel,SOL_SOCKET,SO_SNDBUF,&bufsize,ol);
+ // setsockopt(channel,SOL_SOCKET,SO_RCVBUF,&bufsize,ol);
+
+ // XXX FIXME XXX prepare to capture long jumps, because if
+ // we dont, then errors in octave might escape to the prompt
+
+ command[4] = '\0';
+ if (debug) tic();
+ while (reads(channel, &command, 4)) {
+ // XXX FIXME XXX do whatever is require to check if function files
+ // have changed; do we really want to do this for _every_ command?
+ // Maybe we need a 'reload' command.
+ STATUS("received command " << command << " after " << toc() << "us");
+
+ // Check for magic command code
+ if (command[0] != '!' || command[1] != '!' || command[2] != '!') {
+ STATUS("communication error: closing connection");
+ break;
+ }
+
+ // Get command length
+ if (debug) tic(); // time the read
+ uint32_t len;
+ if (!reads(channel, &len, 4)) break;
+ len = ntohl(len);
+ // STATUS("read 4 byte command length in " << toc() << "us");
+
+ // Read the command context, allocating a new one if the default
+ // is too small.
+ if (len > (signed)sizeof(def_context)-1) {
+ // XXX FIXME XXX use octave allocators
+ // XXX FIXME XXX unwind_protect
+ context= new char[len+1];
+ if (context== NULL) {
+ // Requested command is too large --- skip to the next command
+ // XXX FIXME XXX maybe we want to kill the connection instead?
+ channel_error(channel,"out of memory");
+ ok = true;
+ STATUS("skip big command loop");
+ while (ok && len > (signed)sizeof(def_context)) {
+ ok = reads(channel, def_context, sizeof(def_context));
+ len -= sizeof(def_context);
+ }
+ STATUS("done skip big command loop");
+ if (!ok) break;
+ ok = reads(channel, def_context, sizeof(def_context));
+ if (!ok) break;
+ continue;
+ }
+ } else {
+ context = def_context;
+ }
+ // if (debug) tic();
+ ok = reads(channel, context, len);
+ context[len] = '\0';
+ STATUS("read " << len << " byte command in " << toc() << "us");
+
+ // Process the command
+ if (ok) switch (command[3]) {
+ case 'm': // send the named matrix
+ {
+ // XXX FIXME XXX this can be removed: app can do send(name,value)
+ STATUS("sending " << context);
+ uint32_t t;
+
+ // read the matrix contents
+ octave_value def = get_octave_value(context);
+ if(!def.is_defined() || !def.is_real_matrix())
+ channel_error(channel,"not a matrix");
+ Matrix m = def.matrix_value();
+
+ // write the matrix transfer header
+ ok = writes(channel,"!!!m",4); // matrix message
+ t = htonl(12 + sizeof(double)*m.rows()*m.columns());
+ if (ok) ok = writes(channel,&t,4); // length of message
+ t = htonl(m.rows());
+ if (ok) ok = writes(channel,&t,4); // rows
+ t = htonl(m.columns());
+ if (ok) ok = writes(channel,&t,4); // columns
+ t = htonl(len);
+ if (ok) ok = writes(channel, &t, 4); // name length
+ if (ok) ok = writes(channel,context,len); // name
+
+ // write the matrix contents
+ const double *v = m.data(); // data
+ if (ok) ok = writes(channel,v,sizeof(double)*m.rows()*m.columns());
+ if (ok)
+ STATUS("sent " << m.rows()*m.columns());
+ else
+ STATUS("failed " << m.rows()*m.columns());
+ }
+ break;
+
+ case 'x': // silently execute the command
+ {
+ if (debug)
+ {
+ if (len > 500)
+ {
+ // XXX FIXME XXX can we limit the maximum output width for a
+ // string? The setprecision() io manipulator doesn't do it.
+ // In the meantime, a hack ...
+ char t = context[400]; context[400] = '\0';
+ STATUS("evaluating (" << len << ") "
+ << context << std::endl
+ << "..." << std::endl
+ << context+len-100);
+ context[400] = t;
+ }
+ else
+ {
+ STATUS("evaluating (" << len << ") " << context);
+ }
+ }
+
+ if (debug) tic();
+#if 1
+ error_state = 0;
+ int parse_status = 0;
+ eval_string(context, true, parse_status, 0);
+ if (parse_status != 0 || error_state)
+ eval_string("senderror(lasterr);", true, parse_status, 0);
+#elif 0
+ octave_value_list evalargs;
+ evalargs(1) = "senderror(lasterr);";
+ evalargs(0) = context;
+ octave_value_list fret = feval("eval",evalargs,0);
+#else
+ evalargs(0) = octave_value(0.);
+#endif
+ STATUS("done command");
+ }
+ STATUS("free evalargs");
+ break;
+
+ case 'c': // execute the command and capture stdin/stdout
+ STATUS("capture command not yet implemented");
+ break;
+
+ default:
+ STATUS("ignoring command " << command);
+ break;
+ }
+
+ if (context != def_context) delete[] context;
+ STATUS("done " << command);
+ if (!ok) break;
+ if (debug) tic();
+ }
+}
+
+
+int channel = -1;
+
+DEFUN_DLD(senderror,args,,"\
+Send the given error message across the socket. The error context\n\
+is taken to be the last command received from the socket.")
+{
+ std::string str;
+ const int nargin = args.length();
+ if (nargin != 1) str="senderror not called with error";
+ else str = args(0).string_value();
+
+ // provide a context for the error (but not too much!)
+ str += "when evaluating:\n";
+ if (strlen(context) > 100)
+ {
+ char t=context[100];
+ context[100] = '\0';
+ str+=context;
+ context[100]=t;
+ }
+ else
+ str += context;
+
+ STATUS("error is " << str);
+ channel_error(channel,str.c_str());
+ return octave_value_list();
+}
+
+DEFUN_DLD(send,args,,"\
+send(str)\n\
+ Send a command on the current connection\n\
+send(name,value)\n\
+ Send a binary value with the given name on the current connection\n\
+")
+{
+ bool ok;
+ uint32_t t;
+ octave_value_list ret;
+ int nargin = args.length();
+ if (nargin < 1 || nargin > 2)
+ {
+ print_usage ();
+ return ret;
+ }
+
+ if (channel < 0) {
+ error("Not presently listening on a port");
+ return ret;
+ }
+
+ std::string cmd(args(0).string_value());
+ if (error_state) return ret;
+
+ // XXX FIXME XXX perhaps process the panalopy of types?
+ if (nargin > 1) {
+
+ octave_value def = args(1);
+ if (args(1).is_string()) {
+ // Grab the string value from args(1).
+ // Can't use args(1).string_value() because that trims trailing \0
+ charMatrix m(args(1).char_matrix_value());
+ std::string s(m.row_as_string(0,false,true));
+ STATUS("sending string(" << cmd.c_str() << " len " << s.length() << ")");
+ ok = writes(channel,"!!!s",4); // string message
+ t = htonl(8 + cmd.length() + s.length());
+ if (ok) ok = writes(channel,&t,4); // length of message
+ t = htonl(s.length());
+ if (ok) ok = writes(channel, &t, 4); // string length
+ t = htonl(cmd.length());
+ if (ok) ok = writes(channel, &t, 4); // name length
+ if (cmd.length() && ok)
+ ok = writes(channel, cmd.c_str(), cmd.length()); // name
+ if (s.length() && ok)
+ ok = writes(channel, s.c_str(), s.length()); // string
+ } else if (args(1).is_real_type()) {
+ Matrix m(args(1).matrix_value());
+ STATUS("sending matrix(" << cmd.c_str() << " "
+ << m.rows() << "x" << m.columns() << ")");
+
+ // write the matrix transfer header
+ ok = writes(channel,"!!!m",4); // matrix message
+ t = htonl(12 + cmd.length() + sizeof(double)*m.rows()*m.columns());
+ if (ok) ok = writes(channel,&t,4); // length of message
+ t = htonl(m.rows());
+ if (ok) ok = writes(channel,&t,4); // rows
+ t = htonl(m.columns());
+ if (ok) ok = writes(channel,&t,4); // columns
+ t = htonl(cmd.length());
+ if (ok) ok = writes(channel, &t, 4); // name length
+ if (ok) ok = writes(channel, cmd.c_str(), cmd.length()); // name
+
+ // write the matrix contents
+ const double *v = m.data(); // data
+ if (m.rows()*m.columns() && ok)
+ ok = writes(channel,v,sizeof(double)*m.rows()*m.columns());
+ } else {
+ ok = false;
+ error("send expected name and matrix or string value");
+ }
+ if (!ok) error("send could not write to channel");
+ } else {
+ STATUS("sending command(" << cmd.length() << ") " << cmd.c_str());
+ // STATUS("start writing at "<<toc()<<"us");
+ ok = writes(channel, "!!!x", 4);
+ t = htonl(cmd.length()); writes(channel, &t, 4);
+ if (ok) ok = writes(channel, cmd.c_str(), cmd.length());
+ if (!ok) error("send could not write to channel");
+ // STATUS("stop writing at "<<toc()<<"us");
+ }
+
+ return ret;
+}
+
+extern "C" int listencanfork(void);
+extern "C" int StringCaseMatch(const char* s, const char* p, int nocase);
+
+bool ishostglob(const std::string& s)
+{
+ for (unsigned int i=0; i < s.length(); i++) {
+ if (! ( isdigit(s[i]) || s[i]=='*' || s[i]=='-'
+ || s[i]=='.' || s[i]=='[' || s[i]==']')) return false;
+ }
+ return true;
+}
+
+bool anyhostglob(const string_vector& hostlist, const char* host)
+{
+ for (int j=0; j < hostlist.length(); j++) {
+ if (StringCaseMatch(host, hostlist[j].c_str(), 0)) return true;
+ }
+ return false;
+}
+
+// Known bug: functions which pass or return structures use a
+// different ABI for gcc and native compilers on some architectures.
+// Whether this is a bug depends on the structure length. SGI's 64-bit
+// architecture makes this a problem for inet_ntoa.
+#if defined(__GNUC__) && defined(_sgi)
+#define BROKEN_INET_NTOA
+#endif
+
+#ifdef BROKEN_INET_NTOA
+
+/*************************************************
+* Replacement for broken inet_ntoa() *
+*************************************************/
+
+
+/* On IRIX systems, gcc uses a different structure passing convention to the
+native libraries. This causes inet_ntoa() to always yield 0.0.0.0 or
+255.255.255.255. To get round this, we provide a private version of the
+function here. It is used only if USE_INET_NTOA_FIX is set, which should
+happen
+only when gcc is in use on an IRIX system. Code send to me by J.T. Breitner,
+with these comments:
+
+
+ code by Stuart Levy
+ as seen in comp.sys.sgi.admin
+
+
+Arguments: sa an in_addr structure
+Returns: pointer to static text string
+*/
+
+
+char *
+inet_ntoa(struct in_addr sa)
+{
+static char addr[20];
+sprintf(addr, "%d.%d.%d.%d",
+ (US &sa.s_addr)[0],
+ (US &sa.s_addr)[1],
+ (US &sa.s_addr)[2],
+ (US &sa.s_addr)[3]);
+ return addr;
+}
+
+#endif /* BROKEN_INET_NTOA */
+
+
+void _autoload(const char name[])
+{
+ octave_value_list evalargs, fret;
+ evalargs(0) = "server";
+ fret = feval("which",evalargs,1);
+ evalargs(0) = name;
+ evalargs(1) = fret(0);
+ fret = feval("autoload",evalargs,0);
+}
+
+DEFUN_DLD(server,args,,"\
+server(port,host,host,...)\n\
+ Listen for connections on the given port. Normally only accepts\n\
+ connections from localhost (127.0.0.1), but you can specify any\n\
+ dot-separated host name globs. E.g., '128.2.20.*' or '128.2.2[012].*'\n\
+ Use '?' for '[0123456789]'. Use '*.*.*.*' for any host.\n\
+server(...,'debug'|'nodebug')\n\
+ If debug, echo all commands sent across the connection. If nodebug,\n\
+ detach the process and don't echo anything. You will need to use\n\
+ kill directly to end the process. Nodebug is the default.\n\
+server(...,'fork'|'nofork')\n\
+ If fork, start new server for each connection. If nofork, only allow\n\
+ one connection at a time. Fork is the default (depending on system).\n\
+server(...,'loopback')\n\
+ Use loopback address 127.0.0.1 rather than 0.0.0.0.\n\
+")
+{
+ bool canfork = CAN_FORK;
+
+ _autoload("send");
+ _autoload("senderror");
+ octave_value_list ret;
+ int nargin = args.length();
+ if (nargin < 1)
+ {
+ print_usage ();
+ return ret;
+ }
+ int port = args(0).int_value();
+ if (error_state) return ret;
+
+ // Winsock requires initialization
+ if (!init_sockets())
+ {
+ socket_error("init");
+ return ret;
+ }
+
+
+ debug = false;
+ uint32_t inaddr = INADDR_ANY;
+
+ string_vector hostlist;
+ hostlist.append(std::string("127.0.0.1"));
+ for (int k = 1; k < nargin; k++) {
+ std::string lastarg(args(k).string_value());
+ if (error_state) return ret;
+ lowercase(lastarg);
+ if (lastarg == "debug") {
+ debug = true;
+ } else if (lastarg == "nodebug") {
+ debug = false;
+ } else if (lastarg == "fork") {
+ canfork = true;
+ } else if (lastarg == "nofork") {
+ canfork = false;
+ } else if (lastarg == "loopback") {
+ inaddr = INADDR_LOOPBACK;
+ } else if (ishostglob(lastarg)) {
+ hostlist.append(lastarg);
+ } else {
+ print_usage ();
+ }
+ }
+
+ int sockfd; // listen on sockfd, new connection channel
+ struct sockaddr_in my_addr; // my address information
+ struct sockaddr_in their_addr; // connector's address information
+ socklen_t sin_size;
+ int yes=1;
+
+ sockfd = socket(AF_INET, SOCK_STREAM, 0);
+ if (sockfd == -1) {
+ socket_error("socket");
+ return ret;
+ }
+
+ if (setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,(const char *)(&yes),sizeof(yes)) == -1) {
+ socket_error("setsockopt");
+ return ret;
+ }
+
+ my_addr.sin_family = AF_INET; // host byte order
+ my_addr.sin_port = htons(port); // short, network byte order
+ my_addr.sin_addr.s_addr = htonl(inaddr); // automatically fill with my IP
+ memset(&(my_addr.sin_zero), '\0', 8); // zero the rest of the struct
+
+ if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr))
+ == -1) {
+ socket_error("bind");
+ closesocket(sockfd);
+ return ret;
+ }
+
+ /* listen for connections (allowing one pending connection) */
+ if (listen(sockfd, canfork?1:0) == -1) {
+ socket_error("listen");
+ closesocket(sockfd);
+ return ret;
+ }
+
+#if 0
+ unwind_protect::begin_frame("Fserver");
+ unwind_protect_bool (buffer_error_messages);
+ buffer_error_messages = true;
+#endif
+
+ sigchld_setup();
+ if (!debug && canfork) daemonize();
+
+ // XXX FIXME XXX want a 'sandbox' option which disables fopen, cd, pwd,
+ // system, popen ... Or maybe just an initial script to run for each
+ // connection, plus a separate command to disable specific functions.
+ STATUS("listening on port " << port);
+ while(1) { // main accept() loop
+ sin_size = sizeof(struct sockaddr_in);
+ STATUS("trying to accept");
+ if ((channel = accept(sockfd, (struct sockaddr *)&their_addr,
+ &sin_size)) == -1) {
+ // XXX FIXME XXX
+ // Linux is returning "Interrupted system call" when the
+ // child terminates. Until I figure out why, I can't use
+ // accept errors as a basis for breaking out of the listen
+ // loop, so instead print the octave PID so that I can kill
+ // it from another terminal.
+ STATUS("failed to accept" << std::endl
+ << "Octave pid: " << octave_syscalls::getpid() );
+ perror("accept");
+#if defined(_sgi)
+ break;
+#else
+ continue;
+#endif
+ }
+ STATUS("connected");
+
+ /* Simulate inet_ntoa */
+ const char *them = inet_ntoa(their_addr.sin_addr);
+ STATUS("server: got connection from " << them);
+
+ if (anyhostglob(hostlist,them)) {
+#ifdef HAVE_FORK
+ if (canfork) {
+ int pid = fork();
+ if (pid == -1) {
+ socket_error("fork");
+ break;
+ } else if (pid == 0) {
+ closesocket(sockfd); // child doesn't need listener
+ signal(SIGCHLD,SIG_DFL); // child doesn't need SIGCHLD signal
+ process_commands(channel);
+ STATUS("child is exitting");
+ exit(0);
+ }
+ } else {
+ process_commands(channel);
+ STATUS("server: connection closed");
+ }
+#else // !HAVE_FORK
+ process_commands(channel);
+ STATUS("server: connection closed");
+#endif // !HAVE_FORK
+ } else {
+ STATUS("server: connection refused.");
+ }
+
+ closesocket(channel);
+ channel = -1;
+ }
+
+ STATUS("could not read commands; returning");
+ closesocket(sockfd);
+ end_sockets();
+#if 0
+ unwind_protect::run_frame("Fserver");
+#endif
+ return ret;
+}
diff --git a/devel/server.txt b/devel/server.txt
new file mode 100644
index 0000000..985fedb
--- /dev/null
+++ b/devel/server.txt
@@ -0,0 +1,118 @@
+You can talk to octave directly from other environments over the tcp/ip.
+The protocol is not sophisticated.
+
+Here is what you can send to octave:
+
+!!!x length command
+
+ evaluate command in octave.
+ length is a 32-bit network order integer.
+ command is a string (without zero-terminator).
+
+!!!m length name
+
+ send matrix back to client.
+ length is a 32-bit network order integer.
+ name is a string (without zero-terminator).
+
+ I don't use the !!!m command to the server because it is the same as
+
+ !!!x send('name', matrix expression)
+
+ The latter is much more useful because you don't have to name
+ the data that you are sending across.
+
+!!!n length namelen name command
+
+ *** Not implemented ***
+ Evaluate the command in the namespace. This needs a lookup table
+ Map<string,symbol_table> namespace
+ and a command
+ evalin(symbol_table,command)
+ The function evalin pushes the given symbol table onto curr_sym_tab,
+ evaluates the command then pops the symbol table.
+
+Here is what you will receive from octave:
+
+!!!m length rows columns namelength name data
+
+ recieve matrix from server.
+ length,rows,columns,namelength are 32-bit network order integers.
+ name is a string (without zero-terminator).
+ data is an array of rows*columns server order double values.
+
+ This is sent in response to a !!!m matrix request or a
+ send('name',matrix) command.
+
+ The first thing I do when I open a connection is request a matrix
+ containing 1.0. If the result is not 1.0, I know that I need to
+ swap the data to convert from server order to client order doubles.
+
+!!!s length strlen namelen name str
+
+ receive string from server.
+ length, strlen, namelen are 32-bit network order integers.
+ name is a string (without zero-terminator).
+ str is a string (without zero-terminator).
+
+ This is sent in response to a send('name',string) command.
+
+!!!x length str
+
+ evaluate string in client.
+ length is a 32-bit network order integer.
+ str is a string (without zero-terminator).
+
+ This is sent in response to a send('str'). The contents of str
+ are completely arbitrary (and may indeed contain binary data). It is
+ up to the client to decide how they want to interpret these strings.
+
+!!!e length error
+
+ receive error from octave.
+ length is a 32-bit network order integer.
+ error is a string (without zero-terminator).
+
+ This is sent in response to a !!!x command which produced an error.
+
+Composite values can be decomposed into their constituent parts. E.g.,
+ structures:
+ for [v,k]=x, send([name,'.',k],v); end
+ complex arrays:
+ send([name,'.real'],real(x));
+ send([name,'.imag'],imag(x));
+ sparse arrays:
+ [v,i,j] = spfind(x);
+ send([name,'.i'],i);
+ send([name,'.j'],j);
+ send([name,'.v'],v);
+ cell arrays:
+ [nr,nc]=size(x);
+ for r=1:nr, for c=1:nc, send([name,sprintf('.%d.%d',r,c)],x{r,c}); end
+
+Note that the communication is completely asynchronous. I have a tcl client
+that processes server responses via fileevent. That means that responses from
+octave are not processed until tcl enters its event loop.
+
+To be sure that octave has processed a command I follow that command with a
+synchronization sequence:
+
+ set sync[incr syncid] 1
+ octave eval "send('unset sync$syncid')"
+ vwait sync$syncid
+
+In practice it is more complicated than that because I allow the
+syncronization command to time out just in case octave crashed out from
+underneath me, but the idea is the same.
+
+Using sockets gives you platform independence and network transparency,
+which is a big win. The only caveat is that winsock is slow. The best I
+can do with dedicated winsock code on my machine is .3 seconds to transfer
+a 1 Mb message. Under tcl/tk, it was closer to 1 second IIRC. A memory
+copy of the same size took less than 0.06 seconds IIRC.
+
+That is why I'm working on a way to embed octave into tcl. Hopefully
+it will be easy to embed in other environments as well.
+
+Paul Kienzle
+2003
diff --git a/devel/stringmatch.c b/devel/stringmatch.c
new file mode 100644
index 0000000..9ef2b7d
--- /dev/null
+++ b/devel/stringmatch.c
@@ -0,0 +1,242 @@
+/* Extracted from tclUtil.c
+
+Copyright (c) 1987-1993 The Regents of the University of California.
+Copyright (c) 1994-1998 Sun Microsystems, Inc.
+Copyright (c) 2001 by Kevin B. Kenny. All rights reserved.
+
+
+This software is copyrighted by the Regents of the University of
+California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
+Corporation and other parties. The following terms apply to all files
+associated with the software unless explicitly disclaimed in
+individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+GOVERNMENT USE: If you are acquiring this software on behalf of the
+U.S. government, the Government shall have only "Restricted Rights"
+in the software and related documentation as defined in the Federal
+Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
+are acquiring the software on behalf of the Department of Defense, the
+software shall be classified as "Commercial Computer Software" and the
+Government shall have only "Restricted Rights" as defined in Clause
+252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
+authors grant the U.S. Government and others acting in its behalf
+permission to use and distribute the software in accordance with the
+terms specified in this license.
+
+ */
+
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * StringCaseMatch --
+ *
+ * See if a particular string matches a particular pattern.
+ * Allows case insensitivity.
+ *
+ * Results:
+ * The return value is 1 if string matches pattern, and
+ * 0 otherwise. The matching operation permits the following
+ * special characters in the pattern: *?\[] (see the manual
+ * entry for details on what these mean).
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+#include <ctype.h> /* PAK: need tolower declaration */
+#define CONST const
+#define UCHAR (unsigned char)
+
+/* Note: restore original code from the Tcl tree if you want unicode
+ * support. */
+
+int
+StringCaseMatch(string, pattern, nocase)
+ CONST char *string; /* String. */
+ CONST char *pattern; /* Pattern, which may contain special
+ * characters. */
+ int nocase; /* 0 for case sensitive, 1 for insensitive */
+{
+ int p /*, charLen*/; /* PAK: unused */
+ /* CONST char *pstart = pattern; */ /* PAK: unused */
+ char ch1, ch2;
+
+ while (1) {
+ p = *pattern;
+
+ /*
+ * See if we're at the end of both the pattern and the string. If
+ * so, we succeeded. If we're at the end of the pattern but not at
+ * the end of the string, we failed.
+ */
+
+ if (p == '\0') {
+ return (*string == '\0');
+ }
+ if ((*string == '\0') && (p != '*')) {
+ return 0;
+ }
+
+ /*
+ * Check for a "*" as the next pattern character. It matches
+ * any substring. We handle this by calling ourselves
+ * recursively for each postfix of string, until either we
+ * match or we reach the end of the string.
+ */
+
+ if (p == '*') {
+ /*
+ * Skip all successive *'s in the pattern
+ */
+ while (*(++pattern) == '*') {}
+ p = *pattern;
+ if (p == '\0') {
+ return 1;
+ }
+ ch2 = (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
+ while (1) {
+ /*
+ * Optimization for matching - cruise through the string
+ * quickly if the next char in the pattern isn't a special
+ * character
+ */
+ if ((p != '[') && (p != '?') && (p != '\\')) {
+ if (nocase) {
+ while (*string) {
+ ch1 = *string;
+ if (ch2==ch1 || ch2==tolower(ch1)) break;
+ string++;
+ }
+ } else {
+ while (*string) {
+ ch1 = *string;
+ if (ch2==ch1) break;
+ string++;
+ }
+ }
+ }
+ if (StringCaseMatch(string, pattern, nocase)) {
+ return 1;
+ }
+ if (*string == '\0') {
+ return 0;
+ }
+ string++;
+ }
+ }
+
+ /*
+ * Check for a "?" as the next pattern character. It matches
+ * any single character.
+ */
+
+ if (p == '?') {
+ pattern++;
+ string++;
+ continue;
+ }
+
+ /*
+ * Check for a "[" as the next pattern character. It is followed
+ * by a list of characters that are acceptable, or by a range
+ * (two characters separated by "-").
+ */
+
+ if (p == '[') {
+ char startChar, endChar;
+
+ pattern++;
+ ch1 = (nocase ? tolower(UCHAR(*string)) : UCHAR(*string));
+ string++;
+ while (1) {
+ if ((*pattern == ']') || (*pattern == '\0')) {
+ return 0;
+ }
+ startChar =
+ (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
+ pattern++;
+ if (*pattern == '-') {
+ pattern++;
+ if (*pattern == '\0') {
+ return 0;
+ }
+ endChar =
+ (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern));
+ pattern++;
+ if (((startChar <= ch1) && (ch1 <= endChar))
+ || ((endChar <= ch1) && (ch1 <= startChar))) {
+ /*
+ * Matches ranges of form [a-z] or [z-a].
+ */
+
+ break;
+ }
+ } else if (startChar == ch1) {
+ break;
+ }
+ }
+ while (*pattern != ']') {
+ if (*pattern == '\0') {
+ pattern--;
+ break;
+ }
+ pattern++;
+ }
+ pattern++;
+ continue;
+ }
+
+ /*
+ * If the next pattern character is '\', just strip off the '\'
+ * so we do exact matching on the character that follows.
+ */
+
+ if (p == '\\') {
+ pattern++;
+ if (*pattern == '\0') {
+ return 0;
+ }
+ }
+
+ /*
+ * There's no special character. Just make sure that the next
+ * bytes of each string match.
+ */
+
+ ch1 = *string++;
+ ch2 = *pattern++;
+ if (nocase) {
+ if (tolower(ch1) != tolower(ch2)) {
+ return 0;
+ }
+ } else if (ch1 != ch2) {
+ return 0;
+ }
+ }
+}
diff --git a/inst/apply.m b/inst/apply.m
deleted file mode 100644
index a65c7d3..0000000
--- a/inst/apply.m
+++ /dev/null
@@ -1,102 +0,0 @@
-## Copyright (C) 2007, Muthiah Annamalai <muthiah.annamalai at uta.edu>
-##
-## This program is free software; you can redistribute it and/or modify it under
-## the terms of the GNU General Public License as published by the Free Software
-## Foundation; either version 3 of the License, or (at your option) any later
-## version.
-##
-## This program is distributed in the hope that it will be useful, but WITHOUT
-## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-## details.
-##
-## You should have received a copy of the GNU General Public License along with
-## this program; if not, see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn {Loadable Function} {@var{return_value} =} apply (@var{@@function_handle}, at var{cell_array_of_args})
-## @deftypefnx {Loadable Function} {@var{return_value} =} apply (@var{@@function_handle})
-## Apply calls the function @var{function_handle} with the arguments of the cell
-## array @var{cell_array_of_args} which contains the actual arguments arg1,arg2,..., argn
-## to the function, in that order. Apply invokes the function as
-## @var{function_handle}(arg1, arg2, ... ,argn), where the arguments are
-## extracted from each elements of the 1-row cell array @var{cell_array_of_args}.
-##
-## @emph{warning}: @code{apply} has been deprecated in favor of @code{arrayfun}
-## and @code{cellfun} for arrays and cells respectively. This function will be
-## removed from future versions of the 'miscellaneous' package".
-##
-## Apply also works on array of function handles if
-## @var{function_handle} is passed as a cell array of a handles; in this
-## case apply, evaluates each function (using the handle) with the same
-## arguments.
-##
-## The cell-array argument is optional second argument, in the form
-## of a 1-row with multiple elements. The elements of the cell-array
-## form the actual arguments supplied when invoking the function @var{function_handle}.
-##
-## The return value depends on the function invoked, and the validity of
-## the arguments.
-##
-## @example
-## z=apply(@@sqrt,cell([1,2; 3,4]));
-## z=apply(@@apply,cell(@@sqrt,cell([1,2; 3,4])));
-## apply(@@sum,cell([1,2,3,4]))
-## apply(@@max,cell([1,2,3,4]))
-## apply(@@min,cell([1,2,3,4]))
-## @end example
-##
-##
-## In first case, apply computes the sqrt of the matrix [1,2; 3,4];
-## The second example is meta-apply, using apply on itself.
-## The rest of the examples invoke sum, max, min respectively.
-## @end deftypefn
-##
-
-function rval=apply(fun_handle,cell_array)
-
- persistent warned = false;
- if (! warned)
- warned = true;
- warning ("Octave:deprecated-function",
- "apply has been deprecated, and will be removed in the future. Use `arrayfun' or `cellfun' instead.");
- endif
-
- if (nargin == 0)
- print_usage();
- error("apply(): needs at least 1 argument, see usage");
- elseif( nargin < 2)
- if iscell(fun_handle)
- for idx=1:length(fun_handle)
- rval(idx)=feval(@feval,fun_handle{idx});
- end
- else
- rval=feval(@feval,fun_handle);
- end
- return
- elseif(!iscell(cell_array))
- error("apply(): needs second argument, to be a cell-array");
- end
-
-
- if iscell(fun_handle)
- for idx=1:length(fun_handle)
- rval(idx)=feval(@feval,fun_handle{idx},cell_array{:});
- end
- return
- end
-
- rval=feval(@feval,fun_handle,cell_array{:});
-end
-%!
-%!assert(apply({@min, @max, @mean},{[1:10]}),[ 1.0000 ,10.0000 ,5.5000])
-%!assert(apply(@min,{[1,2,3,4]}),1)
-%!assert(apply(@dot,{[1,2],[3,4]}),11)
-%!assert(apply(@min,{[1, 3]}),1)
-%!assert(apply(@sum,{[1:10]}),55)
-%!assert(apply(@sqrt,{[1,2; 3,4]}),sqrt([1,2;3,4]))
-%!assert(apply(@apply,{@sqrt,{[1,2; 3,4]}}),sqrt([1,2;3,4]))
-%!assert(apply(@sum,{[1,2,3,4]}),10)
-%!assert(apply(@max,{[1,2,3,4]}),4)
-%!assert(apply(@min,{[1,2,3,4]}),1)
-%!
diff --git a/inst/asci.m b/inst/asci.m
index b18cfdc..b6bfb29 100644
--- a/inst/asci.m
+++ b/inst/asci.m
@@ -15,74 +15,19 @@
## -*- texinfo -*-
## @deftypefn {Function} {[@var{string}] =} asci ([@var{columns}])
-## Print ASCI table.
+## Print ASCII table.
##
-## If this function is called without any input argument and without any output
-## argument then print a nice ASCI-table (excluding special characters with
-## hexcode 0x00 to 0x20) on screen with four columns per default. If this
-## function is called with one output argument then return an ASCI-table string
-## and don't print anything on screen. Finally, if this function is called with
-## one input argument of type scalar then either print (no output argument) or
-## return (one output argument) an ASCI-table with a number of columns given in
-## @var{columns}.
+## This function has been renamed @code{ascii} (note double i at the end of
+## its name) and will be removed from future versions of the miscellaneous
+## package. Please refer to @code{ascii} help text for its documentation.
##
-## For example,
-## @example
-## A = asci (3);
-## disp (A);
-## @end example
## @end deftypefn
function [varargout] = asci (varargin)
-
- %# Check number and types of input arguments
- if (nargin == 0)
- vcol = 4;
- elseif (isnumeric (varargin{1}) && \
- isequal (size (varargin{1}), [1, 1]))
- vcol = floor (varargin{1});
- else
- print_usage ();
- endif
-
- %# First char is #32 (0x20) and last char is #128 (0x80)
- vtab = "";
- voff = floor ((128 - 32) / vcol);
-
- %# Print a first row for the and underline that row
- for vcnt = 1:vcol
- vtab = sprintf ("%s Dec Hex Chr ", vtab);
- endfor
- vtab = sprintf ("%s\n", vtab);
-
- for vcnt = 1:vcol
- vtab = sprintf ("%s-------------", vtab);
- endfor
- vtab = sprintf ("%s\n", vtab);
-
- %# Create the lines and columns of the asci table
- for vpos = 32:(32+voff)
- for vcnt = 1:vcol
- vact = (vcnt-1)*voff+vpos;
- vstr = {num2str(vact), dec2hex(vact), char(vact)};
- for vctn = 1:length (vstr)
- vtab = sprintf ("%s %3s", vtab, vstr{vctn});
- endfor
- vtab = sprintf ("%s ", vtab);
- endfor
- vtab = sprintf ("%s\n", vtab);
- endfor
- vtab = sprintf ("%s\n", vtab);
-
- %# Print table to screen or return it to output argument
- if (nargout == 0)
- printf ("%s", vtab);
- elseif (nargout == 1)
- varargout{1} = vtab;
+ persistent warned = false;
+ if (! warned)
+ warned = true;
+ warning ("asci() has been deprecated. Use ascii (note double i in the name) instead");
endif
+ [varargout{1:nargout}] = ascii (varargin{:});
endfunction
-
-%!test
-%! A = asci ();
-%!test
-%! A = asci (2);
diff --git a/inst/ascii.m b/inst/ascii.m
new file mode 100644
index 0000000..1d04cda
--- /dev/null
+++ b/inst/ascii.m
@@ -0,0 +1,93 @@
+## Copyright (C) 2008 Thomas Treichl <thomas.treichl at gmx.net>
+## Copyright (C) 2013 Carnë Draug <carandraug at octave.org>
+##
+## This program is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free Software
+## Foundation; either version 3 of the License, or (at your option) any later
+## version.
+##
+## This program is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public License along with
+## this program; if not, see <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} ascii ()
+## @deftypefnx {Function File} {} ascii (@var{columns})
+## Print ASCII table.
+##
+## If this function is called without any input argument and without any output
+## argument then prints a nice ASCII-table (excluding special characters with
+## hexcode 0x00 to 0x20). The input argument @var{columns} specifies the
+## number of columns and defaults to 4.
+##
+## If it is called with one output argument then return the ASCII table as
+## a string without displaying anything. Run @code{demo ascii} for examples.
+##
+## @seealso{char, isascii, toascii}
+## @end deftypefn
+
+function table = ascii (vcol = 4)
+
+ if (nargin > 1)
+ print_usage ();
+ elseif (! isnumeric (vcol) || ! isscalar (vcol) ||
+ fix (vcol) != vcol || vcol < 1)
+ error ("ascii: COLUMNS must be a positive integer");
+ endif
+
+ ## First char is #32 (0x20) and last char is #128 (0x80)
+ voff = floor ((128 - 32) / vcol);
+
+ ## Print a first row for the and underline that row
+ vtab = [repmat(" Dec Hex Chr ", [1 vcol])
+ repmat("-------------", [1 vcol])];
+
+ ## Create the lines and columns of the asci table
+ for vpos = 32:(32+voff)
+ vline = "";
+ for vcnt = 1:vcol
+ vact = (vcnt-1)*voff+vpos;
+ vstr = {num2str(vact), dec2hex(vact), char(vact)};
+ vline = [vline sprintf(" %3s", vstr{1:length (vstr)}) " "];
+ endfor
+ vtab = [vtab; vline];
+ endfor
+
+ ## Print table to screen or return it to output argument
+ if (nargout == 0)
+ display (vtab);
+ else
+ table = vtab;
+ endif
+endfunction
+
+%!demo
+%! ## Display pretty table of conversion between ASCII, decimal and hexadecimal
+%! ascii ()
+
+%!demo
+%! ## Display 6 columns table of conversion between ASCII, decimal and hexadecimal
+%! ascii (6)
+
+%!demo
+%! ## Return a string with a pretty formatted table (but don't display it)
+%! table = ascii (1)
+%! display (table (65, :));
+
+%!test
+%! str = ascii (5);
+%! assert (str(1,:), " Dec Hex Chr Dec Hex Chr Dec Hex Chr Dec Hex Chr Dec Hex Chr ");
+%! assert (str(4,:), " 33 21 ! 52 34 4 71 47 G 90 5A Z 109 6D m ");
+
+%!test
+%! str = ascii (1);
+%! assert (str(1,:), " Dec Hex Chr ");
+%! assert (str(6,:), " 35 23 # ");
+
+%!error <positive> ascii (0)
+%!error <integer> ascii (4.5)
+%!error <COLUMNS> ascii ("dec")
diff --git a/inst/chebyshevpoly.m b/inst/chebyshevpoly.m
index da57971..d607d8d 100644
--- a/inst/chebyshevpoly.m
+++ b/inst/chebyshevpoly.m
@@ -18,11 +18,11 @@
##
## Compute the coefficients of the Chebyshev polynomial, given the
## @var{order}. We calculate the Chebyshev polynomial using the recurrence
-## relations, Tn+1(x) = (2*x*Tn(x) - Tn-1(x)). The @var{kind} can set to
-## compute the first or second kind chebyshev polynomial.
+## relations Tn+1(x) = (2*x*Tn(x) - Tn-1(x)). The @var{kind} can be set to
+## compute the first or second kind Chebyshev polynomial.
##
-## If the value @var{x} is specified, the polynomial is also evaluated,
-## otherwise just the return the coefficients of the polynomial are returned.
+## If the value @var{x} is specified, the polynomial is evaluated at @var{x},
+## otherwise just the coefficients of the polynomial are returned.
##
## This is NOT the generalized Chebyshev polynomial.
##
@@ -64,3 +64,12 @@ function h=chebyshevpoly(kind,order,val)
endif
endfunction
+
+%!test
+%! x = logspace(-2, 2, 30);
+%! maxdeg = 10;
+%! for n = 1:maxdeg
+%! assert( chebyshevpoly(1,n,cos(x)), cos(n*x), 1E3*eps )
+%! assert( chebyshevpoly(2,n,cos(x)) .* sin(x), sin((n+1)*x), 1E3*eps )
+%! endfor
+
diff --git a/inst/map.m b/inst/map.m
deleted file mode 100644
index 8551752..0000000
--- a/inst/map.m
+++ /dev/null
@@ -1,96 +0,0 @@
-## Copyright (C) 2003 Tomer Altman <taltman at lbl.gov>
-## Copyright (C) 2007 Muthiah Annamalai <muthiah.annamalai at uta.edu>
-## Copyright (C) 2012 Carnë Draug <carandraug+dev at gmail.com>
-## Copyright (C) 2012 Juan Pablo Carbajal <carbajal at ifi.uzh.ch>
-##
-## This program is free software; you can redistribute it and/or modify it under
-## the terms of the GNU General Public License as published by the Free Software
-## Foundation; either version 3 of the License, or (at your option) any later
-## version.
-##
-## This program is distributed in the hope that it will be useful, but WITHOUT
-## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-## details.
-##
-## You should have received a copy of the GNU General Public License along with
-## this program; if not, see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn{Function File} {@var{result} =} map (@var{function}, @var{iterable}, @dots{})
-## Apply @var{function} to every item of @var{iterable} and return the results.
-##
-## @code{map}, like Lisp's ( & numerous other language's ) function for
-## iterating the result of a function applied to each of the data
-## structure's elements in turn. The results are stored in the
-## corresponding input's place. For now, just will work with cells and
-## matrices, but support for structs are intended for future versions.
-## Also, only "prefix" functions ( like @code{min (a, b, c, ...)} ) are
-## supported. FUN_HANDLE can either be a function name string or a
-## function handle (recommended).
-##
-## Example:
-## @example
-##
-## octave> A
-## A
-## @{
-## [1,1] = 0.0096243
-## [2,1] = 0.82781
-## [1,2] = 0.052571
-## [2,2] = 0.84645
-## @}
-## octave> B
-## B =
-## @{
-## [1,1] = 0.75563
-## [2,1] = 0.84858
-## [1,2] = 0.16765
-## [2,2] = 0.85477
-## @}
-## octave> map(@@min,A,B)
-## ans =
-## @{
-## [1,1] = 0.0096243
-## [2,1] = 0.82781
-## [1,2] = 0.052571
-## [2,2] = 0.84645
-## @}
-## @end example
-## @seealso{reduce, match}
-## @end deftypefn
-
-function return_type = map (fun_handle, data_struct, varargin)
-
- persistent warned = false;
- if (! warned)
- warned = true;
- warning ("Octave:deprecated-function",
- "map has been deprecated, and will be removed in the future. Use `arrayfun' or `cellfun' instead.");
- endif
-
- if (nargin < 2)
- print_usage;
- elseif (!(isnumeric (data_struct) || iscell (data_struct)))
- error ("second argument must be either a matrix or a cell object");
- endif
-
- if (isa (fun_handle, "function_handle"))
- ##do nothing
- elseif (ischar (fun_handle))
- fun_handle = str2func (fun_handle);
- else
- error ("fun_handle must either be a function handle or the name of a function");
- endif
-
- if (iscell (data_struct))
- return_type = cellfun (fun_handle, data_struct,varargin{:});
- else
- return_type = arrayfun (fun_handle, data_struct,varargin{:});
- endif
-
-endfunction
-
-%!assert(map(@min,[1 2 3 4 5],[5 4 3 2 1]), [1 2 3 2 1])
-%!assert(map(@min,rand(1,5),[0 0 0 0 0]), [0 0 0 0 0])
-%!assert(map(@(x,y) (sin(x).^2 + cos(y).^2),-pi:0.5:+pi,-pi:0.5:+pi),ones(1,13))
diff --git a/inst/physical_constant.py b/inst/physical_constant.py
new file mode 100755
index 0000000..5b289e5
--- /dev/null
+++ b/inst/physical_constant.py
@@ -0,0 +1,180 @@
+#!/usr/bin/python
+## coding: utf-8
+## Copyright (C) 2007 Muthiah Annamalai <muthiah.annamalai at uta.edu>
+## Copyright (C) 2012 Carnë Draug <carandraug+dev at gmail.com>
+##
+## This program is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free Software
+## Foundation; either version 3 of the License, or (at your option) any later
+## version.
+##
+## This program is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+## details.
+##
+## You should have received a copy of the GNU General Public License along with
+## this program; if not, see <http://www.gnu.org/licenses/>.
+
+## This is the code generator that works on the NIST file available for download
+## at http://physics.nist.gov/cuu/Constants/Table/allascii.txt It downloads and
+## parses the file automatically, only needs as argument the directory where to
+## save the function file (if no arguments are supplied, it saves file in the
+## directory as the script)
+
+import time
+import sys
+import os.path
+import urllib
+
+def get_header ():
+ header = [
+ '## Copyright (C) 2007 Muthiah Annamalai <muthiah.annamalai at uta.edu>',
+ '## Copyright (C) 2012 Carnë Draug <carandraug+dev at gmail.com>',
+ '##',
+ '## This program is free software; you can redistribute it and/or modify it under',
+ '## the terms of the GNU General Public License as published by the Free Software',
+ '## Foundation; either version 3 of the License, or (at your option) any later',
+ '## version.',
+ '##',
+ '## This program is distributed in the hope that it will be useful, but WITHOUT',
+ '## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or',
+ '## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more',
+ '## details.',
+ '##',
+ '## You should have received a copy of the GNU General Public License along with',
+ '## this program; if not, see <http://www.gnu.org/licenses/>.',
+ '',
+ '## -*- texinfo -*-',
+ '## @deftypefn {Function File} {[@var{names}] =} physical_constant',
+ '## @deftypefnx {Function File} {[@var{val}, @var{uncertainty}, @var{unit}] =} physical_constant (@var{name})',
+ '## @deftypefnx {Function File} {[@var{constants}] =} physical_constant ("all")',
+ '## Get physical constant @var{arg}.',
+ '##',
+ '## If no arguments are given, returns a cell array with all possible @var{name}s.',
+ '## Alternatively, @var{name} can be `all\' in which case @var{val} is a structure',
+ '## array with 4 fields (name, value, uncertainty, units).',
+ '##',
+ '## Since the long list of values needs to be parsed on each call to this function',
+ '## it is much more efficient to store the values in a variable rather make multiple',
+ '## calls to this function with the same argument',
+ '##',
+ '## The values are the ones recommended by CODATA. This function was autogenerated',
+ '## on ' + str (time.ctime ()) + ' from NIST database at @uref{http://physics.nist.gov/constants}',
+ '## @end deftypefn',
+ '',
+ '## DO NOT EDIT THIS FILE',
+ '## This function file is generated automatically by physical_constant.py',
+ ]
+ return header
+
+
+def get_constants_table ():
+ """Download and parse the current list of constants from NIST website"""
+
+ url = 'http://physics.nist.gov/cuu/Constants/Table/allascii.txt'
+ ## the ideal would be to parse the whole file in a smart way with regexp
+ ## rather than relying on a fixed format which already broke this script
+ ## before. By having the values here rather than hardcoded, it will make
+ ## at least easier to fix it in the future. Even better would be if they
+ ## supplied us a XML rather than a ASCII table. These are the guys from
+ ## NIST to contact in case of problems:
+ ## Barry N. Taylor <barry.taylor at nist.gov>
+ ## David Newell <david.newell at nist.gov>
+ ## Peter Mohr <mohr at nist.gov>
+ ini_skip = 10 # number of lines to skip (header)
+ length_name = 60 # max length of the `quantity' column
+ length_value = 25 # max length of the `value' column
+ length_uncert = 25 # max length of the `uncertainty' column
+ length_unit = 15 # max length of the `unit' column
+
+ ascii = urllib.urlopen(url).read().split('\r\n')[ini_skip:]
+ table = {}
+ for line in ascii:
+ if not line: continue # skip empty lines (at least the end of file)
+ name = line[: length_name].strip()
+ line = line[length_name :]
+ value = line[: length_value].strip()
+ line = line[length_value :]
+ uncert = line[:length_uncert].strip()
+ line = line[length_uncert:]
+ unit = line[: length_unit].strip()
+
+ ## do NOT adjust name. Old code would have description (the complete string)
+ ## and name (which would have some changes). However, some constants that
+ ## were defined twice (for different conditions) would appear only once
+ ## without information on the conditions. See the old revisions
+
+ ## adjust value and uncertainty
+ for old, new in {
+ ' ' : '', # remove spaces
+ '...' : '', # is decimal
+ }.items():
+ value = value.replace (old, new)
+ uncert = uncert.replace (old, new)
+
+ uncert = uncert.replace ('(exact)', '0.0')
+ table[name] = [value, uncert, unit]
+ return table
+
+
+## Start script
+table = get_constants_table ()
+
+## if there's any argument, assume it's directory and save function there
+## otherwise save function file on same directory as script
+if len (sys.argv) > 1:
+ filepath = os.path.join(os.path.dirname (sys.argv[1]), 'physical_constant.m')
+else:
+ filepath = os.path.join(os.path.dirname (sys.argv[0]), 'physical_constant.m')
+
+sys.stdout = open (filepath, "w")
+
+for line in get_header():
+ print line
+
+print '''
+function [rval, uncert, unit] = physical_constant (arg)
+
+ persistent unit_data;
+ if (isempty(unit_data))
+ unit_data = get_data;
+ endif
+
+ if (nargin > 1 || (nargin == 1 && !ischar (arg)))
+ print_usage;
+ elseif (nargin == 0)
+ rval = reshape ({unit_data(:).name}, size (unit_data));
+ return
+ elseif (nargin == 1 && strcmpi (arg, "all"))
+ rval = unit_data;
+ return
+ endif
+
+ val = reshape ({unit_data(:).name}, size (unit_data));
+ map = strcmpi (val, arg);
+ if (any (map))
+ val = unit_data(map);
+ rval = val.value;
+ uncert = val.uncertainty;
+ unit = val.units;
+ else
+ error ("No constant with name '%s' found", arg)
+ endif
+endfunction
+'''
+
+print 'function unit_data = get_data'
+index = 1
+#for name in sorted (table.keys()):
+for name, values in sorted(table.items()):
+ print ' unit_data(' + str (index) + ').name = "' + name + '";'
+ print ' unit_data(' + str (index) + ').value = ' + str (values[0]) + ';'
+ print ' unit_data(' + str (index) + ').uncertainty = ' + str (values[1]) + ';'
+ print ' unit_data(' + str (index) + ').units = "' + values[2] + '";'
+ print ''
+ index += 1
+print 'endfunction'
+
+for name, values in sorted(table.items()):
+ print '%!assert(physical_constant("' + name + '"), '+ str (values[0]) +');'
diff --git a/inst/private/strsplit.m b/inst/private/strsplit.m
new file mode 100644
index 0000000..897969f
--- /dev/null
+++ b/inst/private/strsplit.m
@@ -0,0 +1,125 @@
+## Copyright (C) 2009-2012 Jaroslav Hajek
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING. If not, see
+## <http://www.gnu.org/licenses/>.
+##
+## FIXME: this file is here to avoid conflicts with new Octave versions. Matlab
+## has recently added strplit function (used to exist in Octave only) but
+## their syntax is not compatible with ours. Rather than timing the
+## release of each octave forge package that used strsplit, a copy of the
+## old version was placed as private. Once the new Octave version is
+## released, this file can be removed, and the calls to strsplit fixed.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{cstr}] =} strsplit (@var{s}, @var{sep})
+## @deftypefnx {Function File} {[@var{cstr}] =} strsplit (@var{s}, @var{sep}, @var{strip_empty})
+## Split the string @var{s} using one or more separators @var{sep} and return
+## a cell array of strings. Consecutive separators and separators at
+## boundaries result in empty strings, unless @var{strip_empty} is true.
+## The default value of @var{strip_empty} is false.
+##
+## 2-D character arrays are split at separators and at the original column
+## boundaries.
+##
+## Example:
+##
+## @example
+## @group
+## strsplit ("a,b,c", ",")
+## @result{}
+## @{
+## [1,1] = a
+## [1,2] = b
+## [1,3] = c
+## @}
+##
+## strsplit (["a,b" ; "cde"], ",")
+## @result{}
+## @{
+## [1,1] = a
+## [1,2] = b
+## [1,3] = cde
+## @}
+## @end group
+## @end example
+## @seealso{strtok}
+## @end deftypefn
+
+function cstr = strsplit (s, sep, strip_empty = false)
+
+ if (nargin < 2 || nargin > 3)
+ print_usage ();
+ elseif (! ischar (s) || ! ischar (sep))
+ error ("strsplit: S and SEP must be string values");
+ elseif (! isscalar (strip_empty))
+ error ("strsplit: STRIP_EMPTY must be a scalar value");
+ endif
+
+ if (isempty (s))
+ cstr = cell (size (s));
+ else
+ if (rows (s) > 1)
+ ## For 2-D arrays, add separator character at line boundaries
+ ## and transform to single string
+ s(:, end+1) = sep(1);
+ s = reshape (s.', 1, numel (s));
+ s(end) = [];
+ endif
+
+ ## Split s according to delimiter
+ if (isscalar (sep))
+ ## Single separator
+ idx = find (s == sep);
+ else
+ ## Multiple separators
+ idx = strchr (s, sep);
+ endif
+
+ ## Get substring lengths.
+ if (isempty (idx))
+ strlens = length (s);
+ else
+ strlens = [idx(1)-1, diff(idx)-1, numel(s)-idx(end)];
+ endif
+ ## Remove separators.
+ s(idx) = [];
+ if (strip_empty)
+ ## Omit zero lengths.
+ strlens = strlens(strlens != 0);
+ endif
+
+ ## Convert!
+ cstr = mat2cell (s, 1, strlens);
+ endif
+
+endfunction
+
+
+%!assert (strsplit ("road to hell", " "), {"road", "to", "hell"})
+%!assert (strsplit ("road to^hell", " ^"), {"road", "to", "hell"})
+%!assert (strsplit ("road to--hell", " -", true), {"road", "to", "hell"})
+%!assert (strsplit (["a,bc";",de"], ","), {"a", "bc", char(ones(1,0)), "de "})
+%!assert (strsplit (["a,bc";",de"], ",", true), {"a", "bc", "de "})
+%!assert (strsplit (["a,bc";",de"], ", ", true), {"a", "bc", "de"})
+
+%% Test input validation
+%!error strsplit ()
+%!error strsplit ("abc")
+%!error strsplit ("abc", "b", true, 4)
+%!error <S and SEP must be string values> strsplit (123, "b")
+%!error <S and SEP must be string values> strsplit ("abc", 1)
+%!error <STRIP_EMPTY must be a scalar value> strsplit ("abc", "def", ones (3,3))
+
diff --git a/inst/temp_name.m b/inst/temp_name.m
deleted file mode 100644
index d743168..0000000
--- a/inst/temp_name.m
+++ /dev/null
@@ -1,71 +0,0 @@
-## Copyright (C) 2002 Etienne Grossmann <etienne at egdn.net>
-##
-## This program is free software; you can redistribute it and/or modify it under
-## the terms of the GNU General Public License as published by the Free Software
-## Foundation; either version 3 of the License, or (at your option) any later
-## version.
-##
-## This program is distributed in the hope that it will be useful, but WITHOUT
-## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-## details.
-##
-## You should have received a copy of the GNU General Public License along with
-## this program; if not, see <http://www.gnu.org/licenses/>.
-
-## -*- texinfo -*-
-## @deftypefn{Function File} {@var{n} = } temp_name ( rootname, quick )
-## @cindex
-## name = temp_name(rootname, quick=1) - Return a name that is not used
-##
-## Returns a name, suitable for defining a new function, script or global
-## variable, of the form
-##
-## [rootname,number]
-##
-## Default rootname is "temp_name_"
-##
-## "quick" is an optional parameter, which defaults to 1. If it is false,
-## temp_name() will find the smallest acceptable number for the name.
-## Otherwise, a hopefully quicker method is used.
-##
-## @end deftypefn
-
-function n = temp_name (rootname, quick)
-
- persistent warned = false;
- if (! warned)
- warned = true;
- warning ("Octave:deprecated-function",
- "temp_name has been deprecated, and will be removed in the future. Use `tmpnam' instead.");
- endif
-
- ### Keep track of previously asked names
- persistent cnt = struct ("dummy",0);
-
- if nargin<1 || !length(rootname), rootname = "temp_name_" ; endif
-
- if nargin<2, quick = 1; endif
-
- if quick
- if ! isfield (cnt, rootname)
- cnt.(rootname) = 0;
- c = 0 ;
- else
- c = cnt.(rootname) ;
- endif
- else
- c = 0;
- endif
-
- n = sprintf ([rootname,"%i"], c);
-
- while exist (n),
- c++ ;
- n = sprintf ([rootname,"%i"], c);
- endwhile
-
- if quick
- cnt.(rootname) = c ;
- endif
-endfunction
diff --git a/inst/units.m b/inst/units.m
index 2951203..fc89496 100644
--- a/inst/units.m
+++ b/inst/units.m
@@ -1,4 +1,5 @@
## Copyright (C) 2005 Carl Osterwisch <osterwischc at asme.org>
+## Copyright (C) 2013 Carnë Draug <carandraug at octave.org>
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
@@ -14,7 +15,7 @@
## this program; if not, see <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
-## @deftypefn {Function File} {} units (@var{fromUnit}, @var{toUnit})
+## @deftypefn {Function File} {} units (@var{fromUnit}, @var{toUnit})
## @deftypefnx {Function File} {} units (@var{fromUnit}, @var{toUnit}, @var{x})
## Return the conversion factor from @var{fromUnit} to @var{toUnit} measurements.
##
@@ -23,8 +24,7 @@
## measurement units. See @code{man units} or
## @url{http://www.gnu.org/software/units} for more information.
## If the optional argument @var{x} is supplied, return that argument
-## multiplied by the conversion factor. Nonlinear conversions
-## such as Fahrenheit to Celsius are not currently supported. For example, to
+## multiplied by the conversion factor. For example, to
## convert three values from miles per hour into meters per second:
##
## @example
@@ -35,21 +35,128 @@
## @end example
## @end deftypefn
-function y = units(fromUnit, toUnit, x)
- if 2 > nargin || 3 < nargin || !ischar(fromUnit) || !ischar(toUnit)
- print_usage;
+function y = units (fromUnit, toUnit, x = 1)
+
+ if (nargin < 2 || nargin > 3)
+ print_usage ();
+ elseif (! ischar (fromUnit))
+ error ("units: FromUNIT must be a string");
+ elseif (! ischar (toUnit))
+ error ("units: ToUNIT must be a string");
+ elseif (! isnumeric (x))
+ error ("units: X must be numeric");
+ endif
+
+ persistent available = check_units ();
+ persistent compact = has_compact_option ();
+ persistent template = template_cmd (compact);
+
+ ## We have to insert the template on the string this way, because it may have
+ ## a %%.16g which we may want to keep for later use in non-linear conversion
+ cmd = sprintf ([template ' "%s" "%s"'], fromUnit, toUnit);
+ [status, rawoutput] = system (cmd);
+ if (status)
+ error ("units: %s", rawoutput);
+ endif
+
+ if (! compact)
+ ## No compact or one-line option, we need to find the conversion factor
+ ## from the text ourselves
+ ini_factor = index (rawoutput, "*");
+ end_factor = index (rawoutput, "\n") - 1;
+ if (isempty (ini_factor) || ini_factor > end_factor)
+ error ("units: unable to parse output from units:\n%s", rawoutput);
endif
+ rawoutput = rawoutput(ini_factor+1:end_factor);
+ endif
- [status, rawoutput] = system(sprintf('units "%s" "%s"', fromUnit, toUnit), 1);
- (0 == status) || error([rawoutput,
- 'Verify that GNU units is installed in the current path.']);
-
- i = index(rawoutput, "*");
- j = index(rawoutput, "\n") - 1;
- i && (i < j) || error('parsing units output "%s"', rawoutput);
+ c_factor = str2double (rawoutput);
+ if (any (isnan (c_factor(:))))
+ if (index (rawoutput, "=") || index (rawoutput, "+") ||
+ index (rawoutput, "-") || index (rawoutput, "*") ||
+ index (rawoutput, "/"))
+ ## If there's a mathematical operator in the output, it may be a formula
+ ## for a non-linear conversion such as "tempC(x) = x K + stdtemp"
+ ## We don't check for the equal only because some versions of units data
+ ## file (not version of the units application, see bug #38270) have a
+ ## very different syntax.
+ if (nargin < 3)
+ ## for a non-linear unit conversion, we need a value to convert
+ error ("units: argument X is required for non-linear unit conversion");
+ endif
+ y = zeros (size (x));
+ template_non_linear = function_template (template, fromUnit, toUnit);
+ for ind = 1:numel(y)
+ cmd = sprintf (template_non_linear, x(ind));
+ [status, rawoutput] = system (cmd);
+ if (status)
+ error ("units: %s", rawoutput);
+ endif
+ y(ind) = str2double (rawoutput);
+ if (isnan (y(ind)))
+ error ("units unable to parse non-linear conversion `%s'", rawoutput);
+ endif
+ endfor
+ else
+ error ("units: unable to parse output `%s' from units.", rawoutput);
+ endif
+ else
+ y = x * c_factor;
+ endif
+endfunction
+
+function fpath = check_units ()
+ ## See bug #38270 about why we're checking this way.
+ fpath = file_in_path (getenv ("PATH"), sprintf ("units%s", octave_config_info ("EXEEXT")));
+ if (isempty (fpath))
+ error ("units: %s\nVerify that GNU units is installed in the current path.",
+ rawoutput);
+ endif
+endfunction
- exist("x", "var") || (x = 1);
- eval(['y = x', rawoutput(i:j), ';'])
+function compact = has_compact_option ()
+ compact = true;
+ ## We must give some units to convert because the only thing that would
+ ## make it not do any work (--version) actually exits with exit value 3
+ [status, rawoutput] = system ('units --compact --one-line "in" "cm"');
+ if (status)
+ compact = false;
+ endif
+endfunction
+
+function template = template_cmd (compact)
+ ## do we have the format option?
+ format = true;
+ [status, rawoutput] = system ('units --output-format "%.16g" "in" "cm"');
+ if (status)
+ format = false;
+ endif
+
+ template = "units ";
+ if (format)
+ template = [template '--output-format "%%.16g" '];
+ endif
+ if (compact)
+ template = [template '--compact --one-line '];
+ endif
+endfunction
+
+## Test the correct way to do non-linear conversion.
+function template = function_template (template, from, to)
+
+ ## First try the most common syntax distributed with the most recent
+ ## units.dat file using parentheses "from(x)" as if it was a function.
+ if (! system (sprintf ([template '"%s(1)" "%s"'], from, to), true))
+ template = sprintf ('%s "%s(%%.16g)" "%s"', template, from, to);
+
+ ## If it doesn't work, try the oldest syntax of the style "x from"
+ elseif (! system (sprintf ([template '"100 %s" "%s"'], from, to), true))
+ template = sprintf ('%s "%%.16g %s" "%s"', template, from, to);
+
+ ## If it doesn't work, give up
+ else
+ error ("units: unable to identify correct syntax for non-linear conversion");
+ endif
endfunction
%!demo
@@ -58,4 +165,11 @@ endfunction
%! c.unit = 'kg';
%! c.value = units(a.unit, c.unit, a.value) + units(b.unit, c.unit, b.value)
-%!assert( units("in", "mm"), 25.4 )
+# test normal usage
+%!assert (units ("in", "mm"), 25.4)
+# multiple values
+%!assert (units ("in", "mm", [5 7; 8 9]), 25.4 * [5 7; 8 9])
+# a non-linear conversion
+%!assert (units ("tempC", "tempF", 100), 212)
+%!error <non-linear unit conversion> units ("tempC", "tempF")
+
diff --git a/src/Makefile b/src/Makefile
index b0cb2a9..c4cdd53 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,4 +1,4 @@
-MKOCTFILE = mkoctfile -Wall
+MKOCTFILE ?= mkoctfile -Wall
PROGS = $(patsubst %.cc,%.oct,$(wildcard *.cc))
diff --git a/src/bootstrap b/src/bootstrap
new file mode 100755
index 0000000..909401f
--- /dev/null
+++ b/src/bootstrap
@@ -0,0 +1,6 @@
+#!/bin/bash
+## Octave-Forge: miscellaneous package bootstrap script
+## Run this to generate the configure script
+
+set -e # halt if unhandled error
+autoconf # generate configure script
diff --git a/src/configure b/src/configure
new file mode 100755
index 0000000..e5aff6d
--- /dev/null
+++ b/src/configure
@@ -0,0 +1,3522 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for Octave-Forge miscellaneous package 1.2.0+.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf at gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='Octave-Forge miscellaneous package'
+PACKAGE_TARNAME='octave-forge-miscellaneous-package'
+PACKAGE_VERSION='1.2.0+'
+PACKAGE_STRING='Octave-Forge miscellaneous package 1.2.0+'
+PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='UNITS_AVAILABLE
+ac_ct_CXX
+CXXFLAGS
+CXX
+EGREP
+GREP
+CPP
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures Octave-Forge miscellaneous package 1.2.0+ to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root
+ [DATAROOTDIR/doc/octave-forge-miscellaneous-package]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of Octave-Forge miscellaneous package 1.2.0+:";;
+ esac
+ cat <<\_ACEOF
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to the package provider.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+Octave-Forge miscellaneous package configure 1.2.0+
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by Octave-Forge miscellaneous package $as_me 1.2.0+, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+## these are C headers required for text_waitbar
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "term.h" "ac_cv_header_term_h" "$ac_includes_default"
+if test "x$ac_cv_header_term_h" = xyes; then :
+
+else
+ ac_fn_c_check_header_mongrel "$LINENO" "termcap.h" "ac_cv_header_termcap_h" "$ac_includes_default"
+if test "x$ac_cv_header_termcap_h" = xyes; then :
+
+else
+ as_fn_error $? "Unable to find ncurses library headers." "$LINENO" 5
+
+fi
+
+
+
+fi
+
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+else
+ CXXFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+## this is required for the units.m function
+# Extract the first word of "units", so it can be a program name with args.
+set dummy units; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_UNITS_AVAILABLE+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$UNITS_AVAILABLE"; then
+ ac_cv_prog_UNITS_AVAILABLE="$UNITS_AVAILABLE" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_UNITS_AVAILABLE="yes"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+UNITS_AVAILABLE=$ac_cv_prog_UNITS_AVAILABLE
+if test -n "$UNITS_AVAILABLE"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNITS_AVAILABLE" >&5
+$as_echo "$UNITS_AVAILABLE" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"$UNITS_AVAILABLE" != x"yes" ; then
+ as_fn_error $? "The program GNU Units is required to install $PACKAGE_NAME." "$LINENO" 5
+fi
diff --git a/src/configure.ac b/src/configure.ac
new file mode 100644
index 0000000..655345a
--- /dev/null
+++ b/src/configure.ac
@@ -0,0 +1,20 @@
+AC_PREREQ([2.67])
+AC_INIT([Octave-Forge miscellaneous package], [1.2.0+])
+
+## these are C headers required for text_waitbar
+AC_CHECK_HEADER([term.h],
+ [],
+ [AC_CHECK_HEADER([termcap.h],
+ [],
+ [AC_MSG_ERROR([Unable to find ncurses library headers.])]
+ ])
+)
+
+AC_PROG_CXX
+AC_LANG(C++)
+
+## this is required for the units.m function
+AC_CHECK_PROG(UNITS_AVAILABLE, units, yes)
+if test x"$UNITS_AVAILABLE" != x"yes" ; then
+ AC_MSG_ERROR([The program GNU Units is required to install $PACKAGE_NAME.])
+fi
diff --git a/src/partarray.cc b/src/partarray.cc
deleted file mode 100644
index a18c7b3..0000000
--- a/src/partarray.cc
+++ /dev/null
@@ -1,231 +0,0 @@
-// Copyright (C) 2010,2011 Olaf Till <i7tiol at t-online.de>
-//
-// This program is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the Free Software
-// Foundation; either version 3 of the License, or (at your option) any later
-// version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-// details.
-//
-// You should have received a copy of the GNU General Public License along with
-// this program; if not, see <http://www.gnu.org/licenses/>.
-
-#include <octave/oct.h>
-#include <octave/ov-struct.h>
-
-template<class NDA>
-static Cell
-do_partarray (const NDA& a, const std::string& fname,
- const octave_value_list& args)
-{
- // FIXME: some type-independent code should probably go into an
- // extra function (no template) to avoid its repetitive instanciation
-
- int nidc = args.length () - 1;
-
- dim_vector dv = a.dims ();
-
- int ndims = dv.length ();
-
- int maxdims = ndims > nidc ? ndims : nidc;
-
- Array<octave_idx_type> alldims (dim_vector (maxdims, 1));
- for (int i = 0; i < maxdims; alldims(i) = i < ndims ? dv(i) : 1, i++);
-
- int nc = 1;
- Array<int> nidx (dim_vector (maxdims, 1));
- // Octave-3.2.4 reports "missing symbol" with Array<Array< > >,
- // though 3.3.54+ does not
- Array<octave_idx_type> bidc [maxdims], eidc [maxdims];
- //
- Array<octave_idx_type> step (dim_vector (maxdims, 1));
- step(0) = 1;
- for (int i = 0; i < maxdims; i++)
- {
- int cnidx;
- octave_value arg;
- if (i >= nidc || (arg = args(i + 1)).is_empty ())
- {
- Array<octave_idx_type> bidx (dim_vector (1, 1), 1);
- Array<octave_idx_type> eidx (dim_vector (1, 1), alldims(i));
- bidc[i] = bidx;
- eidc[i] = eidx;
- cnidx = 1;
- }
- else
- {
- dim_vector argdims = arg.dims ();
- if (argdims.length () > 2 || argdims(1) != 2)
- {
- error ("%s: argument %i: wrong dimensions",
- fname.c_str (), i + 2);
- return Cell ();
- }
- cnidx =
- (bidc[i] = octave_value (arg.matrix_value ().column (0)).
- octave_idx_type_vector_value ()).length ();
- eidc[i] = octave_value (arg.matrix_value ().column (1)).
- octave_idx_type_vector_value ();
- for (int j = 0; j < cnidx; j++)
- {
- if (bidc[i](j) < 1 || eidc[i](j) > alldims(i))
- error ("%s: index given by row %i of argument %i exceeds array dimensions",
- fname.c_str (), j, i + 2);
- if (bidc[i](j) > eidc[i](j))
- // so later length calculations yield 0
- eidc[i](j) = bidc[i](j) - 1;
- }
- }
- nc *= (nidx(i) = cnidx);
- if (i < maxdims - 1)
- step(i + 1) = step(i) * alldims(i);
- }
- if (error_state)
- return Cell ();
-
- dim_vector rdv (nc, 1);
-
- Cell retval (rdv);
-
- // preparations are done, start now; take care, indices are
- // one-based, since given by user
-
- // go through all combinations of indices into user indices
- Array<int> cidx (dim_vector (maxdims, 1), 0); // current combination
- for (int i = 0; i < nc; i++)
- {
- // set cursor to start of subarray and calculate some lengths
- octave_idx_type n = 1, cursor = 0;
- Array<octave_idx_type> lengths (dim_vector (maxdims, 1));
- for (int j = 0; j < maxdims; j++)
- {
- octave_idx_type begin = bidc[j](cidx(j));
- octave_idx_type end = eidc[j](cidx(j));
- octave_idx_type length = end + 1 - begin;
- lengths(j) = length;
- n *= length;
- cursor += (begin - 1) * step(j);
- }
- Array<octave_idx_type> starts (dim_vector (maxdims - 1, 1), cursor);
- Array<octave_idx_type> idx_cursors (dim_vector (maxdims, 1), 0);
- // copy the subarray
- dim_vector subdv;
- subdv.resize (maxdims);
- for (octave_idx_type k = 0; k < maxdims; k++)
- subdv(k) = lengths(k);
- NDA asub (subdv);
- for (octave_idx_type k = 0; k < n; k++)
- {
- asub(k) = a(cursor++);
- idx_cursors(0)++;
- for (int l = 0; l < maxdims - 1; l++)
- {
- if (idx_cursors(l) == lengths(l))
- {
- idx_cursors(l) = 0;
- idx_cursors(l + 1)++;
- cursor = starts(l) + step(l + 1);
- for (int m = 0; m <= l; starts(m) = cursor, m++);
- }
- }
- }
- // insert subarray into cell
- retval(i, 0) = octave_value (asub);
- // prepare next combination
- cidx(0)++;
- for (int j = 0; j < maxdims - 1; j++)
- if (cidx(j) >= nidx(j))
- {
- cidx(j) = 0;
- cidx(j + 1)++;
- }
- }
-
- return retval;
-}
-
-DEFUN_DLD (partarray, args, ,
- "-*- texinfo -*-\n\
- at deftypefn {Loadable Function} {} partarray (@var{a}, @var{idx}, @dots{})\n\
-Return a column cell array with subarrays of the @var{a}. Start and end indices of subarrays are given in the rows of @var{idx}. @var{idx} can be given for each dimension, empty @var{idx} means no partitioning in the respective dimension. Order of returned subarrays: rows of @var{idx} of some dimension are completely used before using the next row of @var{idx} of the higher dimension.\n\
-\n\
-Does not work with structure arrays at the moment.\n\
- at end deftypefn")
-{
- static bool warned = false;
- if (!warned){
- warning_with_id ("Octave:deprecated-function",
- "partarray has been deprecated, and will be removed in the future. Use `mat2cell' instead.");
- warned = true;
- }
- std::string fname ("partarray");
-
- if (args.length () == 0)
- {
- print_usage ();
- return octave_value_list ();
- }
-
- octave_value array = args(0);
- octave_value retval;
-
- // The idea to use a function template was taken from Octaves
- // num2cell in src/DLD-FUNCTIONS/cellfun.cc. The following code,
- // which distinguishes the applicable types for the template, was
- // cut and pasted from there and adapted.
- if (array.is_bool_type ())
- retval = do_partarray (array.bool_array_value (), fname, args);
- else if (array.is_char_matrix ())
- retval = do_partarray (array.char_array_value (), fname, args);
- else if (array.is_numeric_type ())
- {
- if (array.is_integer_type ())
- {
- if (array.is_int8_type ())
- retval = do_partarray (array.int8_array_value (), fname, args);
- else if (array.is_int16_type ())
- retval = do_partarray (array.int16_array_value (), fname, args);
- else if (array.is_int32_type ())
- retval = do_partarray (array.int32_array_value (), fname, args);
- else if (array.is_int64_type ())
- retval = do_partarray (array.int64_array_value (), fname, args);
- else if (array.is_uint8_type ())
- retval = do_partarray (array.uint8_array_value (), fname, args);
- else if (array.is_uint16_type ())
- retval = do_partarray (array.uint16_array_value (), fname, args);
- else if (array.is_uint32_type ())
- retval = do_partarray (array.uint32_array_value (), fname, args);
- else if (array.is_uint64_type ())
- retval = do_partarray (array.uint64_array_value (), fname, args);
- }
- else if (array.is_complex_type ())
- {
- if (array.is_single_type ())
- retval = do_partarray (array.float_complex_array_value (),
- fname, args);
- else
- retval = do_partarray (array.complex_array_value (), fname, args);
- }
- else
- {
- if (array.is_single_type ())
- retval = do_partarray (array.float_array_value (), fname, args);
- else
- retval = do_partarray (array.array_value (), fname, args);
- }
- }
- // FIXME: This seems to work in cellfun.cc, but not here ...
- /*
- else if (array.is_map ())
- retval = do_partarray (array.map_value (), fname, args);
- */
- else if (array.is_cell ())
- retval = do_partarray (array.cell_value (), fname, args);
- else
- gripe_wrong_type_arg (fname, array);
-
- return octave_value (retval);
-}
diff --git a/src/sample.cc b/src/sample.cc
old mode 100755
new mode 100644
--
Alioth's /home/groups/pkg-octave/bin/git-commit-notice on /srv/git.debian.org/git/pkg-octave/octave-miscellaneous.git
More information about the Pkg-octave-commit
mailing list